@@ -0,0 +1,31 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { OrganizationService } from 'app/organization/organization.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holiday data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class HolidayResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {OrganizationService} organizationService Organization service.
|
||||||
|
*/
|
||||||
|
constructor(private organizationService: OrganizationService) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the holiday data.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||||
|
const holidayId = route.paramMap.get('id');
|
||||||
|
return this.organizationService.getHoliday(holidayId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
</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;" class="select-row"></tr>
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row" [routerLink]="[row.id]"></tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
|
||||||
|
<button mat-raised-button color="accent" *ngIf="holidayData.status.value !== 'Active'">
|
||||||
|
<fa-icon icon="lock-open"></fa-icon>
|
||||||
|
Activate
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="primary" [routerLink]="['edit']">
|
||||||
|
<fa-icon icon="edit"></fa-icon>
|
||||||
|
Edit
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="warn" (click)="deleteHoliday()">
|
||||||
|
<fa-icon icon="trash"></fa-icon>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="row wrap" class="content">
|
||||||
|
|
||||||
|
<div fxFlex="50%" class="header">
|
||||||
|
Name
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%">
|
||||||
|
{{ holidayData.name }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%" class="header">
|
||||||
|
From Date
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%">
|
||||||
|
{{ holidayData.fromDate | date }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%" class="header">
|
||||||
|
To Date
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%">
|
||||||
|
{{ holidayData.toDate | date }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%" class="header">
|
||||||
|
Repayments Scheduled To
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%" *ngIf="holidayData.repaymentsRescheduledTo !== undefined && holidayData.repaymentsRescheduledTo !== null">
|
||||||
|
{{ holidayData.repaymentsRescheduledTo | date }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div fxFlex="50%" *ngIf="holidayData.repaymentsRescheduledTo === undefined || holidayData.repaymentsRescheduledTo === null">
|
||||||
|
Next Repayment Date
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
.container {
|
||||||
|
max-width: 37rem;
|
||||||
|
|
||||||
|
.content {
|
||||||
|
div {
|
||||||
|
margin: 1rem 0;
|
||||||
|
word-wrap: break-word;
|
||||||
|
|
||||||
|
&.header {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ViewHolidaysComponent } from './view-holidays.component';
|
||||||
|
|
||||||
|
describe('ViewHolidaysComponent', () => {
|
||||||
|
let component: ViewHolidaysComponent;
|
||||||
|
let fixture: ComponentFixture<ViewHolidaysComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ViewHolidaysComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ViewHolidaysComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/** Angular Imports. */
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { MatDialog } from '@angular/material';
|
||||||
|
|
||||||
|
/** Custom Services. */
|
||||||
|
import { OrganizationService } from 'app/organization/organization.service';
|
||||||
|
|
||||||
|
/** Custom Components. */
|
||||||
|
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* View Holidays component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-view-holidays',
|
||||||
|
templateUrl: './view-holidays.component.html',
|
||||||
|
styleUrls: ['./view-holidays.component.scss']
|
||||||
|
})
|
||||||
|
export class ViewHolidaysComponent {
|
||||||
|
|
||||||
|
/** Holiday data. */
|
||||||
|
holidayData: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves hioliday data from `resolve`.
|
||||||
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
|
*/
|
||||||
|
constructor(private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
private dialog: MatDialog,
|
||||||
|
private organizationService: OrganizationService ) {
|
||||||
|
this.route.data.subscribe((data: { holidays: any}) => {
|
||||||
|
this.holidayData = data.holidays;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deletes the holiday.
|
||||||
|
*/
|
||||||
|
deleteHoliday() {
|
||||||
|
const deleteHolidayDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||||
|
data: { deleteContext: `holiday ${this.holidayData.id}` }
|
||||||
|
});
|
||||||
|
deleteHolidayDialogRef.afterClosed().subscribe((response: any) => {
|
||||||
|
if (response.delete) {
|
||||||
|
this.organizationService.deleteHoliday(this.holidayData.id)
|
||||||
|
.subscribe(() => {
|
||||||
|
this.router.navigate(['../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -34,6 +34,7 @@ import { EditEmployeeComponent } from './employees/edit-employee/edit-employee.c
|
|||||||
import { CreateTellerComponent } from './tellers/create-teller/create-teller.component';
|
import { CreateTellerComponent } from './tellers/create-teller/create-teller.component';
|
||||||
import { EditTellerComponent } from './tellers/edit-teller/edit-teller.component';
|
import { EditTellerComponent } from './tellers/edit-teller/edit-teller.component';
|
||||||
import { ViewCashierComponent } from './tellers/view-cashier/view-cashier.component';
|
import { ViewCashierComponent } from './tellers/view-cashier/view-cashier.component';
|
||||||
|
import { ViewHolidaysComponent } from './holidays/view-holidays/view-holidays.component';
|
||||||
|
|
||||||
/** Custom Resolvers */
|
/** Custom Resolvers */
|
||||||
import { LoanProvisioningCriteriaResolver } from './loan-provisioning-criteria/loan-provisioning-criteria.resolver';
|
import { LoanProvisioningCriteriaResolver } from './loan-provisioning-criteria/loan-provisioning-criteria.resolver';
|
||||||
@@ -58,6 +59,7 @@ import { AdhocQueryTemplateResolver } from './adhoc-query/adhoc-query-template.r
|
|||||||
import { ViewLoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/view-loan-provisioning-criteria/view-loan-provisioning-criteria.component';
|
import { ViewLoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/view-loan-provisioning-criteria/view-loan-provisioning-criteria.component';
|
||||||
import { LoanProvisioningCriteriasResolver } from './loan-provisioning-criteria/loan-provisioning-criterias.resolver';
|
import { LoanProvisioningCriteriasResolver } from './loan-provisioning-criteria/loan-provisioning-criterias.resolver';
|
||||||
import { CashierResolver } from './tellers/cashier.resolver';
|
import { CashierResolver } from './tellers/cashier.resolver';
|
||||||
|
import { HolidayResolver } from './holidays/holiday.resolver';
|
||||||
|
|
||||||
/** Organization Routes */
|
/** Organization Routes */
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@@ -338,11 +340,29 @@ const routes: Routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'holidays',
|
path: 'holidays',
|
||||||
component: HolidaysComponent,
|
|
||||||
data: { title: extract('Manage Holidays'), breadcrumb: 'Manage Holidays' },
|
data: { title: extract('Manage Holidays'), breadcrumb: 'Manage Holidays' },
|
||||||
resolve: {
|
children: [
|
||||||
offices: OfficesResolver
|
{
|
||||||
}
|
path: '',
|
||||||
|
component: HolidaysComponent,
|
||||||
|
resolve: {
|
||||||
|
offices: OfficesResolver
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: ':id',
|
||||||
|
data: { title: extract('View Holidays'), routeParamBreadcrumb: 'id' },
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: ViewHolidaysComponent,
|
||||||
|
resolve: {
|
||||||
|
holidays: HolidayResolver
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -377,7 +397,8 @@ const routes: Routes = [
|
|||||||
EditOfficeResolver,
|
EditOfficeResolver,
|
||||||
AdhocQueryTemplateResolver,
|
AdhocQueryTemplateResolver,
|
||||||
LoanProvisioningCriteriasResolver,
|
LoanProvisioningCriteriasResolver,
|
||||||
CashierResolver
|
CashierResolver,
|
||||||
|
HolidayResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OrganizationRoutingModule { }
|
export class OrganizationRoutingModule { }
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import { CreateTellerComponent } from './tellers/create-teller/create-teller.com
|
|||||||
import { EditTellerComponent } from './tellers/edit-teller/edit-teller.component';
|
import { EditTellerComponent } from './tellers/edit-teller/edit-teller.component';
|
||||||
import { ViewLoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/view-loan-provisioning-criteria/view-loan-provisioning-criteria.component';
|
import { ViewLoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/view-loan-provisioning-criteria/view-loan-provisioning-criteria.component';
|
||||||
import { ViewCashierComponent } from './tellers/view-cashier/view-cashier.component';
|
import { ViewCashierComponent } from './tellers/view-cashier/view-cashier.component';
|
||||||
|
import { ViewHolidaysComponent } from './holidays/view-holidays/view-holidays.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Organization Module
|
* Organization Module
|
||||||
@@ -74,6 +75,7 @@ import { ViewCashierComponent } from './tellers/view-cashier/view-cashier.compon
|
|||||||
EditTellerComponent,
|
EditTellerComponent,
|
||||||
ViewLoanProvisioningCriteriaComponent,
|
ViewLoanProvisioningCriteriaComponent,
|
||||||
ViewCashierComponent,
|
ViewCashierComponent,
|
||||||
|
ViewHolidaysComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OrganizationModule { }
|
export class OrganizationModule { }
|
||||||
|
|||||||
@@ -301,6 +301,24 @@ export class OrganizationService {
|
|||||||
return this.http.get('/holidays', { params: httpParams });
|
return this.http.get('/holidays', { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Holiday data.
|
||||||
|
* @param holidayId Holiday Id of holidays.
|
||||||
|
* @returns {Observable<any>} Holiday data.
|
||||||
|
*/
|
||||||
|
getHoliday(holidayId: string): Observable<any> {
|
||||||
|
return this.http.get(`/holidays/${holidayId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete Holiday.
|
||||||
|
* @param holidayId Holiday Id to be deleted.
|
||||||
|
* @returns {Observable<any>} Resource Id.
|
||||||
|
*/
|
||||||
|
deleteHoliday(holidayId: string) {
|
||||||
|
return this.http.delete(`/holidays/${holidayId}`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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>}
|
||||||
|
|||||||
Reference in New Issue
Block a user