import {CatalogRoutingModule} from './routing.module';
import {HoldsModule} from '@eg/staff/share/holds/holds.module';
import {HoldingsModule} from '@eg/staff/share/holdings/holdings.module';
+import {BookingModule} from '@eg/staff/share/booking/booking.module';
import {CatalogComponent} from './catalog.component';
import {SearchFormComponent} from './search-form.component';
import {ResultsComponent} from './result/results.component';
CatalogCommonModule,
CatalogRoutingModule,
HoldsModule,
- HoldingsModule
+ HoldingsModule,
+ BookingModule
],
providers: [
StaffCatalogService
<eg-delete-volcopy-dialog #deleteVolcopy></eg-delete-volcopy-dialog>
<eg-bucket-dialog #bucketDialog></eg-bucket-dialog>
<eg-conjoined-items-dialog #conjoinedDialog></eg-conjoined-items-dialog>
+<eg-make-bookable-dialog #makeBookableDialog></eg-make-bookable-dialog>
<!-- holdings grid -->
<div class='eg-copies w-100 mt-3'>
</eg-grid-column>
<eg-grid-column path="copyCount" datatype="number" label="Copies" i18n-label>
</eg-grid-column>
- <eg-grid-column path="volume._label" name="call_number.label" label="Call Number" i18n-label>
+ <eg-grid-column path="volume._label" name="call_number.label"
+ label="Call Number" i18n-label>
</eg-grid-column>
<eg-grid-column path="copy.barcode" name="barcode" label="Barcode" i18n-label>
</eg-grid-column>
datatype="org_unit"></eg-grid-column>
<eg-grid-column i18n-label label="Due Date" path="circ.due_date"
datatype="timestamp"></eg-grid-column>
- <eg-grid-column i18n-label label="Shelving Location" path="copy.location.name" name="location.name">
+ <eg-grid-column i18n-label label="Shelving Location"
+ path="copy.location.name" name="location.name">
</eg-grid-column>
<eg-grid-column i18n-label label="Circulation Modifier"
path="copy.circ_modifier" name="circ_modifier">
</eg-grid-column>
- <eg-grid-column i18n-label label="Copy Number" path="copy.copy_number" name="copy_number" [hidden]="true">
+ <eg-grid-column i18n-label label="Copy Number" path="copy.copy_number"
+ name="copy_number" [hidden]="true">
</eg-grid-column>
- <eg-grid-column i18n-label label="Status" path="copy.status.name" name="status_name">
+ <eg-grid-column i18n-label label="Status"
+ path="copy.status.name" name="status_name">
</eg-grid-column>
<eg-grid-column i18n-label label="Call Number Prefix"
path="volume.prefix.label" name="call_number.prefix.label" [hidden]="true">
} from '@eg/staff/share/buckets/bucket-dialog.component';
import {ConjoinedItemsDialogComponent
} from '@eg/staff/share/holdings/conjoined-items-dialog.component';
+import {MakeBookableDialogComponent
+ } from '@eg/staff/share/booking/make-bookable-dialog.component';
// The holdings grid models a single HoldingsTree, composed of HoldingsTreeNodes
// flattened on-demand into a list of HoldingEntry objects.
private bucketDialog: BucketDialogComponent;
@ViewChild('conjoinedDialog')
private conjoinedDialog: ConjoinedItemsDialogComponent;
+ @ViewChild('makeBookableDialog')
+ private makeBookableDialog: MakeBookableDialogComponent;
holdingsTree: HoldingsTree;
makeBookable(rows: HoldingsEntry[]) {
const copyIds = this.selectedCopyIds(rows);
if (copyIds.length > 0) {
- alert('TODO');
+ this.makeBookableDialog.copyIds = copyIds;
+ this.makeBookableDialog.open({}).then(
+ modified => {}, // No refresh needed
+ dismissed => {}
+ )
}
}
}
--- /dev/null
+import {NgModule} from '@angular/core';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {MakeBookableDialogComponent} from './make-bookable-dialog.component';
+
+@NgModule({
+ declarations: [
+ MakeBookableDialogComponent
+ ],
+ imports: [
+ StaffCommonModule
+ ],
+ exports: [
+ MakeBookableDialogComponent
+ ],
+ providers: [
+ ]
+})
+
+export class BookingModule {}
+
--- /dev/null
+
+
+<eg-string #successMsg
+ text="Successfully Made Item(s) Bookable" i18n-text></eg-string>
+<eg-string #errorMsg
+ text="Failed To Make Item(s) Bookable" i18n-text></eg-string>
+
+<ng-template #dialogContent>
+ <div class="modal-header bg-info">
+ <h4 class="modal-title">
+ <span i18n>Make Items Bookable</span>
+ </h4>
+ <button type="button" class="close"
+ i18n-aria-label aria-label="Close" (click)="dismiss('cross_click')">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <div class="row">
+ <div class="col-lg-12 d-flex justify-content-center">
+ <span i18n>Make {{copyIds.length}} Item(s) Bookable?</span>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <ng-container>
+ <button type="button" class="btn btn-warning"
+ (click)="dismiss('canceled')" i18n>Cancel</button>
+ <ng-container *ngIf="!updateComplete">
+ <button type="button" class="btn btn-success"
+ (click)="makeBookable()" i18n>Make Bookable</button>
+ </ng-container>
+ <ng-container *ngIf="updateComplete">
+ <button type="button" class="btn btn-success"
+ (click)="close(numSucceeded > 0)" i18n>Done</button>
+ </ng-container>
+ </ng-container>
+ </div>
+ </ng-template>
+
--- /dev/null
+import {Component, OnInit, OnDestroy, Input, ViewChild,
+ Renderer2} from '@angular/core';
+import {Subscription} from 'rxjs';
+import {IdlObject} from '@eg/core/idl.service';
+import {NetService} from '@eg/core/net.service';
+import {EventService} from '@eg/core/event.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {AuthService} from '@eg/core/auth.service';
+import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {StringComponent} from '@eg/share/string/string.component';
+
+/**
+ * Dialog for making items bookable
+ */
+
+@Component({
+ selector: 'eg-make-bookable-dialog',
+ templateUrl: 'make-bookable-dialog.component.html'
+})
+export class MakeBookableDialogComponent
+ extends DialogComponent implements OnInit, OnDestroy {
+
+ // Note copyIds must refer to copies that belong to a single
+ // bib record.
+ @Input() copyIds: number[];
+ copies: IdlObject[];
+
+ numSucceeded: number;
+ numFailed: number;
+ updateComplete: boolean;
+
+ onOpenSub: Subscription;
+
+ @ViewChild('successMsg') private successMsg: StringComponent;
+ @ViewChild('errorMsg') private errorMsg: StringComponent;
+
+ constructor(
+ private modal: NgbModal, // required for passing to parent
+ private toast: ToastService,
+ private net: NetService,
+ private pcrud: PcrudService,
+ private evt: EventService,
+ private renderer: Renderer2,
+ private auth: AuthService) {
+ super(modal); // required for subclassing
+ }
+
+ ngOnInit() {
+ this.onOpenSub = this.onOpen$.subscribe(async () => {
+ this.numSucceeded = 0;
+ this.numFailed = 0;
+ this.updateComplete = false;
+ });
+ }
+
+ ngOnDestroy() {
+ this.onOpenSub.unsubscribe();
+ }
+}
+
+
+