Skip to content

Commit

Permalink
fix: move my reports and team reports pages to platform APIs, move ba…
Browse files Browse the repository at this point in the history
…ck tasks stats to platform, and restrict access for HOD/HOP roles to Team Reports page
  • Loading branch information
bistaastha authored May 29, 2024
1 parent ea2b65b commit 5adf729
Show file tree
Hide file tree
Showing 53 changed files with 1,666 additions and 1,228 deletions.
12 changes: 5 additions & 7 deletions src/app/core/mock-data/api-params.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ export const getMyReportsParam2: ReportApiParams = deepFreeze({
export const getTeamReportsParams1: ReportApiParams = deepFreeze({
offset: 0,
limit: 10,
queryParams: {
rp_state: 'in.(APPROVER_PENDING)',
},
state: 'in.(APPROVER_PENDING)',
next_approver_user_ids: 'cs.[usvKA4X8Ugcr]',
order: null,
});

export const getTeamReportsParams2: ReportApiParams = deepFreeze({
offset: 0,
limit: 10,
queryParams: {
rp_state: 'in.(APPROVER_PENDING)',
},
order: 'approvalDate.asc',
state: 'in.(APPROVER_PENDING)',
next_approver_user_ids: 'cs.[usvKA4X8Ugcr]',
order: null,
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export const tasksQueryParamsWithFiltersData: Partial<GetTasksQueryParamsWithFil
sortDir: 'asc',
searchString: 'example',
queryParams: {
rp_state: 'in.(APPROVER_PENDING)',
state: 'in.(APPROVER_PENDING)',
q: 'example:*',
},
});

Expand All @@ -21,14 +22,14 @@ export const tasksQueryParamsWithFiltersData3: Partial<GetTasksQueryParamsWithFi
pageNumber: 1,
sortDir: 'desc',
searchString: 'example',
sortParam: 'rp_submitted_at',
sortParam: 'last_submitted_at',
queryParams: {
or: ['(rp_state.in.(APPROVER_INQUIRY))'],
and: '(rp_submitted_at.gte.2023-01-01T00:00:00.000Z,rp_submitted_at.lt.2023-01-04T00:00:00.000Z)',
state: 'in.(APPROVER_INQUIRY)',
and: '(last_submitted_at.gte.2023-01-01T00:00:00.000Z,last_submitted_at.lt.2023-01-04T00:00:00.000Z)',
},
});

