From 4e29bdeed270c5f2ffdd8be296e5a1647f162d41 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 16 Jun 2020 17:48:25 -0400 Subject: [PATCH] LPXXX Angular Volcopy Signed-off-by: Bill Erickson --- .../staff/cat/volcopy/copy-attrs.component.html | 154 +++++++++++++++++++++ .../app/staff/cat/volcopy/copy-attrs.component.ts | 42 +++++- .../app/staff/cat/volcopy/volcopy.component.html | 5 +- .../src/app/staff/cat/volcopy/volcopy.component.ts | 2 +- .../share/holdings/batch-item-attr.component.html | 2 +- .../share/holdings/batch-item-attr.component.ts | 9 ++ 6 files changed, 207 insertions(+), 7 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 139597f9cb..253b3bce08 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 @@ -1,2 +1,156 @@ +
+ +
+ +
+

Identification

+

Location

+

Circulation

+

Miscellaneous

+

Statistics

+
+ + + + + + + + + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+
+ + + +
+
+ + +
+
+
+
+
+
+
+
+
+
+ + + +
+
+ + +
+
+
+
+
+
+
+
+
+
+ + + +
+
+ + +
+
+
+
+
+
+
+
+
+
+ + + +
+
+ + +
+
+
+
+
+
+
+
+
+
+ + + +
+
+ + +
+
+
+
+
+
+
+
+
+
+ +
+
+ + +
+
+
+
+
+
+
+
+
+
+ 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 f32b4d34c9..9ef3b05820 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 @@ -1,4 +1,4 @@ -import {Component, OnInit, AfterViewInit, ViewChild, Renderer2} from '@angular/core'; +import {Component, Input, OnInit, AfterViewInit, ViewChild, Renderer2} from '@angular/core'; import {Router, ActivatedRoute, ParamMap} from '@angular/router'; import {tap} from 'rxjs/operators'; import {IdlObject, IdlService} from '@eg/core/idl.service'; @@ -10,14 +10,15 @@ import {PcrudService} from '@eg/core/pcrud.service'; import {HoldingsService} from '@eg/staff/share/holdings/holdings.service'; import {VolCopyContext} from './volcopy'; import {VolCopyService} from './volcopy.service'; - - +import {FormatService} from '@eg/core/format.service'; @Component({ + selector: 'eg-copy-attrs', templateUrl: 'copy-attrs.component.html' }) export class CopyAttrsComponent implements OnInit { + @Input() context: VolCopyContext; constructor( private router: Router, @@ -30,13 +31,46 @@ export class CopyAttrsComponent implements OnInit { private auth: AuthService, private pcrud: PcrudService, private holdings: HoldingsService, - private volcopy: VolCopyService + private volcopy: VolCopyService, + private format: FormatService ) { } ngOnInit() { } + itemAttrCounts(field: string): {[value: string]: number} { + + 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.match(/date/)) { + value = this.format.transform({ + datatype: 'timestamp', + value: value + }); + } else if (field === 'creator' || field === 'editor') { + value = value.usrname(); + } + } + + if (counts[value] === undefined) { + counts[value] = 0; + }; + counts[value]++; + }); + + return counts; + } } 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 7eec4801c7..086edc9ccb 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 @@ -16,10 +16,13 @@ -
+
+
+ +
diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts index 6b2470463a..5932ffb81a 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts @@ -16,7 +16,7 @@ import {VolCopyService} from './volcopy.service'; const COPY_FLESH = { flesh: 1, flesh_fields: { - acp: ['call_number', 'location', 'parts'] + acp: ['call_number', 'location', 'parts', 'creator', 'editor'] } }; diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.html b/Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.html index 64fd34d251..1d673b4f96 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.html @@ -2,7 +2,7 @@
{{label}}
+ [ngClass]="{'bg-info': hasChanged}" (click)="toggleEditMode()">
diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.ts index dc3be46b29..46b8958306 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/batch-item-attr.component.ts @@ -30,6 +30,9 @@ export class BatchItemAttrComponent { // human friendly. @Input() displayAs: 'bool' | 'currency' = null; + // Display only + @Input() readOnly = false; + @Output() changesSaved: EventEmitter = new EventEmitter(); @Output() changesCanceled: EventEmitter = new EventEmitter(); @@ -50,6 +53,12 @@ export class BatchItemAttrComponent { this.editing = false; this.changesCanceled.emit(); } + + toggleEditMode() { + if (!this.readOnly) { + this.editing = !this.editing; + } + } } -- 2.11.0