@@ -0,0 +1,40 @@
|
|||||||
|
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||||
|
<button mat-raised-button color="primary">
|
||||||
|
<fa-icon icon="plus"></fa-icon>
|
||||||
|
Add/Edit
|
||||||
|
</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> Currency Name </th>
|
||||||
|
<td mat-cell *matCellDef="let currency"> {{ currency.name }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="code">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> Currency Code </th>
|
||||||
|
<td mat-cell *matCellDef="let currency"> {{ currency.code }} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CurrenciesComponent } from './currencies.component';
|
||||||
|
|
||||||
|
describe('CurrenciesComponent', () => {
|
||||||
|
let component: CurrenciesComponent;
|
||||||
|
let fixture: ComponentFixture<CurrenciesComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CurrenciesComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CurrenciesComponent);
|
||||||
|
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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currencies component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-currencies',
|
||||||
|
templateUrl: './currencies.component.html',
|
||||||
|
styleUrls: ['./currencies.component.scss']
|
||||||
|
})
|
||||||
|
export class CurrenciesComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Currencies data. */
|
||||||
|
currenciesData: any;
|
||||||
|
/** Columns to be displayed in currencies table. */
|
||||||
|
displayedColumns: string[] = ['name', 'code'];
|
||||||
|
/** Data source for currencies table. */
|
||||||
|
dataSource: MatTableDataSource<any>;
|
||||||
|
|
||||||
|
/** Paginator for currencies table. */
|
||||||
|
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||||
|
/** Sorter for currencies table. */
|
||||||
|
@ViewChild(MatSort) sort: MatSort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the currencies data from `resolve`.
|
||||||
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
|
*/
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
this.route.data.subscribe(( data: { currencies: any }) => {
|
||||||
|
this.currenciesData = data.currencies.selectedCurrencyOptions;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters data in currencies table based on passed value.
|
||||||
|
* @param {string} filterValue Value to filter data.
|
||||||
|
*/
|
||||||
|
applyFilter(filterValue: string) {
|
||||||
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the currencies table.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.setCurrencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the data source, paginator and sorter for currencies table.
|
||||||
|
*/
|
||||||
|
setCurrencies() {
|
||||||
|
this.dataSource = new MatTableDataSource(this.currenciesData);
|
||||||
|
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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Currencies data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class CurrenciesResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {OrganizationService} organizationService Organization service.
|
||||||
|
*/
|
||||||
|
constructor(private organizationService: OrganizationService) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the currencies data.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(): Observable<any> {
|
||||||
|
return this.organizationService.getCurrencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,11 +13,13 @@ 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';
|
import { OfficesComponent } from './offices/offices.component';
|
||||||
import { EmployeesComponent } from './employees/employees.component';
|
import { EmployeesComponent } from './employees/employees.component';
|
||||||
|
import { CurrenciesComponent } from './currencies/currencies.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';
|
import { OfficesResolver } from './offices/offices.resolver';
|
||||||
import { EmployeesResolver } from './employees/employees.resolver';
|
import { EmployeesResolver } from './employees/employees.resolver';
|
||||||
|
import { CurrenciesResolver } from './currencies/currencies.resolver';
|
||||||
|
|
||||||
/** Organization Routes */
|
/** Organization Routes */
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
@@ -53,6 +55,14 @@ const routes: Routes = [
|
|||||||
resolve: {
|
resolve: {
|
||||||
employees: EmployeesResolver
|
employees: EmployeesResolver
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'currencies',
|
||||||
|
component: CurrenciesComponent,
|
||||||
|
data: { title: extract('Currency Configuration'), breadcrumb: 'Currency Configuration' },
|
||||||
|
resolve: {
|
||||||
|
currencies: CurrenciesResolver
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -70,7 +80,8 @@ const routes: Routes = [
|
|||||||
providers: [
|
providers: [
|
||||||
LoanProvisioningCriteriaResolver,
|
LoanProvisioningCriteriaResolver,
|
||||||
OfficesResolver,
|
OfficesResolver,
|
||||||
EmployeesResolver
|
EmployeesResolver,
|
||||||
|
CurrenciesResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OrganizationRoutingModule { }
|
export class OrganizationRoutingModule { }
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
<mat-nav-list>
|
<mat-nav-list>
|
||||||
|
|
||||||
<mat-list-item>
|
<mat-list-item [routerLink]="['currencies']">
|
||||||
<mat-icon matListIcon>
|
<mat-icon matListIcon>
|
||||||
<fa-icon icon="cogs" size="sm"></fa-icon>
|
<fa-icon icon="cogs" size="sm"></fa-icon>
|
||||||
</mat-icon>
|
</mat-icon>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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';
|
import { OfficesComponent } from './offices/offices.component';
|
||||||
import { EmployeesComponent } from './employees/employees.component';
|
import { EmployeesComponent } from './employees/employees.component';
|
||||||
|
import { CurrenciesComponent } from './currencies/currencies.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Organization Module
|
* Organization Module
|
||||||
@@ -25,7 +26,8 @@ import { EmployeesComponent } from './employees/employees.component';
|
|||||||
OrganizationComponent,
|
OrganizationComponent,
|
||||||
LoanProvisioningCriteriaComponent,
|
LoanProvisioningCriteriaComponent,
|
||||||
OfficesComponent,
|
OfficesComponent,
|
||||||
EmployeesComponent
|
EmployeesComponent,
|
||||||
|
CurrenciesComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class OrganizationModule { }
|
export class OrganizationModule { }
|
||||||
|
|||||||
@@ -39,4 +39,11 @@ export class OrganizationService {
|
|||||||
return this.http.get('/staff');
|
return this.http.get('/staff');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} Currencies data
|
||||||
|
*/
|
||||||
|
getCurrencies(): Observable<any> {
|
||||||
|
return this.http.get('/currencies');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user