activate holidays

This commit is contained in:
gustavao
2021-08-11 11:30:46 -05:00
parent 7b084caa61
commit 84b2d8c5df
3 changed files with 67 additions and 38 deletions
@@ -1,15 +1,15 @@
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20"> <div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
<span *mifosxHasPermission="'ACTIVATE_HOLIDAY'"> <span *mifosxHasPermission="'ACTIVATE_HOLIDAY'">
<button mat-raised-button color="accent" *ngIf="holidayData.status.value !== 'Active'"> <button mat-raised-button color="accent" (click)="activateHoliday()" *ngIf="holidayData.status.value !== 'Active'">
<fa-icon icon="lock-open"></fa-icon>&nbsp;&nbsp; <fa-icon icon="lock-open"></fa-icon>&nbsp;&nbsp;
Activate Activate
</button> </button>
</span> </span>
<button mat-raised-button color="primary" [routerLink]="['edit']" *mifosxHasPermission="'UPDATE_HOLIDAY'"> <button mat-raised-button color="primary" [routerLink]="['edit']" *mifosxHasPermission="'UPDATE_HOLIDAY'">
<fa-icon icon="edit"></fa-icon>&nbsp;&nbsp; <fa-icon icon="edit"></fa-icon>&nbsp;&nbsp;
Edit Edit
</button> </button>
<button mat-raised-button color="warn" (click)="deleteHoliday()" *mifosxHasPermission="'DELETE_HOLIDAY'"> <button mat-raised-button color="warn" (click)="deleteHoliday()" *mifosxHasPermission="'DELETE_HOLIDAY'">
<fa-icon icon="trash"></fa-icon>&nbsp;&nbsp; <fa-icon icon="trash"></fa-icon>&nbsp;&nbsp;
Delete Delete
</button> </button>
@@ -17,52 +17,52 @@
<div class="container"> <div class="container">
<mat-card> <mat-card>
<mat-card-content> <mat-card-content>
<div fxLayout="row wrap" class="content"> <div fxLayout="row wrap" class="content">
<div fxFlex="50%" class="header"> <div fxFlex="50%" class="header">
Name Name
</div> </div>
<div fxFlex="50%"> <div fxFlex="50%">
{{ holidayData.name }} {{ holidayData.name }}
</div> </div>
<div fxFlex="50%" class="header"> <div fxFlex="50%" class="header">
From Date From Date
</div> </div>
<div fxFlex="50%"> <div fxFlex="50%">
{{ holidayData.fromDate | date }} {{ holidayData.fromDate | date }}
</div> </div>
<div fxFlex="50%" class="header"> <div fxFlex="50%" class="header">
To Date To Date
</div> </div>
<div fxFlex="50%"> <div fxFlex="50%">
{{ holidayData.toDate | date }} {{ holidayData.toDate | date }}
</div> </div>
<div fxFlex="50%" class="header"> <div fxFlex="50%" class="header">
Repayments Scheduled To Repayments Scheduled To
</div> </div>
<div fxFlex="50%" *ngIf="holidayData.repaymentsRescheduledTo !== undefined && holidayData.repaymentsRescheduledTo !== null"> <div fxFlex="50%" *ngIf="holidayData.repaymentsRescheduledTo !== undefined && holidayData.repaymentsRescheduledTo !== null">
{{ holidayData.repaymentsRescheduledTo | date }} {{ holidayData.repaymentsRescheduledTo | date }}
</div> </div>
<div fxFlex="50%" *ngIf="holidayData.repaymentsRescheduledTo === undefined || holidayData.repaymentsRescheduledTo === null"> <div fxFlex="50%" *ngIf="holidayData.repaymentsRescheduledTo === undefined || holidayData.repaymentsRescheduledTo === null">
Next Repayment Date Next Repayment Date
</div> </div>
</div> </div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>
</div> </div>
@@ -7,6 +7,7 @@ import { MatDialog } from '@angular/material/dialog';
import { OrganizationService } from 'app/organization/organization.service'; import { OrganizationService } from 'app/organization/organization.service';
/** Custom Components. */ /** Custom Components. */
import { ConfirmationDialogComponent } from '../../../shared/confirmation-dialog/confirmation-dialog.component';
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-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']);
});
}
});
}
} }
@@ -639,6 +639,17 @@ export class OrganizationService {
return this.http.delete(`/holidays/${holidayId}`); return this.http.delete(`/holidays/${holidayId}`);
} }
/**
* Activate Holiday.
* @param holidayId Holiday Id to be deleted.
* @returns {Observable<any>} Resource Id.
*/
activateHoliday(holidayId: string): Observable<any> {
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. * @param {any} employeeId Employee ID of Employee to be edited.
* @returns {Observable<any>} * @returns {Observable<any>}