webstaff: Add actions for jumping to item status
authorMike Rylander <mrylander@gmail.com>
Wed, 24 Jun 2015 13:18:47 +0000 (09:18 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Wed, 19 Aug 2015 17:39:18 +0000 (13:39 -0400)
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/cat/catalog/t_holdings.tt2
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js

index 233e202..ae7b2b8 100644 (file)
       checkbox="holdings_show_vols"
       checked="holdings_show_vols"/>
 
+    <eg-grid-action handler="selectedHoldingsItemStatus" group="[% l('Show') %]"
+      label="[% l('Item Status (list)') %]"></eg-grid-action>
+    <eg-grid-action handler="selectedHoldingsItemStatusDetail" group="[% l('Show') %]"
+      label="[% l('Item Status (detail)') %]"></eg-grid-action>
+    <eg-grid-action handler="selectedHoldingsItemStatusTgrEvt" group="[% l('Show') %]"
+      label="[% l('Triggered Events') %]"></eg-grid-action>
 
     <eg-grid-field label="[% l('Owning Library') %]"  path="owner_label" flex="4" align="right" visible></eg-grid-field>
     <eg-grid-field label="[% l('Call Number') %]"     path="call_number.label" visible></eg-grid-field>
index d030db0..8f0ee40 100644 (file)
@@ -147,9 +147,9 @@ function($scope , $routeParams , $location , $q , egCore ) {
 }])
 
 .controller('CatalogCtrl',
-       ['$scope','$routeParams','$location','$q','egCore','egHolds',
+       ['$scope','$routeParams','$location','$window','$q','egCore','egHolds',
         'egGridDataProvider','egHoldGridActions','$timeout','holdingsSvc',
-function($scope , $routeParams , $location , $q , egCore , egHolds, 
+function($scope , $routeParams , $location , $window , $q , egCore , egHolds, 
          egGridDataProvider , egHoldGridActions , $timeout , holdingsSvc) {
 
     // set record ID on page load if available...
@@ -313,6 +313,50 @@ function($scope , $routeParams , $location , $q , egCore , egHolds,
         $scope[item.checkbox + '_changed'](item.checked);
     }
 
+    $scope.selectedHoldingsItemStatus = function (){
+        var cp_id_list = [];
+        angular.forEach(
+            $scope.holdingsGridControls.selectedItems(),
+            function (item) { cp_id_list = cp_id_list.concat(item.id_list) }
+        );
+        var url = egCore.env.basePath + 'cat/item/search/' + cp_id_list.join(',')
+        $timeout(function() { $window.open(url, '_blank') });
+    }
+
+    $scope.selectedHoldingsItemStatusDetail = function (){
+        var cp_id_list = [];
+        angular.forEach(
+            $scope.holdingsGridControls.selectedItems(),
+            function (item) {
+                angular.forEach(
+                    item.id_list,
+                    function (cid) {
+                        var url = egCore.env.basePath +
+                                  'cat/item/' + cid;
+                        $timeout(function() { $window.open(url, '_blank') });
+                    }
+                )
+            }
+        );
+    }
+
+    $scope.selectedHoldingsItemStatusTgrEvt = function (){
+        var cp_id_list = [];
+        angular.forEach(
+            $scope.holdingsGridControls.selectedItems(),
+            function (item) {
+                angular.forEach(
+                    item.id_list,
+                    function (cid) {
+                        var url = egCore.env.basePath +
+                                  'cat/item/' + cid + '/triggered_events';
+                        $timeout(function() { $window.open(url, '_blank') });
+                    }
+                )
+            }
+        );
+    }
+
 
     // ------------------------------------------------------------------
     // Holds 
@@ -645,7 +689,8 @@ function(egCore , $q) {
                         if (!prev_key) {
                             prev_key = cp.owner_list.join('') + cp.call_number.label;
                             if (cp.barcode) current_blob.copy_count = 1;
-                            current_blob.index = ++index;
+                            current_blob.index = index++;
+                            current_blob.id_list = cp.id_list;
                             current_blob.call_number = cp.call_number;
                             current_blob.owner_list = cp.owner_list;
                             current_blob.owner_label = cp.owner_label;
@@ -653,13 +698,15 @@ function(egCore , $q) {
                             var current_key = cp.owner_list.join('') + cp.call_number.label;
                             if (prev_key == current_key) { // collapse into current_blob
                                 current_blob.copy_count++;
+                                current_blob.id_list = current_blob.id_list.concat(cp.id_list);
                             } else {
                                 current_blob.barcode = current_blob.copy_count;
                                 cp_list.push(current_blob);
                                 prev_key = current_key;
                                 current_blob = {};
                                 if (cp.barcode) current_blob.copy_count = 1;
-                                current_blob.index = ++index;
+                                current_blob.index = index++;
+                                current_blob.id_list = cp.id_list;
                                 current_blob.owner_label = cp.owner_label;
                                 current_blob.call_number = cp.call_number;
                                 current_blob.owner_list = cp.owner_list;
@@ -680,7 +727,8 @@ function(egCore , $q) {
                         angular.forEach(cp_list, function (cp) {
                             if (!prev_key) {
                                 prev_key = cp.owner_list.join('');
-                                current_blob.index = ++index;
+                                current_blob.index = index++;
+                                current_blob.id_list = cp.id_list;
                                 current_blob.cn_count = 1;
                                 current_blob.copy_count = cp.copy_count;
                                 current_blob.owner_list = cp.owner_list;
@@ -690,13 +738,15 @@ function(egCore , $q) {
                                 if (prev_key == current_key) { // collapse into current_blob
                                     current_blob.cn_count++;
                                     current_blob.copy_count += cp.copy_count;
+                                    current_blob.id_list = current_blob.id_list.concat(cp.id_list);
                                 } else {
                                     current_blob.barcode = current_blob.copy_count;
                                     current_blob.call_number = { label : current_blob.cn_count };
                                     cn_list.push(current_blob);
                                     prev_key = current_key;
                                     current_blob = {};
-                                    current_blob.index = ++index;
+                                    current_blob.index = index++;
+                                    current_blob.id_list = cp.id_list;
                                     current_blob.owner_label = cp.owner_label;
                                     current_blob.cn_count = 1;
                                     current_blob.copy_count = cp.copy_count;
@@ -740,6 +790,7 @@ function(egCore , $q) {
 
                 angular.forEach(flat, function (cp) {
                     cp.owner_list = owner_name_list;
+                    cp.id_list = [cp.id];
                 });
 
                 service.copies = service.copies.concat(flat);