1 import {Component, OnInit, Input} from '@angular/core';
2 import {Router} from '@angular/router';
3 import {StoreService} from '@eg/core/store.service';
4 import {CatalogService} from '@eg/share/catalog/catalog.service';
5 import {CatalogSearchContext} from '@eg/share/catalog/search-context';
6 import {CatalogUrlService} from '@eg/share/catalog/catalog-url.service';
7 import {StaffCatalogService} from '../catalog.service';
8 import {StringService} from '@eg/share/string/string.service';
9 import {ToastService} from '@eg/share/toast/toast.service';
10 import {HoldingsService} from '@eg/staff/share/holdings.service';
13 selector: 'eg-catalog-record-actions',
14 templateUrl: 'actions.component.html'
16 export class RecordActionsComponent implements OnInit {
20 searchContext: CatalogSearchContext;
24 key: 'eg.cat.marked_conjoined_record',
28 key: 'eg.cat.marked_overlay_record',
32 key: 'eg.circ.hold.title_transfer_target',
36 key: 'eg.cat.marked_volume_transfer_record',
41 @Input() set recordId(recId: number) {
44 // Fire any record specific actions here
49 private router: Router,
50 private store: StoreService,
51 private strings: StringService,
52 private toast: ToastService,
53 private cat: CatalogService,
54 private catUrl: CatalogUrlService,
55 private staffCat: StaffCatalogService,
56 private holdings: HoldingsService
62 Object.keys(this.targets).forEach(name => {
63 const target = this.targets[name];
64 target.current = this.store.getLocalItem(target.key);
69 const target = this.targets[name];
70 target.current = this.recId;
71 this.store.setLocalItem(target.key, this.recId);
72 this.strings.interpolate('catalog.record.toast.' + name)
73 .then(txt => this.toast.success(txt));
77 Object.keys(this.targets).forEach(name => {
78 const target = this.targets[name];
79 target.current = null;
80 this.store.removeLocalItem(target.key);
82 this.strings.interpolate('catalog.record.toast.cleared')
83 .then(txt => this.toast.success(txt));
86 // TODO: Support adding copies to existing volumes by getting
87 // selected volumes from the holdings grid.
88 // TODO: Support adding like volumes by getting selected
89 // volumes from the holdings grid.
91 this.holdings.spawnAddHoldingsUi(this.recId);