From 7f38b6f2616912c037c4171cfaa907ba2009b5d5 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 27 Jul 2021 15:09:45 -0400 Subject: [PATCH] LP1903358 Staff catalog holds barcode realtime lookup Avoid requiring staff to send an Enter event (keyword / scanner) when entering a patron barcode into the place holds form. Instead, look the barcode up after a sufficient amount of time has passed. Signed-off-by: Bill Erickson Signed-off-by: Ruth Frasur Signed-off-by: Galen Charlton --- .../eg2/src/app/staff/catalog/hold/hold.component.html | 5 +++-- .../eg2/src/app/staff/catalog/hold/hold.component.ts | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html index 2b733af027..df4130e3bb 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html @@ -62,8 +62,9 @@ + (ngModelChange)="debounceUserBarcodeLookup($event)" + (paste)="debounceUserBarcodeLookup($event)" + [(ngModel)]="userBarcode"/>
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts index b4d24430f9..8f86dc06f9 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts @@ -74,6 +74,7 @@ export class HoldComponent implements OnInit { currentUserBarcode: string; smsCarriers: ComboboxEntry[]; + userBarcodeTimeout: number; smsEnabled: boolean; @@ -351,6 +352,22 @@ export class HoldComponent implements OnInit { } } + // Note this is called before this.userBarcode has its latest value. + debounceUserBarcodeLookup(barcode: string | ClipboardEvent) { + clearTimeout(this.userBarcodeTimeout); + + if (!barcode) { + this.badBarcode = null; + return; + } + + const timeout = + (barcode && (barcode as ClipboardEvent).target) ? 0 : 500; + + this.userBarcodeTimeout = + setTimeout(() => this.userBarcodeChanged(), timeout); + } + userBarcodeChanged() { const newBc = this.userBarcode; -- 2.11.0