From 6fde8d6fa992d0ee5c3d9f06dc73f29b6faf44fa 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 345eb23933..f6a8f84d32 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 @@ -165,8 +165,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 c79561f1f4..a14ccad17b 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 @@ -24,6 +24,10 @@ handler="abortTransit" label="[% l('Abort 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 b2df9875a0..a489d9f5ac 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -64,6 +64,11 @@ grid-controls="gridControls" persist-key="circ.patron.checkout"> + + + 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 6e411ef595..7eb7be8e2b 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 @@ -959,8 +959,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.tab = $routeParams.tab || 'summary'; $scope.context.page = 'detail'; @@ -1318,6 +1318,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 a9b70ca2b9..39a395f730 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 @@ -318,5 +318,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 8fc38de8d5..d425a0ce93 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 @@ -202,6 +202,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 d771c3eb5c..2757f900fb 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 @@ -1213,7 +1213,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 5f09f586d9..d6b0add173 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