From 84b2d8c5dfa33932e6d34a1f10371cfac35e71f9 Mon Sep 17 00:00:00 2001 From: gustavao Date: Mon, 2 Aug 2021 17:43:48 -0500 Subject: [PATCH] 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}