From 486dd087c2ddbfd0d443ea9ba9503b1ce1339b34 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 Signed-off-by: Galen Charlton Conflicts: Open-ILS/web/js/ui/default/staff/circ/services/circ.js Signed-off-by: Galen Charlton --- .../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 dad33c74c5..9e3793939d 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 @@ -179,6 +179,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 b85db1f718..c0ade10fa7 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 @@ -32,6 +32,10 @@ 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 75256d659e..8980a3391e 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 @@ -94,6 +94,10 @@ dateformat="{{$root.egDateAndTimeFormat}}"> + + 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 7233765d23..7f006ce758 100644 --- a/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 +++ b/Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 @@ -67,7 +67,11 @@ label="[% l('Cancel 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 c2c79f1b40..58a2b7acf6 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 @@ -897,6 +897,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 d5eb59833f..91a3288110 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 @@ -388,6 +388,16 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg itemSvc.print_spine_labels(copy_ids); } + $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 8acad73d8a..1a72654b31 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 @@ -255,6 +255,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 91d589f8c3..1f95cac5d2 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 @@ -200,6 +200,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 dd3c51f0d8..9d4767f26f 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 = { @@ -1339,6 +1339,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 b8dec81cd8..e5985b7ee6 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -572,6 +572,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