From 6c6c26099e9a6aec71d70805d43b9320b6e360fc Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 8 Dec 2015 11:22:57 -0500 Subject: [PATCH] add copy alert ack/manage action to checkin, checkout, and item status Signed-off-by: Galen Charlton Conflicts: Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 --- .../templates/staff/cat/item/t_summary_pane.tt2 | 6 ++- .../staff/circ/checkin/t_checkin_table.tt2 | 5 ++ .../src/templates/staff/circ/patron/t_checkout.tt2 | 5 ++ .../staff/share/t_copy_alert_manager_dialog.tt2 | 3 ++ Open-ILS/web/js/ui/default/staff/cat/item/app.js | 10 +++- .../web/js/ui/default/staff/circ/checkin/app.js | 11 ++++ .../js/ui/default/staff/circ/patron/checkout.js | 10 ++++ .../web/js/ui/default/staff/circ/services/circ.js | 9 +++- Open-ILS/web/js/ui/default/staff/services/ui.js | 61 +++++++++++++++------- 9 files changed, 97 insertions(+), 23 deletions(-) diff --git a/Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 b/Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 index 4b9abe3f3f..a24326d14d 100644 --- a/Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 +++ b/Open-ILS/src/templates/staff/cat/item/t_summary_pane.tt2 @@ -177,8 +177,10 @@
-
[% l('Alert Message') %]
-
{{copy.alert_message()}}
+
[% l('Copy Alerts') %]
+
+ +
diff --git a/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 b/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 index 4d34a6148c..51d9dfe870 100644 --- a/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 +++ b/Open-ILS/src/templates/staff/circ/checkin/t_checkin_table.tt2 @@ -31,6 +31,11 @@ handler="abortTransit" label="[% l('Cancel Transits') %]"> + + + 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 9343c92e6c..e54142467e 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -65,6 +65,11 @@ persist-key="circ.patron.checkout" dateformat="{{$root.egDateAndTimeFormat}}"> + + + diff --git a/Open-ILS/src/templates/staff/share/t_copy_alert_manager_dialog.tt2 b/Open-ILS/src/templates/staff/share/t_copy_alert_manager_dialog.tt2 index 2b615e8d8b..e055505ef3 100644 --- a/Open-ILS/src/templates/staff/share/t_copy_alert_manager_dialog.tt2 +++ b/Open-ILS/src/templates/staff/share/t_copy_alert_manager_dialog.tt2 @@ -15,6 +15,9 @@ + 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 2eac88868a..d87ecda35e 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 @@ -510,8 +510,8 @@ function($scope , $q , $routeParams , $location , $timeout , $window , egCore , * Detail view -- shows one copy */ .controller('ViewCtrl', - ['$scope','$q','$location','$routeParams','$timeout','$window','egCore','egItem','egBilling', -function($scope , $q , $location , $routeParams , $timeout , $window , egCore , itemSvc , egBilling) { + ['$scope','$q','$location','$routeParams','$timeout','$window','egCore','egItem','egBilling','egCirc', +function($scope , $q , $location , $routeParams , $timeout , $window , egCore , itemSvc , egBilling , egCirc) { var copyId = $routeParams.id; $scope.args.copyId = copyId; $scope.tab = $routeParams.tab || 'summary'; @@ -896,6 +896,12 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore , return; } + $scope.manageCopyAlerts = function(copy_id) { + egCirc.manage_copy_alerts([copy_id]).then(function() { + // update grid items? + }); + } + $scope.context.toggleDisplay = function() { $location.path('/cat/item/search'); } diff --git a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js index 62713e4782..d35dc805b9 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js @@ -384,5 +384,16 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg }); itemSvc.print_spine_labels(copy_ids); } + + $scope.manageCopyAlerts = function(items) { + var copy_ids = []; + angular.forEach(items, function(item) { + if (item.acp) copy_ids.push(item.acp.id()); + }); + egCirc.manage_copy_alerts(copy_ids).then(function() { + // update grid items? + }); + } + }]) 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 e85a3f753d..7293cdfe35 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 @@ -205,6 +205,16 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc , } } + $scope.manageCopyAlerts = function(items) { + var copy_ids = []; + angular.forEach(items, function(item) { + if (item.acp) copy_ids.push(item.acp.id()); + }); + egCirc.manage_copy_alerts(copy_ids).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/circ.js b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js index 78fa40a7d1..595e139957 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js @@ -1276,7 +1276,14 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egCopyAlert }); } - + service.manage_copy_alerts = function(item_ids) { + return egCopyAlertManagerDialog.open({ + copy_id : item_ids[0], + mode : 'manage', + ok : function() { }, + cancel : function() {} + }).result.then(function() { }); + } // alert when copy location alert_message is set. // This does not affect processing, it only produces a click-through diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js index 7d022eb772..989f2f3f3a 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -555,31 +555,53 @@ function($window , egStrings) { function($modal , $interpolate , egCore) { var service = {}; + service.get_user_copy_alerts = function(copy_id) { + return egCore.pcrud.search('aca', { copy : copy_id, ack_time : null }, + { flesh : 1, flesh_fields : { aca : ['alert_type'] } }, + { atomic : true } + ); + } + service.open = function(args) { return $modal.open({ templateUrl: './share/t_copy_alert_manager_dialog', - controller: ['$scope', '$modalInstance', - function($scope, $modalInstance) { - $scope.alerts = args.alerts; + controller: ['$scope','$q','$modalInstance', + function( $scope , $q , $modalInstance) { + + function init(args) { + var defer = $q.defer(); + if (args.copy_id) { + service.get_user_copy_alerts(args.copy_id).then(function(aca) { + defer.resolve(aca); + }); + } else { + defer.resolve(args.alerts); + } + return defer.promise; + } + $scope.mode = args.mode || 'checkin'; var next_statuses = []; var seen_statuses = {}; - angular.forEach($scope.alerts, function(copy_alert) { - var state = copy_alert.alert_type().state(); - var evt = copy_alert.alert_type().event(); - - copy_alert.message = copy_alert.note() || - egCore.strings.ON_DEMAND_COPY_ALERT[evt][state]; - - if (copy_alert.temp() == 't') { - angular.forEach(copy_alert.alert_type().next_status(), function (st) { - if (!seen_statuses[st]) { - seen_statuses[st] = true; - next_statuses.push(st); - } - }); - } + init(args).then(function(copy_alerts) { + $scope.alerts = copy_alerts; + angular.forEach($scope.alerts, function(copy_alert) { + var state = copy_alert.alert_type().state(); + var evt = copy_alert.alert_type().event(); + + copy_alert.message = copy_alert.note() || + egCore.strings.ON_DEMAND_COPY_ALERT[evt][state]; + + if (copy_alert.temp() == 't') { + angular.forEach(copy_alert.alert_type().next_status(), function (st) { + if (!seen_statuses[st]) { + seen_statuses[st] = true; + next_statuses.push(st); + } + }); + } + }); }); // returns a promise resolved with the list of circ mods @@ -613,6 +635,9 @@ function($modal , $interpolate , egCore) { $scope.canBeAcknowledged = function(copy_alert) { return (!copy_alert.ack_time() && copy_alert.temp() == 't'); }; + $scope.canBeRemoved = function(copy_alert) { + return (!copy_alert.ack_time() && copy_alert.temp() == 'f'); + }; $scope.ok = function() { var acks = []; -- 2.11.0