initial patron (penalty) messages page
authorBill Erickson <berick@esilibrary.com>
Thu, 5 Jun 2014 20:13:45 +0000 (16:13 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 5 Jun 2014 20:13:45 +0000 (16:13 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_messages.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js

index 6eedce0..3a91292 100644 (file)
@@ -1,6 +1,44 @@
-<div class="row pad-vert">
-  <div class="col-md-10 col-md-offset-1">
-    <div class="alert alert-warning">[% l('MESSAGES Development Pending') %]</div>
-  </div>
-</div>
+
+<eg-grid
+  label="[% l('Staff-Generated Penalties / Messages') %]"
+  idl-class="ausp"
+  query="activeQuery"
+  sort="activeSort"
+  revision="activeRevision">
+
+  <eg-grid-menu-item handler="applyPenalty"
+    label="[% l('Apply Penalty / Message') %]"></eg-grid-menu-item>
+
+  <eg-grid-action label="[% l('Remove Penalty / Message') %]" 
+    handler="removePenalty"></eg-grid-action>
+  <eg-grid-action label="[% l('Modify Penalty / Message') %]" 
+    handler="editPenalty"></eg-grid-action>
+  <eg-grid-action label="[% l('Archive Penalty / Message') %]" 
+    handler="archivePenalty"></eg-grid-action>
+
+  <eg-grid-field path="set_date" label="[% l('Applied On') %]"></eg-grid-field>
+  <eg-grid-field path="standing_penalty.label"></eg-grid-field>
+  <eg-grid-field path="org_unit.shortname" label="[% l('Library') %]"></eg-grid-field>
+  <eg-grid-field path="note"></eg-grid-field>
+  <eg-grid-field path="standing_penalty.block_list" required hidden></eg-grid-field>
+  <eg-grid-field path="standing_penalty.*" hidden></eg-grid-field>
+
+</eg-grid>
+
+<eg-grid
+  label="[% l('Archived Penalties / Messages') %]"
+  idl-class="ausp"
+  query="archiveQuery"
+  sort="archiveSort"
+  revision="archiveRevision">
+
+  <eg-grid-field path="set_date" label="[% l('Applied On') %]"></eg-grid-field>
+  <eg-grid-field path="standing_penalty.label"></eg-grid-field>
+  <eg-grid-field path="org_unit.shortname" label="[% l('Library') %]"></eg-grid-field>
+  <eg-grid-field path="note"></eg-grid-field>
+  <eg-grid-field path="standing_penalty.block_list" required hidden></eg-grid-field>
+  <eg-grid-field path="standing_penalty.*" hidden></eg-grid-field>
+
+</eg-grid>
+
 
index ca05dc8..fc748ab 100644 (file)
@@ -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();
 }])