From: Bill Erickson Date: Thu, 4 Jun 2020 22:21:50 +0000 (-0400) Subject: LPXXX Angular Volcopy X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=faceabef86cbf9c351d34018ba82213c4fc45c27;p=working%2FEvergreen.git LPXXX Angular Volcopy Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.css b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.css new file mode 100644 index 0000000000..bfbc3efa95 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.css @@ -0,0 +1,4 @@ + +input[type="number"] { + width: 5em; +} 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 664d2e17bc..4ff4529942 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 @@ -1,5 +1,5 @@ -
+
BATCH
@@ -47,6 +47,7 @@
@@ -54,20 +55,27 @@
+ (onChange)="applyVolValue(volNode.target, 'label_class', $event)"> + +
- + (onChange)="applyVolValue(volNode.target, 'prefix', $event)"> + + @@ -75,19 +83,60 @@
+ + +
+ + + + + + + +
+ + +
+
+
+ + + +
- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts index a39f5f43e9..684b5a90cf 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/vol-edit.component.ts @@ -9,7 +9,8 @@ import {HoldingsService} from '@eg/staff/share/holdings/holdings.service'; @Component({ selector: 'eg-vol-edit', - templateUrl: 'vol-edit.component.html' + templateUrl: 'vol-edit.component.html', + styleUrls: ['vol-edit.component.css'] }) @@ -27,13 +28,17 @@ export class VolEditComponent implements OnInit { volClasses: IdlObject[] = null; volPrefixes: IdlObject[] = null; volSuffixes: IdlObject[] = null; + bibParts: {[bibId: number]: IdlObject[]} = {}; constructor( + private pcrud: PcrudService, private holdings: HoldingsService ) {} ngOnInit() { + this.fetchBibParts(); + // TODO: Filter these to only show org-scoped values // plus any values otherwise needed for the current // holdings tree. @@ -49,12 +54,44 @@ export class VolEditComponent implements OnInit { this.volSuffixes = suffixes.filter(pfx => pfx.id() !== -1)); } + fetchBibParts() { + + this.context.orgNodes().forEach(orgNode => { + orgNode.children.forEach(volNode => + this.bibParts[volNode.target.record()] = [] + ); + }); + + this.pcrud.search('bmp', + {record: Object.keys(this.bibParts), deleted: 'f'}) + .subscribe( + part => { + if (!this.bibParts[part.record()]) { + this.bibParts[part.record()] = []; + } + this.bibParts[part.record()].push(part); + }, + err => {}, + () => { + Object.keys(this.bibParts).forEach(bibId => { + this.bibParts[bibId] = this.bibParts[bibId] + .sort((p1, p2) => + p1.label_sortkey() < p2.label_sortkey() ? -1 : 1) + }); + } + ); + } + flexAt(column: number): number { return this.flexSettings[column]; } - volCountChanged(orgNode: HoldingsTreeNode, value: number) { - console.log('vol set set to ', value); + volCountChanged(orgNode: HoldingsTreeNode, count: number) { + console.log('vol set set to ', count); + } + + copyCountChanged(volNode: HoldingsTreeNode, count: number) { + console.log('vol set set to ', count); } applyVolValue(vol: IdlObject, key: string, value: any) { @@ -64,19 +101,15 @@ export class VolEditComponent implements OnInit { } } - volClassChanged(volNode: HoldingsTreeNode, entry: ComboboxEntry) { - if (!entry) { return; } - this.applyVolValue(volNode.target, 'label_class', entry.id); - } - - volPrefixChanged(volNode: HoldingsTreeNode, entry: ComboboxEntry) { - if (!entry) { return; } - this.applyVolValue(volNode.target, 'prefix', entry.id); + applyCopyValue(copy: IdlObject, key: string, value: any) { + if (copy[key]() !== value) { + copy[key](value); + copy.ischanged(true); + } } - volSuffixChanged(volNode: HoldingsTreeNode, entry: ComboboxEntry) { - if (!entry) { return; } - this.applyVolValue(volNode.target, 'suffix', entry.id); + copyPartChanged(copyNode: HoldingsTreeNode, entry: ComboboxEntry) { + // TODO } } 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 696406b0c6..623075ffe1 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 @@ -9,7 +9,7 @@ import {VolCopyContext} from './volcopy'; const copy_FLESH = { flesh: 1, flesh_fields: { - acp: ['call_number', 'location'] + acp: ['call_number', 'location', 'parts'] } } @@ -19,8 +19,13 @@ const copy_FLESH = { export class VolCopyComponent implements OnInit { context: VolCopyContext; + + // Note in multi-record mode this value will be unset. recordId: number; + + // Load the editor for a specific copy by ID. copyId: number; + session: string; loading = true; @@ -70,6 +75,7 @@ export class VolCopyComponent implements OnInit { } } + fetchCopy(): Promise { return this.pcrud.retrieve('acp', this.copyId, copy_FLESH) .toPromise().then(copy => { 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 7597020caf..b4f6e27221 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 @@ -82,7 +82,6 @@ export class HoldingsService { // Returns a sorted list of call number prefixes fetchCallNumberPrefixes(): Promise { if (this.callNumberPrefixes) { - console.log('H2', this.callNumberPrefixes); return Promise.resolve(this.callNumberPrefixes); } @@ -108,6 +107,5 @@ export class HoldingsService { return this.callNumberSuffixes; }); } - }