diff --git a/src/app/core/mock-data/platform-report.data.ts b/src/app/core/mock-data/platform-report.data.ts index 791e9c5231..f87773bb6c 100644 --- a/src/app/core/mock-data/platform-report.data.ts +++ b/src/app/core/mock-data/platform-report.data.ts @@ -36,16 +36,19 @@ export const platformReportData: Report = deepFreeze({ state: ApprovalState.APPROVAL_DONE, }, ], - created_at: new Date('2023-07-11T06:19:28.260142+00:00'), + created_at: new Date('2023-07-11T16:24:01.335Z'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: undefined, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -108,16 +111,22 @@ export const allReportsPaginated1: PlatformApiResponse = deepFreeze({ { amount: 100, approvals: [], + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -147,7 +156,7 @@ export const allReportsPaginated1: PlatformApiResponse = deepFreeze({ last_approved_at: null, last_paid_at: null, last_resubmitted_at: null, - last_submitted_at: null, + last_submitted_at: new Date('2023-02-01T13:02:35.097839+00:00'), next_approver_user_ids: null, num_expenses: 0, org_id: 'orNVthTo2Zyo', @@ -173,13 +182,16 @@ export const allReportsPaginated1: PlatformApiResponse = deepFreeze({ created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -261,13 +273,16 @@ export const allReportsPaginatedWithApproval: PlatformApiResponse = de created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -323,13 +338,16 @@ export const allReportsPaginatedWithApproval: PlatformApiResponse = de created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -392,13 +410,16 @@ export const filteredReportsData: PlatformApiResponse = deepFreeze({ created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -461,13 +482,16 @@ export const allReportsPaginated2: PlatformApiResponse = deepFreeze({ created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -523,13 +547,16 @@ export const allReportsPaginated2: PlatformApiResponse = deepFreeze({ created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -589,13 +616,16 @@ export const submittedReportData: Report = deepFreeze({ created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -671,13 +701,16 @@ export const submittedReportDataWithApproval: Report = deepFreeze({ created_at: new Date('2023-07-11T06:19:28.260142+00:00'), currency: 'USD', employee: { + org_name: 'Staging Loaded', + level: null, + mobile: '123456098', ach_account: { added: true, verified: null, }, business_unit: 'A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed A very long Business Unit indeed', - code: null, + code: '101', department: { code: null, display_name: '0000000 / arun', @@ -738,6 +771,14 @@ export const expectedSingleReport: Report[] = deepFreeze([allReportsPaginated1.d export const expectedReportsSinglePage: Report[] = deepFreeze([...allReportsPaginated1.data]); +export const sentBackReportData: Report = deepFreeze({ ...submittedReportData, state: 'APPROVER_INQUIRY' }); + +export const reportWithExpenses: Report = deepFreeze({ + ...platformReportData, + num_expenses: 3, + amount: 100, +}); + export const expectedReportsSinglePageWithApproval: Report[] = deepFreeze([...allReportsPaginatedWithApproval.data]); export const expectedReportsSinglePageFiltered: Report[] = deepFreeze([...filteredReportsData.data]); diff --git a/src/app/core/models/platform/v1/level.model.ts b/src/app/core/models/platform/v1/level.model.ts index 8507596fb0..39bd5b5d2f 100644 --- a/src/app/core/models/platform/v1/level.model.ts +++ b/src/app/core/models/platform/v1/level.model.ts @@ -1,11 +1,11 @@ export interface Level { id: string; - org_id: string; - created_at: Date; - updated_at: Date; + org_id?: string; + created_at?: Date; + updated_at?: Date; name: string; band: string; - code: string; - description: string; - is_enabled: boolean; + code?: string; + description?: string; + is_enabled?: boolean; } diff --git a/src/app/core/models/platform/v1/report.model.ts b/src/app/core/models/platform/v1/report.model.ts index a451898605..08e5b1bc6d 100644 --- a/src/app/core/models/platform/v1/report.model.ts +++ b/src/app/core/models/platform/v1/report.model.ts @@ -1,9 +1,10 @@ import { ReportApprovals } from '../report-approvals.model'; +import { Level } from './level.model'; export interface Report { id: string; org_id: string; - created_at: Date; + created_at: Date | string; updated_at: Date; user_id: string; user: { @@ -42,7 +43,10 @@ export interface Report { }; code: string; org_id: string; + org_name: string; department_id: string; + level: Level; + mobile: string; department: { id: string; code: string; diff --git a/src/app/core/services/report.service.spec.ts b/src/app/core/services/report.service.spec.ts index fbdb4e3967..e8813d49bb 100644 --- a/src/app/core/services/report.service.spec.ts +++ b/src/app/core/services/report.service.spec.ts @@ -655,7 +655,7 @@ describe('ReportService', () => { it('updateReportPurpose(): should update the report purpose', (done) => { spenderPlatformV1ApiService.post.and.returnValue(of(platformReportData)); - reportService.updateReportPurpose(reportData1).subscribe((res) => { + reportService.updateReportPurpose(platformReportData).subscribe((res) => { expect(res).toEqual(platformReportData); expect(spenderPlatformV1ApiService.post).toHaveBeenCalledOnceWith('/reports', { data: { @@ -670,7 +670,7 @@ describe('ReportService', () => { it('approverUpdateReportPurpose(): should update the report purpose for approver', (done) => { approverPlatformApiService.post.and.returnValue(of(platformReportData)); - reportService.approverUpdateReportPurpose(reportData1).subscribe((res) => { + reportService.approverUpdateReportPurpose(platformReportData).subscribe((res) => { expect(res).toEqual(platformReportData); expect(approverPlatformApiService.post).toHaveBeenCalledOnceWith('/reports', { data: { diff --git a/src/app/core/services/report.service.ts b/src/app/core/services/report.service.ts index cd295af2d8..037b2c8840 100644 --- a/src/app/core/services/report.service.ts +++ b/src/app/core/services/report.service.ts @@ -210,12 +210,12 @@ export class ReportService { @CacheBuster({ cacheBusterNotifier: reportsCacheBuster$, }) - updateReportPurpose(erpt: ExtendedReport): Observable { + updateReportPurpose(report: Report): Observable { const params = { data: { - id: erpt.rp_id, - source: erpt.rp_source, - purpose: erpt.rp_purpose, + id: report.id, + source: report.source, + purpose: report.purpose, }, }; return this.spenderPlatformV1ApiService.post('/reports', params); @@ -579,12 +579,12 @@ export class ReportService { ); } - approverUpdateReportPurpose(erpt: ExtendedReport): Observable { + approverUpdateReportPurpose(report: Report): Observable { const params: { data: Pick } = { data: { - id: erpt.rp_id, - source: erpt.rp_source, - purpose: erpt.rp_purpose, + id: report.id, + source: report.source, + purpose: report.purpose, }, }; return this.approverPlatformApiService.post('/reports', params); diff --git a/src/app/fyle/my-view-report/my-view-report.page.html b/src/app/fyle/my-view-report/my-view-report.page.html index abea74ae2e..076261f63f 100644 --- a/src/app/fyle/my-view-report/my-view-report.page.html +++ b/src/app/fyle/my-view-report/my-view-report.page.html @@ -8,8 +8,8 @@ View Report - - + + @@ -25,7 +25,7 @@ -
+
@@ -33,9 +33,9 @@
- {{erpt.rp_purpose | ellipsis: 35}} + {{report.purpose | ellipsis: 35}} {{ reportCurrencySymbol }} - {{ erpt.rp_amount || 0 | humanizeCurrency: erpt.rp_currency:true }} + {{ report.amount || 0 | humanizeCurrency: report.currency:true }}
@@ -58,8 +58,8 @@ -
- {{erpt.rp_state | reportState : simplifyReportsSettings.enabled | snakeCaseToSpaceCase}} +
+ {{report.state | reportState : simplifyReportsSettings.enabled | snakeCaseToSpaceCase}}
@@ -71,13 +71,13 @@ @@ -94,24 +94,18 @@
-
-
+
+
Approvers
-
+
-
{{ ap.approver_name }}
+
{{ approver.approver_user.full_name }}
-
{{ ap.state === 'APPROVAL_DONE' ? 'Approved' : (ap.state | titlecase | + >{{ approver.state === 'APPROVAL_DONE' ? 'Approved' : (approver.state | titlecase | snakeCaseToSpaceCase)}}
@@ -153,7 +147,7 @@ -
+
@@ -173,7 +167,7 @@
-
+
No expense in this report
Looks like this report is empty.
@@ -308,7 +302,7 @@
@@ -331,7 +325,7 @@ Submit Report @@ -342,7 +336,7 @@