@@ -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