border-top: 1px solid rgba(0,0,0,.125);
border-bottom: 1px solid rgba(0,0,0,.125);
}
+
+
+.clear-button {
+ border: none;
+ background-color: rgba(0, 0, 0, 0.0);
+ padding-left: .25rem;
+ padding-right: .25rem;
+ line-height: inherit;
+}
+
+.clear-button .material-icons {
+ font-size: 15px;
+ color: grey;
+}
+
+<eg-confirm-dialog
+ #confirmDelVol
+ i18n-dialogTitle i18n-dialogBody
+ dialogTitle="Delete Call Number?"
+ dialogBody="Delete {{deleteVolCount}} Call Number(s) and {{deleteCopyCount}} Associated Item(s)?">
+</eg-confirm-dialog>
<div class="row d-flex vol-row border border-info mb-2">
<div class="p-1" [ngStyle]="{flex: flexAt(1)}">
<ng-container *ngFor="let copyNode of volNode.children; let copyIdx = index">
<div class="row d-flex mt-1" [ngClass]="{'vol-row': copyIdx == 0}">
<div class="p-1" [ngStyle]="{flex: flexAt(1)}">
- <span *ngIf="copyIdx == 0">{{orgNode.target.shortname()}}</span>
+ <ng-container *ngIf="copyIdx == 0">
+ <span>{{orgNode.target.shortname()}}</span>
+ <button class="clear-button" (click)="deleteVol(volNode)"
+ title="Delete Call Number" i18n-title>
+ <span class="material-icons">clear</span>
+ </button>
+ </ng-container>
</div>
<div class="p-1" [ngStyle]="{flex: flexAt(2)}">
<ng-container *ngIf="copyIdx == 0 && volIdx == 0">
(ngModelChange)="barcodeChanged(copyNode.target, $event)"
(keyup.enter)="selectNextBarcode(copyNode.target.id())"
(keyup.shift.enter)="selectNextBarcode(copyNode.target.id(), true)"
+ (focus)="$event.target.select()"
[ngModel]="copyNode.target.barcode()"
(ngModelChange)="applyCopyValue(copyNode.target, 'barcode', $event)"/>
<div *ngIf="copyNode.target._dupe_barcode"
import {VolCopyContext, HoldingsTreeNode} from './volcopy';
import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
import {HoldingsService} from '@eg/staff/share/holdings/holdings.service';
+import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
@Component({
selector: 'eg-vol-edit',
autoId = -1;
+ volsToDelete: IdlObject[] = [];
+ copiesToDelete: IdlObject[] = [];
+ deleteVolCount: number = null;
+ deleteCopyCount: number = null;
+
+ @ViewChild('confirmDelVol', {static: false})
+ confirmDelVol: ConfirmDialogComponent;
+
constructor(
private renderer: Renderer2,
private idl: IdlService,
ngOnInit() {
+ this.volsToDelete = [];
+ this.copiesToDelete = [];
+ this.deleteVolCount = null;
+ this.deleteCopyCount = null;
+
this.fetchRecordVolLabels()
.then(_ => this.fetchBibParts())
.then(_ => this.addStubCopies());
});
}
}
+
+ deleteVol(volNode: HoldingsTreeNode) {
+ this.deleteVolCount = 1;
+ this.deleteCopyCount = volNode.children.length;
+
+ this.confirmDelVol.open().toPromise().then(confirmed => {
+ if (confirmed) { this.deleteOneVol(volNode); }
+ });
+ }
+
+ deleteOneVol(volNode: HoldingsTreeNode) {
+ let deleteVolIdx = null;
+ const targetVol = volNode.target;
+
+ // FOR loops allow for early exit
+ const orgNodes = this.context.orgNodes();
+ for (let orgIdx = 0; orgIdx < orgNodes.length; orgIdx++) {
+ const orgNode = orgNodes[orgIdx];
+
+ for (let volIdx = 0; volIdx < orgNode.children.length; volIdx++) {
+ const vol = orgNode.children[volIdx].target;
+
+ if (vol.id() === targetVol.id()) {
+ deleteVolIdx = volIdx;
+
+ if (vol.isnew()) {
+ // New volumes, which can only have new copies
+ // may simply be removed from the holdings
+ // tree to delete them.
+ break;
+ }
+
+ // Mark volume and attached copies as deleted
+ // and track for later deletion.
+ targetVol.isdeleted(true);
+ this.volsToDelete.push(targetVol);
+
+ volNode.children.forEach(copyNode => {
+ const copy = copyNode.target;
+ if (copy.isnew()) {
+ // New copies can simply be discarded.
+ } else {
+ copy.isdeleted(true);
+ this.copiesToDelete.push(copy);
+ }
+ });
+ }
+
+ if (deleteVolIdx) { break; }
+ }
+
+ if (deleteVolIdx !== null) {
+ orgNode.children.splice(deleteVolIdx, 1);
+ break;
+ }
+ }
+ }
}
<eg-staff-banner bannerText="Holdings Editor" i18n-bannerText></eg-staff-banner>
+<ng-container *ngIf="loading">
+ <div class="row">
+ <div class="col-lg-6 offset-lg-3">
+ <eg-progress-inline #loadingProgress></eg-progress-inline>
+ </div>
+ </div>
+</ng-container>
+
<ng-container *ngIf="!loading">
<eg-bib-summary *ngIf="recordId" [recordId]="recordId"></eg-bib-summary>
import {PcrudService} from '@eg/core/pcrud.service';
import {HoldingsService} from '@eg/staff/share/holdings/holdings.service';
import {VolCopyContext} from './volcopy';
+import {ProgressInlineComponent} from '@eg/share/dialog/progress-inline.component';
const COPY_FLESH = {
flesh: 1,
session: string;
loading = true;
+ @ViewChild('loadingProgress', {static: false})
+ loadingProgress: ProgressInlineComponent;
constructor(
private router: Router,
this.loading = true;
this.context.reset();
this.fetchHoldings()
+ .then(_ => this.loadingProgress.increment())
.then(_ => this.holdings.fetchCallNumberClasses())
+ .then(_ => this.loadingProgress.increment())
.then(_ => this.holdings.fetchCallNumberPrefixes())
+ .then(_ => this.loadingProgress.increment())
.then(_ => this.holdings.fetchCallNumberSuffixes())
+ .then(_ => this.loadingProgress.increment())
.then(_ => this.context.sortHoldings())
+ .then(_ => this.loadingProgress.increment())
.then(_ => this.setRecordId())
+ .then(_ => this.loadingProgress.increment())
.then(_ => this.loading = false);
}