activate holidays

issue1317 add correct route

tslint bugs are fixed

tslint bugs are fixed
This commit is contained in:
jagadeeshakn
2021-08-18 14:45:26 -05:00
committed by gustavao
parent 5293703014
commit 5ed53be3d8
5 changed files with 127 additions and 96 deletions
+2
View File
@@ -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 `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 ### Further help
To get more help on the Angular CLI use `ng help` or go check out the To get more help on the Angular CLI use `ng help` or go check out the
@@ -1,6 +1,6 @@
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px"> <div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
<button mat-raised-button color="primary" *mifosxHasPermission="'CREATE_STAFF'" [routerLink]="['../', 'organization', 'bulk-import', 'Employees']"> <button mat-raised-button color="primary" *mifosxHasPermission="'CREATE_STAFF'" [routerLink]="['/', 'organization', 'bulk-import', 'Employees']">
<fa-icon icon="upload"></fa-icon>&nbsp;&nbsp; <fa-icon icon="upload"></fa-icon>&nbsp;&nbsp;
Import Employees Import Employees
</button> </button>
@@ -1,6 +1,6 @@
<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>
@@ -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(() => {
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>}