From aa4af6f413c615401de39b8323b90ff78f8f40b0 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 5 Feb 2021 16:44:55 -0500 Subject: [PATCH] LP1904036 Patron ui checkout tab Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../app/staff/circ/patron/checkout.component.html | 9 ++++++ .../app/staff/circ/patron/checkout.component.ts | 32 +++++++++++++--------- .../src/app/staff/circ/patron/patron.service.ts | 12 ++++++++ .../eg2/src/app/staff/share/circ/circ.service.ts | 7 ++++- 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html index c856da3d2b..988ea06ec9 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.html @@ -59,6 +59,15 @@ + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts index 9a278a2487..f1f8c69f40 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts @@ -7,19 +7,13 @@ import {IdlObject} from '@eg/core/idl.service'; import {OrgService} from '@eg/core/org.service'; import {NetService} from '@eg/core/net.service'; import {PatronService} from '@eg/staff/share/patron/patron.service'; -import {PatronManagerService} from './patron.service'; +import {PatronManagerService, CircGridEntry} from './patron.service'; import {CheckoutParams, CheckoutResult, CircService} from '@eg/staff/share/circ/circ.service'; import {PromptDialogComponent} from '@eg/share/dialog/prompt.component'; import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/grid'; import {GridComponent} from '@eg/share/grid/grid.component'; import {Pager} from '@eg/share/util/pager'; -interface CircGridEntry { - title?: string; - circ?: IdlObject; - copyAlertCount: number; -} - @Component({ templateUrl: 'checkout.component.html', selector: 'eg-patron-checkout' @@ -29,7 +23,6 @@ export class CheckoutComponent implements OnInit { maxNoncats = 99; // Matches AngJS version checkoutNoncat: IdlObject = null; checkoutBarcode = ''; - checkouts: CircGridEntry[] = []; gridDataSource: GridDataSource = new GridDataSource(); cellTextGenerator: GridCellTextGenerator; @@ -48,7 +41,7 @@ export class CheckoutComponent implements OnInit { this.circ.getNonCatTypes(); this.gridDataSource.getRows = (pager: Pager, sort: any[]) => { - return from(this.checkouts); + return from(this.context.checkouts); }; this.cellTextGenerator = { @@ -115,17 +108,30 @@ export class CheckoutComponent implements OnInit { gridifyResult(result: CheckoutResult) { const entry: CircGridEntry = { + title: '', + copy: result.copy, circ: result.circ, + dueDate: null, copyAlertCount: 0 // TODO }; - if (this.checkoutNoncat) { + if (result.nonCatCirc) { + entry.title = this.checkoutNoncat.name(); - } else if (result.record) { - entry.title = result.record.title(); + entry.dueDate = result.nonCatCirc.duedate(); + + } else { + + if (result.record) { + entry.title = result.record.title(); + } + + if (result.circ) { + entry.dueDate = result.circ.due_date(); + } } - this.checkouts.unshift(entry); + this.context.checkouts.unshift(entry); this.checkoutsGrid.reload(); } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts index 78f25ad686..cf653c727f 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts @@ -5,6 +5,14 @@ import {AuthService} from '@eg/core/auth.service'; import {PatronService} from '@eg/staff/share/patron/patron.service'; import {PatronSearch} from '@eg/staff/share/patron/search.component'; +export interface CircGridEntry { + title?: string; + copy?: IdlObject; + circ?: IdlObject; + dueDate?: string; + copyAlertCount: number; +} + const PATRON_FLESH_FIELDS = [ 'card', 'cards', @@ -60,6 +68,9 @@ export class PatronManagerService { lastPatronSearch: PatronSearch; + // These should persist tab changes + checkouts: CircGridEntry[] = []; + constructor( private net: NetService, private auth: AuthService, @@ -69,6 +80,7 @@ export class PatronManagerService { loadPatron(id: number): Promise { this.loaded = false; this.patron = null; + this.checkouts = []; return this.net.request( 'open-ils.actor', diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts b/Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts index 554b77d93b..1b69e0498f 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts @@ -26,7 +26,9 @@ export interface CheckoutResult { index: number; params: CheckoutParams, success: boolean; + copy?: IdlObject; circ?: IdlObject; + nonCatCirc: IdlObject; record?: IdlObject; } @@ -89,7 +91,10 @@ export class CircService { index: CircService.resultIndex++, params: params, success: true, - circ: payload.circ + circ: payload.circ, + copy: payload.copy, + record: payload.record, + nonCatCirc: payload.noncat_circ }; return Promise.resolve(result); -- 2.11.0