<!-- TODO: status is batch editable under certain conditions -->
<div class="mb-1" *ngIf="displayAttr('status')">
- <eg-batch-item-attr label="Status" i18n-label [readOnly]="true"
+ <eg-batch-item-attr label="Status" i18n-label
+ [readOnly]="!statusEditable()"
[labelCounts]="itemAttrCounts('status')">
</eg-batch-item-attr>
</div>
const def = this.idl.classes.acp.field_map[field];
return def ? def.label : '';
}
+
+ // Returns false if any items are in magic statuses
+ statusEditable(): boolean {
+ const copies = this.context.copyList();
+ for (let idx = 0; idx < copies.length; idx++) {
+ if (this.volcopy.copyStatIsMagic(copies[idx].status())) {
+ return false;
+ }
+ }
+ return true;
+ }
}
title="{{copyStatLabel(copyNode.target)}}"
id="barcode-input-{{copyNode.target.id()}}"
spellcheck="false" [required]="true"
+ [disabled]="volcopy.copyStatIsMagic(copyNode.target.status())"
[ngClass]="{'text-danger': copyNode.target._dupe_barcode}"
(change)="barcodeChanged(copyNode.target, $event.target.value)"
(ngModelChange)="copyNode.target.barcode($event)"
templates: any = {};
commonData: {[key: string]: IdlObject[]} = {};
+ magicCopyStats: number[] = [];
constructor(
private evt: EventService,
'eg.cat.record.summary.collapse'
]))
+ .then(_ => this.holdings.getMagicCopyStatuses())
+ .then(stats => this.magicCopyStats = stats)
.then(_ => this.fetchDefaults())
.then(_ => this.fetchTemplates());
}
-
ingestCommonData() {
this.commonData.acp_location.forEach(
);
}
+
+ copyStatIsMagic(id: number): boolean {
+ return this.magicCopyStats.includes(id);
+ }
}
});
});
}
+
+ /* TODO: make these more configurable per lp1616170 */
+ getMagicCopyStatuses(): Promise<number[]> {
+ return Promise.resolve([
+ 1, // Checked out
+ 3, // Lost
+ 6, // In transit
+ 8, // On holds shelf
+ 16, // Long overdue
+ 18 // Canceled Transit
+ ]);
+ }
}