From: Bill Erickson Date: Wed, 20 Mar 2019 21:10:04 +0000 (-0400) Subject: lpxxx Angular holdings maintenance wip X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a0f0a9517f2ec14383d5877a353a4d6ef4a3ecc0;p=working%2FEvergreen.git lpxxx Angular holdings maintenance wip Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html index 25938bc036..ba20df3475 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html @@ -77,7 +77,24 @@ i18n-label label="Print Labels" (onClick)="openItemPrintLabels($event)"> - + + + + + + + + + + + + - + Number(c.id())); } + selectedVolumeIds(rows: HoldingsEntry[]): number[] { + return rows + .filter(r => r.treeNode.nodeType === 'volume') + .map(r => Number(r.volume.id())); + } + async showMarkDamagedDialog(rows: HoldingsEntry[]) { const copyIds = this.selectedCopyIds(rows, 14 /* ignore damaged */); @@ -672,4 +682,45 @@ export class HoldingsMaintenanceComponent implements OnInit { this.anonCache.setItem(null, 'print-labels-these-copies', {copies: ids}) .then(key => this.openAngJsWindow(`cat/printlabels/${key}`)); } + + openVolCopyEdit(rows: HoldingsEntry[], addVols: boolean, addCopies: boolean) { + + // The user may select a set of volumes by selecting volume and/or + // copy rows. + const volumes = []; + rows.forEach(r => { + if (r.treeNode.nodeType === 'volume') { + volumes.push(r.volume); + } else if (r.treeNode.nodeType === 'copy') { + volumes.push(r.treeNode.parentNode.target); + } + }); + + if (addCopies && !addVols) { + // Adding copies to an existing set of volumes. + if (volumes.length > 0) { + const volIds = volumes.map(v => Number(v.id())); + this.holdings.spawnAddHoldingsUi(this.recordId, volIds); + } + + } else if (addVols) { + const entries = []; + + if (volumes.length > 0) { + + // When adding volumes, if any are selected in the grid, + // create volumes that have the same label and owner. + volumes.forEach(v => + entries.push({label: v.label(), owner: v.owning_lib()})); + + } else { + + // Otherwise create new volumes from scratch. + entries.push({owner: this.auth.user().ws_ou()}) + } + + this.holdings.spawnAddHoldingsUi( + this.recordId, null, entries, !addCopies); + } + } } 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 4b28f70369..964ccf14ad 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 @@ -24,9 +24,10 @@ export class HoldingsService { // Open the holdings editor UI in a new browser window/tab. spawnAddHoldingsUi( - recordId: number, // Bib record ID - addToVols: number[] = [], // Add copies to existing volumes - volumeData: NewVolumeData[] = []) { // Creating new volumes + recordId: number, // Bib record ID + addToVols?: number[], // Add copies to existing volumes + volumeData?: NewVolumeData[], // Creating new volumes + hideCopies?: boolean) { // Hide the copy edit pane const raw: any[] = []; @@ -42,7 +43,7 @@ export class HoldingsService { record_id: recordId, raw: raw, hide_vols : false, - hide_copies : false + hide_copies : hideCopies ? true : false }).then(key => { if (!key) { console.error('Could not create holds cache key!');