import {EventService} from '@eg/core/event.service';
interface NewCallNumData {
- owner: number;
+ owner?: number;
label?: string;
+ fast_add?: boolean;
+ barcode?: string;
}
@Injectable()
// Open the holdings editor UI in a new browser window/tab.
spawnAddHoldingsUi(
recordId: number, // Bib record ID
- addToCallNums?: number[], // Add copies to / modify existing CNs
- callNumData?: NewCallNumData[], // Creating new call numbers
+ addToCallNums?: number[], // Add copies to / modify existing CNs
+ callNumData?: NewCallNumData[], // Creating new call numbers
hideCopies?: boolean) { // Hide the copy edit pane
const raw: any[] = [];
<eg-string #failMsg i18n-text text="Record failed to update"></eg-string>
<div class="row d-flex p-2 m-2">
+
+ <div class="form-check">
+ <input class="form-check-input" type="checkbox"
+ [(ngModel)]="showFastAdd" id="fast-add-item"/>
+ <label class="form-check-label" for="fast-add-item">
+ Add Item
+ </label>
+ </div>
+
+ <ng-container *ngIf="showFastAdd">
+ <div class="form-inline">
+ <input type="text" class="form-control ml-2"
+ [(ngModel)]="fastItemLabel" placeholder="Call Number" i18n-placeholder/>
+ <input type="text" class="form-control ml-2"
+ [(ngModel)]="fastItemBarcode" placeholder="Barcode" i18n-placeholder/>
+ </div>
+ </ng-container>
+
<div class="flex-1"></div>
<h3 class="mr-2">
import {ConfirmDialogComponent} from '@eg/share/dialog/confirm.component';
import {MarcEditContext} from './editor-context';
import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
+import {HoldingsService} from '@eg/staff/share/holdings/holdings.service';
interface MarcSavedEvent {
marcXml: string;
@ViewChild('successMsg', {static: false}) successMsg: StringComponent;
@ViewChild('failMsg', {static: false}) failMsg: StringComponent;
+ fastItemLabel: string;
+ fastItemBarcode: string;
+ showFastAdd: boolean;
+
constructor(
private evt: EventService,
private idl: IdlService,
private org: OrgService,
private pcrud: PcrudService,
private toast: ToastService,
+ private holdings: HoldingsService,
private store: ServerStoreService
) {
this.sources = [];
// NOTE we do not reinitialize our record with the MARC returned
// from the server after a create/update, which means our record
// may be out of sync, e.g. missing 901* values. It's the
- // callers onsibility to tear us down and rebuild us.
+ // callers responsibility to tear us down and rebuild us.
return promise.then(marcXml => {
if (!marcXml) { return null; }
this.successMsg.current().then(msg => this.toast.success(msg));
emission.marcXml = marcXml;
emission.recordId = this.recordId;
this.recordSaved.emit(emission);
+ this.fastAdd();
return marcXml;
});
}
});
});
}
+
+ // Spawns the copy editor with the requested barcode and
+ // call number label. Called after our record is saved.
+ fastAdd() {
+ if (this.showFastAdd && this.fastItemLabel && this.fastItemBarcode) {
+
+ const fastItem = {
+ label: this.fastItemLabel,
+ barcode: this.fastItemBarcode,
+ fast_add: true
+ };
+
+ this.holdings.spawnAddHoldingsUi(this.recordId, null, [fastItem]);
+ }
+ }
}