export const personalCardQueryParamFiltersData = deepFreeze({
export const personalCardQueryParamFiltersData: Partial<GetTasksQueryParamsWithFilters> = deepFreeze({
pageNumber: 1,
queryParams: {
or: [],
Expand Down
14 changes: 5 additions & 9 deletions src/app/core/mock-data/get-tasks-query-params.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@ import deepFreeze from 'deep-freeze-strict';
import { GetTasksQueryParams } from '../models/get-tasks.query-params.model';

export const tasksQueryParamsParams: Partial<GetTasksQueryParams> = deepFreeze({
rp_approval_state: 'in.(APPROVAL_PENDING)',
rp_state: 'in.(APPROVER_PENDING)',
sequential_approval_turn: 'in.(true)',
state: 'in.(APPROVER_PENDING)',
next_approver_user_ids: 'cs.[usaTtklUXVZn]',
});

export const teamReportsQueryParams: Partial<GetTasksQueryParams> = deepFreeze({
or: [],
and: '(rp_submitted_at.gte.2023-01-01T00:00:00.000Z,rp_submitted_at.lt.2023-01-04T00:00:00.000Z)',
and: '(last_submitted_at.gte.2023-01-01T00:00:00.000Z,last_submitted_at.lt.2023-01-04T00:00:00.000Z)',
});

export const teamReportsQueryParams2: Partial<GetTasksQueryParams> = deepFreeze({
or: [],
and: '(rp_submitted_at.gte.2023-01-01T00:00:00.000Z)',
and: '(last_submitted_at.gte.2023-01-01T00:00:00.000Z)',
});

export const teamReportsQueryParams3: Partial<GetTasksQueryParams> = deepFreeze({
or: [],
and: '(rp_submitted_at.lt.2023-01-04T00:00:00.000Z)',
and: '(last_submitted_at.lt.2023-01-04T00:00:00.000Z)',
});
8 changes: 4 additions & 4 deletions src/app/core/mock-data/my-reports-filters.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const filter1 = deepFreeze({
date: 'last_week',
customDateStart: new Date('2023-01-01'),
customDateEnd: new Date('2023-01-07'),
sortParam: 'rp_created_at',
sortParam: 'created_at',
sortDir: 'asc',
});

Expand All @@ -20,7 +20,7 @@ export const filter2 = deepFreeze({
export const filter3 = deepFreeze({
state: ['active', 'completed'],
date: DateFilters.thisWeek,
sortParam: 'rp_created_at',
sortParam: 'created_at',
sortDir: 'asc',
});

Expand Down Expand Up @@ -84,6 +84,6 @@ export const filter13 = deepFreeze({

export const filter14 = deepFreeze({
sortDir: 'desc',
sortParam: 'rp_created_at',
rp_state: 'APPROVED',
sortParam: 'created_at',
state: 'APPROVED',
});
2 changes: 2 additions & 0 deletions src/app/core/mock-data/option.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const optionData1: Option[] = deepFreeze([
label: 'report 1',
value: {
amount: 1348.09332,
comments: [],
approvals: [],
created_at: new Date('2023-07-11T06:19:28.260142+00:00'),
currency: 'USD',
Expand Down Expand Up @@ -76,6 +77,7 @@ export const optionData1: Option[] = deepFreeze([
label: 'report 2',
value: {
amount: 100,
comments: [],
approvals: [],
created_at: new Date('2023-07-11T06:19:28.260142+00:00'),
currency: 'USD',
Expand Down
106 changes: 106 additions & 0 deletions src/app/core/mock-data/platform-report.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const mockQueryParamsForCount: ReportsQueryParams = deepFreeze({

export const platformReportData: Report = deepFreeze({
amount: 0,
comments: [],
approvals: [
{
approver_user: {
Expand Down Expand Up @@ -110,6 +111,55 @@ export const allReportsPaginated1: PlatformApiResponse<Report[]> = deepFreeze({
data: [
{
amount: 100,
comments: [
{
comment: 'changed to APPROVER_PENDING by Suyash ([email protected])',
created_at: new Date('2024-05-21T11:07:01.99036+00:00'),
creator_user: null,
creator_user_id: 'SYSTEM',
id: 'styBS6Mt3srX',
},
{
comment: 'submitted by Suyash ([email protected])',
created_at: new Date('2024-05-21T11:07:02.102867+00:00'),
creator_user: null,
creator_user_id: 'SYSTEM',
id: 'stI6NDy8La7b',
},
{
comment: 'aaab',
created_at: new Date('2024-05-22T07:32:19.199048+00:00'),
creator_user: {
email: '[email protected]',
full_name: 'Aastha',
id: 'usaTtklUXVZn',
},
creator_user_id: 'usaTtklUXVZn',
id: 'stVFdDpz1LAi',
},
{
comment: 'aaac',
created_at: new Date('2024-05-22T07:32:19.199048+00:00'),
creator_user: {
email: '[email protected]',
full_name: 'Aastha',
id: 'usaTtklUXVZn',
},
creator_user_id: 'usaTtklUXVZn',
id: 'stVFdDpz1LAd',
},
{
comment: 'aaa',
created_at: new Date('2024-05-23T07:32:19.199048+00:00'),
creator_user: {
email: '[email protected]',
full_name: 'Aastha',
id: 'usaTtklUXVZn',
},
creator_user_id: 'usaTtklUXVZn',
id: 'stVFdDpz1LAL',
},
],
approvals: [],
org_name: 'Staging Loaded',
level: null,
Expand Down Expand Up @@ -179,6 +229,7 @@ export const allReportsPaginated1: PlatformApiResponse<Report[]> = deepFreeze({
{
amount: 200,
approvals: [],
comments: [],
created_at: new Date('2023-07-11T06:19:28.260142+00:00'),
currency: 'USD',
employee: {
Expand Down Expand Up @@ -250,6 +301,7 @@ export const allReportsPaginatedWithApproval: PlatformApiResponse<Report[]> = de
data: [
{
amount: 100,
comments: [],
approvals: [
{
approver_user: {
Expand Down Expand Up @@ -334,6 +386,7 @@ export const allReportsPaginatedWithApproval: PlatformApiResponse<Report[]> = de
},
{
amount: 200,
comments: [],
approvals: [],
created_at: new Date('2023-07-11T06:19:28.260142+00:00'),
currency: 'USD',
Expand Down Expand Up @@ -406,6 +459,7 @@ export const filteredReportsData: PlatformApiResponse<Report[]> = deepFreeze({
data: [
{
amount: 200,
comments: [],
approvals: [],
created_at: new Date('2023-07-11T06:19:28.260142+00:00'),
currency: 'USD',
Expand Down Expand Up @@ -478,6 +532,7 @@ export const allReportsPaginated2: PlatformApiResponse<Report[]> = deepFreeze({
data: [
{
amount: 300,
comments: [],
approvals: [],
created_at: new Date('2023-07-11T06:19:28.260142+00:00'),
currency: 'USD',
Expand Down Expand Up @@ -543,6 +598,7 @@ export const allReportsPaginated2: PlatformApiResponse<Report[]> = deepFreeze({
},
{
amount: 400,
comments: [],
approvals: [],
created_at: new Date('2023-07-11T06:19:28.260142+00:00'),
currency: 'USD',
Expand Down Expand Up @@ -614,6 +670,55 @@ export const submittedReportData: Report = deepFreeze({
amount: 300,
approvals: [],
created_at: new Date('2023-07-11T06:19:28.260142+00:00'),
comments: [
{
comment: 'changed to APPROVER_PENDING by Suyash ([email protected])',
created_at: new Date('2024-05-21T11:07:01.99036+00:00'),
creator_user: null,
creator_user_id: 'SYSTEM',
id: 'styBS6Mt3srX',
},
{
comment: 'submitted by Suyash ([email protected])',
created_at: new Date('2024-05-21T11:07:02.102867+00:00'),
creator_user: null,
creator_user_id: 'SYSTEM',
id: 'stI6NDy8La7b',
},
{
comment: 'aaab',
created_at: new Date('2024-05-22T07:32:19.199048+00:00'),
creator_user: {
email: '[email protected]',
full_name: 'Aastha',
id: 'usaTtklUXVZn',
},
creator_user_id: 'usaTtklUXVZn',
id: 'stVFdDpz1LAi',
},
{
comment: 'aaac',
created_at: new Date('2024-05-22T07:32:19.199048+00:00'),
creator_user: {
email: '[email protected]',
full_name: 'Aastha',
id: 'usaTtklUXVZn',
},
creator_user_id: 'usaTtklUXVZn',
id: 'stVFdDpz1LAd',
},
{
comment: 'aaa',
created_at: new Date('2024-05-23T07:32:19.199048+00:00'),
creator_user: {
email: '[email protected]',
full_name: 'Aastha',
id: 'usaTtklUXVZn',
},
creator_user_id: 'usaTtklUXVZn',
id: 'stVFdDpz1LAL',
},
],
currency: 'USD',
employee: {
org_name: 'Staging Loaded',
Expand Down Expand Up @@ -678,6 +783,7 @@ export const submittedReportData: Report = deepFreeze({

export const submittedReportDataWithApproval: Report = deepFreeze({
amount: 300,
comments: [],
approvals: [
{
approver_user: {
Expand Down
18 changes: 0 additions & 18 deletions src/app/core/mock-data/report-actions.data.ts

This file was deleted.

19 changes: 19 additions & 0 deletions src/app/core/mock-data/report-permissions.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import deepFreeze from 'deep-freeze-strict';

import { ReportPermissions } from '../models/report-permissions.model';

export const apiReportPermissions: ReportPermissions = deepFreeze({
can_resubmit: false,
can_approve: false,
can_delete: true,
can_edit: true,
can_export: true,
can_submit: false,
can_add_approver: true,
can_remove_approver: true,
can_verify: true,
can_admin_approve: true,
can_admin_or_approver_edit: false,
can_move_to_payment_pending: false,
can_send_back: true,
});
14 changes: 7 additions & 7 deletions src/app/core/mock-data/team-reports-filters.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@ import { TeamReportsFilters } from '../models/team-reports-filters.model';

export const teamReportsFiltersData: Partial<TeamReportsFilters> = deepFreeze({
sortDir: 'desc',
sortParam: 'rp_created_at',
sortParam: 'created_at',
date: 'custom',
});

export const teamReportsFiltersData2: Partial<TeamReportsFilters> = deepFreeze({
sortDir: 'desc',
state: 'DRAFT',
sortParam: 'rp_created_at',
sortParam: 'created_at',
date: 'custom',
customDateStart: new Date('2023-01-01'),
customDateEnd: new Date('2023-02-02'),
});

export const teamReportsFiltersParams: Partial<TeamReportsFilters> = deepFreeze({
sortParam: 'rp_purpose',
sortParam: 'purpose',
sortDir: 'asc',
});

export const teamReportsFiltersParams2: Partial<TeamReportsFilters> = deepFreeze({
sortParam: 'rp_purpose',
sortParam: 'purpose',
sortDir: 'desc',
});

Expand All @@ -46,17 +46,17 @@ export const teamReportsFiltersParams3: Partial<TeamReportsFilters> = deepFreeze
});

export const teamReportsFiltersParams4: Partial<TeamReportsFilters> = deepFreeze({
sortParam: 'rp_submitted_at',
sortParam: 'last_submitted_at',
sortDir: 'asc',
});

export const teamReportsFiltersParams5: Partial<TeamReportsFilters> = deepFreeze({
sortParam: 'rp_amount',
sortParam: 'amount',
sortDir: 'desc',
});

export const teamReportsFiltersParams6: Partial<TeamReportsFilters> = deepFreeze({
sortParam: 'rp_purpose',
sortParam: 'purpose',
sortDir: 'asc',
});

Expand Down
Loading

0 comments on commit 5adf729

Please sign in to comment.