LP1904036 Move precat dialog to shared circ service
authorBill Erickson <berickxx@gmail.com>
Thu, 25 Feb 2021 17:32:42 +0000 (12:32 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:24 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/circ/patron/checkout.component.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/patron.module.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.html [deleted file]
Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.ts [deleted file]
Open-ILS/src/eg2/src/app/staff/share/circ/circ.module.ts
Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts
Open-ILS/src/eg2/src/app/staff/share/circ/precat-dialog.component.html [new file with mode: 0644]
Open-ILS/src/eg2/src/app/staff/share/circ/precat-dialog.component.ts [new file with mode: 0644]

index bbb1998..b1c73ca 100644 (file)
@@ -16,7 +16,7 @@ import {GridComponent} from '@eg/share/grid/grid.component';
 import {Pager} from '@eg/share/util/pager';
 import {StoreService} from '@eg/core/store.service';
 import {ServerStoreService} from '@eg/core/server-store.service';
-import {PrecatCheckoutDialogComponent} from './precat-dialog.component';
+import {PrecatCheckoutDialogComponent} from '@eg/staff/share/circ/precat-dialog.component';
 import {AudioService} from '@eg/share/util/audio.service';
 import {CopyAlertsDialogComponent
     } from '@eg/staff/share/holdings/copy-alerts-dialog.component';
@@ -167,7 +167,6 @@ export class CheckoutComponent implements OnInit, AfterViewInit {
 
         switch (result.evt.textcode) {
             case 'ITEM_NOT_CATALOGED':
-                this.audio.play('error.checkout.no_cataloged');
                 this.handlePrecat(result);
                 break;
         }
index 1cc7dcb..b459def 100644 (file)
@@ -15,7 +15,6 @@ import {HoldsComponent} from './holds.component';
 import {EditComponent} from './edit.component';
 import {EditToolbarComponent} from './edit-toolbar.component';
 import {BcSearchComponent} from './bcsearch.component';
-import {PrecatCheckoutDialogComponent} from './precat-dialog.component';
 import {BarcodesModule} from '@eg/staff/share/barcodes/barcodes.module';
 import {ItemsComponent} from './items.component';
 
@@ -28,8 +27,7 @@ import {ItemsComponent} from './items.component';
     EditComponent,
     EditToolbarComponent,
     BcSearchComponent,
-    ItemsComponent,
-    PrecatCheckoutDialogComponent
+    ItemsComponent
   ],
   imports: [
     StaffCommonModule,
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.html
deleted file mode 100644 (file)
index 5d1182c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<ng-template #dialogContent>
-  <div class="modal-header bg-info">
-    <h4 i18n>Barcode "{{barcode}}" was mis-scanned or is a non-cataloged item.</h4>
-    <button type="button" class="close"
-      i18n-aria-label aria-label="Close" (click)="close()">
-      <span aria-hidden="true">&times;</span>
-    </button>
-  </div>
-  <div class="modal-body">
-
-    <div class="row">
-      <div class="col-lg-4" i18n>Title</div>
-      <div class="col-lg-8">
-        <input class="form-control" [(ngModel)]="values.dummy_title"
-          id='precat-title-input' i18n-placeholder placeholder="Title..."/>
-      </div>
-    </div>
-
-    <div class="row mt-2">
-      <div class="col-lg-4" i18n>Author</div>
-      <div class="col-lg-8">
-        <input class="form-control" [(ngModel)]="values.dummy_author"
-          i18n-placeholder placeholder="Author..."/>
-      </div>
-    </div>
-
-    <div class="row mt-2">
-      <div class="col-lg-4" i18n>ISBN</div>
-      <div class="col-lg-8">
-        <input class="form-control" [(ngModel)]="values.dummy_isbn"
-          i18n-placeholder placeholder="ISBN..."/>
-      </div>
-    </div>
-
-    <div class="row mt-2">
-      <div class="col-lg-4" i18n>Circulation Modifier</div>
-      <div class="col-lg-8">
-        <eg-combobox idlClass="ccm" 
-          i18n-placeholder placeholder="Circulation Modifier..."
-          (onChange)="values.circ_modifier = $event ? $event.id : null">
-        </eg-combobox>
-      </div>
-    </div>
-  </div>
-  <div class="modal-footer">
-    <button type="button" class="btn btn-success" (click)="close(values)" 
-      [disabled]="!hasPerm || !values.dummy_title" i18n>Submit</button>
-    <button type="button" class="btn btn-warning" (click)="close()" i18n>Cancel</button>
-  </div>
-</ng-template>
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/precat-dialog.component.ts
deleted file mode 100644 (file)
index 3b9ce8f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-import {Component, OnInit, Input} from '@angular/core';
-import {Observable} from 'rxjs';
-import {DialogComponent} from '@eg/share/dialog/dialog.component';
-import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
-import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
-import {PermService} from '@eg/core/perm.service';
-
-/**
- * Precat checkout dialog
- */
-
-@Component({
-  selector: 'eg-precat-checkout-dialog',
-  templateUrl: 'precat-dialog.component.html'
-})
-
-export class PrecatCheckoutDialogComponent extends DialogComponent implements OnInit {
-
-    @Input() barcode = '';
-
-    circModifier: ComboboxEntry;
-    hasPerm = false;
-
-    values = {
-        dummy_title: null,
-        dummy_author: null,
-        dummy_isbn: null,
-        circ_modifier: null
-    };
-
-    constructor(
-        private perm: PermService,
-        private modal: NgbModal) {
-        super(modal);
-    }
-
-    ngOnInit() {
-        this.onOpen$.subscribe(_ => {
-            this.perm.hasWorkPermHere('CREATE_PRECAT')
-            .then(perms => this.hasPerm = perms['CREATE_PRECAT']);
-
-            setTimeout(() => {
-                const node = document.getElementById('precat-title-input');
-                if (node) { node.focus(); }
-            });
-        });
-    }
-}
-
-
-
index af4904f..714cf65 100644 (file)
@@ -4,18 +4,21 @@ import {HoldingsModule} from '@eg/staff/share/holdings/holdings.module';
 import {CircService} from './circ.service';
 import {CircGridComponent} from './grid.component';
 import {DueDateDialogComponent} from './due-date-dialog.component';
+import {PrecatCheckoutDialogComponent} from './precat-dialog.component';
 
 @NgModule({
     declarations: [
         CircGridComponent,
-        DueDateDialogComponent
+        DueDateDialogComponent,
+        PrecatCheckoutDialogComponent
     ],
     imports: [
         StaffCommonModule,
         HoldingsModule
     ],
     exports: [
-        CircGridComponent
+        CircGridComponent,
+        PrecatCheckoutDialogComponent
     ],
     providers: [
         CircService
index 027bfd6..c7d3d8c 100644 (file)
@@ -156,6 +156,7 @@ export class CircService {
 
         switch (evt.textcode) {
             case 'ITEM_NOT_CATALOGED':
+                this.audio.play('error.checkout.no_cataloged');
                 // alert, etc.
         }
 
diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/precat-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/circ/precat-dialog.component.html
new file mode 100644 (file)
index 0000000..5d1182c
--- /dev/null
@@ -0,0 +1,50 @@
+<ng-template #dialogContent>
+  <div class="modal-header bg-info">
+    <h4 i18n>Barcode "{{barcode}}" was mis-scanned or is a non-cataloged item.</h4>
+    <button type="button" class="close"
+      i18n-aria-label aria-label="Close" (click)="close()">
+      <span aria-hidden="true">&times;</span>
+    </button>
+  </div>
+  <div class="modal-body">
+
+    <div class="row">
+      <div class="col-lg-4" i18n>Title</div>
+      <div class="col-lg-8">
+        <input class="form-control" [(ngModel)]="values.dummy_title"
+          id='precat-title-input' i18n-placeholder placeholder="Title..."/>
+      </div>
+    </div>
+
+    <div class="row mt-2">
+      <div class="col-lg-4" i18n>Author</div>
+      <div class="col-lg-8">
+        <input class="form-control" [(ngModel)]="values.dummy_author"
+          i18n-placeholder placeholder="Author..."/>
+      </div>
+    </div>
+
+    <div class="row mt-2">
+      <div class="col-lg-4" i18n>ISBN</div>
+      <div class="col-lg-8">
+        <input class="form-control" [(ngModel)]="values.dummy_isbn"
+          i18n-placeholder placeholder="ISBN..."/>
+      </div>
+    </div>
+
+    <div class="row mt-2">
+      <div class="col-lg-4" i18n>Circulation Modifier</div>
+      <div class="col-lg-8">
+        <eg-combobox idlClass="ccm" 
+          i18n-placeholder placeholder="Circulation Modifier..."
+          (onChange)="values.circ_modifier = $event ? $event.id : null">
+        </eg-combobox>
+      </div>
+    </div>
+  </div>
+  <div class="modal-footer">
+    <button type="button" class="btn btn-success" (click)="close(values)" 
+      [disabled]="!hasPerm || !values.dummy_title" i18n>Submit</button>
+    <button type="button" class="btn btn-warning" (click)="close()" i18n>Cancel</button>
+  </div>
+</ng-template>
diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/precat-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/circ/precat-dialog.component.ts
new file mode 100644 (file)
index 0000000..3b9ce8f
--- /dev/null
@@ -0,0 +1,51 @@
+import {Component, OnInit, Input} from '@angular/core';
+import {Observable} from 'rxjs';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
+import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
+import {PermService} from '@eg/core/perm.service';
+
+/**
+ * Precat checkout dialog
+ */
+
+@Component({
+  selector: 'eg-precat-checkout-dialog',
+  templateUrl: 'precat-dialog.component.html'
+})
+
+export class PrecatCheckoutDialogComponent extends DialogComponent implements OnInit {
+
+    @Input() barcode = '';
+
+    circModifier: ComboboxEntry;
+    hasPerm = false;
+
+    values = {
+        dummy_title: null,
+        dummy_author: null,
+        dummy_isbn: null,
+        circ_modifier: null
+    };
+
+    constructor(
+        private perm: PermService,
+        private modal: NgbModal) {
+        super(modal);
+    }
+
+    ngOnInit() {
+        this.onOpen$.subscribe(_ => {
+            this.perm.hasWorkPermHere('CREATE_PRECAT')
+            .then(perms => this.hasPerm = perms['CREATE_PRECAT']);
+
+            setTimeout(() => {
+                const node = document.getElementById('precat-title-input');
+                if (node) { node.focus(); }
+            });
+        });
+    }
+}
+
+
+