webstaff: give the Holds Shelf a template and print button
authorMike Rylander <mrylander@gmail.com>
Wed, 11 Mar 2015 18:18:04 +0000 (14:18 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:12 +0000 (13:39 -0400)
Also expose both that and the Pull List in the workstation print
interface

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/templates/staff/admin/workstation/t_print_templates.tt2
Open-ILS/src/templates/staff/circ/holds/t_shelf_list.tt2
Open-ILS/src/templates/staff/share/print_templates/t_hold_shelf_list.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/circ/holds/app.js

index cbc79f8..c3f17a1 100644 (file)
@@ -20,6 +20,8 @@
       <option value="hold_shelf_slip">[% l('Hold Shelf Slip') %]</option>
       <option value="holds_for_bibs">[% l('Holds for Bib Record') %]</option>
       <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="patron_address">[% l('Patron Address') %]</option>
       <option value="patron_note">[% l('Patron Note') %]</option>
       <option value="transit_slip">[% l('Transit Slip') %]</option>
index ae2df27..1e3cfa4 100644 (file)
@@ -1,3 +1,6 @@
+<div ng-if="print_list_progress !== null" class="strong-text-2">
+  [% l('Loading... [_1]', '{{print_list_progress}}') %]
+</div>
 
 <eg-grid
   id-field="id"
@@ -20,6 +23,9 @@
   <eg-grid-menu-item handler="clear_holds" disabled="disable_clear"
     label="[% l('Clear These Holds') %]"></eg-grid-menu-item>
 
+  <eg-grid-menu-item handler="print_shelf_list"
+    label="[% l('Print Full List') %]"></eg-grid-menu-item>
+
   <eg-grid-action handler="grid_actions.show_recent_circs"
     label="[% l('Show Last Few Circulations') %]"></eg-grid-action>
   <eg-grid-action handler="grid_actions.show_patrons"
diff --git a/Open-ILS/src/templates/staff/share/print_templates/t_hold_shelf_list.tt2 b/Open-ILS/src/templates/staff/share/print_templates/t_hold_shelf_list.tt2
new file mode 100644 (file)
index 0000000..ce23fe4
--- /dev/null
@@ -0,0 +1,29 @@
+<table id='pull-list-template-table'>
+  <style>
+    #pull-list-template-table td,
+    #pull-list-template-table th {
+      padding: 5px;
+      border: 1px solid #000;
+    }
+  </style>
+  <thead>
+    <tr>
+      <th>[% l('Type') %]</th>
+      <th>[% l('Title') %]</th>
+      <th>[% l('Author') %]</th>
+      <th>[% l('Shelf Location') %]</th>
+      <th>[% l('Call Number') %]</th>
+      <th>[% l('Barcode/Part') %]</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr ng-repeat="hold_data in holds">
+      <td>{{hold_data.hold.hold_type}}</td>
+      <td>{{hold_data.title}}</td>
+      <td>{{hold_data.author}}</td>
+      <td>{{hold_data.copy.location.name}}</td>
+      <td>{{hold_data.volume.label}}</td>
+      <td>{{hold_data.copy.barcode}} {{hold_data.part.label}}</td>
+    </tr>
+  </tbody>
+</table>
index f0f5be5..83bb529 100644 (file)
@@ -202,6 +202,48 @@ function($scope , $q , $routeParams , $window , $location , egCore , egHolds , e
         );
     }
 
+    $scope.print_list_progress = null;
+    $scope.print_shelf_list = function() {
+        var print_holds = [];
+        $scope.print_list_loading = true;
+        $scope.print_list_progress = 0;
+
+        // collect the full list of holds
+        egCore.net.request(
+            'open-ils.circ',
+            'open-ils.circ.captured_holds.id_list.on_shelf.retrieve.authoritative.atomic',
+            egCore.auth.token(), $scope.pickup_ou.id()
+        ).then( function(idlist) {
+
+            egHolds.fetch_holds(idlist).then(
+                function () {
+                    console.debug('printing ' + print_holds.length + ' holds');
+                    // holds fetched, send to print
+                    egCore.print.print({
+                        context : 'default', 
+                        template : 'hold_shelf_list', 
+                        scope : {holds : print_holds}
+                    })
+                },
+                null,
+                function(hold_data) {
+                    $scope.print_list_progress++;
+                    egHolds.local_flesh(hold_data);
+                    print_holds.push(hold_data);
+                    hold_data.title = hold_data.mvr.title();
+                    hold_data.author = hold_data.mvr.author();
+                    hold_data.hold = egCore.idl.toHash(hold_data.hold);
+                    hold_data.copy = egCore.idl.toHash(hold_data.copy);
+                    hold_data.volume = egCore.idl.toHash(hold_data.volume);
+                    hold_data.part = egCore.idl.toHash(hold_data.part);
+                }
+            )
+        }).finally(function() {
+            $scope.print_list_loading = false;
+            $scope.print_list_progress = null;
+        });
+    }
+
     refresh_page();
 
 }])