<eg-grid #billGrid idlClass="mbt" [dataSource]="gridDataSource"
persistKey="circ.patron.bills" [sortable]="true"
(onRowActivate)="showStatement($event)"
+ [cellClassCallback]="cellClassCallback"
[reloadOnColumnChange]="true"
[showDeclaredFieldsOnly]="true"
[rowClassCallback]="rowClassCallback"
cellTextGenerator: GridCellTextGenerator;
rowClassCallback: (row: any) => string;
rowFlairCallback: (row: any) => GridRowFlairEntry;
+ cellClassCallback: (row: any, col: GridColumn) => string;
nowTime: number = new Date().getTime();
ngOnInit() {
+ this.cellClassCallback = (row: any, col: GridColumn): string => {
+ if (col.name === 'paymentPending') {
+ const val = this.billGrid.context.getRowColumnBareValue(row, col);
+ if (val < 0) {
+ return 'bg-warning p-1';
+ }
+ }
+ return '';
+ }
+
this.cellTextGenerator = {
title: row => row.title,
copy_barcode: row => row.copy_barcode,
// Recaclulate the amount owed per selected transaction as the
// grid rows selections change.
this.billGrid.context.rowSelector.selectionChange
- .subscribe(_ => this.updatePendingColumn());
+ .subscribe(_ => {
+ this.refunding = false;
+ this.updatePendingColumn();
+ });
this.focusPayAmount();
}
// Reset...
this.gridDataSource.data.forEach(row => row.paymentPending = 0);
+ // No actions pending. Reset and exit.
+ if (!this.paymentAmount && !this.refunding) { return; }
+
let amount = this.pendingPayment();
let done = false;
if (!confirmed) { return; }
this.refunding = true; // clearen in applyPayment()
this.paymentAmount = null;
+ this.updatePendingColumn();
});
}