webstaff: add Print Labels action to Copy Buckets
authorJason Etheridge <jason@esilibrary.com>
Mon, 10 Apr 2017 19:36:21 +0000 (15:36 -0400)
committerJason Etheridge <jason@esilibrary.com>
Fri, 14 Apr 2017 03:35:06 +0000 (23:35 -0400)
and some other cosmetic tweaks to the Actions menu

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/src/templates/staff/cat/bucket/copy/t_view.tt2
Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js

index 655e785..ddca768 100644 (file)
 
   [% INCLUDE 'staff/cat/bucket/copy/t_grid_menu.tt2' %]
 
-  <eg-grid-action label="[% l('Request Selected Copies') %]" 
+  <eg-grid-action label="[% l('Remove Selected Copies from Bucket') %]" group="[% l('Bucket') %]"
+    handler="detachCopies"></eg-grid-action>
+  <eg-grid-action label="[% l('Request Selected Copies') %]" group="[% l('Items') %]"
     handler="requestItems"></eg-grid-action>
-  <eg-grid-action label="[% l('Edit Selected Copies') %]" 
+  <eg-grid-action label="[% l('Edit Selected Copies') %]" group="[% l('Items') %]"
     handler="spawnHoldingsEdit"></eg-grid-action>
-  <eg-grid-action label="[% l('Remove Selected Copies from Bucket') %]" 
-    handler="detachCopies"></eg-grid-action>
-  <eg-grid-action label="[% l('Transfer Selected Copies to Marked Volume') %]" 
+  <eg-grid-action handler="print_labels" group="[% l('Show') %]"
+    label="[% l('Print Labels') %]"></eg-grid-action>
+  <eg-grid-action label="[% l('Transfer Selected Copies to Marked Volume') %]" group="[% l('Items') %]"
     handler="transferCopies"></eg-grid-action>
-  <eg-grid-action label="[% l('Delete Selected Copies from Catalog') %]" 
+  <eg-grid-action label="[% l('Delete Selected Copies from Catalog') %]" group="[% l('Items') %]"
     handler="deleteCopiesFromCatalog"></eg-grid-action>
 
   <eg-grid-field path="id" required hidden></eg-grid-field>
index e3b068e..81dde2a 100644 (file)
@@ -473,6 +473,28 @@ function($scope,  $q , $routeParams , $timeout , $window , $uibModal , bucketSvc
         });
     }
 
+    $scope.print_labels = function() {
+        var cp_list = []
+        angular.forEach($scope.gridControls.selectedItems(), function (i) {
+            cp_list.push(i.id);
+        })
+
+        egCore.net.request(
+            'open-ils.actor',
+            'open-ils.actor.anon_cache.set_value',
+            null, 'print-labels-these-copies', {
+                copies : cp_list
+            }
+        ).then(function(key) {
+            if (key) {
+                var url = egCore.env.basePath + 'cat/printlabels/' + key;
+                $timeout(function() { $window.open(url, '_blank') });
+            } else {
+                alert('Could not create anonymous cache key!');
+            }
+        });
+    }
+
     $scope.requestItems = function() {
         var copy_list = $scope.gridControls.selectedItems().map(
             function (i) {