From: Bill Erickson Date: Mon, 8 Feb 2021 21:41:55 +0000 (-0500) Subject: LP1904036 precat checkouts X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=84a1fe33f62b93efdd74e83fe07237cc8f617a8b;p=evergreen%2Fpines.git LP1904036 precat checkouts Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- 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 665034adc5..54aacaafc7 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 @@ -35,9 +35,9 @@ + i18n-aria-label aria-label="Barcode Input" (keydown.enter)="checkout()" />
-
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 1217c56755..2b36ca76ec 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 @@ -92,14 +92,6 @@ export class CheckoutComponent implements OnInit { } 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.dueDateOptions > 0) { params.due_date = this.dueDate; } return Promise.resolve(params); @@ -108,10 +100,23 @@ export class CheckoutComponent implements OnInit { return Promise.resolve(null); } - checkout() { - this.collectParams() + checkout(params?: CheckoutParams, override?: boolean): Promise { - .then((params: CheckoutParams) => { + const barcode = params.copy_barcode || ''; + + if (barcode) { + + if (this.copiesInFlight[barcode]) { + console.debug('Item ' + barcode + ' is already mid-checkout'); + return Promise.resolve(null); + } + + this.copiesInFlight[barcode] = true; + } + + const promise = params ? Promise.resolve(params) : this.collectParams(); + + promise.then((params: CheckoutParams) => { if (params) { return this.circ.checkout(params); } @@ -119,12 +124,12 @@ export class CheckoutComponent implements OnInit { .then((result: CheckoutResult) => { if (result) { - if (result.params.copy_barcode) { - delete this.copiesInFlight[result.params.copy_barcode]; - } this.dispatchResult(result); + return result; } - }); + }) + + .finally(() => delete this.copiesInFlight[barcode]); } dispatchResult(result: CheckoutResult) { @@ -248,8 +253,13 @@ export class CheckoutComponent implements OnInit { } handlePrecat(result: CheckoutResult) { - this.precatDialog.open({size: 'lg'}).subscribe(values => { - console.log('precat values', values); + this.precatDialog.open().subscribe(values => { + if (values && values.dummy_title) { + const params = result.params; + params.precat = true; + Object.keys(values).forEach(key => params[key] = values[key]); + this.checkout(params); + } }) } } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.html index 2b3d45e128..5d1182cd35 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.html @@ -7,14 +7,44 @@ diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.ts index d4408766b2..8e79cff675 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.ts @@ -21,6 +21,13 @@ export class PrecatCheckoutDialogComponent extends DialogComponent implements On circModifier: ComboboxEntry; hasPerm = false; + values = { + dummy_title: null, + dummy_author: null, + dummy_isbn: null, + circ_modifier: null + }; + constructor( private perm: PermService, private modal: NgbModal) { @@ -28,8 +35,13 @@ export class PrecatCheckoutDialogComponent extends DialogComponent implements On } ngOnInit() { - this.perm.hasWorkPermHere('CREATE_PRECAT') - .then(perms => this.hasPerm = perms['CREATE_PRECAT']); + this.onOpen$.subscribe(_ => { + this.perm.hasWorkPermHere('CREATE_PRECAT') + .then(perms => this.hasPerm = perms['CREATE_PRECAT']); + + const node = document.getElementById('precat-title-input'); + if (node) { node.focus(); } + }); } } 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 dee1b9949a..2acffcb874 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,14 +13,19 @@ import {AudioService} from '@eg/share/util/audio.service'; // API parameter options export interface CheckoutParams { - due_date?: string; patron_id: number; + due_date?: string; copy_id?: number; copy_barcode?: string; noncat?: boolean; noncat_type?: number; noncat_count?: number; noop?: boolean; + precat?: boolean; + dummy_title?: string; + dummy_author?: string; + dummy_isbn?: string; + circ_modifier?: string; } export interface CheckoutResult {