2 * Common code for mananging holdings
4 import {Injectable, EventEmitter} from '@angular/core';
5 import {NetService} from '@eg/core/net.service';
6 import {AnonCacheService} from '@eg/share/util/anon-cache.service';
8 interface NewVolumeData {
14 export class HoldingsService {
17 private net: NetService,
18 private anonCache: AnonCacheService
21 // Open the holdings editor UI in a new browser window/tab.
23 recordId: number, // Bib record ID
24 addToVols: number[] = [], // Add copies to existing volumes
25 volumeData: NewVolumeData[] = []) { // Creating new volumes
27 const raw: any[] = [];
30 addToVols.forEach(volId => raw.push({callnumber: volId}));
31 } else if (volumeData) {
32 volumeData.forEach(data => raw.push(data));
35 if (raw.length === 0) { raw.push({}); }
37 this.anonCache.setItem(null, 'edit-these-copies', {
44 console.error('Could not create holds cache key!');
48 const url = `/eg/staff/cat/volcopy/${key}`;
49 window.open(url, '_blank');