From: Bill Erickson Date: Wed, 17 Jun 2020 16:22:36 +0000 (-0400) Subject: LPXXX Angular Volcopy X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e5b14f51cf30077cbc384e09996799e80e22a9f9;p=working%2FEvergreen.git LPXXX Angular Volcopy Signed-off-by: Bill Erickson --- 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 009d198860..7db5a1c0b6 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 @@ -21,49 +21,49 @@
-
-
-
-
-
-
- @@ -76,107 +76,123 @@
- - + (changesSaved)="applyCopyValue('location', values['location'])">
- - + (changesSaved)="circLibChanged()">
- - + (changesSaved)="owningLibChanged()">
- + - + (changesSaved)="applyCopyValue('copy_number', values['copy_number'])">
-
+
- - + + - + (changesSaved)="applyCopyValue('circulate', + values['circulate'] === 'yes' ? 't': 'f')">
- - + + - + (changesSaved)="applyCopyValue('holdable', + values['holdable'] === 'yes' ? 't': 'f')">
+
+ + + + + +
-
+
-
+
-
+ 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 52ce3a1926..1f4a00bc51 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,12 +20,11 @@ export class CopyAttrsComponent implements OnInit { @Input() context: VolCopyContext; - location: IdlObject; - circLib: number; - owningLib: number; - copyNumber: number; - circulate: string; - holdable: string; + // Batch values applied from the form. + // Some values are scalar, some IdlObjects depending on copy fleshyness. + values: {[field: string]: any} = {}; + + ageProtectRules: IdlObject[] = []; constructor( private router: Router, @@ -42,8 +41,14 @@ export class CopyAttrsComponent implements OnInit { private format: FormatService ) { } - ngOnInit() { + + this.pcrud.retrieveAll('crahp').subscribe( + rule => this.ageProtectRules.push(rule), + err => {}, + () => this.ageProtectRules = this.ageProtectRules.sort( + (a, b) => a.name() < b.name() ? -1 : 1) + ); } itemAttrCounts(field: string): {[value: string]: number} { @@ -94,6 +99,11 @@ export class CopyAttrsComponent implements OnInit { case 'circ_lib': return this.org.get(value).shortname(); + + case 'age_protect': + const rule = this.ageProtectRules.filter( + r => r.id() === Number(value))[0]; + return rule ? rule.name() : ''; } return value; @@ -110,16 +120,16 @@ export class CopyAttrsComponent implements OnInit { } locationChanged() { - this.applyCopyValue('location', this.location); + this.applyCopyValue('location', this.values['location']); } circLibChanged() { - this.applyCopyValue('circ_lib', this.circLib); + this.applyCopyValue('circ_lib', this.values['circ_lib']); } owningLibChanged() { // TODO - console.log('OWNING LIB ', this.owningLib); + console.log('OWNING LIB ', this.values['owning_lib']); } }