}
broadcast(key: string, value: any) {
- if (typeof BroadcastChannel === 'undefined') { return; }
+ if (typeof BroadcastChannel === 'undefined') { return; }
if (this.subscriptions[key]) {
this.subscriptions[key].channel.postMessage(value);
}
close(key: string) {
- if (typeof BroadcastChannel === 'undefined') { return; }
+ if (typeof BroadcastChannel === 'undefined') { return; }
if (this.subscriptions[key]) {
this.subscriptions[key].channel.close();
<div class="col-lg-1 font-weight-bold" i18n>Templates:</div>
<div class="col-lg-4">
<eg-combobox #copyTemplateCbox domId="template-select"
- [allowFreeText]="true" [entries]="volcopy.templateNames"
- [(ngModel)]="currentTemplate">
+ [allowFreeText]="true" [entries]="volcopy.templateNames">
</eg-combobox>
</div>
<div class="col-lg-7 d-flex">
const orgs = this.org.descendants(this.statCatFilter, true);
return this.volcopy.commonData.acp_stat_cat.filter(
- sc => orgs.includes(sc.owner()))
+ sc => orgs.includes(sc.owner()));
} else {
owningLibChanged(orgId: number) {
if (!orgId) { return; }
- let promise = Promise.resolve();
-
// Map existing vol IDs to their replacments.
const newVols: any = {};
// volume at the server, since other items could be attached
// of which this instance of the editor is not aware.
Object.keys(newVols).forEach(volId => {
+
const volNode = this.context.volNodes().filter(
- volNode => volNode.target.id() === +volId)[0];
+ node => node.target.id() === +volId)[0];
if (volNode && volNode.children.length === 0) {
this.context.removeVolNode(+volId);
this.context.copyList().forEach(copy => {
if (copy.tags().filter(
- map => map.tag().id() === tag.id()).length > 0) {
+ m => m.tag().id() === tag.id()).length > 0) {
return; // map already exists
}
this.batchAttrs.forEach(comp => {
if (!comp.hasChanged) { return; }
- const name = comp.name;
- const value = this.values[name];
+ const field = comp.name;
+ const value = this.values[field];
if (value === null) {
- delete template[name];
+ delete template[field];
return;
}
- if (name.match(/stat_cat_/)) {
- const statId = name.match(/stat_cat_(\d+)/)[1];
+ if (field.match(/stat_cat_/)) {
+ const statId = field.match(/stat_cat_(\d+)/)[1];
if (!template.statcats) { template.statcats = {}; }
template.statcats[statId] = value;
// Some values are fleshed. this assumes fleshed objects
// have an 'id' value, which is true so far.
- template[name] =
+ template[field] =
typeof value === 'object' ? value.id() : value;
}
});
<div class="p-1" [ngStyle]="{flex: flexAt(5)}">
<div><label class="font-weight-bold" i18n>Call Number Label</label></div>
<div>
- <eg-combobox [smallFormControl]="true" [(ngModel)]="batchVolLabel">
- <eg-combobox-entry *ngFor="let label of recordVolLabels" [entryId]="label">
+ <eg-combobox [smallFormControl]="true"
+ [allowFreeText]="true" [(ngModel)]="batchVolLabel">
+ <eg-combobox-entry *ngFor="let label of recordVolLabels"
+ [entryId]="label" [entryLabel]="label">
</eg-combobox-entry>
</eg-combobox>
</div>
copyPartChanged(copyNode: HoldingsTreeNode, entry: ComboboxEntry) {
const copy = copyNode.target;
- let part = copyNode.target.parts()[0];
+ const part = copyNode.target.parts()[0];
if (entry) {
this.applyVolValue(vol, 'suffix', this.batchVolSuffix.id);
}
if (this.batchVolLabel) {
- this.applyVolValue(vol, 'label', this.batchVolLabel.id);
+ // Use label; could be freetext.
+ this.applyVolValue(vol, 'label', this.batchVolLabel.label);
}
});
}
interface VolCopyDefaults {
- values: {[field: string]: any},
- hidden: {[field: string]: boolean}
+ values: {[field: string]: any};
+ hidden: {[field: string]: boolean};
}
@Injectable()
);
}
- openItemTags(rows: HoldingsEntry[], mode: string) {
+ openItemTags(rows: HoldingsEntry[]) {
const copyIds = this.selectedCopyIds(rows);
if (copyIds.length === 0) { return; }
this.copies.forEach(copy => {
if (copy.tags() && copy.tags().filter(
- map => map.tag().id() === tag.id()).length > 0) {
+ m => m.tag().id() === tag.id()).length > 0) {
return; // map already exists
}
promise = promise.then(_ => {
- const map = this.idl.create('acptcm');
- map.isnew(true);
- map.copy(copy.id());
- map.tag(tag.id());
- return this.pcrud.create(map).toPromise();
+ const tagMap = this.idl.create('acptcm');
+ tagMap.isnew(true);
+ tagMap.copy(copy.id());
+ tagMap.tag(tag.id());
+ return this.pcrud.create(tagMap).toPromise();
});
- })
+ });
});
promise.then(_ => {