plac holds continued; from basket
authorBill Erickson <berickxx@gmail.com>
Mon, 26 Nov 2018 21:04:48 +0000 (16:04 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 30 Nov 2018 16:34:20 +0000 (11:34 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/catalog/basket-actions.component.html
Open-ILS/src/eg2/src/app/staff/catalog/basket-actions.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html
Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts

index e30fb8c..86d8099 100644 (file)
@@ -18,7 +18,7 @@
         [(ngModel)]="basketAction" (change)="applyAction()">
       <option value='' [disabled]="true" i18n>Basket Actions...</option>
       <option value="view"   i18n>View Basket</option>
-      <option value="hold"   [disabled]="true" i18n>Place Hold</option>
+      <option value="hold"   i18n>Place Hold</option>
       <option value="print"  i18n>Print Title Details</option>
       <option value="email"  i18n>Email Title Details</option>
       <option value="bucket" i18n>Add Basket to Bucket</option>
index d5aff9d..d01dc36 100644 (file)
@@ -52,6 +52,13 @@ export class BasketActionsComponent implements OnInit {
                 this.basket.removeAllRecordIds();
                 break;
 
+            case 'hold':
+                this.basket.getRecordIds().then(ids => {
+                    this.router.navigate(['/staff/catalog/hold/T'],
+                        {queryParams: {target: ids}});
+                });
+                break; 
+
             case 'print':
                 this.basket.getRecordIds().then(ids => {
                     this.net.request(
index 1ec9531..3686ce1 100644 (file)
 
 <h3 i18n>Place Hold 
-  <ng-container *ngIf="user"> 
+  <small *ngIf="user"> 
    ({{user.family_name()}}, {{user.first_given_name()}})
-  </ng-container>
+  </small>
 </h3>
 
-<form class="form form-validated common-form striped-odd
+<form class="form form-validated common-form" 
   autocomplete="off" (keydown.enter)="$event.preventDefault()">
   <div class="row">
-    <div class="col-lg-3">
-      <div class="form-check">
-        <input class="form-check-input" type="radio" 
-          (change)="holdForChanged()"
-          name="holdFor" value="patron" [(ngModel)]="holdFor"/>
-        <label class="form-check-label" i18n>
-          Place hold for patron by barcode:
-        </label>
-      </div>
-    </div>
-    <div class="col-lg-3">
-      <div class="input-group">
-        <input type='text' class="form-control" name="userBarcode"
-          [disabled]="holdFor!='patron'" id='patron-barcode' 
-          (keyup.enter)="userBarcodeChanged()"
-          [(ngModel)]="userBarcode" (change)="userBarcodeChanged()"/>
-        <div class="input-group-append">
-          <button class="btn btn-outline-dark" 
-            (click)="userSearch()" i18n>Search</button>
+    <div class="col-lg-6 common-form striped-odd">
+      <div class="row mt-2">
+        <div class="col-lg-6">
+          <div class="form-check">
+            <input class="form-check-input" type="radio" 
+              (change)="holdForChanged()"
+              name="holdFor" value="patron" [(ngModel)]="holdFor"/>
+            <label class="form-check-label" i18n>
+              Place hold for patron by barcode:
+            </label>
+          </div>
+        </div>
+        <div class="col-lg-6">
+          <div class="input-group">
+            <input type='text' class="form-control" name="userBarcode"
+              [disabled]="holdFor!='patron'" id='patron-barcode' 
+              (keyup.enter)="userBarcodeChanged()"
+              [(ngModel)]="userBarcode" (change)="userBarcodeChanged()"/>
+            <div class="input-group-append">
+              <button class="btn btn-outline-dark" 
+                (click)="userSearch()" i18n>Search</button>
+            </div>
+          </div>
         </div>
       </div>
-    </div>
-    <div class="col-lg-3">
-      <div class="form-check">
-        <input class="form-check-input" type="checkbox" 
-          name="suspend" [(ngModel)]="suspend"/>
-        <label class="form-check-label" i18n>Suspend Hold</label>
-      </div>
-    </div>
-    <div class="col-lg-3">
-      <eg-date-select (onChangeAsISO)="activeDateSelected($event)"
-        [disabled]="!suspend">
-      </eg-date-select>
-    </div>
-  </div>
-  <div class="row mt-2">
-    <div class="col-lg-3">
-      <div class="form-check">
-        <input class="form-check-input" type="radio" 
-          (change)="holdForChanged()"
-          name="holdFor" value="staff" [(ngModel)]="holdFor"/>
-        <label class="form-check-label" i18n>
-          Place hold for this staff account:
-        </label>
-      </div>
-    </div>
-    <div class="col-lg-3 font-weight-bold">{{requestor.usrname()}}</div>
-    <div class="col-lg-3">
-      <div class="form-check">
-        <input class="form-check-input" type="checkbox" name="notifyEmail"
-          [disabled]="!user || !user.email()" [(ngModel)]="notifyEmail"/>
-        <label class="form-check-label" i18n>Notify by Email</label>
-      </div>
-    </div>
-    <div class="col-lg-3">
-      <div class="input-group">
-        <div class="input-group-prepend">
-          <span class="input-group-text" i18n>Email Address</span>
+      <div class="row mt-2">
+        <div class="col-lg-6">
+          <div class="form-check">
+            <input class="form-check-input" type="radio" 
+              (change)="holdForChanged()"
+              name="holdFor" value="staff" [(ngModel)]="holdFor"/>
+            <label class="form-check-label" i18n>
+              Place hold for this staff account:
+            </label>
+          </div>
         </div>
-        <input type="text" class="form-control" name="userEmail"
-          [disabled]="true" value="{{user ? user.email() : ''}}"/>
+        <div class="col-lg-6 font-weight-bold">{{requestor.usrname()}}</div>
       </div>
-    </div>
-  </div>
-  <div class="row mt-2">
-    <div class="col-lg-3">
-      <label i18n>Pickup Location: </label>
-    </div>
-    <div class="col-lg-3">
-      <eg-org-select [applyOrgId]="pickupLib"></eg-org-select>
-    </div>
-    <div class="col-lg-3">
-      <div class="form-check">
-        <input class="form-check-input" type="checkbox" 
-          name="notifyPhone" [(ngModel)]="notifyPhone"/>
-        <label class="form-check-label" i18n>Notify by Phone</label>
+      <div class="row mt-2">
+        <div class="col-lg-6">
+          <label i18n>Pickup Location: </label>
+        </div>
+        <div class="col-lg-6">
+          <eg-org-select [applyOrgId]="pickupLib"></eg-org-select>
+        </div>
       </div>
-    </div>
-    <div class="col-lg-3">
-      <div class="input-group">
-        <div class="input-group-prepend">
-          <span class="input-group-text" i18n>Phone Number</span>
+      <div class="row mt-2">
+        <div class="col-lg-6">
+          <div class="form-check">
+            <input class="form-check-input" type="checkbox" 
+              name="suspend" [(ngModel)]="suspend"/>
+            <label class="form-check-label" i18n>Suspend Hold</label>
+          </div>
+        </div>
+        <div class="col-lg-6">
+          <eg-date-select (onChangeAsISO)="activeDateSelected($event)"
+            [disabled]="!suspend">
+          </eg-date-select>
         </div>
-        <input type="text" class="form-control" [disabled]="!notifyPhone"
-          name="phoneValue" [(ngModel)]="phoneValue"/>
       </div>
-    </div>
-  </div>
+    </div><!-- left column -->
+    <div class="col-lg-6">
+      <div class="card">
+        <div class="card-header">
+          <h4 i18n>Notifications</h4>
+        </div>
+        <ul class="list-group list-group-flush">
+          <li class="list-group-item d-flex">
+            <div class="flex-1">
+              <div class="form-check">
+                <input class="form-check-input" type="checkbox" name="notifyEmail"
+                  [disabled]="!user || !user.email()" [(ngModel)]="notifyEmail"/>
+                <label class="form-check-label" i18n>Notify by Email</label>
+              </div>
+            </div>
+            <div class="flex-1">
+              <div class="input-group">
+                <div class="input-group-prepend">
+                  <span class="input-group-text" i18n>Email Address</span>
+                </div>
+                <input type="text" class="form-control" name="userEmail"
+                  [disabled]="true" value="{{user ? user.email() : ''}}"/>
+              </div>
+            </div>
+          </li>
+          <li class="list-group-item d-flex">
+            <div class="flex-1">
+              <div class="form-check">
+                <input class="form-check-input" type="checkbox" 
+                  name="notifyPhone" [(ngModel)]="notifyPhone"/>
+                <label class="form-check-label" i18n>Notify by Phone</label>
+              </div>
+            </div>
+            <div class="flex-1">
+              <div class="input-group">
+                <div class="input-group-prepend">
+                  <span class="input-group-text" i18n>Phone Number</span>
+                </div>
+                <input type="text" class="form-control" [disabled]="!notifyPhone"
+                  name="phoneValue" [(ngModel)]="phoneValue"/>
+              </div>
+            </div>
+          </li>
+          <li *ngIf="smsEnabled" class="list-group-item d-flex">
+            <div class="flex-1">
+              <div class="form-check">
+                <input class="form-check-input" type="checkbox" 
+                  name="notifySms" [(ngModel)]="notifySms"/>
+                <label class="form-check-label" i18n>Notify by SMS</label>
+              </div>
+            </div>
+            <div class="flex-1">
+              <div class="input-group">
+                <div class="input-group-prepend">
+                  <span class="input-group-text" i18n>SMS Number</span>
+                </div>
+                <input type="text" class="form-control" [disabled]="!notifySms"
+                  name="smsValue" [(ngModel)]="smsValue"/>
+              </div>
+            </div>
+          </li>
+          <li *ngIf="smsEnabled" class="list-group-item d-flex">
+            <div class="flex-1">
+              <label i18n>SMS Carrier</label>
+            </div>
+            <div class="flex-1">
+              <eg-combobox
+                placeholder="SMS Carriers" i18n-placeholder
+                [entries]="smsCarriers">
+              </eg-combobox>
+            </div>
+          </li>
+        </ul><!-- col -->
+      </div><!-- row -->
+    </div><!--card -->
+  </div><!-- col -->
   <div class="row mt-2">
     <div class="col-lg-3">
       <button class="btn btn-success" (click)="placeHolds()" 
index b61d82d..daf2279 100644 (file)
@@ -1,4 +1,5 @@
 import {Component, OnInit, Input, ViewChild, Renderer2} from '@angular/core';
+import {Observable} from 'rxjs/Observable';
 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
 import {EventService} from '@eg/core/event.service';
 import {NetService} from '@eg/core/net.service';
@@ -6,11 +7,13 @@ import {AuthService} from '@eg/core/auth.service';
 import {PcrudService} from '@eg/core/pcrud.service';
 import {PermService} from '@eg/core/perm.service';
 import {IdlObject} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
 import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service';
 import {CatalogSearchContext, CatalogSearchState} from '@eg/share/catalog/search-context';
 import {CatalogService} from '@eg/share/catalog/catalog.service';
 import {StaffCatalogService} from '../catalog.service';
 import {HoldService, HoldRequest} from '@eg/staff/share/hold.service';
+import {ComboboxEntry} from '@eg/share/combobox/combobox.component';
 
 class HoldContext {
     recordId: number;
@@ -46,6 +49,9 @@ export class HoldComponent implements OnInit {
     recordSummaries: BibRecordSummary[];
 
     currentUserBarcode: string;
+    smsCarriers: ComboboxEntry[];
+
+    smsEnabled: boolean;
 
     constructor(
         private router: Router,
@@ -53,6 +59,7 @@ export class HoldComponent implements OnInit {
         private renderer: Renderer2,
         private evt: EventService,
         private net: NetService,
+        private org: OrgService,
         private auth: AuthService,
         private pcrud: PcrudService,
         private bib: BibRecordService,
@@ -62,6 +69,7 @@ export class HoldComponent implements OnInit {
         private perm: PermService
     ) {
         this.holdContexts = [];
+        this.smsCarriers = [];
     }
 
     ngOnInit() {
@@ -86,6 +94,19 @@ export class HoldComponent implements OnInit {
 
         this.findRecords();
 
+        this.org.settings('sms.enable').then(sets => {
+            this.smsEnabled = sets['sms.enable']
+            if (!this.smsEnabled) { return; }
+
+            this.pcrud.search('csc', {active: 't'}, {order_by: {csc: 'name'}})
+            .subscribe(carrier => {
+                this.smsCarriers.push({
+                    id: carrier.id(), 
+                    label: carrier.name()
+                })
+            });
+        });
+
         setTimeout(() => // Focus barcode input
             this.renderer.selectRootElement('#patron-barcode').focus());
     }