@@ -0,0 +1,62 @@
|
|||||||
|
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||||
|
|
||||||
|
<button mat-raised-button color="primary">
|
||||||
|
<fa-icon icon="sitemap"></fa-icon>
|
||||||
|
Tree View
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button mat-raised-button color="primary">
|
||||||
|
<fa-icon icon="plus"></fa-icon>
|
||||||
|
Create Office
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button mat-raised-button color="primary">
|
||||||
|
<fa-icon icon="upload"></fa-icon>
|
||||||
|
Import Offices
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div fxLayout="row" fxLayoutGap="20px">
|
||||||
|
<mat-form-field fxFlex>
|
||||||
|
<mat-label>Filter</mat-label>
|
||||||
|
<input matInput (keyup)="applyFilter($event.target.value)">
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mat-elevation-z8">
|
||||||
|
|
||||||
|
<table mat-table [dataSource]="dataSource" matSort>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Office Name </th>
|
||||||
|
<td mat-cell *matCellDef="let offices"> {{ offices.name }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="externalId">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> External ID </th>
|
||||||
|
<td mat-cell *matCellDef="let offices"> {{ offices.externalId }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="parentName">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Parent Office </th>
|
||||||
|
<td mat-cell *matCellDef="let offices"> {{ offices.parentName }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="openingDate">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Opened On </th>
|
||||||
|
<td mat-cell *matCellDef="let offices"> {{ offices.openingDate | date }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row"></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
.select-row:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { OfficesComponent } from './offices.component';
|
||||||
|
|
||||||
|
describe('OfficesComponent', () => {
|
||||||
|
let component: OfficesComponent;
|
||||||
|
let fixture: ComponentFixture<OfficesComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ OfficesComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(OfficesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
|
import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Offices component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-offices',
|
||||||
|
templateUrl: './offices.component.html',
|
||||||
|
styleUrls: ['./offices.component.scss']
|
||||||
|
})
|
||||||
|
export class OfficesComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Offices data. */
|
||||||
|
officesData: any;
|
||||||
|
/** Columns to be displayed in offices table. */
|
||||||
|
displayedColumns: string[] = ['name', 'externalId', 'parentName', 'openingDate'];
|
||||||
|
/** Data source for offices table. */
|
||||||
|
dataSource: MatTableDataSource<any>;
|
||||||
|
|
||||||
|
/** Paginator for offices table. */
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
/** Sorter for offices table. */
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the offices data from `resolve`.
|
||||||
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
|
*/
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
this.route.data.subscribe(( data: { offices: any }) => {
|
||||||
|
this.officesData = data.offices;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters data in offices table based on passed value.
|
||||||
|
* @param {string} filterValue Value to filter data.
|
||||||
|
*/
|
||||||
|
applyFilter(filterValue: string) {
|
||||||
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the offices table.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.setOffices();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the data source, paginator and sorter for offices table.
|
||||||
|
*/
|
||||||
|
setOffices() {
|
||||||
|
this.dataSource = new MatTableDataSource(this.officesData);
|
||||||
|
this.dataSource.paginator = this.paginator;
|
||||||
|
this.dataSource.sort = this.sort;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { OrganizationService } from '../organization.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manage Offices data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class OfficesResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {OrganizationService} organizationService Organization service.
|
||||||
|
*/
|
||||||
|
constructor(private organizationService: OrganizationService) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the offices data.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(): Observable<any> {
|
||||||
|
return this.organizationService.getOffices();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -11,9 +11,11 @@ import { extract } from '../core/i18n/i18n.service';
|
|||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { OrganizationComponent } from './organization.component';
|
import { OrganizationComponent } from './organization.component';
|
||||||
import { LoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/loan-provisioning-criteria.component';
|
import { LoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/loan-provisioning-criteria.component';
|
||||||
|
import { OfficesComponent } from './offices/offices.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';
|
||||||
|
import { OfficesResolver } from './offices/offices.resolver';
|
||||||
|
|
||||||
/** Organization Routes */
|
/** Organization Routes */
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@@ -33,6 +35,14 @@ const routes: Routes = [
|
|||||||
resolve: {
|
resolve: {
|
||||||
loanProvisioningCriteria: LoanProvisioningCriteriaResolver
|
loanProvisioningCriteria: LoanProvisioningCriteriaResolver
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'offices',
|
||||||
|
component: OfficesComponent,
|
||||||
|
data: { title: extract('Manage Offices'), breadcrumb: 'Manage Offices' },
|
||||||
|
resolve: {
|
||||||
|
offices: OfficesResolver
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -48,7 +58,8 @@ const routes: Routes = [
|
|||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
providers: [
|
providers: [
|
||||||
LoanProvisioningCriteriaResolver
|
LoanProvisioningCriteriaResolver,
|
||||||
|
OfficesResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OrganizationRoutingModule { }
|
export class OrganizationRoutingModule { }
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<mat-nav-list>
|
<mat-nav-list>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item [routerLink]="['offices']">
|
||||||
<mat-icon matListIcon>
|
<mat-icon matListIcon>
|
||||||
<fa-icon icon="building" size="sm"></fa-icon>
|
<fa-icon icon="building" size="sm"></fa-icon>
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { OrganizationRoutingModule } from './organization-routing.module';
|
|||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { OrganizationComponent } from './organization.component';
|
import { OrganizationComponent } from './organization.component';
|
||||||
import { LoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/loan-provisioning-criteria.component';
|
import { LoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/loan-provisioning-criteria.component';
|
||||||
|
import { OfficesComponent } from './offices/offices.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Organization Module
|
* Organization Module
|
||||||
@@ -21,7 +22,8 @@ import { LoanProvisioningCriteriaComponent } from './loan-provisioning-criteria/
|
|||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
OrganizationComponent,
|
OrganizationComponent,
|
||||||
LoanProvisioningCriteriaComponent
|
LoanProvisioningCriteriaComponent,
|
||||||
|
OfficesComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OrganizationModule { }
|
export class OrganizationModule { }
|
||||||
|
|||||||
@@ -25,4 +25,11 @@ export class OrganizationService {
|
|||||||
return this.http.get('/provisioningcriteria');
|
return this.http.get('/provisioningcriteria');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} Offices data
|
||||||
|
*/
|
||||||
|
getOffices(): Observable<any> {
|
||||||
|
return this.http.get('/offices');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user