From bc081602f0a7510bbb871e713514ec8472ce3549 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 24 Feb 2022 11:38:39 -0500 Subject: [PATCH] LP1904036 Refund shows styled neg. amount; other fixes Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/app/staff/circ/patron/bills.component.html | 1 + .../eg2/src/app/staff/circ/patron/bills.component.ts | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html index 7e5a27bc7d..7d540cc12f 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.html @@ -169,6 +169,7 @@ string; rowFlairCallback: (row: any) => GridRowFlairEntry; + cellClassCallback: (row: any, col: GridColumn) => string; nowTime: number = new Date().getTime(); @@ -96,6 +97,16 @@ export class BillsComponent implements OnInit, AfterViewInit { 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, @@ -188,7 +199,10 @@ export class BillsComponent implements OnInit, AfterViewInit { // 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(); } @@ -401,6 +415,9 @@ export class BillsComponent implements OnInit, AfterViewInit { // 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; @@ -617,6 +634,7 @@ export class BillsComponent implements OnInit, AfterViewInit { if (!confirmed) { return; } this.refunding = true; // clearen in applyPayment() this.paymentAmount = null; + this.updatePendingColumn(); }); } -- 2.11.0