LP1821382 Make items bookable (part 1)
authorBill Erickson <berickxx@gmail.com>
Tue, 26 Mar 2019 22:08:44 +0000 (18:08 -0400)
committerDan Wells <dbw2@calvin.edu>
Wed, 29 May 2019 19:30:51 +0000 (15:30 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/eg2/src/app/staff/catalog/catalog.module.ts
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.html
Open-ILS/src/eg2/src/app/staff/catalog/record/holdings.component.ts
Open-ILS/src/eg2/src/app/staff/share/booking/booking.module.ts [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/share/booking/make-bookable-dialog.component.ts [new file with mode: 0644]

index aab101d..b07938a 100644 (file)
@@ -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
index bf5ee84..830538f 100644 (file)
@@ -51,6 +51,7 @@
 <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">
index 555ac83..15fbb07 100644 (file)
@@ -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 (file)
index 0000000..f1f11c7
--- /dev/null
@@ -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 (file)
index 0000000..cc03fc6
--- /dev/null
@@ -0,0 +1,40 @@
+
+
+<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">&times;</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>
+  
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 (file)
index 0000000..84d7941
--- /dev/null
@@ -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();
+    }
+}
+
+
+