place holds continued
authorBill Erickson <berickxx@gmail.com>
Mon, 26 Nov 2018 19:52:09 +0000 (14:52 -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/share/catalog/catalog.service.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
Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts
Open-ILS/src/eg2/src/app/staff/share/hold.service.ts

index c513407..1035d35 100644 (file)
@@ -226,6 +226,15 @@ export class CatalogService {
         });
     }
 
+    iconFormatLabel(code: string): string {
+        if (this.ccvmMap) {
+            const ccvm = this.ccvmMap.icon_format.filter(
+                format => format.code() === code)[0];
+            if (ccvm) {
+                return ccvm.search_label();
+            }                                                                  
+        }                                                                      
+    }      
 
     fetchCmfs(): Promise<void> {
         // At the moment, we only need facet CMFs.
index a161e22..1ec9531 100644 (file)
@@ -1,8 +1,8 @@
 
 <h3 i18n>Place Hold 
-    <ng-container *ngIf="user"> 
-       ({{user.family_name()}}, {{user.first_given_name()}} {{user.second_given_name()}})
-    </ng-container>
+  <ng-container *ngIf="user"> 
+   ({{user.family_name()}}, {{user.first_given_name()}})
+  </ng-container>
 </h3>
 
 <form class="form form-validated common-form striped-odd" 
     </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: {{requestor.usrname()}}
+          Place hold for this staff account:
         </label>
       </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>
-  <div class="row mt-2">
+    <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"
   </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"/>
   </div>
   <div class="row mt-2">
     <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">
       <button class="btn btn-success" (click)="placeHolds()" 
         [disabled]="!user" i18n>Submit</button>
     </div>
 <div class="hold-records-list common-form striped-even">
 
   <div class="row mt-2 ml-1 mr-1 font-weight-bold">
-    <div class="col-lg-3" i18n>Title</div>
+    <div class="col-lg-1" i18n>Format</div>
+    <div class="col-lg-2" i18n>Title</div>
     <div class="col-lg-2" i18n>Author</div>
     <div class="col-lg-1" i18n>TCN</div>
     <div class="col-lg-2" i18n>Call Number</div>
   </div>
   <div class="row mt-1 ml-1 mr-1" *ngFor="let ctx of holdContexts">
     <ng-container *ngIf="ctx.bibSummary">
-      <div class="col-lg-3">
+      <div class="col-lg-1">
+        <ng-container *ngFor="let code of ctx.bibSummary.attributes.icon_format">
+          <img class="pr-1" 
+            alt="{{iconFormatLabel(code)}}"
+            title="{{iconFormatLabel(code)}}"
+            src="/images/format_icons/icon_format/{{code}}.png"/>
+        </ng-container>
+      </div>
+      <div class="col-lg-2">
         <a routerLink="/staff/catalog/record/{{ctx.recordId}}">
           {{ctx.bibSummary.display.title}}
         </a>
index e813a94..b61d82d 100644 (file)
@@ -34,8 +34,10 @@ export class HoldComponent implements OnInit {
     pickupLib: number;
     notifyEmail: boolean;
     notifyPhone: boolean;
-    notifySms: boolean;
     phoneValue: string;
+    notifySms: boolean;
+    smsValue: string;
+    smsCarrier: string;
     suspend: boolean;
     activeDate: string;
 
@@ -114,6 +116,7 @@ export class HoldComponent implements OnInit {
     }
 
     holdForChanged() {
+        this.user = null;
 
         if (this.holdFor === 'patron') {
             if (this.userBarcode) {
@@ -238,7 +241,13 @@ export class HoldComponent implements OnInit {
             recipient: this.user.id(),
             requestor: this.requestor.id(),
             pickupLib: this.pickupLib,
-            override: override
+            override: override,
+            notifyEmail: this.notifyEmail, // bool
+            notifyPhone: this.notifyPhone ? this.phoneValue : null,
+            notifySms: this.notifySms ? this.smsValue : null,
+            smsCarrier: this.notifySms ? this.smsCarrier : null,
+            thawDate: this.suspend ? this.activeDate : null,
+            frozen: this.suspend
 
         }).toPromise().then(request => {
             console.log('hold returned: ', request);
@@ -269,6 +278,10 @@ export class HoldComponent implements OnInit {
         return ctx.lastRequest && 
                 !ctx.lastRequest.result.success && ctx.canOverride;
     }
+
+    iconFormatLabel(code: string): string {
+        return this.cat.iconFormatLabel(code);
+    }
 }
 
 
index b99a4a1..b05d6b4 100644 (file)
@@ -54,13 +54,7 @@ export class ResultRecordComponent implements OnInit, OnDestroy {
     }
 
     iconFormatLabel(code: string): string {
-        if (this.cat.ccvmMap) {
-            const ccvm = this.cat.ccvmMap.icon_format.filter(
-                format => format.code() === code)[0];
-            if (ccvm) {
-                return ccvm.search_label();
-            }
-        }
+        return this.cat.iconFormatLabel(code);
     }
 
     placeHold(): void {
index 7004a46..5651d59 100644 (file)
@@ -21,6 +21,12 @@ export interface HoldRequest {
     requestor: number;
     pickupLib: number;
     override?: boolean;
+    notifyEmail?: boolean;
+    notifyPhone?: string;
+    notifySms?: string;
+    smsCarrier?: string;
+    thawDate?: string; // ISO date
+    frozen?: boolean;
     //holdableFormats?: {[id: number]: string[]};
     result?: HoldRequestResult
     // ...
@@ -42,9 +48,15 @@ export class HoldService {
 
         return this.net.request(
             'open-ils.circ', method, this.auth.token(), {
-                patronid: request.recipient,
-                pickup_lib: request.pickupLib,
-                hold_type: request.holdType,
+                patronid:       request.recipient,
+                pickup_lib:     request.pickupLib,
+                hold_type:      request.holdType,
+                email_notify:   request.notifyEmail,
+                phone_notify:   request.notifyPhone,
+                thaw_date:      request.thawDate,
+                frozen:         request.frozen,
+                sms_notify:     request.notifySms,
+                sms_carrier:    request.smsCarrier
                 //holdable_formats_map: request.holdableFormats
             },
             [request.holdTarget]