-<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>
+
['$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
*/
$scope.initTab('other', $routeParams.id);
var usr_id = $routeParams.id;
+ // fetch the notes
function refreshPage() {
$scope.notes = [];
egCore.pcrud.search('aun',
});
}
+ // open the new-note dialog and create the note
$scope.newNote = function() {
$modal.open({
templateUrl: './circ/patron/t_new_note_dialog',
);
}
+ // 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());
'default', 'patron_note', {note : hash});
}
+ // perform the initial note fetch
refreshPage();
}])