From 27ecb036ef3d4fc942d5229afb01c21b65666ab7 Mon Sep 17 00:00:00 2001 From: gustavao Date: Mon, 2 Aug 2021 17:43:48 -0500 Subject: [PATCH 1/9] activate holidays --- .../view-holidays.component.html | 76 +++++++++---------- .../view-holidays/view-holidays.component.ts | 18 +++++ src/app/organization/organization.service.ts | 11 +++ 3 files changed, 67 insertions(+), 38 deletions(-) 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..deada1c43 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((response: any) => { + this.router.navigate(['/organization/holidays']); + }); + } + }); + } + } diff --git a/src/app/organization/organization.service.ts b/src/app/organization/organization.service.ts index 3762ba537..fed484649 100644 --- a/src/app/organization/organization.service.ts +++ b/src/app/organization/organization.service.ts @@ -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} From db4284d5f58fee526f79160dc5c44c79dc1c880f Mon Sep 17 00:00:00 2001 From: gustavao Date: Tue, 3 Aug 2021 10:30:42 -0500 Subject: [PATCH 2/9] tslint bugs are fixed --- .../view-holidays/view-holidays.component.ts | 10 +++---- src/app/organization/organization.service.ts | 30 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) 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 deada1c43..d794f14ee 100644 --- a/src/app/organization/holidays/view-holidays/view-holidays.component.ts +++ b/src/app/organization/holidays/view-holidays/view-holidays.component.ts @@ -28,10 +28,10 @@ export class ViewHolidaysComponent { * @param {ActivatedRoute} route Activated Route. */ constructor(private route: ActivatedRoute, - private router: Router, - private dialog: MatDialog, - private organizationService: OrganizationService ) { - this.route.data.subscribe((data: { holidays: any}) => { + private router: Router, + private dialog: MatDialog, + private organizationService: OrganizationService) { + this.route.data.subscribe((data: { holidays: any }) => { this.holidayData = data.holidays; }); } @@ -63,7 +63,7 @@ export class ViewHolidaysComponent { unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => { if (response.confirm) { this.organizationService.activateHoliday(this.holidayData.id) - .subscribe((response: any) => { + .subscribe(() => { this.router.navigate(['/organization/holidays']); }); } diff --git a/src/app/organization/organization.service.ts b/src/app/organization/organization.service.ts index fed484649..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,14 +639,14 @@ 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'); + .set('command', 'activate'); return this.http.post(`/holidays/${holidayId}`, null, { params: httpParams }); } @@ -706,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 }); } /** @@ -765,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' }); } /** @@ -775,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' }); } /** @@ -794,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 }); } } From 7b084caa617972ba46c0e3fe6638727273917bad Mon Sep 17 00:00:00 2001 From: jagadeeshakn Date: Mon, 5 Jul 2021 18:18:32 +0530 Subject: [PATCH 3/9] readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index a3a5cd2ba..bd0877f62 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ Run `ng generate component component-name` to generate a new component. You can Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. +Run `npm run build:prod` to build a production artifacts Instead. + ### Further help To get more help on the Angular CLI use `ng help` or go check out the From 84b2d8c5dfa33932e6d34a1f10371cfac35e71f9 Mon Sep 17 00:00:00 2001 From: gustavao Date: Mon, 2 Aug 2021 17:43:48 -0500 Subject: [PATCH 4/9] activate holidays --- .../view-holidays.component.html | 76 +++++++++---------- .../view-holidays/view-holidays.component.ts | 18 +++++ src/app/organization/organization.service.ts | 11 +++ 3 files changed, 67 insertions(+), 38 deletions(-) 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..deada1c43 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((response: any) => { + this.router.navigate(['/organization/holidays']); + }); + } + }); + } + } diff --git a/src/app/organization/organization.service.ts b/src/app/organization/organization.service.ts index 3762ba537..fed484649 100644 --- a/src/app/organization/organization.service.ts +++ b/src/app/organization/organization.service.ts @@ -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} From 3cdc0b3de2ed7a9234639986ddc7641454325f97 Mon Sep 17 00:00:00 2001 From: gustavao Date: Mon, 2 Aug 2021 18:00:43 -0500 Subject: [PATCH 5/9] issue1317 add correct route --- .../employees/employees.component.html | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 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 From 16728bcbbf026610e9d897068c515772d6d1b249 Mon Sep 17 00:00:00 2001 From: gustavao Date: Tue, 3 Aug 2021 12:13:10 -0500 Subject: [PATCH 6/9] tslint bugs are fixed --- .../view-holidays/view-holidays.component.ts | 2 +- src/app/organization/organization.service.ts | 30 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) 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 deada1c43..9ef74db51 100644 --- a/src/app/organization/holidays/view-holidays/view-holidays.component.ts +++ b/src/app/organization/holidays/view-holidays/view-holidays.component.ts @@ -63,7 +63,7 @@ export class ViewHolidaysComponent { unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => { if (response.confirm) { this.organizationService.activateHoliday(this.holidayData.id) - .subscribe((response: any) => { + .subscribe(() => { this.router.navigate(['/organization/holidays']); }); } diff --git a/src/app/organization/organization.service.ts b/src/app/organization/organization.service.ts index fed484649..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,14 +639,14 @@ 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'); + .set('command', 'activate'); return this.http.post(`/holidays/${holidayId}`, null, { params: httpParams }); } @@ -706,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 }); } /** @@ -765,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' }); } /** @@ -775,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' }); } /** @@ -794,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 }); } } From 7044b6e34d233a6fbebc1e658f51d335a9e93c3f Mon Sep 17 00:00:00 2001 From: gustavao Date: Tue, 3 Aug 2021 10:30:42 -0500 Subject: [PATCH 7/9] tslint bugs are fixed --- .../holidays/view-holidays/view-holidays.component.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 9ef74db51..d794f14ee 100644 --- a/src/app/organization/holidays/view-holidays/view-holidays.component.ts +++ b/src/app/organization/holidays/view-holidays/view-holidays.component.ts @@ -28,10 +28,10 @@ export class ViewHolidaysComponent { * @param {ActivatedRoute} route Activated Route. */ constructor(private route: ActivatedRoute, - private router: Router, - private dialog: MatDialog, - private organizationService: OrganizationService ) { - this.route.data.subscribe((data: { holidays: any}) => { + private router: Router, + private dialog: MatDialog, + private organizationService: OrganizationService) { + this.route.data.subscribe((data: { holidays: any }) => { this.holidayData = data.holidays; }); } From 5ed53be3d8f320c1153fa4bf16b466fed1427848 Mon Sep 17 00:00:00 2001 From: jagadeeshakn Date: Mon, 5 Jul 2021 18:18:32 +0530 Subject: [PATCH 8/9] readme activate holidays issue1317 add correct route tslint bugs are fixed tslint bugs are fixed --- README.md | 2 + .../employees/employees.component.html | 82 +++++++++---------- .../view-holidays.component.html | 76 ++++++++--------- .../view-holidays/view-holidays.component.ts | 26 +++++- src/app/organization/organization.service.ts | 37 ++++++--- 5 files changed, 127 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index a3a5cd2ba..bd0877f62 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ Run `ng generate component component-name` to generate a new component. You can Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. +Run `npm run build:prod` to build a production artifacts Instead. + ### Further help To get more help on the Angular CLI use `ng help` or go check out the 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..d794f14ee 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'; /** @@ -27,10 +28,10 @@ export class ViewHolidaysComponent { * @param {ActivatedRoute} route Activated Route. */ constructor(private route: ActivatedRoute, - private router: Router, - private dialog: MatDialog, - private organizationService: OrganizationService ) { - this.route.data.subscribe((data: { holidays: any}) => { + private router: Router, + private dialog: MatDialog, + private organizationService: OrganizationService) { + this.route.data.subscribe((data: { holidays: any }) => { this.holidayData = data.holidays; }); } @@ -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 }); } } From 9d4726e7dd7f0a3e1cc3b31cc8a2e1d2436265b2 Mon Sep 17 00:00:00 2001 From: gustavao Date: Thu, 26 Aug 2021 18:16:07 -0500 Subject: [PATCH 9/9] add new server issue 1357 --- .../server-selector.component.html | 30 ++++++++++++++----- .../server-selector.component.scss | 26 ++++++++++++++++ .../server-selector.component.ts | 24 +++++++++++++-- 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/src/app/shared/server-selector/server-selector.component.html b/src/app/shared/server-selector/server-selector.component.html index d98c450d0..f7510dc0f 100644 --- a/src/app/shared/server-selector/server-selector.component.html +++ b/src/app/shared/server-selector/server-selector.component.html @@ -1,8 +1,24 @@ - Server - - - {{ server }} - - - + Server + +
+
+
+ + language + Add new server + + + Url is required + + + + +
+
+
+ + {{ server }} + +
+ \ No newline at end of file diff --git a/src/app/shared/server-selector/server-selector.component.scss b/src/app/shared/server-selector/server-selector.component.scss index e69de29bb..5f17f5472 100644 --- a/src/app/shared/server-selector/server-selector.component.scss +++ b/src/app/shared/server-selector/server-selector.component.scss @@ -0,0 +1,26 @@ +.actions { + display: inline-block; +} + +.rg { + float: right; +} + +.ml { + margin-left: 10px; +} + + +/* .pba { + width: 80%; + left: 10%; + margin: 12px; +} */ + +.sticky { + position: sticky; + z-index: 1; // appear above mat-option + top: 0; // fix at the top + background-color: white; // don't see mat-option when scrolling + box-shadow: 1px -2px 10px 0px grey; // shadow at the bottom +} \ No newline at end of file diff --git a/src/app/shared/server-selector/server-selector.component.ts b/src/app/shared/server-selector/server-selector.component.ts index 7267c49e9..ce6fe82d7 100644 --- a/src/app/shared/server-selector/server-selector.component.ts +++ b/src/app/shared/server-selector/server-selector.component.ts @@ -1,7 +1,8 @@ /** Angular Imports */ import { Component, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; - +import { MatDialog } from '@angular/material/dialog'; +import { FormBuilder, Validators } from '@angular/forms'; /** Custom Services */ import { SettingsService } from 'app/settings/settings.service'; @@ -13,8 +14,12 @@ import { SettingsService } from 'app/settings/settings.service'; templateUrl: './server-selector.component.html', styleUrls: ['./server-selector.component.scss'] }) + export class ServerSelectorComponent implements OnInit { + /** Input server. */ + form: any; + /** Server Settings. */ servers: string[]; @@ -24,12 +29,15 @@ export class ServerSelectorComponent implements OnInit { /** * @param {SettingsService} settingsService Settings Service */ - constructor(private settingsService: SettingsService) { } + constructor(private settingsService: SettingsService, public dialog: MatDialog, private formBuilder: FormBuilder) { } ngOnInit(): void { this.servers = this.settingsService.servers; this.serverSelector.patchValue(this.settingsService.server); this.buildDependencies(); + this.form = this.formBuilder.group({ + 'url': ['', [Validators.required]], + }); } /** @@ -42,4 +50,16 @@ export class ServerSelectorComponent implements OnInit { }); } + /** + * Set new server. + */ + setNewServer() { + let servers; + this.settingsService.setServer(this.form.value.url); + servers = this.settingsService.servers; + servers.push(this.form.value.url); + this.settingsService.setServers(servers); + window.location.reload(); + } + }