checkout due date; address print
authorBill Erickson <berick@esilibrary.com>
Mon, 16 Jun 2014 18:19:28 +0000 (14:19 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 16 Jun 2014 18:19:28 +0000 (14:19 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/admin/workstation/t_print_templates.tt2
Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2
Open-ILS/src/templates/staff/circ/patron/t_summary.tt2
Open-ILS/src/templates/staff/css/circ/patron.css.tt2
Open-ILS/src/templates/staff/share/print_templates/t_patron_address.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/admin/workstation/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js
Open-ILS/web/js/ui/default/staff/services/grid.js

index 5e30af2..15e07b2 100644 (file)
@@ -15,6 +15,7 @@
       <option value="bills_current">[% l('Bills, Current') %]</option>
       <option value="bills_historical">[% l('Bills, Historical') %]</option>
       <option value="bill_payment">[% l('Bills, Payment') %]</option>
+      <option value="patron_address">[% l('Patron Address') %]</option>
       <option value="patron_note">[% l('Patron Note') %]</option>
       <option value="transit_slip">[% l('Transit Slip') %]</option>
     </select>
index 8a2cc26..48fe012 100644 (file)
@@ -11,7 +11,8 @@
             <span class="caret"></span>
           </button>
           <ul class="dropdown-menu">
-            <li><a href='' ng-click="checkoutArgs.noncat_type='barcode';focusMe=true">
+            <li><a href 
+              ng-click="checkoutArgs.noncat_type='barcode';focusMe=true">
               [% l('Barcode') %]</a>
             </li>
             <li class="divider"></li>
       </div>
     </form>
   </div>
+  <div class="col-md-6">
+    <div class="flex-row">
+      <div class="flex-cell"></div>
+      <div class="checkbox pad-horiz">
+        <label>
+          <input type="checkbox" ng-model="checkoutArgs.sticky_date"/>
+          [% l('Specific Due Date') %]
+        </label>
+      </div>
+      <!--
+      <div><input type="checkbox" class="checkbox" ng-model="checkoutArgs.sticky_date"/></div>
+      <div class="pad-horiz">[% l('Specific Due Date') %]</div>
+      -->
+      <!-- FIXME: This needs a time component as well, but type="datetime" 
+            is not yet supported by any browsers -->
+      <div><input eg-date-input class="form-control" 
+        ng-model="checkoutArgs.due_date"/>
+      </div>
+    </div>
+  </div>
 </div>
+<hr/>
 
 <eg-grid
   id-field="id"
@@ -41,7 +63,8 @@
   persist-key="circ.patron.checkout">
   <eg-grid-field label="[% l('Barcode') %]"     path='copy_barcode' visible></eg-grid-field>
   <eg-grid-field label="[% l('Circ ID') %]"     path='payload.circ.id' visible></eg-grid-field>
-  <eg-grid-field label="[% l('Due Date') %]"    path='payload.circ.due_date' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Due Date') %]"    path='payload.circ.due_date' 
+    visible datatype="timestamp" dateformat="short"></eg-grid-field>
   <eg-grid-field label="[% l('Response') %]"    path='textcode' visible></eg-grid-field>
   <eg-grid-field label="[% l('Title') %]"       path='payload.record.title' visible></eg-grid-field>
   <eg-grid-field label="[% l('Author') %]"      path='payload.record.author' visible></eg-grid-field>
index 186e8fa..85acb8f 100644 (file)
     <div class="panel">
       <div class="panel-body">
         <fieldset>
-          <legend>{{addr.address_type()}}</legend>
+          <legend>
+            {{addr.address_type()}} 
+            <a href class="pad-horiz patron-summary-act-link" 
+              ng-click="print_address(addr)">[% l('(print)') %]</a>
+          </legend>
           <div>{{addr.street1()}} {{addr.street2()}}</div>
           <div>{{addr.city()}}, {{addr.state()}} {{addr.post_code()}}</div>
         </fieldset>
index 6628c8f..5b05b14 100644 (file)
@@ -6,8 +6,9 @@
 but the ones I'm finding aren't quite cutting it..*/
 .patron-summary-alert {color: red; font-weight:bold}
 .patron-summary-alert-small {color: red}
-
 .patron-summary-divider { border-top: 1px solid #CCC}
+.patron-summary-act-link {font-size: .8em;}
+
 #patron-checkout-barcode { width: 16em; }
 
 #patron-search-form div.form-group {
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_patron_address.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_patron_address.tt2
new file mode 100644 (file)
index 0000000..c1a3e37
--- /dev/null
@@ -0,0 +1,12 @@
+<div>
+  <div>
+    {{patron.first_given_name}} 
+    {{patron.second_given_name}} 
+    {{patron.family_name}}
+  </div>
+  <div>{{address.street1}}</div>
+  <div ng-if="address.street2">{{address.street2}}</div>
+  <div>
+    {{address.city}}, {{address.state}} {{address.post_code}}
+  </div>
+</div>
index 11db1bd..7e37c4e 100644 (file)
@@ -389,7 +389,9 @@ function($scope , $q , egCore) {
         },
         title : seed_record.title,
         author : seed_record.author,
-        staff : egCore.idl.toHash(egCore.auth.user())
+        staff : egCore.idl.toHash(egCore.auth.user()),
+        patron : egCore.idl.toHash(egCore.auth.user()),
+        address : seed_addr
     }
 
     $scope.preview_scope.payments = [
index a02b001..6662f65 100644 (file)
@@ -504,6 +504,13 @@ function($scope,  $q,  $location , $filter,  egCore,  egUser,  patronSvc) {
     $scope.patron = function() { return patronSvc.current }
     $scope.patron_stats = function() { return patronSvc.patron_stats }
     $scope.summary_stat_cats = function() { return patronSvc.summary_stat_cats }
+
+    $scope.print_address = function(addr) {
+        egCore.hatch.printFromTemplate('default', 'patron_address', {
+            patron : egCore.idl.toHash(patronSvc.current),
+            address : egCore.idl.toHash(addr)
+        });
+    }
 }])
 
 .controller('PatronBarcodeSearchCtrl',
@@ -754,9 +761,9 @@ function($scope,  $q,  $routeParams,  $timeout,  $window,  $location,  egCore,
         var search = {};
         angular.forEach(args, function(val, key) {
             if (!val) return;
-            if (key == 'profile') {
+            if (key == 'profile' && args.profile) {
                 search.profile = {value : args.profile.id(), group : 0};
-            } else if (key == 'home_ou') {
+            } else if (key == 'home_ou' && args.home_ou) {
                 search.home_ou = args.home_ou.id(); // passed separately
             } else if (key == 'inactive') {
                 search.inactive = val;
index 20ac649..4dd6ea0 100644 (file)
@@ -13,7 +13,10 @@ function($scope , $q , $modal , $routeParams , egCore , egUser , patronSvc ,
     $scope.initTab('checkout', $routeParams.id);
     $scope.focusMe = true;
     $scope.checkouts = patronSvc.checkouts;
-    $scope.checkoutArgs = {noncat_type : 'barcode'};
+    $scope.checkoutArgs = {
+        noncat_type : 'barcode',
+        due_date : new Date()
+    };
     $scope.gridDataProvider = egGridDataProvider.instance({
         get : function(offset, count) {
             return this.arrayNotifier($scope.checkouts, offset, count);
@@ -38,6 +41,13 @@ function($scope , $q , $modal , $routeParams , egCore , egUser , patronSvc ,
         var params = angular.copy(args);
         params.patron_id = patronSvc.current.id();
 
+        if (args.sticky_date) {
+            params.due_date = args.due_date.toISOString();
+        } else {
+            delete params.due_date;
+        }
+        delete params.sticky_date;
+
         if (params.noncat_type == 'barcode') {
             if (!args.copy_barcode) return;
 
index 08da5c7..9464df4 100644 (file)
@@ -792,6 +792,7 @@ angular.module('egGridMod',
             path  : '@', // optional; flesh path
             label : '@', // optional; display label
             flex  : '@',  // optional; default flex width
+            dateformat : '@', // optional: passed down to egGridValueFilter
 
             // optional: for non-IDL columns, specifying a datatype
             // lets the caller control which display filter is used.
@@ -1011,7 +1012,8 @@ angular.module('egGridMod',
                 sortable : colSpec.sortable,
                 nonsortable      : colSpec.nonsortable,
                 multisortable    : colSpec.multisortable,
-                nonmultisortable : colSpec.nonmultisortable
+                nonmultisortable : colSpec.nonmultisortable,
+                dateformat       : colSpec.dateformat
             };
         }
 
@@ -1450,7 +1452,9 @@ angular.module('egGridMod',
                 }
             case 'timestamp':                                                  
                 // canned angular date filter FTW                              
-                return $filter('date')(value, 'shortDate');                                 
+                if (!column.dateformat) 
+                    column.dateformat = 'shortDate';
+                return $filter('date')(value, column.dateformat);
             case 'money':                                                  
                 return $filter('currency')(value);
             default: