</div>
<div class="flex-row">
- <div class="flex-cell">[% l('Alert Message') %]</div>
- <div class="well" style="flex:7">{{copy.alert_message()}}</div>
+ <div class="flex-cell">[% l('Copy Alerts') %]</div>
+ <div id="item-status-alert-msg">
+ <button ng-click="manageCopyAlerts(copy.id())" >[% l('Manage') %]</button>
+ </div>
</div>
</div>
handler="abortTransit"
label="[% l('Cancel Transits') %]">
</eg-grid-action>
+ <eg-grid-action
+ handler="manageCopyAlerts"
+ label="[% l('Acknowledge Alerts') %]">
+ </eg-grid-action>
+
<!-- Show Group -->
<eg-grid-action handler="showBibHolds" group="[% l('Show') %]"
label="[% l('Record Holds') %]">
persist-key="circ.patron.checkout"
dateformat="{{$root.egDateAndTimeFormat}}">
+ <eg-grid-action
+ handler="manageCopyAlerts"
+ label="[% l('Acknowledge Alerts') %]">
+ </eg-grid-action>
+
<eg-grid-field label="[% l('Alert Msg') %]"
path="acp.alert_message"></eg-grid-field>
<button ng-if="canBeAcknowledged(alert)"
class="btn btn-xs btn-default"
ng-click="alert.acked = !alert.acked" >[% l('Acknowledge') %]</button>
+ <button ng-if="canBeRemoved(alert) && mode == 'manage'"
+ class="btn btn-xs btn-default"
+ ng-click="alert.acked = !alert.acked" >[% l('Remove') %]</button>
</div>
</div>
</div>
* Detail view -- shows one copy
*/
.controller('ViewCtrl',
- ['$scope','$q','$location','$routeParams','$timeout','$window','egCore','egItem','egBilling',
-function($scope , $q , $location , $routeParams , $timeout , $window , egCore , itemSvc , egBilling) {
+ ['$scope','$q','$location','$routeParams','$timeout','$window','egCore','egItem','egBilling','egCirc',
+function($scope , $q , $location , $routeParams , $timeout , $window , egCore , itemSvc , egBilling , egCirc) {
var copyId = $routeParams.id;
$scope.args.copyId = copyId;
$scope.tab = $routeParams.tab || 'summary';
return;
}
+ $scope.manageCopyAlerts = function(copy_id) {
+ egCirc.manage_copy_alerts([copy_id]).then(function() {
+ // update grid items?
+ });
+ }
+
$scope.context.toggleDisplay = function() {
$location.path('/cat/item/search');
}
});
itemSvc.print_spine_labels(copy_ids);
}
+
+ $scope.manageCopyAlerts = function(items) {
+ var copy_ids = [];
+ angular.forEach(items, function(item) {
+ if (item.acp) copy_ids.push(item.acp.id());
+ });
+ egCirc.manage_copy_alerts(copy_ids).then(function() {
+ // update grid items?
+ });
+ }
+
}])
}
}
+ $scope.manageCopyAlerts = function(items) {
+ var copy_ids = [];
+ angular.forEach(items, function(item) {
+ if (item.acp) copy_ids.push(item.acp.id());
+ });
+ egCirc.manage_copy_alerts(copy_ids).then(function() {
+ // update grid items?
+ });
+ }
+
$scope.print_receipt = function() {
var print_data = {circulations : []}
});
}
-
+ service.manage_copy_alerts = function(item_ids) {
+ return egCopyAlertManagerDialog.open({
+ copy_id : item_ids[0],
+ mode : 'manage',
+ ok : function() { },
+ cancel : function() {}
+ }).result.then(function() { });
+ }
// alert when copy location alert_message is set.
// This does not affect processing, it only produces a click-through
function($modal , $interpolate , egCore) {
var service = {};
+ service.get_user_copy_alerts = function(copy_id) {
+ return egCore.pcrud.search('aca', { copy : copy_id, ack_time : null },
+ { flesh : 1, flesh_fields : { aca : ['alert_type'] } },
+ { atomic : true }
+ );
+ }
+
service.open = function(args) {
return $modal.open({
templateUrl: './share/t_copy_alert_manager_dialog',
- controller: ['$scope', '$modalInstance',
- function($scope, $modalInstance) {
- $scope.alerts = args.alerts;
+ controller: ['$scope','$q','$modalInstance',
+ function( $scope , $q , $modalInstance) {
+
+ function init(args) {
+ var defer = $q.defer();
+ if (args.copy_id) {
+ service.get_user_copy_alerts(args.copy_id).then(function(aca) {
+ defer.resolve(aca);
+ });
+ } else {
+ defer.resolve(args.alerts);
+ }
+ return defer.promise;
+ }
+
$scope.mode = args.mode || 'checkin';
var next_statuses = [];
var seen_statuses = {};
- angular.forEach($scope.alerts, function(copy_alert) {
- var state = copy_alert.alert_type().state();
- var evt = copy_alert.alert_type().event();
-
- copy_alert.message = copy_alert.note() ||
- egCore.strings.ON_DEMAND_COPY_ALERT[evt][state];
-
- if (copy_alert.temp() == 't') {
- angular.forEach(copy_alert.alert_type().next_status(), function (st) {
- if (!seen_statuses[st]) {
- seen_statuses[st] = true;
- next_statuses.push(st);
- }
- });
- }
+ init(args).then(function(copy_alerts) {
+ $scope.alerts = copy_alerts;
+ angular.forEach($scope.alerts, function(copy_alert) {
+ var state = copy_alert.alert_type().state();
+ var evt = copy_alert.alert_type().event();
+
+ copy_alert.message = copy_alert.note() ||
+ egCore.strings.ON_DEMAND_COPY_ALERT[evt][state];
+
+ if (copy_alert.temp() == 't') {
+ angular.forEach(copy_alert.alert_type().next_status(), function (st) {
+ if (!seen_statuses[st]) {
+ seen_statuses[st] = true;
+ next_statuses.push(st);
+ }
+ });
+ }
+ });
});
// returns a promise resolved with the list of circ mods
$scope.canBeAcknowledged = function(copy_alert) {
return (!copy_alert.ack_time() && copy_alert.temp() == 't');
};
+ $scope.canBeRemoved = function(copy_alert) {
+ return (!copy_alert.ack_time() && copy_alert.temp() == 'f');
+ };
$scope.ok = function() {
var acks = [];