<div class="p-1" [ngStyle]="{flex: flexAt(2)}">
<ng-container *ngIf="copyIdx == 0 && volIdx == 0">
<input type="number" class="form-control form-control-sm"
+ [disabled]="context.sessionType == 'copy' || context.sessionType == 'vol'"
[required]="true" [min]="existingVolCount(orgNode)"
[ngModel]="orgNode.children.length"
(ngModelChange)="volCountChanged(orgNode, $event)"/>
<div class="p-1" [ngStyle]="{flex: flexAt(7)}">
<ng-container *ngIf="copyIdx == 0">
<input type="number" class="form-control form-control-sm"
+ [disabled]="context.sessionType == 'copy'"
[required]="true" [min]="existingCopyCount(volNode)"
[ngModel]="volNode.children.length"
(ngModelChange)="copyCountChanged(volNode, $event)"/>
context: VolCopyContext;
- // Note in multi-record mode this value will be unset.
- recordId: number;
-
- // Load specific call number by ID.
- volId: number;
-
- // Load specific copy by ID.
- copyId: number;
-
- session: string;
loading = true;
@ViewChild('loadingProgress', {static: false})
loadingProgress: ProgressInlineComponent;
}
negotiateRoute(params: ParamMap) {
- this.recordId = +params.get('record_id') || null;
- this.volId = +params.get('vol_id') || null;
- this.copyId = +params.get('copy_id') || null;
- this.session = params.get('session') || null;
+ this.context.recordId = +params.get('record_id') || null;
+ this.context.volId = +params.get('vol_id') || null;
+ this.context.copyId = +params.get('copy_id') || null;
+ this.context.session = params.get('session') || null;
this.load();
}
}
setRecordId() {
- if (!this.recordId) {
+ if (!this.context.recordId) {
const ids = this.context.getRecordIds();
if (ids.length === 1) {
- this.recordId = ids[0];
+ this.context.recordId = ids[0];
}
}
}
fetchHoldings(): Promise<any> {
- if (this.copyId) {
- return this.fetchCopies(this.copyId);
- } else if (this.volId) {
- return this.fetchVols(this.volId);
- } else if (this.recordId) {
- return this.fetchRecords(this.recordId);
+ if (this.context.copyId) {
+ this.context.sessionType = 'copy';
+ return this.fetchCopies(this.context.copyId);
+ } else if (this.context.volId) {
+ this.context.sessionType = 'vol';
+ return this.fetchVols(this.context.volId);
+ } else if (this.context.recordId) {
+ this.context.sessionType = 'record';
+ return this.fetchRecords(this.context.recordId);
+ } else if (this.context.session) {
+ this.context.sessionType = 'mixed';
}
}
holdings: HoldingsTree = new HoldingsTree();
org: OrgService; // injected
+ sessionType: 'copy' | 'vol' | 'record' | 'mixed';
+
+ // Edit content comes from a cached session
+ session: string;
+
+ // Note in multi-record mode this value will be unset.
+ recordId: number;
+
+ // Load specific call number by ID.
+ volId: number;
+
+ // Load specific copy by ID.
+ copyId: number;
+
volsToDelete: IdlObject[] = [];
copiesToDelete: IdlObject[] = [];