From: Bill Erickson Date: Mon, 23 Aug 2021 17:16:44 +0000 (-0400) Subject: LP1904036 Bills grid color coding; lint X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=836be138ef7f53331b7c91ef57251fe9d5b76357;p=evergreen%2Fpines.git LP1904036 Bills grid color coding; lint Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- 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 390f74df8c..4a26b2c35a 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 @@ -171,6 +171,9 @@ (onRowActivate)="showStatement($event)" [reloadOnColumnChange]="true" [showDeclaredFieldsOnly]="true" + [rowClassCallback]="rowClassCallback" + [rowFlairIsEnabled]="true" + [rowFlairCallback]="rowFlairCallback" [cellTextGenerator]="cellTextGenerator"> + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts index d38210fef6..b4288a1243 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts @@ -12,7 +12,7 @@ import {AuthService} from '@eg/core/auth.service'; import {ServerStoreService} from '@eg/core/server-store.service'; import {PatronService} from '@eg/staff/share/patron/patron.service'; import {PatronContextService} from './patron.service'; -import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/grid'; +import {GridDataSource, GridColumn, GridCellTextGenerator, GridRowFlairEntry} from '@eg/share/grid/grid'; import {GridComponent} from '@eg/share/grid/grid.component'; import {Pager} from '@eg/share/util/pager'; import {CircService, CircDisplayInfo} from '@eg/staff/share/circ/circ.service'; @@ -58,6 +58,10 @@ export class BillsComponent implements OnInit, AfterViewInit { gridDataSource: GridDataSource = new GridDataSource(); cellTextGenerator: GridCellTextGenerator; + rowClassCallback: (row: any) => string; + rowFlairCallback: (row: any) => GridRowFlairEntry; + + nowTime: number = new Date().getTime(); @ViewChild('billGrid') private billGrid: GridComponent; @ViewChild('annotateDialog') private annotateDialog: PromptDialogComponent; @@ -98,6 +102,27 @@ export class BillsComponent implements OnInit, AfterViewInit { call_number: row => row.call_number_label }; + this.rowClassCallback = (row: any): string => { + if (row['circulation.stop_fines'] === 'LOST') { + return 'lost-row'; + } else if (row['circulation.stop_fines'] === 'LONGOVERDUE') { + return 'longoverdue-row'; + } else if (this.circIsOverdue(row)) { + return 'less-intense-alert'; + } + return ''; + }; + + this.rowFlairCallback = (row: any): GridRowFlairEntry => { + if (row['circulation.stop_fines'] === 'LOST') { + return {icon: 'help'}; + } else if (row['circulation.stop_fines'] === 'LONGOVERDUE') { + return {icon: 'priority-high'}; + } else if (this.circIsOverdue(row)) { + return {icon: 'schedule'}; + } + }; + this.gridDataSource.getRows = (pager: Pager, sort: any[]) => { const query: any = { @@ -122,6 +147,18 @@ export class BillsComponent implements OnInit, AfterViewInit { .then(_ => this.loadSettings()); } + circIsOverdue(row: any): boolean { + const due = row['circulation.due_date']; + if (due && !row['circulation.checkin_time']) { + const stopFines = row['circulation.stop_fines'] || ''; + if (stopFines.match(/LOST|CLAIMSRETURNED|CLAIMSNEVERCHECKEDOUT/)) { + return false; + } + + return (Date.parse(due) < this.nowTime); + } + } + loadSettings(): Promise { return this.serverStore.getItemBatch([ 'ui.circ.billing.amount_warn', diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.css b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.css index d4abd5f1e6..dcf83244fe 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.css +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.component.css @@ -3,3 +3,13 @@ font-size: 1rem; /* defaults to 1.5 */ } +::ng-deep .lost-row { + color: #FFF; + background-color: #800000 !important; +} + +::ng-deep .longoverdue-row { + color: #000; + background-color: #FFE1A8 !important; +} + diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts index 8a3bad3f63..dd5997a6f9 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/grid.component.ts @@ -641,7 +641,7 @@ export class HoldsGridComponent implements OnInit { 'open-ils.circ', 'open-ils.circ.hold.uncancel', this.auth.token(), holdId - ) + ); })).subscribe( resp => { if (Number(resp) !== 1) {