From 6d45ca718b63ea8d4a29e8020638be8452f0bec2 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 2 Jul 2020 12:43:25 -0400 Subject: [PATCH] LPXXX Angular Volcopy Signed-off-by: Bill Erickson --- .../eg2/src/app/staff/cat/volcopy/copy-attrs.component.html | 3 ++- .../eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts | 11 +++++++++++ .../eg2/src/app/staff/cat/volcopy/vol-edit.component.html | 1 + .../src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts | 8 +++++++- .../src/eg2/src/app/staff/share/holdings/holdings.service.ts | 12 ++++++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html index bede5f58c2..08af143944 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.html @@ -74,7 +74,8 @@
-
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts index 2097f003d7..cf4e98ac6c 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts @@ -546,6 +546,17 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { const def = this.idl.classes.acp.field_map[field]; return def ? def.label : ''; } + + // Returns false if any items are in magic statuses + statusEditable(): boolean { + const copies = this.context.copyList(); + for (let idx = 0; idx < copies.length; idx++) { + if (this.volcopy.copyStatIsMagic(copies[idx].status())) { + return false; + } + } + return true; + } } diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html index 97895ae2ae..b62f280dbf 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.html @@ -221,6 +221,7 @@ title="{{copyStatLabel(copyNode.target)}}" id="barcode-input-{{copyNode.target.id()}}" spellcheck="false" [required]="true" + [disabled]="volcopy.copyStatIsMagic(copyNode.target.status())" [ngClass]="{'text-danger': copyNode.target._dupe_barcode}" (change)="barcodeChanged(copyNode.target, $event.target.value)" (ngModelChange)="copyNode.target.barcode($event)" diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts index ba20dc96d9..8711740e0c 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.service.ts @@ -45,6 +45,7 @@ export class VolCopyService { templates: any = {}; commonData: {[key: string]: IdlObject[]} = {}; + magicCopyStats: number[] = []; constructor( private evt: EventService, @@ -81,11 +82,12 @@ export class VolCopyService { 'eg.cat.record.summary.collapse' ])) + .then(_ => this.holdings.getMagicCopyStatuses()) + .then(stats => this.magicCopyStats = stats) .then(_ => this.fetchDefaults()) .then(_ => this.fetchTemplates()); } - ingestCommonData() { this.commonData.acp_location.forEach( @@ -410,5 +412,9 @@ export class VolCopyService { ); } + + copyStatIsMagic(id: number): boolean { + return this.magicCopyStats.includes(id); + } } diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts index 9c2b4a5422..e86c44cbfd 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/holdings.service.ts @@ -64,5 +64,17 @@ export class HoldingsService { }); }); } + + /* TODO: make these more configurable per lp1616170 */ + getMagicCopyStatuses(): Promise { + return Promise.resolve([ + 1, // Checked out + 3, // Lost + 6, // In transit + 8, // On holds shelf + 16, // Long overdue + 18 // Canceled Transit + ]); + } } -- 2.11.0