From cc8781e6ef662885f0dd644d18733ec89ace6e79 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 5 Jun 2014 16:13:45 -0400 Subject: [PATCH] initial patron (penalty) messages page Signed-off-by: Bill Erickson --- .../src/templates/staff/circ/patron/t_messages.tt2 | 48 +++++++++++++++++++--- .../web/js/ui/default/staff/circ/patron/app.js | 45 ++++++++++++++++++++ 2 files changed, 88 insertions(+), 5 deletions(-) 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 6eedce0e40..3a912929d4 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_messages.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_messages.tt2 @@ -1,6 +1,44 @@ -
-
-
[% l('MESSAGES Development Pending') %]
-
-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 ca05dc8d0e..fc748ab022 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 @@ -733,8 +733,48 @@ function($scope, $q, $routeParams, $timeout, $window, $location, egCore, ['$scope','$routeParams','egCore', function($scope, $routeParams, egCore) { $scope.initTab('messages', $routeParams.id); + var usr_id = $routeParams.id; + + $scope.activeQuery = function() { + return { + usr : usr_id, + '-or' : [ + {stop_date : null}, + {stop_date : {'>' : 'now'}} + ] + } + }; + $scope.activeSort = ['set_date']; + $scope.activeRevision = 0; + + $scope.archiveQuery = function() { + return { + usr : usr_id, + stop_date : {'<=' : 'now'} + } + }; + $scope.archiveSort = ['set_date']; + $scope.archiveRevision = 0; + + + var start = new Date(); // now - 1 year + start.setFullYear(start.getFullYear() - 1), + $scope.dates = { + set_date : start, + stop_date : new Date() + } + + $scope.date_range = function() { + var start = $scope.dates.set_date.toISOString().replace(/T.*/,''); + var end = $scope.dates.stop_date.toISOString().replace(/T.*/,''); + var today = new Date().toISOString().replace(/T.*/,''); + if (end == today) end = 'now'; + return [start, end]; + } + }]) + /** * Manages edit */ @@ -845,6 +885,7 @@ function($scope, $routeParams , $location , egCore , patronSvc , $modal) { $scope.initTab('other', $routeParams.id); var usr_id = $routeParams.id; + // fetch the notes function refreshPage() { $scope.notes = []; egCore.pcrud.search('aun', @@ -856,6 +897,7 @@ function($scope, $routeParams , $location , egCore , patronSvc , $modal) { }); } + // open the new-note dialog and create the note $scope.newNote = function() { $modal.open({ templateUrl: './circ/patron/t_new_note_dialog', @@ -881,10 +923,12 @@ function($scope, $routeParams , $location , egCore , patronSvc , $modal) { ); } + // delete the selected note $scope.deleteNote = function(note) { egCore.pcrud.remove(note).then(function() {refreshPage()}); } + // print the selected note $scope.printNote = function(note) { var hash = egCore.idl.toHash(note); hash.usr = egCore.idl.toHash($scope.patron()); @@ -892,6 +936,7 @@ function($scope, $routeParams , $location , egCore , patronSvc , $modal) { 'default', 'patron_note', {note : hash}); } + // perform the initial note fetch refreshPage(); }]) -- 2.11.0