hold / translit dialogs / printing repairs
authorBill Erickson <berick@esilibrary.com>
Mon, 23 Jun 2014 17:11:01 +0000 (13:11 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 23 Jun 2014 17:11:01 +0000 (13:11 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2
Open-ILS/src/templates/staff/circ/share/t_hold_shelf_dialog.tt2
Open-ILS/src/templates/staff/circ/share/t_noncat_dialog.tt2
Open-ILS/src/templates/staff/circ/share/t_transit_dialog.tt2
Open-ILS/src/templates/staff/share/print_templates/t_hold_shelf_slip.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js
Open-ILS/web/js/ui/default/staff/circ/services/circ.js

index 1edcf3d..0cd4ce4 100644 (file)
             <span class="caret"></span>
           </button>
           <ul class="dropdown-menu">
-            <li><a href 
+            <li><a href dropdown-toggle
               ng-click="checkoutArgs.noncat_type='barcode';focusMe=true">
               [% l('Barcode') %]</a>
             </li>
             <li class="divider"></li>
             <li>
-              <a href ng-repeat='type in nonCatTypes'
+              <a href ng-repeat='type in nonCatTypes' dropdown-toggle
                ng-click="checkoutArgs.noncat_type=type.id()">{{type.name()}}</a>
             </li>
           </ul>
index bcea59d..22e74e1 100644 (file)
@@ -5,59 +5,58 @@
     <h4 class="modal-title">[% l('Hold Slip') %]</h4>
   </div>
   <div class="modal-body">
-    <!-- TODO: pub / priv shelf -->
-    <div ng-switch on="evt.payload.hold.behind_desk()">
+    <div ng-switch on="hold.behind_desk">
       <div ng-switch-when="t">
-        [% l('This item should be routed to the Private Holds Shelf') %]
+        [% l('This item should be routed to the [_1]Private Holds Shelf[_2]',
+          '<strong>','</strong>') %]
       </div>
       <div ng-switch-when="f">
-        [% l('This item should be routed to the Public Holds Shelf') %]
+        [% l('This item should be routed to the [_1]Public Holds Shelf[_2]',
+          '<strong>','</strong>') %]
       </div>
     </div>
     <br/>
     <div>
       <span>[% l('Item Barcode:') %]</span>
-      <span>{{evt.payload.copy.barcode()}}</span>
+      <span>{{copy.barcode}}</span>
     </div>
     <div>
       <span>[% l('Title:') %]</span>
-      <span>{{evt.payload.record.title()}}</span>
+      <span>{{title}}</span>
     </div>
     <div>
       <span>[% l('Author:') %]</span>
-      <span>{{evt.payload.record.author()}}</span>
+      <span>{{author}}</span>
     </div>
     <br/>
     <div>
     
-    <div ng-show="holdUser.alias()">
-      [% l('Hold for patron {{holdUser.alias()}}') %]
+    <div ng-show="patron.alias">
+      [% l('Hold for patron {{patron.alias}}') %]
     </div>
-    <div ng-hide="holdUser.alias()">
+    <div ng-hide="patron.alias">
       [% |l %]
-      Hold for patron {{holdUser.family_name()}}, 
-      {{holdUser.first_given_name()}} {{holdUser.second_given_name()}}
+      Hold for patron {{patron.family_name}}, 
+      {{patron.first_given_name}} {{patron.second_given_name}}
       [% END %]
     </div>
     <div>
       <span>[% l('Patron Barcode:') %]</span>
-      <span>{{holdUser.card().barcode()}}</span>
+      <span>{{patron.card.barcode}}</span>
     </div>
     <br/>
     <div>
       <span>[% l('Request Date:') %]</span>
-      <span>{{evt.payload.hold.request_time() | date:'shortDate'}}</span>
+      <span>{{hold.request_time | date:'shortDate'}}</span>
     </div>
     <div>
       <span>[% l('Slip Date:') %]</span>
-      <span>{{now | date:'shortDate'}}</span>
+      <span>{{today | date:'shortDate'}}</span>
     </div>
   </div>
   <div class="modal-footer">
-    <!--
-    <input type="button" class="btn btn-primary" disabled="disabled"
+    <input type="button" class="btn btn-primary"
       ng-click="print()" value="[% l('Print') %]"/>
-    -->
     <input type="submit" class="btn btn-warning"
       ng-click="ok()" value="[% l('Do Not Print') %]"/>
   </div>
index 7cbadfd..345848e 100644 (file)
@@ -1,27 +1,25 @@
 <!-- edit bucket dialog -->
-<form class="form-validated" novalidate ng-submit="ok(count)" name="form">
-  <div class="">
-    <div class="">
-      <div class="modal-header">
-        <button type="button" class="close" 
-          ng-click="cancel()" aria-hidden="true">&times;</button>
-        <h4 class="modal-title">
-          [% l('Enter the number of {{type.name()}} circulating') %]
-        </h4>
-      </div>
-      <div class="modal-body">
-        <div class="form-group">
-          <label for="noncat-count" class="sr-only">[% l('Count') %]</label>
-          <input type="number" class="form-control" focus-me='focusMe' required
-            id="noncat-title" ng-model="count" placeholder="[% l('Count...') %]"/>
-        </div>
-      </div>
-      <div class="modal-footer">
-        <input type="submit" class="btn btn-primary" 
-            ng-disabled="form.$invalid" value="[% l('OK') %]"/>
-        <button class="btn btn-warning" 
-          ng-click="cancel()">[% l('Cancel') %]</button>
-      </div>
-    </div> <!-- modal-content -->
-  </div> <!-- modal-dialog -->
+<form ng-submit="ok(count)" role="form">
+  <div class="modal-header">
+    <button type="button" class="close" 
+      ng-click="cancel()" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">
+      [% l('Enter the number of {{type.name()}} circulating') %]
+    </h4>
+  </div>
+  <div class="modal-body">
+    <div class="form-group">
+      <label for="noncat-count" class="sr-only">[% l('Count') %]</label>
+      <input type="number" class="form-control" focus-me='focusMe' 
+        required id="noncat-title" ng-model="count" 
+        min="1" max="{{noncatMax}}"
+        placeholder="[% l('Count...') %]"/>
+    </div>
+  </div>
+  <div class="modal-footer">
+    <input type="submit" class="btn btn-primary" 
+        ng-disabled="form.$invalid" value="[% l('OK') %]"/>
+    <button class="btn btn-warning" 
+      ng-click="cancel($event)">[% l('Cancel') %]</button>
+  </div>
 </form>
index 817b962..1491fb2 100644 (file)
@@ -8,69 +8,50 @@
     <div class="modal-body">
       <div>
         <span>[% l('Destination') %]</span>
-        <strong>{{dest.shortname()}}</strong>
+        <strong>{{dest_location.shortname}}</strong>
       </div>
       <br/>
       <div>
         <address>
-          <strong>{{dest.name()}}</strong><br>
-          {{destAddr.street1()}} {{destAddr.street2()}}<br/>
-          {{destAddr.city()}}, {{destAddr.state()}} {{destAddr.post_code()}}<br/>
-          <abbr title="[% l('Phone') %]">P:</abbr> {{dest.phone()}}
+          <strong>{{dest_location.name}}</strong><br>
+          {{dest_address.street1}} {{dest_address.street2}}<br/>
+          {{dest_address.city}}, {{dest_address.state}} {{dest_address.post_code}}<br/>
+          <abbr title="[% l('Phone') %]">P:</abbr> {{dest_location.phone}}
         </address>
       </div>
       <div>
         <span>[% l('Item Barcode:') %]</span>
-        <span>{{evt.payload.copy.barcode()}}</span>
+        <span>{{copy.barcode}}</span>
       </div>
       <div>
         <span>[% l('Title:') %]</span>
-        <span>{{evt.payload.record.title()}}</span>
+        <span>{{title}}</span>
       </div>
       <div>
         <span>[% l('Author:') %]</span>
-        <span>{{evt.payload.record.author()}}</span>
+        <span>{{author}}</span>
       </div>
-      <div ng-if="holdUser">
+      <div ng-if="patron">
         <br/>
         <div>[% |l %]
-          Hold for patron {{holdUser.family_name()}}, 
-          {{holdUser.first_given_name()}} {{holdUser.second_given_name()}}
+          Hold for patron {{patron.family_name}}, 
+          {{patron.first_given_name}} {{patron.second_given_name}}
           [% END %]
         </div>
         <div>
           <span>[% l('Patron Barcode:') %]</span>
-          <span>{{holdUser.card().barcode()}}</span>
+          <span>{{patron.card.barcode}}</span>
         </div>
         <br/>
         <div>
           <span>[% l('Request Date:') %]</span>
-          <span>{{evt.payload.hold.request_time() | date:'shortDate'}}</span>
-        </div>
-        <div>
-          <span>[% l('Slip Date:') %]</span>
-          <span>{{now | date:'shortDate'}}</span>
+          <span>{{hold.request_time | date:'shortDate'}}</span>
         </div>
       </div>
-      <div ng-if="holdUser">
-        <br/>
-        <div>[% |l %]
-          Hold for patron {{holdUser.family_name()}}, 
-          {{holdUser.first_given_name()}} {{holdUser.second_given_name()}}
-          [% END %]
-        </div>
-        <div>
-          <span>[% l('Patron Barcode:') %]</span>
-          <span>{{holdUser.card().barcode()}}</span>
-        </div>
-        <br/>
-        <div>
-          <span>[% l('Request Date:') %]</span>
-          <span>{{evt.payload.hold.request_time() | date:'shortDate'}}</span>
-        </div>
+      <div>
         <div>
           <span>[% l('Slip Date:') %]</span>
-          <span>{{now | date:'shortDate'}}</span>
+          <span>{{today | date:'shortDate'}}</span>
         </div>
       </div>
     </div>
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_hold_shelf_slip.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_hold_shelf_slip.tt2
new file mode 100644 (file)
index 0000000..f1980d7
--- /dev/null
@@ -0,0 +1,37 @@
+<div>
+  <div ng-switch on="hold.behind_desk">
+    <div ng-switch-when="t">
+      [% l('This item needs to be routed to the [_1]Private Holds Shelf[_2].',
+        '<strong>','</strong>') %]
+    </div>
+    <div ng-switch-when="f">
+      [% l('This item needs to be routed to the [_1]Public Holds Shelf[_2].',
+        '<strong>','</strong>') %]
+    </div>
+  </div>
+  <br/>
+
+  [% l('Barcode: [_1]', '{{copy.barcode}}') %]</div>
+  [% l('Title: [_1]', '{{title}}') %]</div>
+
+  <br/>
+  <br/>
+
+  <div>[% l('Hold for patron [_1], [_2] [_3]',
+    '{{patron.family_given_name}}',
+    '{{patron.first_given_name}}',
+    '{{patron.second_given_name}}') %]</div>
+  <div>[% l('Barcode: [_1]', '{{patron.card.barcode}}') %]</div>
+  <div ng-if="hold.phone_notify">[% l('Notify by phone: [_1]', '{{hold.phone_notify}}') %]</div>
+  <div ng-if="hold.sms_notify">[% l('Notify by text: [_1]', '{{hold.sms_notify}}') %]</div>
+  <div ng-if="hold.email_notify == 't'">[% l('Notify by email: [_1]', '{{patron.email}}') %]</div>
+
+  <br/>
+
+  <div>[% l('Request Date: [_1]', 
+    '{{hold.request_time | date:"short"}}') %]</div>
+  <div>[% l('Slip Date: [_1]', '{{today | date:"short"}}') %]</div>
+  <div>[% l('Printed by [_1] at [_2]', 
+    '{{staff.first_given_name}}', '{{current_location.shortname}}') %]</div>
+
+</div>
index 593198a..a032464 100644 (file)
@@ -167,7 +167,6 @@ function($scope , $q , $modal , $routeParams , egCore , egUser , patronSvc ,
         }
     }
 
-    // TODO: show print dialog
     $scope.print_receipt = function() {
         var print_data = {circulations : []}
 
index 1b9259d..1c88249 100644 (file)
@@ -313,6 +313,7 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
     // This assumes the caller has already handled the noncat-type
     // selection and just needs to collect the count info.
     service.noncat_dialog = function(params, options) {
+        var noncatMax = 99; // hard-coded max
         
         // the caller should presumably have fetched the noncat_types via
         // our API already, but fetch them again (from cache) to be safe.
@@ -329,12 +330,17 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
                     $scope.focusMe = true;
                     $scope.type = type;
                     $scope.count = 1;
+                    $scope.noncatMax = noncatMax;
                     $scope.ok = function(count) { $modalInstance.close(count) }
-                    $scope.cancel = function () { $modalInstance.dismiss() }
+                    $scope.cancel = function ($event) { 
+                        $modalInstance.dismiss() 
+                        $event.preventDefault();
+                    }
                 }],
             }).result.then(
                 function(count) {
-                    if (count && count > 0 /* && count < x (TODO) */) {
+                    if (count && count > 0 && count <= noncatMax) { 
+                        // NOTE: in Chrome, form validation ensure a valid number
                         params.noncat_count = count;
                         return $q.when(params);
                     } else {
@@ -548,34 +554,40 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
                         '$scope','$modalInstance','destAddr','holdUser','transit',
                 function($scope , $modalInstance , destAddr , holdUser , transit) {
 
-                // TODO: synchronize scope variables with print context vars.
-                
-                $scope.destAddr = destAddr;
-                $scope.holdUser = holdUser;
-                $scope.dest = egCore.org.get(evt.org);
-                $scope.evt = evt;
-                $scope.now = new Date();
+                $scope.today = new Date();
+
+                var print_context = {
+                    copy : egCore.idl.toHash(evt.payload.copy),
+                    title : evt.payload.record.title(),
+                    author : evt.payload.record.author()
+                }
+
+                if (transit) {
+                    // route_dialog includes the "route to holds shelf" 
+                    // dialog, which has no transit
+                    print_context.transit = egCore.idl.toHash(transit);
+                    print_context.dest_address = egCore.idl.toHash(destAddr);
+                    print_context.dest_location =
+                        egCore.idl.toHash(egCore.org.get(transit.dest()));
+                }
+
+                if (holdUser) {
+                    print_context.hold = egCore.idl.toHash(evt.payload.hold);
+                    print_context.patron = egCore.idl.toHash(holdUser);
+                }
+
+                angular.forEach(print_context, function(val, key) {
+                    $scope[key] = val;
+                });
+
                 $scope.ok = function() {$modalInstance.close()}
 
                 $scope.print = function() {
                     $modalInstance.close();
 
-                    var print_context = {
-                        transit : egCore.idl.toHash(transit),
-                        title : evt.payload.record.title(),
-                        author : evt.payload.record.author(),
-                        copy : egCore.idl.toHash(evt.payload.copy),
-                        dest_location :
-                            egCore.idl.toHash(egCore.org.get(transit.dest())),
-                        dest_address : egCore.idl.toHash(destAddr),
-                    }
-
-                    var template = 'transit_slip';
-                    if (holdUser) {
-                        template = 'hold_transit_slip';
-                        print_context.hold = egCore.idl.toHash(evt.payload.hold);
-                        print_context.patron = egCore.idl.toHash(holdUser);
-                    }
+                    template = transit ? 
+                        (holdUser ? 'hold_transit_slip' : 'transit_slip') :
+                        'hold_shelf_slip';
 
                     egCore.print.print({
                         context : 'default', 
@@ -584,9 +596,11 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
                     });
                 }
             }],
+
             resolve : {
                 destAddr : function() {
-                    if (!evt.org) return $q.when();
+                    if (!evt.org || tmpl.match(/hold_shelf/))
+                        return $q.when();
                     return service.get_org_addr(evt.org, 'holds_address');
                 },
                 holdUser : function() {
@@ -599,6 +613,7 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
                     );
                 },
                 transit : function() {
+                    if (tmpl.match(/hold_shelf/)) return $q.when();
                     return service.find_copy_transit(evt, params, options);
                 }
             }