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,11 +1,11 @@
<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>
<button mat-raised-button color="primary" [routerLink]="['create']" *mifosxHasPermission="'CREATE_STAFF'"> <button mat-raised-button color="primary" [routerLink]="['create']" *mifosxHasPermission="'CREATE_STAFF'">
<fa-icon icon="plus"></fa-icon>&nbsp;&nbsp; <fa-icon icon="plus"></fa-icon>&nbsp;&nbsp;
Create Employee Create Employee
</button> </button>
@@ -14,53 +14,53 @@
<div class="container"> <div class="container">
<div fxLayout="row" fxLayoutGap="20px"> <div fxLayout="row" fxLayoutGap="20px">
<mat-form-field fxFlex> <mat-form-field fxFlex>
<mat-label>Filter</mat-label> <mat-label>Filter</mat-label>
<input matInput (keyup)="applyFilter($event.target.value)"> <input matInput (keyup)="applyFilter($event.target.value)">
</mat-form-field> </mat-form-field>
</div> </div>
<div class="mat-elevation-z8"> <div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort> <table mat-table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="displayName"> <ng-container matColumnDef="displayName">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Name </th>
<td mat-cell *matCellDef="let employee"> {{ employee.displayName }} </td> <td mat-cell *matCellDef="let employee"> {{ employee.displayName }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="isLoanOfficer"> <ng-container matColumnDef="isLoanOfficer">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Loan Officer </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Loan Officer </th>
<td mat-cell *matCellDef="let employee"> <td mat-cell *matCellDef="let employee">
<div [className]="employee.isLoanOfficer === true ? 'true' : 'false'"> <div [className]="employee.isLoanOfficer === true ? 'true' : 'false'">
<fa-icon *ngIf="employee.isLoanOfficer" icon="check-circle" size="lg" matTooltip="Yes" matTooltipPosition="right"></fa-icon> <fa-icon *ngIf="employee.isLoanOfficer" icon="check-circle" size="lg" matTooltip="Yes" matTooltipPosition="right"></fa-icon>
<fa-icon *ngIf="!employee.isLoanOfficer" icon="times-circle" size="lg" matTooltip="No" matTooltipPosition="right"></fa-icon> <fa-icon *ngIf="!employee.isLoanOfficer" icon="times-circle" size="lg" matTooltip="No" matTooltipPosition="right"></fa-icon>
</div> </div>
</td> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="officeName"> <ng-container matColumnDef="officeName">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Office </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Office </th>
<td mat-cell *matCellDef="let employees"> {{ employees.officeName }} </td> <td mat-cell *matCellDef="let employees"> {{ employees.officeName }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="isActive"> <ng-container matColumnDef="isActive">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
<td mat-cell *matCellDef="let employee"> <td mat-cell *matCellDef="let employee">
<div [className]="employee.isActive === true ? 'true' : 'false'"> <div [className]="employee.isActive === true ? 'true' : 'false'">
<fa-icon matTooltip="{{ employee.isActive === true ? 'Active' : 'Inactive' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon> <fa-icon matTooltip="{{ employee.isActive === true ? 'Active' : 'Inactive' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
</div> </div>
</td> </td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="[row.id]" class="select-row"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="[row.id]" class="select-row"></tr>
</table> </table>
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator> <mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
</div> </div>
</div> </div>
@@ -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';
/** /**
@@ -27,10 +28,10 @@ export class ViewHolidaysComponent {
* @param {ActivatedRoute} route Activated Route. * @param {ActivatedRoute} route Activated Route.
*/ */
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']);
});
}
});
}
} }
+24 -13
View File
@@ -93,8 +93,8 @@ export class OrganizationService {
*/ */
getOfficerTemplate(officerId: string, officeId: string): Observable<any> { getOfficerTemplate(officerId: string, officeId: string): Observable<any> {
const httpParams = new HttpParams() const httpParams = new HttpParams()
.set('fromLoanOfficerId', officerId.toString()) .set('fromLoanOfficerId', officerId.toString())
.set('officeId', officerId.toString()); .set('officeId', officerId.toString());
return this.http.get('/loans/loanreassignment/template', { params: httpParams }); return this.http.get('/loans/loanreassignment/template', { params: httpParams });
} }
@@ -134,9 +134,9 @@ export class OrganizationService {
return this.http.put(`/offices/${officeId}`, office); return this.http.put(`/offices/${officeId}`, office);
} }
/** /**
* @returns {Observable<any>} * @returns {Observable<any>}
*/ */
getOfficeDatatables(): Observable<any> { getOfficeDatatables(): Observable<any> {
const httpParams = new HttpParams().set('apptable', 'm_office'); const httpParams = new HttpParams().set('apptable', 'm_office');
return this.http.get(`/datatables`, { params: httpParams }); return this.http.get(`/datatables`, { params: httpParams });
@@ -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 });
} }
} }