From 926dfe49765eba6f17d9be8125d95c6c64dfb250 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 17 Jun 2020 11:48:45 -0400 Subject: [PATCH] LPXXX Angular Volcopy Signed-off-by: Bill Erickson --- .../staff/cat/volcopy/copy-attrs.component.html | 94 +++++++++++++++++++--- .../app/staff/cat/volcopy/copy-attrs.component.ts | 80 ++++++++++++------ .../app/staff/cat/volcopy/volcopy.component.html | 4 + 3 files changed, 145 insertions(+), 33 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 c834bf82a1..009d198860 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 @@ -7,11 +7,11 @@
-

Identification

-

Location

-

Circulation

-

Miscellaneous

-

Statistics

+

Identification

+

Location

+

Circulation

+

Miscellaneous

+

Statistics

@@ -29,7 +29,7 @@
@@ -75,26 +75,102 @@
- - +
+
+ + + + + + + +
+ +
+ + + + + + + +
+ +
+ + + + + + +
+
+
+ +
+ + + + + +
+ +
+ + + + + +
+ +
+
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 5b8e12281e..52ce3a1926 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 @@ -20,7 +20,12 @@ export class CopyAttrsComponent implements OnInit { @Input() context: VolCopyContext; - batchLocation: any; + location: IdlObject; + circLib: number; + owningLib: number; + copyNumber: number; + circulate: string; + holdable: string; constructor( private router: Router, @@ -45,28 +50,7 @@ export class CopyAttrsComponent implements OnInit { const counts = {}; this.context.copyList().forEach(copy => { - let value = copy[field](); - if (value === undefined || value === null) { value = ''; } - - if (value !== '') { - - if (field === 'status') { - if (value in this.volcopy.copyStatuses) { - value = this.volcopy.copyStatuses[value].name(); - } - - } else if (field === 'location') { - value = value.name(); - - } else if (field.match(/date/)) { - value = this.format.transform({ - datatype: 'timestamp', - value: value - }); - } else if (field === 'creator' || field === 'editor') { - value = value.usrname(); - } - } + const value = this.getFieldDisplayValue(field, copy); if (counts[value] === undefined) { counts[value] = 0; @@ -77,7 +61,46 @@ export class CopyAttrsComponent implements OnInit { return counts; } + getFieldDisplayValue(field: string, copy: IdlObject): string { + + // Some fields don't live directly on the copy. + if (field === 'owning_lib') { + return this.org.get( + copy.call_number().owning_lib()).shortname() + + ' : ' + copy.call_number().label(); + } + + let value = copy[field](); + + if (!value && value !== 0) { return ''; } + + switch(field) { + + case 'status': + return this.volcopy.copyStatuses[value].name(); + + case 'location': + return value.name(); + + case 'edit_date': + case 'create_date': + case 'active_date': + return this.format.transform( + {datatype: 'timestamp', value: value}); + + case 'editor': + case 'creator': + return value.usrname(); + + case 'circ_lib': + return this.org.get(value).shortname(); + } + + return value; + } + applyCopyValue(field: string, value: any) { + console.log('APPLYING', field, value); this.context.copyList().forEach(copy => { if (copy[field] && copy[field]() !== value) { copy[field](value); @@ -87,7 +110,16 @@ export class CopyAttrsComponent implements OnInit { } locationChanged() { - this.applyCopyValue('location', this.batchLocation); + this.applyCopyValue('location', this.location); + } + + circLibChanged() { + this.applyCopyValue('circ_lib', this.circLib); + } + + owningLibChanged() { + // TODO + console.log('OWNING LIB ', this.owningLib); } } diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.html b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.html index 086edc9ccb..156540f789 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.html @@ -20,6 +20,10 @@ + +
+
+
-- 2.11.0