webstaff: add print template and action for in-house uses list
authorGalen Charlton <gmc@esilibrary.com>
Wed, 16 Nov 2016 08:07:22 +0000 (03:07 -0500)
committerKathy Lussier <klussier@masslnc.org>
Mon, 9 Jan 2017 15:58:58 +0000 (10:58 -0500)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/admin/workstation/t_print_templates.tt2
Open-ILS/src/templates/staff/circ/in_house_use/index.tt2
Open-ILS/src/templates/staff/share/print_templates/t_in_house_use_list.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/in_house_use/app.js

index 1b09453..25c3f2a 100644 (file)
@@ -24,6 +24,7 @@
           <option value="holds_for_patron">[% l('Holds for Patron') %]</option>
           <option value="hold_pull_list">[% l('Hold Pull List') %]</option>
           <option value="hold_shelf_list">[% l('Hold Shelf List') %]</option>
+          <option value="in_house_use_list">[% l('In-House Use List') %]</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>
index 769d533..edf032c 100644 (file)
@@ -70,6 +70,9 @@
   main-label="[% l('In-House Use') %]"
   items-provider="gridDataProvider"
   persist-key="circ.in_house_use">
+
+  <eg-grid-menu-item handler="print_list" label="[% l('Print List') %]"></eg-grid-menu-item>
+
   <eg-grid-field label="[% l('# of Uses') %]"   path='num_uses' visible></eg-grid-field>
   <eg-grid-field label="[% l('Barcode') %]"     path='copy.barcode' visible></eg-grid-field>
   <eg-grid-field label="[% l('Call Number') %]" path="copy.call_number.label" visible></eg-grid-field>
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_in_house_use_list.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_in_house_use_list.tt2
new file mode 100644 (file)
index 0000000..8bf8533
--- /dev/null
@@ -0,0 +1,28 @@
+<!--
+Template for printing in-house uses. Data specific to this template
+includes:
+
+in_house_uses - list; each entry contains:
+
+  * num_uses - number of uses
+  * copy - data for a copy, including the following keys:
+
+              barcode : barcode
+              location.name : shelving location
+              call_number.label : call number
+
+  * title - copy title
+-->
+<div>
+  <div>[% l('You marked the following in-house items used:') %]</div>
+  <hr/>
+  <ol>
+    <li ng-repeat="ihu in in_house_uses">
+      <div>[% l('Barcode: [_1] Uses: [_2]',
+        '{{ihu.copy.barcode}}',
+        '{{ihu.num_uses}}') %]</div>
+    </li>
+  </ol>
+  <hr/>
+  <div>{{current_location.shortname}} {{today | date:'short'}}</div>
+<br/>
index de37438..0e5663b 100644 (file)
@@ -401,7 +401,13 @@ function($scope , $q , egCore , ngToast) {
     };
 
     var seed_copy = {
-        barcode : '33434322323'
+        barcode : '33434322323',
+        call_number : {
+            label : '636.8 JON'
+        },
+        location : {
+            name : 'General Collection'
+        }
     }
 
     var one_hold = {
@@ -449,6 +455,14 @@ function($scope , $q , egCore , ngToast) {
             },
         ],
 
+        in_house_uses : [
+            {
+                num_uses : 3,
+                copy : seed_copy,
+                title : seed_record.title
+            }
+        ],
+
         previous_balance : 8.45,
         payment_total : 2.00,
         payment_applied : 2.00,
index 0904c94..45e9e59 100644 (file)
@@ -121,4 +121,23 @@ function($scope,  egCore,  egGridDataProvider , egConfirmDialog) {
         });
     }
 
+    $scope.print_list = function() {
+        var print_data = { in_house_uses : [] };
+
+        if (checkouts.length == 0) return $q.when();
+
+        angular.forEach(checkouts, function(ihu) {
+            print_data.in_house_uses.push({
+                num_uses : ihu.num_uses,
+                copy : egCore.idl.toHash(ihu.copy),
+                title : ihu.title
+            })
+        });
+
+        return egCore.print.print({
+            template : 'in_house_use_list',
+            scope : print_data
+        });
+    }
+
 }])