@@ -41,6 +41,7 @@ import { DatatableTabsComponent } from './offices/view-office/datatable-tabs/dat
|
||||
import { ViewCampaignComponent } from './sms-campaigns/view-campaign/view-campaign.component';
|
||||
import { ManageFundsComponent } from './manage-funds/manage-funds.component';
|
||||
import { ManageCurrenciesComponent } from './currencies/manage-currencies/manage-currencies.component';
|
||||
import { CashiersComponent } from './tellers/cashiers/cashiers.component';
|
||||
|
||||
/** Custom Resolvers */
|
||||
import { LoanProvisioningCriteriaResolver } from './loan-provisioning-criteria/loan-provisioning-criteria.resolver';
|
||||
@@ -52,8 +53,8 @@ import { CurrenciesResolver } from './currencies/currencies.resolver';
|
||||
import { SmsCampaignsResolver } from './sms-campaigns/common-resolvers/sms-campaigns.resolver';
|
||||
import { AdhocQueriesResolver } from './adhoc-query/adhoc-queries.resolver';
|
||||
import { AdhocQueryResolver } from './adhoc-query/adhoc-query.resolver';
|
||||
import { TellersResolver } from './tellers/tellers.resolver';
|
||||
import { TellerResolver } from './tellers/teller.resolver';
|
||||
import { TellersResolver } from './tellers/common-resolvers/tellers.resolver';
|
||||
import { TellerResolver } from './tellers/common-resolvers/teller.resolver';
|
||||
import { PaymentTypesResolver } from './payment-types/payment-types.resolver';
|
||||
import { PaymentTypeResolver } from './payment-types/payment-type.resolver';
|
||||
import { PasswordPreferencesTemplateResolver } from './password-preferences/password-preferences-template.resolver';
|
||||
@@ -64,7 +65,8 @@ import { EditOfficeComponent } from './offices/edit-office/edit-office.component
|
||||
import { AdhocQueryTemplateResolver } from './adhoc-query/adhoc-query-template.resolver';
|
||||
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 { CashierResolver } from './tellers/cashier.resolver';
|
||||
import { CashierResolver } from './tellers/common-resolvers/cashier.resolver';
|
||||
import { CashiersResolver } from './tellers/common-resolvers/cashiers.resolver';
|
||||
import { HolidayResolver } from './holidays/holiday.resolver';
|
||||
import { OfficeResolver } from './offices/common-resolvers/office.resolver';
|
||||
import { OfficeDatatableResolver } from './offices/common-resolvers/office-datatable.resolver';
|
||||
@@ -328,6 +330,13 @@ const routes: Routes = [
|
||||
path: 'cashiers',
|
||||
data: { title: extract('View Cashiers'), breadcrumb: 'View Cashiers', routeParamBreadcrumb: false },
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: CashiersComponent,
|
||||
resolve: {
|
||||
cashiersData: CashiersResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':id',
|
||||
component: ViewCashierComponent,
|
||||
@@ -471,6 +480,7 @@ const routes: Routes = [
|
||||
AdhocQueryTemplateResolver,
|
||||
LoanProvisioningCriteriasResolver,
|
||||
CashierResolver,
|
||||
CashiersResolver,
|
||||
HolidayResolver,
|
||||
OfficeResolver,
|
||||
OfficeDatatableResolver,
|
||||
|
||||
@@ -44,6 +44,7 @@ import { MultiRowComponent } from './offices/view-office/datatable-tabs/multi-ro
|
||||
import { ViewCampaignComponent } from './sms-campaigns/view-campaign/view-campaign.component';
|
||||
import { ManageFundsComponent } from './manage-funds/manage-funds.component';
|
||||
import { ManageCurrenciesComponent } from './currencies/manage-currencies/manage-currencies.component';
|
||||
import { CashiersComponent } from './tellers/cashiers/cashiers.component';
|
||||
|
||||
/**
|
||||
* Organization Module
|
||||
@@ -93,7 +94,8 @@ import { ManageCurrenciesComponent } from './currencies/manage-currencies/manage
|
||||
MultiRowComponent,
|
||||
ViewCampaignComponent,
|
||||
ManageFundsComponent,
|
||||
ManageCurrenciesComponent
|
||||
ManageCurrenciesComponent,
|
||||
CashiersComponent
|
||||
]
|
||||
})
|
||||
export class OrganizationModule { }
|
||||
|
||||
@@ -257,7 +257,14 @@ export class OrganizationService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Cashier data.
|
||||
* @param {string} tellerId Teller ID of teller.
|
||||
* @returns {Observable<any>} Cashier data.
|
||||
*/
|
||||
getCashiers(tellerId: string): Observable<any> {
|
||||
return this.http.get(`/tellers/${tellerId}/cashiers`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} tellerId Teller ID of teller.
|
||||
* @param {string} cashierId Cashier ID of cashier
|
||||
* @returns {Observable<any>} Cashier data.
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||
|
||||
<button mat-raised-button color="primary" [routerLink]="['create']">
|
||||
<fa-icon icon="plus"></fa-icon>
|
||||
New Cashier
|
||||
</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="period">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Period </th>
|
||||
<td mat-cell *matCellDef="let cashier"> {{ cashier.startDate | date }} - {{ cashier.endDate | date }}</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="staffName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Cashier/Staff </th>
|
||||
<td mat-cell *matCellDef="let cashier"> {{ cashier.staffName }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="isFullDay">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Full Day/Time </th>
|
||||
<td mat-cell *matCellDef="let cashier"> {{ cashier.isFullDay ? 'Yes' : 'No' }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="vaultActions">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Vault Actions </th>
|
||||
<td mat-cell *matCellDef="let cashier">
|
||||
<button class="cashier-action-button" mat-raised-button color="accent" matTooltip="Allocate Cash">
|
||||
<i class="fa fa-arrow-up"></i>
|
||||
</button>
|
||||
<button class="cashier-action-button" mat-raised-button color="warn" matTooltip="Settle Cash">
|
||||
<i class="fa fa-arrow-down"></i>
|
||||
</button>
|
||||
<button class="cashier-action-button" mat-raised-button color="primary" matTooltip="View Transactions">
|
||||
<i class="fa fa-eye"></i>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row" [routerLink]="[row.id]"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,12 @@
|
||||
table {
|
||||
width: 100%;
|
||||
.cashier-action-button{
|
||||
min-width: 26px;
|
||||
padding: 0 6px;
|
||||
margin: 4px;
|
||||
line-height: 25px;
|
||||
}
|
||||
.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CashiersComponent } from './cashiers.component';
|
||||
|
||||
describe('CashiersComponent', () => {
|
||||
let component: CashiersComponent;
|
||||
let fixture: ComponentFixture<CashiersComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CashiersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CashiersComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,63 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Cashiers component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-cashiers',
|
||||
templateUrl: './cashiers.component.html',
|
||||
styleUrls: ['./cashiers.component.scss']
|
||||
})
|
||||
export class CashiersComponent implements OnInit {
|
||||
|
||||
/** Cashiers data. */
|
||||
cashiersData: any;
|
||||
/** Columns to be displayed in cashiers table. */
|
||||
displayedColumns: string[] = ['period', 'staffName', 'isFullDay', 'vaultActions'];
|
||||
/** Data source for cashiers table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
/** Paginator for cashiers table. */
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
/** Sorter for cashiers table. */
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
/**
|
||||
* Retrieves the cashiers data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { cashiersData: any }) => {
|
||||
this.cashiersData = data.cashiersData.cashiers;
|
||||
console.log(this.cashiersData);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters data in cashiers table based on passed value.
|
||||
* @param {string} filterValue Value to filter data.
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cashiers table.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.setCashiers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for cashiers table.
|
||||
*/
|
||||
setCashiers() {
|
||||
this.dataSource = new MatTableDataSource(this.cashiersData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
/**
|
||||
* Cashiers data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class CashiersResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {OrganizationService} organizationService Organization service.
|
||||
*/
|
||||
constructor(private organizationService: OrganizationService) {}
|
||||
|
||||
/**
|
||||
* Returns the cashiers data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const tellerId = route.parent.paramMap.get('id');
|
||||
return this.organizationService.getCashiers(tellerId);
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ import { Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from '../organization.service';
|
||||
import { OrganizationService } from '../../organization.service';
|
||||
|
||||
/**
|
||||
* Tellers data resolver.
|
||||
Reference in New Issue
Block a user