import {AnonCacheService} from '@eg/share/util/anon-cache.service';
import {VolCopyService} from './volcopy.service';
import {NgbNav, NgbNavChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {BroadcastService} from '@eg/share/util/broadcast.service';
const COPY_FLESH = {
flesh: 1,
private auth: AuthService,
private pcrud: PcrudService,
private cache: AnonCacheService,
+ private broadcaster: BroadcastService,
private holdings: HoldingsService,
private volcopy: VolCopyService
) { }
}).then(_ => this.loading = false);
}
+ broadcastChanges(volumes: IdlObject[]) {
+
+ const volIds = volumes.map(v => v.id());
+ const copyIds = [];
+ const recIds = [];
+
+ volumes.forEach(vol => {
+ if (!recIds.includes(vol.record())) {
+ recIds.push(vol.record());
+ }
+ vol.copies().forEach(copy => copyIds.push(copy.id()));
+ });
+
+ this.broadcaster.broadcast('eg.holdings.update', {
+ copies : copyIds,
+ volumes: volIds,
+ records: recIds
+ });
+ }
+
saveApi(volumes: IdlObject[], override?:
boolean, close?: boolean): Promise<number[]> {
return Promise.reject();
}
+ this.broadcastChanges(volumes);
+
return copyIds;
});
}