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';
/** /**
@@ -29,8 +30,8 @@ export class ViewHolidaysComponent {
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private dialog: MatDialog, private dialog: MatDialog,
private organizationService: OrganizationService ) { private organizationService: OrganizationService) {
this.route.data.subscribe((data: { holidays: any}) => { this.route.data.subscribe((data: { holidays: any }) => {
this.holidayData = data.holidays; 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']);
});
}
});
}
} }
+19 -8
View File
@@ -222,7 +222,7 @@ export class OrganizationService {
* @returns {Observable<any>} Currencies data * @returns {Observable<any>} Currencies data
*/ */
updateCurrencies(currencies: any[]): Observable<any> { updateCurrencies(currencies: any[]): Observable<any> {
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<any> { settleCash(tellerId: string, cashierId: string, cashData: any): Observable<any> {
const httpParams = new HttpParams().set('command', 'settle'); 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<any> { allocateCash(tellerId: string, cashierId: string, cashData: any): Observable<any> {
const httpParams = new HttpParams().set('command', 'allocate'); 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. /** Get Cashier Template.
@@ -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>}
@@ -695,7 +706,7 @@ export class OrganizationService {
*/ */
getImports(entity: string): Observable<any> { getImports(entity: string): Observable<any> {
const httpParams = new HttpParams().set('entityType', entity); 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) { if (legalFormType.length) {
httpParams = httpParams.set('legalFormType', legalFormType); 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<any> { getImportDocument(id: any): Observable<any> {
const httpParams = new HttpParams() const httpParams = new HttpParams()
.set('importDocumentId', id) .set('importDocumentId', id)
.set('tenantIdentifier', 'default' ); .set('tenantIdentifier', 'default');
return this.http.get('/imports/downloadOutputTemplate', { params: httpParams, responseType: 'arraybuffer', observe: 'response'}); 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('file', file);
formData.append('locale', this.settingsService.language.code); formData.append('locale', this.settingsService.language.code);
formData.append('dateFormat', this.settingsService.dateFormat); formData.append('dateFormat', this.settingsService.dateFormat);
return this.http.post(`${urlSuffix}/uploadtemplate`, formData , { params: httpParams } ); return this.http.post(`${urlSuffix}/uploadtemplate`, formData, { params: httpParams });
} }
} }