From e1fc8b6423f59dd64f53dc9152b3cd01f412cc4e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 26 Mar 2019 18:08:44 -0400 Subject: [PATCH] LP1821382 Make items bookable (part 1) Signed-off-by: Bill Erickson Signed-off-by: Dan Wells --- .../eg2/src/app/staff/catalog/catalog.module.ts | 4 +- .../staff/catalog/record/holdings.component.html | 13 +++- .../app/staff/catalog/record/holdings.component.ts | 10 +++- .../src/app/staff/share/booking/booking.module.ts | 20 ++++++ .../booking/make-bookable-dialog.component.html | 40 ++++++++++++ .../booking/make-bookable-dialog.component.ts | 64 ++++++++++++++++++++ 6 files changed, 145 insertions(+), 6 deletions(-) create mode 100644 Open-ILS/src/eg2/src/app/staff/share/booking/booking.module.ts create mode 100644 Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.html create mode 100644 Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.ts diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts index aab101d..b07938a 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts @@ -4,6 +4,7 @@ import {CatalogCommonModule} from '@eg/share/catalog/catalog-common.module'; 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'; @@ -50,7 +51,8 @@ import {ConjoinedComponent} from './record/conjoined.component'; CatalogCommonModule, CatalogRoutingModule, HoldsModule, - HoldingsModule + HoldingsModule, + BookingModule ], providers: [ StaffCatalogService diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html index bf5ee84..830538f 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html @@ -51,6 +51,7 @@ +
@@ -228,7 +229,8 @@ - + @@ -238,15 +240,18 @@ datatype="org_unit"> - + - + - + diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts index 555ac83..15fbb07 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts @@ -30,6 +30,8 @@ import {BucketDialogComponent } 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. @@ -103,6 +105,8 @@ export class HoldingsMaintenanceComponent implements OnInit { private bucketDialog: BucketDialogComponent; @ViewChild('conjoinedDialog') private conjoinedDialog: ConjoinedItemsDialogComponent; + @ViewChild('makeBookableDialog') + private makeBookableDialog: MakeBookableDialogComponent; holdingsTree: HoldingsTree; @@ -882,7 +886,11 @@ export class HoldingsMaintenanceComponent implements OnInit { 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 => {} + ) } } } diff --git a/Open-ILS/src/eg2/src/app/staff/share/booking/booking.module.ts b/Open-ILS/src/eg2/src/app/staff/share/booking/booking.module.ts new file mode 100644 index 0000000..f1f11c7 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/booking/booking.module.ts @@ -0,0 +1,20 @@ +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 {} + diff --git a/Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.html new file mode 100644 index 0000000..cc03fc6 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.html @@ -0,0 +1,40 @@ + + + + + + + + + + + diff --git a/Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.ts new file mode 100644 index 0000000..84d7941 --- /dev/null +++ b/Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.ts @@ -0,0 +1,64 @@ +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(); + } +} + + + -- 1.7.2.5