From: Bill Erickson Date: Wed, 23 Sep 2020 15:45:42 +0000 (-0400) Subject: LP1865898 Missing pieces mult-scan work flow improvements X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7caf8f07ab8170a46db16b09b3636d7341f9f389;p=working%2FEvergreen.git LP1865898 Missing pieces mult-scan work flow improvements After an item is marked as missing pieces, select/focus the barcode input so another item can easily be marked as missing pieces without having to manually clear the form / reload the page. Tweaks the "Cancel" button to use the text "Reset Form" once the current item has been processed, since it can no longer be canceled, but the form can be forceably cleared if desired. Signed-off-by: Bill Erickson Signed-off-by: Mike Risher Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/missing-pieces.component.html b/Open-ILS/src/eg2/src/app/staff/cat/item/missing-pieces.component.html index 2d09622219..b19e0d78a7 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/missing-pieces.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/missing-pieces.component.html @@ -37,8 +37,9 @@ - diff --git a/Open-ILS/src/eg2/src/app/staff/cat/item/missing-pieces.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/item/missing-pieces.component.ts index 638db28de8..01d0757e46 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/item/missing-pieces.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/item/missing-pieces.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, AfterViewInit, ViewChild, Renderer2} from '@angular/core'; +import {Component, Input, AfterViewInit, ViewChild} from '@angular/core'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import {IdlObject} from '@eg/core/idl.service'; import {PcrudService} from '@eg/core/pcrud.service'; @@ -21,13 +21,13 @@ export class MarkItemMissingPiecesComponent implements AfterViewInit { circNotFound = false; processing = false; noSuchItem = false; + itemProcessed = false; @ViewChild('penaltyDialog', {static: false}) penaltyDialog: PatronPenaltyDialogComponent; constructor( private route: ActivatedRoute, - private renderer: Renderer2, private net: NetService, private printer: PrintService, private pcrud: PcrudService, @@ -40,7 +40,7 @@ export class MarkItemMissingPiecesComponent implements AfterViewInit { ngAfterViewInit() { if (this.itemId) { this.getItemById(); } - this.renderer.selectRootElement('#item-barcode-input').focus(); + this.selectInput(); } getItemByBarcode(): Promise { @@ -49,6 +49,11 @@ export class MarkItemMissingPiecesComponent implements AfterViewInit { if (!this.itemBarcode) { return Promise.resolve(); } + // Submitting a new barcode resets the form. + const bc = this.itemBarcode; + this.reset(); + this.itemBarcode = bc; + return this.holdings.getItemIdFromBarcode(this.itemBarcode) .then(id => { this.noSuchItem = (id === null); @@ -58,8 +63,11 @@ export class MarkItemMissingPiecesComponent implements AfterViewInit { } selectInput() { - setTimeout(() => - this.renderer.selectRootElement('#item-barcode-input').select()); + setTimeout(() => { + const node: HTMLInputElement = + document.getElementById('item-barcode-input') as HTMLInputElement; + if (node) { node.select(); } + }); } getItemById(): Promise { @@ -101,12 +109,15 @@ export class MarkItemMissingPiecesComponent implements AfterViewInit { reset() { this.item = null; this.itemId = null; + this.letter = null; this.itemBarcode = null; this.circNotFound = false; + this.itemProcessed = false; } processItem() { this.circNotFound = false; + this.itemProcessed = false; if (!this.item) { return; } @@ -119,9 +130,11 @@ export class MarkItemMissingPiecesComponent implements AfterViewInit { ).subscribe(resp => { const evt = this.evt.parse(resp); // always returns event this.processing = false; + this.itemProcessed = true; if (evt.textcode === 'ACTION_CIRCULATION_NOT_FOUND') { this.circNotFound = true; + this.selectInput(); return; } @@ -142,7 +155,12 @@ export class MarkItemMissingPiecesComponent implements AfterViewInit { if (payload.circ) { this.penaltyDialog.patronId = payload.circ.usr(); this.penaltyDialog.open().subscribe( - penId => console.debug('Applied penalty ', penId)); + penId => console.debug('Applied penalty ', penId), + err => {}, + () => this.selectInput() + ); + } else { + this.selectInput(); } }); }