From 574884826ca3ff2ac5ef66db2fc448070a509b35 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 2 Sep 2016 17:36:25 -0400 Subject: [PATCH] add a copy alert editor dialog This replaces, in certain contexts, the copy alert manager, which is now used only during checkin/checkout. Signed-off-by: Galen Charlton Conflicts: Open-ILS/web/js/ui/default/staff/circ/services/circ.js --- .../staff/share/t_copy_alert_editor_dialog.tt2 | 55 +++++++++++++++++++ .../web/js/ui/default/staff/circ/services/circ.js | 7 ++- Open-ILS/web/js/ui/default/staff/services/ui.js | 63 ++++++++++++++++++++++ 3 files changed, 121 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/src/templates/staff/share/t_copy_alert_editor_dialog.tt2 diff --git a/Open-ILS/src/templates/staff/share/t_copy_alert_editor_dialog.tt2 b/Open-ILS/src/templates/staff/share/t_copy_alert_editor_dialog.tt2 new file mode 100644 index 0000000000..aad1a6b383 --- /dev/null +++ b/Open-ILS/src/templates/staff/share/t_copy_alert_editor_dialog.tt2 @@ -0,0 +1,55 @@ +
+ + + +
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 85ac5203f6..df703556e6 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 @@ -6,9 +6,9 @@ angular.module('egCoreMod') .factory('egCirc', - ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egAddCopyAlertDialog','egCopyAlertManagerDialog', + ['$uibModal','$q','egCore','egAlertDialog','egConfirmDialog','egAddCopyAlertDialog','egCopyAlertManagerDialog','egCopyAlertEditorDialog', 'egWorkLog', -function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAlertDialog , egCopyAlertManagerDialog, +function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAlertDialog , egCopyAlertManagerDialog, egCopyAlertEditorDialog , egWorkLog) { var service = { @@ -1296,9 +1296,8 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl } service.manage_copy_alerts = function(item_ids) { - return egCopyAlertManagerDialog.open({ + return egCopyAlertEditorDialog.open({ copy_id : item_ids[0], - mode : 'manage', ok : function() { }, cancel : function() {} }).result.then(function() { }); 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 cf44622ab1..370824d968 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -734,6 +734,69 @@ function($uibModal , $interpolate , egCore) { return service; }]) +/** + * egCopyAlertEditorDialog - manage copy alerts + */ +.factory('egCopyAlertEditorDialog', + ['$uibModal','$interpolate','egCore', +function($uibModal , $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.get_copy_alert_types = function() { + return egCore.pcrud.search('ccat', + { active : 't' }, + {}, + { atomic : true } + ); + }; + + service.open = function(args) { + return $uibModal.open({ + templateUrl: './share/t_copy_alert_editor_dialog', + controller: ['$scope','$q','$uibModalInstance', + function( $scope , $q , $uibModalInstance) { + + 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; + } + + init(args).then(function(copy_alerts) { + $scope.copy_alert_list = copy_alerts; + }); + service.get_copy_alert_types().then(function(ccat) { + $scope.alert_types = ccat; + }); + + $scope.ok = function() { + egCore.pcrud.apply($scope.copy_alert_list); + $uibModalInstance.close() + } + $scope.cancel = function() { + if (args.cancel) args.cancel(); + $uibModalInstance.dismiss(); + } + } + ] + }) + } + + return service; +}]) .directive('aDisabled', function() { return { restrict : 'A', -- 2.11.0