From 523e1e1560daaa689682f74d110b0f5c1507b123 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 5 Feb 2021 17:57:42 -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 | 35 ++++++++++++++--- .../app/staff/circ/patron/checkout.component.ts | 44 ++++++++++++++++++++++ .../src/app/staff/circ/patron/patron.service.ts | 1 + .../eg2/src/app/staff/share/circ/circ.service.ts | 5 ++- 4 files changed, 77 insertions(+), 8 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 988ea06ec9..d2a7615918 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 @@ -9,12 +9,12 @@ dialogBody="Enter the number of {{checkoutNoncat ? checkoutNoncat.name() : ''}} circulating"> -
+
-
+
+
-
- here +
+
+ +
+ + +
+
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 f1f8c69f40..096ff1bbbd 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 @@ -25,6 +25,8 @@ export class CheckoutComponent implements OnInit { checkoutBarcode = ''; gridDataSource: GridDataSource = new GridDataSource(); cellTextGenerator: GridCellTextGenerator; + dueDate: string; + copiesInFlight: {[barcode: string]: boolean} = {}; @ViewChild('nonCatCount') nonCatCount: PromptDialogComponent; @ViewChild('checkoutsGrid') checkoutsGrid: GridComponent; @@ -53,6 +55,10 @@ export class CheckoutComponent implements OnInit { this.focusInput(); } + setDueDate(iso: string) { + this.dueDate = iso; + } + focusInput() { const input = document.getElementById('barcode-input'); if (input) { input.focus(); } @@ -73,8 +79,19 @@ export class CheckoutComponent implements OnInit { params.noncat_type = this.checkoutNoncat.id(); return params; }); + } else if (this.checkoutBarcode) { + + if (this.copiesInFlight[this.checkoutBarcode]) { + console.log('Item ' + + this.checkoutBarcode + ' is already mid-checkout'); + return Promise.resolve(null); + } + + this.copiesInFlight[this.checkoutBarcode] = true; + params.copy_barcode = this.checkoutBarcode; + if (this.context.dueDateOptions > 0) { params.due_date = this.dueDate; } return Promise.resolve(params); } @@ -92,6 +109,11 @@ export class CheckoutComponent implements OnInit { .then((result: CheckoutResult) => { if (result) { + + if (result.params.copy_barcode) { + delete this.copiesInFlight[result.params.copy_barcode]; + } + if (result.success) { this.gridifyResult(result); this.resetForm(); @@ -101,6 +123,13 @@ export class CheckoutComponent implements OnInit { } resetForm() { + + if (this.context.dueDateOptions < 2) { + // Due date is not configured to persist. + this.context.dueDateOptions = 0; + this.dueDate = null; + } + this.checkoutBarcode = ''; this.checkoutNoncat = null; this.focusInput(); @@ -154,5 +183,20 @@ export class CheckoutComponent implements OnInit { } })); } + + // 0: use server due date + // 1: use specific due date once + // 2: use specific due date until the end of the session. + toggleDateOptions(value: 1 | 2) { + if (this.context.dueDateOptions > 0) { + if (value === 1) { + this.context.dueDateOptions = 0; + } else if (this.context.dueDateOptions === 1) { + this.context.dueDateOptions = 2; + } + } else { + this.context.dueDateOptions = value; + } + } } 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 cf653c727f..7bb36d7d3a 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 @@ -70,6 +70,7 @@ export class PatronManagerService { // These should persist tab changes checkouts: CircGridEntry[] = []; + dueDateOptions: 0 | 1 | 2 = 0; // auto date; specific date; session date constructor( private net: NetService, 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 1b69e0498f..10a9bc23b6 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 @@ -13,6 +13,7 @@ import {AudioService} from '@eg/share/util/audio.service'; // API parameter options export interface CheckoutParams { + due_date?: string; patron_id: number; copy_id?: number; copy_barcode?: string; @@ -68,8 +69,8 @@ export class CircService { return this.net.request( 'open-ils.circ', 'open-ils.circ.checkout.full', - this.auth.token(), params - ).toPromise().then(result => this.processCheckoutResult(params, result)) + this.auth.token(), params).toPromise() + .then(result => this.processCheckoutResult(params, result)); } processCheckoutResult( -- 2.11.0