From b23c68900e28815e5c40fef1266b0626b1782992 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 18 Dec 2015 13:18:46 -0500 Subject: [PATCH] add 'add copy alert' action Signed-off-by: Galen Charlton Conflicts: Open-ILS/web/js/ui/default/staff/circ/services/circ.js --- .../templates/staff/cat/item/t_summary_pane.tt2 | 1 + .../staff/circ/checkin/t_checkin_table.tt2 | 4 ++ .../src/templates/staff/circ/patron/t_checkout.tt2 | 4 ++ .../src/templates/staff/circ/renew/t_renew.tt2 | 6 +- .../staff/share/t_add_copy_alert_dialog.tt2 | 40 +++++++++++++ Open-ILS/web/js/ui/default/staff/cat/item/app.js | 5 ++ .../web/js/ui/default/staff/circ/checkin/app.js | 10 ++++ .../js/ui/default/staff/circ/patron/checkout.js | 10 ++++ Open-ILS/web/js/ui/default/staff/circ/renew/app.js | 10 ++++ .../web/js/ui/default/staff/circ/services/circ.js | 12 +++- Open-ILS/web/js/ui/default/staff/services/ui.js | 67 ++++++++++++++++++++++ 11 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/templates/staff/share/t_add_copy_alert_dialog.tt2 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 b6638717ff..e424251e96 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 @@ -167,6 +167,7 @@
[% 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 7c393a1d48..2e411a9e0a 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 @@ 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 97ee423e8e..8e5d115d72 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,10 @@ persist-key="circ.patron.checkout"> + + diff --git a/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 b/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 index 67cbf0ec64..b78125d2f5 100644 --- a/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 +++ b/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 @@ -66,7 +66,11 @@ label="[% l('Abort Transits') %]"> - + + diff --git a/Open-ILS/src/templates/staff/share/t_add_copy_alert_dialog.tt2 b/Open-ILS/src/templates/staff/share/t_add_copy_alert_dialog.tt2 new file mode 100644 index 0000000000..0b97a3fd9e --- /dev/null +++ b/Open-ILS/src/templates/staff/share/t_add_copy_alert_dialog.tt2 @@ -0,0 +1,40 @@ +
+ + + +
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 7eb7be8e2b..e416c597a1 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 @@ -1318,6 +1318,11 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore , return; } + $scope.addCopyAlerts = function(copy_id) { + egCirc.add_copy_alerts([copy_id]).then(function() { + // update grid items? + }); + } $scope.manageCopyAlerts = function(copy_id) { egCirc.manage_copy_alerts([copy_id]).then(function() { // update grid items? 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 39a395f730..d9c9d7cdd8 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,6 +318,16 @@ function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataPro }); } + $scope.addCopyAlerts = function(items) { + var copy_ids = []; + angular.forEach(items, function(item) { + if (item.acp) copy_ids.push(item.acp.id()); + }); + egCirc.add_copy_alerts(copy_ids).then(function() { + // update grid items? + }); + } + $scope.manageCopyAlerts = function(items) { var copy_ids = []; angular.forEach(items, function(item) { 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 d425a0ce93..963a84faf5 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.addCopyAlerts = function(items) { + var copy_ids = []; + angular.forEach(items, function(item) { + if (item.acp) copy_ids.push(item.acp.id()); + }); + egCirc.add_copy_alerts(copy_ids).then(function() { + // update grid items? + }); + } + $scope.manageCopyAlerts = function(items) { var copy_ids = []; angular.forEach(items, function(item) { diff --git a/Open-ILS/web/js/ui/default/staff/circ/renew/app.js b/Open-ILS/web/js/ui/default/staff/circ/renew/app.js index e01369f231..bf104191f1 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/renew/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/renew/app.js @@ -190,6 +190,16 @@ function($scope , $window , $location , egCore , egGridDataProvider , egCirc) { }); } + $scope.addCopyAlerts = function(items) { + var copy_ids = []; + angular.forEach(items, function(item) { + if (item.acp) copy_ids.push(item.acp.id()); + }); + egCirc.add_copy_alerts(copy_ids).then(function() { + // update grid items? + }); + } + $scope.manageCopyAlerts = function(items) { var copy_ids = []; angular.forEach(items, function(item) { 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 2757f900fb..afe8ef134d 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 @@ -5,9 +5,9 @@ angular.module('egCoreMod') .factory('egCirc', - ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egCopyAlertManagerDialog', + ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egAddCopyAlertDialog','egCopyAlertManagerDialog', 'egWorkLog', -function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egCopyAlertManagerDialog, +function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAlertDialog , egCopyAlertManagerDialog, egWorkLog) { var service = { @@ -1213,6 +1213,14 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egCopyAlert }); } + service.add_copy_alerts = function(item_ids) { + return egAddCopyAlertDialog.open({ + copy_ids : item_ids, + ok : function() { }, + cancel : function() {} + }).result.then(function() { }); + } + service.manage_copy_alerts = function(item_ids) { return egCopyAlertManagerDialog.open({ copy_id : item_ids[0], 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 d6b0add173..61a16014ec 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -409,6 +409,73 @@ function($window , egStrings) { }]) /** + * egAddCopyAlertDialog - manage copy alerts + */ +.factory('egAddCopyAlertDialog', + ['$modal','$interpolate','egCore', +function($modal , $interpolate , egCore) { + var service = {}; + + service.open = function(args) { + return $modal.open({ + templateUrl: './share/t_add_copy_alert_dialog', + controller: ['$scope','$q','$modalInstance', + function( $scope , $q , $modalInstance) { + + $scope.copy_ids = args.copy_ids; + egCore.pcrud.search('ccat', + { active : 't' }, + {}, + { atomic : true } + ).then(function (ccat) { + $scope.alert_types = ccat; + }); + + $scope.copy_alert = { + create_staff : egCore.auth.user().id(), + note : '', + temp : false + }; + + $scope.ok = function(copy_alert) { + if (typeof(copy_alert.note) != 'undefined' && + copy_alert.note != '') { + copy_alerts = []; + angular.forEach($scope.copy_ids, function (cp_id) { + var a = new egCore.idl.aca(); + a.isnew(1); + a.create_staff(copy_alert.create_staff); + a.note(copy_alert.note); + a.temp(copy_alert.temp ? 't' : 'f'); + a.copy(cp_id); + a.ack_time(null); + a.alert_type( + $scope.alert_types.filter(function(at) { + return at.id() == copy_alert.alert_type; + })[0] + ); + copy_alerts.push( a ); + }); + if (copy_alerts.length > 0) { + egCore.pcrud.apply(copy_alerts); + } + } + if (args.ok) args.ok(); + $modalInstance.close() + } + $scope.cancel = function() { + if (args.cancel) args.cancel(); + $modalInstance.dismiss(); + } + } + ] + }) + } + + return service; +}]) + +/** * egCopyAlertManagerDialog - manage copy alerts */ .factory('egCopyAlertManagerDialog', -- 2.11.0