@@ -16,6 +16,7 @@ import { EmployeesComponent } from './employees/employees.component';
|
||||
import { CurrenciesComponent } from './currencies/currencies.component';
|
||||
import { SmsCampaignsComponent } from './sms-campaigns/sms-campaigns.component';
|
||||
import { AdhocQueryComponent } from './adhoc-query/adhoc-query.component';
|
||||
import { TellersComponent } from './tellers/tellers.component';
|
||||
|
||||
/** Custom Resolvers */
|
||||
import { LoanProvisioningCriteriaResolver } from './loan-provisioning-criteria/loan-provisioning-criteria.resolver';
|
||||
@@ -24,6 +25,7 @@ import { EmployeesResolver } from './employees/employees.resolver';
|
||||
import { CurrenciesResolver } from './currencies/currencies.resolver';
|
||||
import { SmsCampaignsResolver } from './sms-campaigns/sms-campaigns.resolver';
|
||||
import { AdhocQueriesResolver } from './adhoc-query/adhoc-queries.resolver';
|
||||
import { TellersResolver } from './tellers/tellers.resolver';
|
||||
|
||||
/** Organization Routes */
|
||||
const routes: Routes = [
|
||||
@@ -88,6 +90,14 @@ const routes: Routes = [
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: 'tellers',
|
||||
component: TellersComponent,
|
||||
data: { title: extract('Tellers'), breadcrumb: 'Tellers' },
|
||||
resolve: {
|
||||
tellers: TellersResolver
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -108,7 +118,8 @@ const routes: Routes = [
|
||||
EmployeesResolver,
|
||||
CurrenciesResolver,
|
||||
SmsCampaignsResolver,
|
||||
AdhocQueriesResolver
|
||||
AdhocQueriesResolver,
|
||||
TellersResolver
|
||||
]
|
||||
})
|
||||
export class OrganizationRoutingModule { }
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
<p matLine>Easy way to reassign all the loan from one LO to another LO</p>
|
||||
</mat-list-item>
|
||||
|
||||
<mat-list-item>
|
||||
<mat-list-item [routerLink]="['tellers']">
|
||||
<mat-icon matListIcon>
|
||||
<fa-icon icon="money-bill-alt" size="sm"></fa-icon>
|
||||
</mat-icon>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { EmployeesComponent } from './employees/employees.component';
|
||||
import { CurrenciesComponent } from './currencies/currencies.component';
|
||||
import { SmsCampaignsComponent } from './sms-campaigns/sms-campaigns.component';
|
||||
import { AdhocQueryComponent } from './adhoc-query/adhoc-query.component';
|
||||
import { TellersComponent } from './tellers/tellers.component';
|
||||
|
||||
/**
|
||||
* Organization Module
|
||||
@@ -33,7 +34,8 @@ import { AdhocQueryComponent } from './adhoc-query/adhoc-query.component';
|
||||
EmployeesComponent,
|
||||
CurrenciesComponent,
|
||||
SmsCampaignsComponent,
|
||||
AdhocQueryComponent
|
||||
AdhocQueryComponent,
|
||||
TellersComponent
|
||||
]
|
||||
})
|
||||
export class OrganizationModule { }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
@@ -60,4 +60,11 @@ export class OrganizationService {
|
||||
return this.http.get('/adhocquery');
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Tellers data
|
||||
*/
|
||||
getTellers(): Observable<any> {
|
||||
return this.http.get('/tellers');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||
|
||||
<button mat-raised-button color="primary">
|
||||
<fa-icon icon="plus"></fa-icon>
|
||||
Create Teller
|
||||
</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="officeName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Branch </th>
|
||||
<td mat-cell *matCellDef="let teller"> {{ teller.officeName }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Teller Name </th>
|
||||
<td mat-cell *matCellDef="let teller"> {{ teller.name }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="status">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Status </th>
|
||||
<td mat-cell *matCellDef="let teller">
|
||||
<div [className]="teller.status === 'ACTIVE' ? 'true' : 'false'">
|
||||
<fa-icon matTooltip="{{ teller.status === 'ACTIVE' ? 'Active' : 'Inactive' }}" matTooltipPosition="right" icon="circle" size="lg"></fa-icon>
|
||||
</div>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="startDate">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Started On </th>
|
||||
<td mat-cell *matCellDef="let teller"> {{ teller.startDate | date }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
||||
<td mat-cell *matCellDef="let teller">
|
||||
<button mat-button color="primary">
|
||||
<fa-icon icon="eye"></fa-icon> View Cashiers
|
||||
</button>
|
||||
</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,15 @@
|
||||
table {
|
||||
width: 100%;
|
||||
|
||||
.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.true {
|
||||
color: #32cd32;
|
||||
}
|
||||
|
||||
.false {
|
||||
color: #f44366;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TellersComponent } from './tellers.component';
|
||||
|
||||
describe('TellersComponent', () => {
|
||||
let component: TellersComponent;
|
||||
let fixture: ComponentFixture<TellersComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TellersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(TellersComponent);
|
||||
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';
|
||||
|
||||
/**
|
||||
* Tellers component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-tellers',
|
||||
templateUrl: './tellers.component.html',
|
||||
styleUrls: ['./tellers.component.scss']
|
||||
})
|
||||
export class TellersComponent implements OnInit {
|
||||
|
||||
/** Tellers data. */
|
||||
tellersData: any;
|
||||
/** Columns to be displayed in tellers table. */
|
||||
displayedColumns: string[] = ['officeName', 'name', 'status', 'startDate', 'actions'];
|
||||
/** Data source for tellers table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
/** Paginator for tellers table. */
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
/** Sorter for tellers table. */
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
/**
|
||||
* Retrieves the tellers data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { tellers: any }) => {
|
||||
this.tellersData = data.tellers;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters data in tellers table based on passed value.
|
||||
* @param {string} filterValue Value to filter data.
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tellers table.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.setTellers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for tellers table.
|
||||
*/
|
||||
setTellers() {
|
||||
this.dataSource = new MatTableDataSource(this.tellersData);
|
||||
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';
|
||||
|
||||
/**
|
||||
* Tellers data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class TellersResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService) {}
|
||||
|
||||
/**
|
||||
* Returns the Tellers data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.organizationService.getTellers();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user