From: Mike Rylander Date: Wed, 24 Jun 2015 13:39:46 +0000 (-0400) Subject: webstaff: Simplify logic of grouped items; Add mark missing/damaged; Add show item... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=06c9e18fb7aa586d3e3cc3b5cb4fc6c39346f49f;p=evergreen%2Fmasslnc.git webstaff: Simplify logic of grouped items; Add mark missing/damaged; Add show item holds Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 index ae7b2b88f4..1d9dfd8c9b 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 @@ -39,6 +39,12 @@ label="[% l('Item Status (detail)') %]"> + + + diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 8f0ee40f1b..708cc56a97 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -147,9 +147,9 @@ function($scope , $routeParams , $location , $q , egCore ) { }]) .controller('CatalogCtrl', - ['$scope','$routeParams','$location','$window','$q','egCore','egHolds', + ['$scope','$routeParams','$location','$window','$q','egCore','egHolds','egCirc', 'egGridDataProvider','egHoldGridActions','$timeout','holdingsSvc', -function($scope , $routeParams , $location , $window , $q , egCore , egHolds, +function($scope , $routeParams , $location , $window , $q , egCore , egHolds , egCirc, egGridDataProvider , egHoldGridActions , $timeout , holdingsSvc) { // set record ID on page load if available... @@ -313,50 +313,81 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds, $scope[item.checkbox + '_changed'](item.checked); } - $scope.selectedHoldingsItemStatus = function (){ + function gatherSelectedHoldingsIds () { 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(',') + return cp_id_list; + } + + $scope.selectedHoldingsItemStatus = function (){ + var url = egCore.env.basePath + 'cat/item/search/' + gatherSelectedHoldingsIds().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') }); - } - ) + gatherSelectedHoldingsIds(), + 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') }); - } - ) + gatherSelectedHoldingsIds(), + function (cid) { + var url = egCore.env.basePath + + 'cat/item/' + cid + '/triggered_events'; + $timeout(function() { $window.open(url, '_blank') }); } ); } + $scope.selectedHoldingsItemStatusHolds = function (){ + angular.forEach( + gatherSelectedHoldingsIds(), + function (cid) { + var url = egCore.env.basePath + + 'cat/item/' + cid + '/holds'; + $timeout(function() { $window.open(url, '_blank') }); + } + ); + } + + $scope.selectedHoldingsDamaged = function () { + egCirc.mark_damaged(gatherSelectedHoldingsIds()).then(function() { + holdingsSvc.fetch({ + rid : $scope.record_id, + org : $scope.holdings_ou, + copy: $scope.holdings_show_copies, + vol : $scope.holdings_show_vols, + empty: $scope.holdings_show_empty + }).then(function() { + $scope.holdingsGridDataProvider.refresh(); + }); + }); + } + + $scope.selectedHoldingsMissing = function () { + egCirc.mark_missing(gatherSelectedHoldingsIds()).then(function() { + holdingsSvc.fetch({ + rid : $scope.record_id, + org : $scope.holdings_ou, + copy: $scope.holdings_show_copies, + vol : $scope.holdings_show_vols, + empty: $scope.holdings_show_empty + }).then(function() { + $scope.holdingsGridDataProvider.refresh(); + }); + }); + } + // ------------------------------------------------------------------ // Holds