From b5e642b6a586f98801d119931cad3d5a866d3bc7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 6 Jun 2014 12:32:06 -0400 Subject: [PATCH] standing penalty creation Signed-off-by: Bill Erickson --- .../src/templates/staff/circ/patron/t_messages.tt2 | 2 +- .../staff/circ/patron/t_new_message_dialog.tt2 | 46 ++++++++++++++++++++++ .../web/js/ui/default/staff/circ/patron/app.js | 41 ++++++++++++++++++- 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/templates/staff/circ/patron/t_new_message_dialog.tt2 diff --git a/Open-ILS/src/templates/staff/circ/patron/t_messages.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_messages.tt2 index 71347e5465..4fa23b4bba 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_messages.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_messages.tt2 @@ -7,7 +7,7 @@ sort="activeSort" revision="activeRevision"> - + + + + + diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 4d49211a27..c10b3d42b8 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -730,8 +730,8 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, * Manages messages */ .controller('PatronMessagesCtrl', - ['$scope','$routeParams','egCore', -function($scope, $routeParams, egCore) { + ['$scope','$routeParams','egCore','$modal', +function($scope, $routeParams, egCore , $modal) { $scope.initTab('messages', $routeParams.id); var usr_id = $routeParams.id; @@ -806,6 +806,43 @@ function($scope, $routeParams, egCore) { }); } + $scope.createPenalty = function() { + $modal.open({ + templateUrl: './circ/patron/t_new_message_dialog', + controller: + ['$scope','$modalInstance','staffPenalties', + function($scope , $modalInstance , staffPenalties) { + $scope.focusNote = true; + $scope.penalties = staffPenalties; + $scope.args = {penalty : 21}; // default to Note + $scope.setPenalty = function(id) { + args.penalty = id; + } + $scope.ok = function(count) { $modalInstance.close($scope.args) } + $scope.cancel = function () { $modalInstance.dismiss() } + }], + resolve : { + staffPenalties : function() { + return egCore.pcrud.search( + // id <= 100 are reserved for system use + 'csp', {id : {'>': 100}}, {}, {atomic : true}); + } + } + }).result.then( + function(args) { + var pen = new egCore.idl.ausp(); + pen.usr(usr_id); + pen.org_unit(egCore.auth.user().ws_ou()); + pen.note(args.note); + pen.standing_penalty(args.penalty); + pen.staff(egCore.auth.user().id()); + pen.set_date('now'); + egCore.pcrud.create(pen).then( + function() { $scope.activeRevision++ }); + } + ); + } + }]) -- 2.11.0