From 7e6c884b46299430a56f1437c92f384e70eac7e6 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 18 Feb 2021 11:18:40 -0500 Subject: [PATCH] LP1904036 Barcode completion continued Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../eg2/src/app/staff/catalog/catalog.module.ts | 2 + .../src/app/staff/catalog/hold/hold.component.html | 4 +- .../src/app/staff/catalog/hold/hold.component.ts | 19 +++++- .../app/staff/circ/patron/bcsearch.component.html | 29 +++++++--- .../app/staff/circ/patron/bcsearch.component.ts | 25 +++++--- .../app/staff/circ/patron/checkout.component.ts | 16 ++++-- .../src/app/staff/circ/patron/routing.module.ts | 6 +- .../share/barcodes/barcode-select.component.html | 15 ++--- .../share/barcodes/barcode-select.component.ts | 67 ++++++++++++++++------ .../src/app/staff/share/patron/patron.module.ts | 4 +- .../src/app/staff/share/patron/patron.service.ts | 7 ++- 11 files changed, 140 insertions(+), 54 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts index 3222d87c03..58781da2c1 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts @@ -35,6 +35,7 @@ import {MarcEditModule} from '@eg/staff/share/marc-edit/marc-edit.module'; import {PreferencesComponent} from './prefs.component'; import {BrowsePagerComponent} from './result/browse-pager.component'; import {HttpClientModule} from '@angular/common/http'; +import {BarcodesModule} from '@eg/staff/share/barcodes/barcodes.module'; @NgModule({ declarations: [ @@ -75,6 +76,7 @@ import {HttpClientModule} from '@angular/common/http'; PatronModule, MarcEditModule, HttpClientModule + BarcodesModule ], providers: [ StaffCatalogService 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 a935efc16d..c04c970dfb 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 @@ -1,6 +1,6 @@ - - + + { - return id ? - this.patron.getById(id, flesh) : - this.patron.getByBarcode(this.userBarcode, flesh); + if (id) { return id; } + // Find the patron ID from the provided barcode. + return this.barcodeSelect.getBarcode('actor', this.userBarcode) + .then(selection => selection ? selection.id : null); + }); + + promise = promise.then(matchId => { + if (matchId) { + return this.patron.getById(matchId, flesh); + } else { + return null; + } }); this.badBarcode = null; diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch.component.html index db013a63e0..8f97db1736 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch.component.html @@ -1,14 +1,25 @@ + + + -
-
-
- Barcode: +
+
+
+
+ Patron Barcode: +
+ +
+ +
- -
- +
+
+
+ No match found for barcode "{{barcode}}".
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch.component.ts index ddd0433909..59a50826c4 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/bcsearch.component.ts @@ -1,7 +1,8 @@ -import {Component, OnInit, AfterViewInit} from '@angular/core'; -import {ActivatedRoute} from '@angular/router'; +import {Component, OnInit, AfterViewInit, ViewChild} from '@angular/core'; +import {Router, ActivatedRoute} from '@angular/router'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; +import {BarcodeSelectComponent} from '@eg/staff/share/barcodes/barcode-select.component'; @Component({ templateUrl: 'bcsearch.component.html', @@ -10,9 +11,12 @@ import {AuthService} from '@eg/core/auth.service'; export class BcSearchComponent implements OnInit, AfterViewInit { + notFound = false; barcode = ''; + @ViewChild('barcodeSelect') private barcodeSelect: BarcodeSelectComponent; constructor( + private router: Router, private route: ActivatedRoute, private net: NetService, private auth: AuthService @@ -20,17 +24,24 @@ export class BcSearchComponent implements OnInit, AfterViewInit { ngOnInit() { this.barcode = this.route.snapshot.paramMap.get('barcode'); - if (this.barcode) { - this.findUser(); - } } ngAfterViewInit() { - document.getElementById('barcode-search-input').focus(); + const node = document.getElementById('barcode-search-input'); + if (node) { node.focus(); } + if (this.barcode) { this.findUser(); } } findUser(): void { - alert('Searching for user ' + this.barcode); + this.notFound = false; + this.barcodeSelect.getBarcode('actor', this.barcode) + .then(selection => { + if (selection && selection.id) { + this.router.navigate(['/staff/circ/patron', selection.id, 'checkout']); + } else { + this.notFound = true; + } + }); } } 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 27baba530d..f7e5b4ae1e 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 @@ -8,7 +8,8 @@ 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, CircGridEntry} from './patron.service'; -import {CheckoutParams, CheckoutResult, CircService} from '@eg/staff/share/circ/circ.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'; @@ -17,8 +18,10 @@ import {StoreService} from '@eg/core/store.service'; import {ServerStoreService} from '@eg/core/server-store.service'; import {PrecatCheckoutDialogComponent} from './precat-dialog.component'; import {AudioService} from '@eg/share/util/audio.service'; -import {CopyAlertsDialogComponent} from '@eg/staff/share/holdings/copy-alerts-dialog.component'; -import {BarcodeSelectComponent} from '@eg/staff/share/barcodes/barcode-select.component'; +import {CopyAlertsDialogComponent + } from '@eg/staff/share/holdings/copy-alerts-dialog.component'; +import {BarcodeSelectComponent + } from '@eg/staff/share/barcodes/barcode-select.component'; const SESSION_DUE_DATE = 'eg.circ.checkout.is_until_logout'; @@ -107,11 +110,12 @@ export class CheckoutComponent implements OnInit { if (this.dueDateOptions > 0) { params.due_date = this.dueDate; } return this.barcodeSelect.getBarcode('asset', this.checkoutBarcode) - .then(barcode => { - if (barcode) { - params.copy_barcode = barcode; + .then(selection => { + if (selection) { + params.copy_barcode = selection.barcode; return params; } else { + // User canceled the multi-match selection dialog. return null; } }); diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts index 999d5f7779..de04742aef 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/routing.module.ts @@ -1,6 +1,7 @@ import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; import {PatronComponent} from './patron.component'; +import {BcSearchComponent} from './bcsearch.component'; const routes: Routes = [{ path: '', @@ -15,7 +16,10 @@ const routes: Routes = [{ component: PatronComponent }, { path: 'bcsearch', - component: PatronComponent + component: BcSearchComponent + }, { + path: 'bcsearch/:barcode', + component: BcSearchComponent }, { path: ':id/:tab', component: PatronComponent, diff --git a/Open-ILS/src/eg2/src/app/staff/share/barcodes/barcode-select.component.html b/Open-ILS/src/eg2/src/app/staff/share/barcodes/barcode-select.component.html index 9081ce8871..4397674ebd 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/barcodes/barcode-select.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/barcodes/barcode-select.component.html @@ -10,20 +10,21 @@