From: Galen Charlton Date: Fri, 14 Oct 2016 20:00:06 +0000 (-0400) Subject: add alerts column to several grids X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2547ad9edc69383bdf61470152cbe9703afe8c33;p=working%2FEvergreen.git add alerts column to several grids The item status, holdings, and checkout grids now have an alerts column that lists the number of copy alerts associated with the item as well as a button to manage them. Signed-off-by: Galen Charlton Signed-off-by: Galen Charlton Conflicts: Open-ILS/web/js/ui/default/staff/cat/item/app.js Open-ILS/web/js/ui/default/staff/cat/services/holdings.js Signed-off-by: Galen Charlton --- 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 1f82fd55c0..7ef5f5fe86 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_holdings.tt2 @@ -122,6 +122,10 @@ + + {{item['copy_alert_count']}} + + diff --git a/Open-ILS/src/templates/staff/cat/item/t_list.tt2 b/Open-ILS/src/templates/staff/cat/item/t_list.tt2 index f39878e816..b239993ce6 100644 --- a/Open-ILS/src/templates/staff/cat/item/t_list.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/t_list.tt2 @@ -79,7 +79,6 @@ - @@ -131,7 +130,11 @@ - + + {{item['copy_alert_count']}} + + +
diff --git a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 index 4b93b7e036..8b14636e8e 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -144,6 +144,12 @@ + + + {{item['copy_alert_count']}} + + + 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 ca2d59bbc5..e7a9901274 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 @@ -1477,6 +1477,13 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e }); } + $scope.gridCellHandlers = {}; + $scope.gridCellHandlers.copyAlertsEdit = function(id) { + egCirc.manage_copy_alerts([id]).then(function() { + // update grid items? + }); + }; + $scope.transferItems = function (){ var xfer_target = egCore.hatch.getLocalItem('eg.cat.item_transfer_target'); var copy_ids = gatherSelectedHoldingsIds(); diff --git a/Open-ILS/web/js/ui/default/staff/cat/item/app.js b/Open-ILS/web/js/ui/default/staff/cat/item/app.js index 40073ec2f3..2fb8f5f4c1 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/item/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/item/app.js @@ -464,6 +464,13 @@ function($scope , $q , $routeParams , $location , $timeout , $window , egCore , }); } + $scope.gridCellHandlers = {}; + $scope.gridCellHandlers.copyAlertsEdit = function(id) { + egCirc.manage_copy_alerts([id]).then(function() { + // update grid items? + }); + }; + $scope.showBibHolds = function () { angular.forEach(gatherSelectedRecordIds(), function (r) { var url = egCore.env.basePath + 'cat/catalog/record/' + r + '/holds'; diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js b/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js index 1d97a49ddd..d8ecdca699 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/holdings.js @@ -15,7 +15,7 @@ function(egCore , $q) { service.prototype.flesh = { flesh : 2, flesh_fields : { - acp : ['status','location','circ_lib','parts','age_protect'], + acp : ['status','location','circ_lib','parts','age_protect','copy_alerts'], acn : ['prefix','suffix','copies'] } } @@ -117,6 +117,11 @@ function(egCore , $q) { } }); + // create virtual field for copy alert count + angular.forEach(svc.copies, function (cp) { + cp.copy_alert_count = cp.copy_alerts.length; + }); + // create a label using just the unique part of the owner list var index = 0; var prev_owner_list; diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index 1a72654b31..215dd65f26 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -252,6 +252,17 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , // Non-cat circs don't return the full list of circs. // Refresh the list of non-cat circs from the server. patronSvc.getUserNonCats(patronSvc.current.id()); + row_item.copy_alert_count = 0; + } else { + row_item.copy_alert_count = 0; + egCore.pcrud.search( + 'aca', + { copy : co_resp.data.acp.id(), ack_time : null }, + null, + { atomic : true } + ).then(function(list) { + row_item.copy_alert_count = list.length; + }); } } @@ -275,6 +286,13 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , }); } + $scope.gridCellHandlers = {}; + $scope.gridCellHandlers.copyAlertsEdit = function(id) { + egCirc.manage_copy_alerts([id]).then(function() { + // update grid items? + }); + }; + $scope.print_receipt = function() { var print_data = {circulations : []} diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/item.js b/Open-ILS/web/js/ui/default/staff/circ/services/item.js index afbc474e71..5bc0bde2ab 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/item.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/item.js @@ -16,7 +16,7 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog flesh : 3, flesh_fields : { acp : ['call_number','location','status','location','floating','circ_modifier', - 'age_protect','circ_lib'], + 'age_protect','circ_lib','copy_alerts'], acn : ['record','prefix','suffix','label_class'], bre : ['simple_record','creator','editor'] }, @@ -152,6 +152,10 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog flatCopy._duration = copyData.circ.duration(); } flatCopy.index = service.index++; + flatCopy.copy_alert_count = copy.copy_alerts().filter(function(aca) { + return !aca.ack_time(); + }).length; + service.copies.unshift(flatCopy); }