From c382867813664980d872f098bf6a8ae0f555fb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Esp=C3=ADndola?= <36246104+gustavao@users.noreply.github.com> Date: Thu, 5 Aug 2021 04:40:13 -0500 Subject: [PATCH] Issue1317 (#1346) * activate holidays * issue1317 add correct route * tslint bugs are fixed merging based on @BLasan approval, thanks Benura and @gustavao --- .../employees/employees.component.html | 82 +++++++++---------- .../view-holidays.component.html | 76 ++++++++--------- .../view-holidays/view-holidays.component.ts | 18 ++++ src/app/organization/organization.service.ts | 37 ++++++--- 4 files changed, 121 insertions(+), 92 deletions(-) diff --git a/src/app/organization/employees/employees.component.html b/src/app/organization/employees/employees.component.html index 959b76470..b0a5f5cb0 100644 --- a/src/app/organization/employees/employees.component.html +++ b/src/app/organization/employees/employees.component.html @@ -1,11 +1,11 @@
- - @@ -14,53 +14,53 @@
-
- - Filter - - -
+
+ + Filter + + +
-
+
- +
- - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - + + -
Name {{ employee.displayName }} Name {{ employee.displayName }} Loan Officer -
- - -
-
Loan Officer +
+ + +
+
Office {{ employees.officeName }} Office {{ employees.officeName }} Status -
- -
-
Status +
+ +
+
+ - + -
+
-
+
\ No newline at end of file diff --git a/src/app/organization/holidays/view-holidays/view-holidays.component.html b/src/app/organization/holidays/view-holidays/view-holidays.component.html index 3a2c872ae..7b64a41af 100644 --- a/src/app/organization/holidays/view-holidays/view-holidays.component.html +++ b/src/app/organization/holidays/view-holidays/view-holidays.component.html @@ -1,15 +1,15 @@
- - - - @@ -17,52 +17,52 @@
- + - + -
+
-
- Name -
+
+ Name +
-
- {{ holidayData.name }} -
+
+ {{ holidayData.name }} +
-
- From Date -
+
+ From Date +
-
- {{ holidayData.fromDate | date }} -
+
+ {{ holidayData.fromDate | date }} +
-
- To Date -
+
+ To Date +
-
- {{ holidayData.toDate | date }} -
+
+ {{ holidayData.toDate | date }} +
-
- Repayments Scheduled To -
+
+ Repayments Scheduled To +
-
- {{ holidayData.repaymentsRescheduledTo | date }} -
+
+ {{ holidayData.repaymentsRescheduledTo | date }} +
-
- Next Repayment Date -
+
+ Next Repayment Date +
-
+
-
+
-
+
-
+
\ No newline at end of file diff --git a/src/app/organization/holidays/view-holidays/view-holidays.component.ts b/src/app/organization/holidays/view-holidays/view-holidays.component.ts index 34522bec7..9ef74db51 100644 --- a/src/app/organization/holidays/view-holidays/view-holidays.component.ts +++ b/src/app/organization/holidays/view-holidays/view-holidays.component.ts @@ -7,6 +7,7 @@ import { MatDialog } from '@angular/material/dialog'; import { OrganizationService } from 'app/organization/organization.service'; /** Custom Components. */ +import { ConfirmationDialogComponent } from '../../../shared/confirmation-dialog/confirmation-dialog.component'; import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component'; /** @@ -52,4 +53,21 @@ export class ViewHolidaysComponent { }); } + /** + * Activate holiday. + */ + activateHoliday() { + const unAssignStaffDialogRef = this.dialog.open(ConfirmationDialogComponent, { + data: { heading: 'Holiday', dialogContext: `Are you sure you want to activate ${this.holidayData.name} holiday` } + }); + unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => { + if (response.confirm) { + this.organizationService.activateHoliday(this.holidayData.id) + .subscribe(() => { + this.router.navigate(['/organization/holidays']); + }); + } + }); + } + } diff --git a/src/app/organization/organization.service.ts b/src/app/organization/organization.service.ts index 3762ba537..820b17792 100644 --- a/src/app/organization/organization.service.ts +++ b/src/app/organization/organization.service.ts @@ -93,8 +93,8 @@ export class OrganizationService { */ getOfficerTemplate(officerId: string, officeId: string): Observable { const httpParams = new HttpParams() - .set('fromLoanOfficerId', officerId.toString()) - .set('officeId', officerId.toString()); + .set('fromLoanOfficerId', officerId.toString()) + .set('officeId', officerId.toString()); return this.http.get('/loans/loanreassignment/template', { params: httpParams }); } @@ -134,9 +134,9 @@ export class OrganizationService { return this.http.put(`/offices/${officeId}`, office); } - /** - * @returns {Observable} - */ + /** + * @returns {Observable} + */ getOfficeDatatables(): Observable { const httpParams = new HttpParams().set('apptable', 'm_office'); return this.http.get(`/datatables`, { params: httpParams }); @@ -222,7 +222,7 @@ export class OrganizationService { * @returns {Observable} Currencies data */ updateCurrencies(currencies: any[]): Observable { - return this.http.put('/currencies', {currencies}); + return this.http.put('/currencies', { currencies }); } /** @@ -431,7 +431,7 @@ export class OrganizationService { */ settleCash(tellerId: string, cashierId: string, cashData: any): Observable { const httpParams = new HttpParams().set('command', 'settle'); - return this.http.post(`/tellers/${tellerId}/cashiers/${cashierId}/settle`, cashData, {params: httpParams}); + return this.http.post(`/tellers/${tellerId}/cashiers/${cashierId}/settle`, cashData, { params: httpParams }); } /** @@ -442,7 +442,7 @@ export class OrganizationService { */ allocateCash(tellerId: string, cashierId: string, cashData: any): Observable { const httpParams = new HttpParams().set('command', 'allocate'); - return this.http.post(`/tellers/${tellerId}/cashiers/${cashierId}/allocate`, cashData, {params: httpParams}); + return this.http.post(`/tellers/${tellerId}/cashiers/${cashierId}/allocate`, cashData, { params: httpParams }); } /** Get Cashier Template. @@ -639,6 +639,17 @@ export class OrganizationService { return this.http.delete(`/holidays/${holidayId}`); } + /** + * Activate Holiday. + * @param holidayId Holiday Id to be deleted. + * @returns {Observable} Resource Id. + */ + activateHoliday(holidayId: string): Observable { + const httpParams = new HttpParams() + .set('command', 'activate'); + return this.http.post(`/holidays/${holidayId}`, null, { params: httpParams }); + } + /** * @param {any} employeeId Employee ID of Employee to be edited. * @returns {Observable} @@ -695,7 +706,7 @@ export class OrganizationService { */ getImports(entity: string): Observable { const httpParams = new HttpParams().set('entityType', entity); - return this.http.get('/imports', { params: httpParams } ); + return this.http.get('/imports', { params: httpParams }); } /** @@ -754,7 +765,7 @@ export class OrganizationService { if (legalFormType.length) { httpParams = httpParams.set('legalFormType', legalFormType); } - return this.http.get(`${urlSuffix}/downloadtemplate`, { params: httpParams, responseType: 'arraybuffer', observe: 'response'} ); + return this.http.get(`${urlSuffix}/downloadtemplate`, { params: httpParams, responseType: 'arraybuffer', observe: 'response' }); } /** @@ -764,8 +775,8 @@ export class OrganizationService { getImportDocument(id: any): Observable { const httpParams = new HttpParams() .set('importDocumentId', id) - .set('tenantIdentifier', 'default' ); - return this.http.get('/imports/downloadOutputTemplate', { params: httpParams, responseType: 'arraybuffer', observe: 'response'}); + .set('tenantIdentifier', 'default'); + return this.http.get('/imports/downloadOutputTemplate', { params: httpParams, responseType: 'arraybuffer', observe: 'response' }); } /** @@ -783,7 +794,7 @@ export class OrganizationService { formData.append('file', file); formData.append('locale', this.settingsService.language.code); formData.append('dateFormat', this.settingsService.dateFormat); - return this.http.post(`${urlSuffix}/uploadtemplate`, formData , { params: httpParams } ); + return this.http.post(`${urlSuffix}/uploadtemplate`, formData, { params: httpParams }); } }