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';
7 import {AuthService} from '@eg/core/auth.service';
8 import {EventService} from '@eg/core/event.service';
10 interface NewCallNumData {
18 export class HoldingsService {
21 private net: NetService,
22 private auth: AuthService,
23 private evt: EventService,
24 private anonCache: AnonCacheService
27 // Open the holdings editor UI in a new browser window/tab.
29 recordId: number, // Bib record ID
30 editExistingCallNums?: number[], // Add copies to / modify existing CNs
31 newCallNumData?: NewCallNumData[], // Creating new call numbers
32 editCopyIds?: number[], // Edit existing items
33 hideCopies?: boolean, // Hide the copy edit pane
36 const raw: any[] = [];
38 if (editExistingCallNums) {
39 editExistingCallNums.forEach(
40 callNumId => raw.push({callnumber: callNumId}));
41 } else if (newCallNumData) {
42 newCallNumData.forEach(data => raw.push(data));
45 this.anonCache.setItem(null, 'edit-these-copies', {
49 hide_vols : hideVols === true,
50 hide_copies : hideCopies === true
53 console.error('Could not create holds cache key!');
57 const url = `/eg/staff/cat/volcopy/${key}`;
58 window.open(url, '_blank');