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=7829f492729247c0ab0300f8fa1f045ea539addc;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 Conflicts: Open-ILS/web/js/ui/default/staff/cat/item/app.js Open-ILS/web/js/ui/default/staff/cat/services/holdings.js --- 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 108267766f..52d36da17c 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 56dcc218c1..1f0bba0c30 100644 --- a/Open-ILS/src/templates/staff/cat/item/t_list.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/t_list.tt2 @@ -72,6 +72,12 @@ {{item['call_number.record.simple_record.title']}} + + + {{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 fe9a8030ba..189aa5c4e0 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -113,6 +113,11 @@ + + {{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 c6d90ece64..cc8ade59d3 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 @@ -1348,6 +1348,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 51678c4169..a077d9c61c 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 @@ -59,7 +59,7 @@ function(egCore) { service.flesh = { flesh : 3, flesh_fields : { - acp : ['call_number','location','status','location','floating','circ_modifier','age_protect'], + acp : ['call_number','location','status','location','floating','circ_modifier','age_protect','copy_alerts'], acn : ['record','prefix','suffix'], bre : ['simple_record','creator','editor'] }, @@ -106,6 +106,10 @@ function(egCore) { if (!flatCopy) { flatCopy = egCore.idl.toHash(copy, true); flatCopy.index = service.index++; + flatCopy.copy_alert_count = copy.copy_alerts().filter(function(aca) { + return !aca.ack_time(); + }).length; + service.copies.unshift(flatCopy); } @@ -821,6 +825,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 3f4ec7d3af..67c64b25d2 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 963a84faf5..44e2dce72e 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 @@ -199,6 +199,17 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , row_item.noncat_count = params.noncat_count; row_item.circ = new egCore.idl.circ(); row_item.circ.due_date(co_resp.evt.payload.noncat_circ.duedate()); + 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; + }); } } @@ -222,6 +233,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 : []}