ng-click="alert.acked = !alert.acked" >[% l('Acknowledge') %]</button>
</div>
</div>
- <div>
+ </div>
+ <div ng-if="mode == 'checkin' && next_statuses.length > 0">
+ <div ng-if="next_statuses.length == 1">
+ [% l('Will set copy status to [_1]', '{{next_statuses[0].name()}}') %]
+ </div>
+ <div ng-if="next_statuses.length > 1">
+ <div class="col-md-4">
+ <label for="select-next-status">[% l('Next copy status') %]</label>
+ </div>
+ <div class="col-md-4">
+ <select id="select-next-status" class="form-control"
+ ng-model="params.the_next_status"
+ ng-options="st.id() as st.name() for st in next_statuses">
+ </select>
+ </select>
+ </div>
+ </div>
</div>
<div class="modal-footer">
[% dialog_footer %]
$scope.alerts = args.alerts;
$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);
+ }
+ });
+ }
});
+ // returns a promise resolved with the list of circ mods
+ $scope.get_copy_statuses = function() {
+ if (egCore.env.ccm)
+ return $q.when(egCore.env.ccs.list);
+
+ return egCore.pcrud.retrieveAll('ccs', null, {atomic : true})
+ .then(function(list) {
+ egCore.env.absorbList(list, 'ccs');
+ return list;
+ });
+ };
+
+ $scope.next_statuses = [];
+ $scope.params = {
+ 'the_next_status' : null
+ }
+ if ($scope.mode == 'checkin' && next_statuses.length > 0) {
+ $scope.get_copy_statuses().then(function() {
+ angular.forEach(next_statuses, function(st) {
+ $scope.next_statuses.push(egCore.env.ccs.list[st]);
+ });
+ $scope.params.the_next_status = $scope.next_statuses[0].id();
+ });
+ }
+
$scope.isAcknowledged = function(copy_alert) {
return (copy_alert.acked);
};
$scope.canBeAcknowledged = function(copy_alert) {
- return (!copy_alert.ack_time() && copy_alert.temp());
+ return (!copy_alert.ack_time() && copy_alert.temp() == 't');
};
+
$scope.ok = function() {
var acks = [];
angular.forEach($scope.alerts, function (copy_alert) {
if (acks.length > 0) {
egCore.pcrud.apply(acks);
}
- if (args.ok) args.ok();
+ if (args.ok) args.ok($scope.params.the_next_status);
$modalInstance.close()
}
$scope.cancel = function() {