From dc1101cfbc930c3be8b79cdb8f5153233208752b 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 | 4 ++ .../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 | 10 ++++ .../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, 95 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 4f03835efa..eb3d68ac6f 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 0ccf9e4bbe..48ba242a6d 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 @@ -25,6 +25,10 @@ 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 57f4b453ba..ebf3e664d4 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 002061eaee..e458532264 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 @@ -1310,8 +1310,8 @@ function($scope , $q , $routeParams , $location , $timeout , $window , egCore , * Detail view -- shows one copy */ .controller('ViewCtrl', - ['$scope','$q','$location','$routeParams','$timeout','$window','egCore','itemSvc','egBilling', -function($scope , $q , $location , $routeParams , $timeout , $window , egCore , itemSvc , egBilling) { + ['$scope','$q','$location','$routeParams','$timeout','$window','egCore','itemSvc','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'; @@ -1696,6 +1696,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 099b1bea73..eac75b15e3 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 @@ -326,5 +326,15 @@ function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataPro }); } + $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 242fa304b6..f5237201f5 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 @@ -1251,7 +1251,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 e7e46a1fed..513378dc3c 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -416,31 +416,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 @@ -474,6 +496,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