s.TEST_NOTIFY_SUCCESS = "[% l('Test Notification sent') %]";
s.TEST_NOTIFY_FAIL = "[% l('Test Notification failed to send') %]";
s.REMOVE_HOLD_SUBSCRIPTIONS = "[% l('Remove selected Hold Groups for user?') %]";
+ s.PENALTY_REFRESH_FAILED = "[% l('Penalty Refresh Failed') %]";
+ s.PENALTY_REFRESH_SUCCESS = "[% l('Penalty Refresh Succeeded') %]";
}]);
</script>
</a>
<ul uib-dropdown-menu>
<li>
+ <a href ng-click="refreshPenalties()">[% l('Refresh Penalties') %]</a>
+ </li>
+ <li>
<a href="./circ/patron/{{patron().id()}}/alerts">
[% l('Display Alerts') %]
</a>
*
* */
.controller('PatronCtrl',
- ['$scope','$q','$location','$filter','egCore','egNet','egUser','egAlertDialog','egConfirmDialog','egPromptDialog','patronSvc','egCirc','hasPermAt',
-function($scope, $q , $location , $filter , egCore , egNet , egUser , egAlertDialog , egConfirmDialog , egPromptDialog , patronSvc , egCirc , hasPermAt) {
+ ['$scope','$q','$location','$filter','egCore','egNet','egUser','egAlertDialog',
+ 'egConfirmDialog','egPromptDialog','patronSvc','egCirc','hasPermAt','ngToast',
+function($scope, $q , $location , $filter , egCore , egNet , egUser , egAlertDialog ,
+ egConfirmDialog , egPromptDialog , patronSvc , egCirc , hasPermAt, ngToast) {
$scope.is_patron_edit = function() {
return Boolean($location.path().match(/patron\/\d+\/edit$/));
});
}
+ $scope.refreshPenalties = function() {
+
+ egNet.request(
+ 'open-ils.actor',
+ 'open-ils.actor.user.penalties.update',
+ egCore.auth.token(), $scope.patron().id()
+
+ ).then(function(resp) {
+
+ if (evt = egCore.evt.parse(resp)) {
+ ngToast.warning(egCore.strings.PENALTY_REFRESH_FAILED);
+ console.error(evt);
+ }
+
+ ngToast.create(egCore.strings.PENALTY_REFRESH_SUCCESS);
+
+ // Depending on which page we're on (e.g. Note/Messages) we
+ // may need to force a full data refresh.
+ setTimeout(function() { location.href = location.href; });
+ });
+ }
+
egCore.hatch.getItem('eg.circ.patron.summary.collapse')
.then(function(val) {$scope.collapsePatronSummary = Boolean(val)});
}])