(onRowActivate)="showStatement($event)"
[reloadOnColumnChange]="true"
[showDeclaredFieldsOnly]="true"
+ [rowClassCallback]="rowClassCallback"
+ [rowFlairIsEnabled]="true"
+ [rowFlairCallback]="rowFlairCallback"
[cellTextGenerator]="cellTextGenerator">
<eg-grid-toolbar-button i18n-label label="Add Billing"
<eg-grid-column path="xact_start" datatype="timestamp" [datePlusTime]="true"
label="Start" i18n-label></eg-grid-column>
+ <eg-grid-column path="circulation.due_date" label="Due Date" i18n-label
+ timezoneContextOrg="circulation.circ_lib" dateOnlyIntervalField="circulation.duration"
+ datatype="timestamp" [required]="true"></eg-grid-column>
+
+ <eg-grid-column path="circulation.stop_fines" [required]="true"
+ label="Stop Fines" i18n-label></eg-grid-column>
+
<eg-grid-column path="summary.xact_type"
label="Type" i18n-label></eg-grid-column>
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';
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;
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 = {
.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<any> {
return this.serverStore.getItemBatch([
'ui.circ.billing.amount_warn',