label="[% l('Activate') %]"></eg-grid-action>
<eg-grid-action handler="suspend"
label="[% l('Suspend') %]"></eg-grid-action>
+ <eg-grid-action handler="set_top_of_queue"
+ label="[% l('Set Top of Queue') %]"></eg-grid-action>
+ <eg-grid-action handler="clear_top_of_queue"
+ label="[% l('Un-Set Top of Queue') %]"></eg-grid-action>
<eg-grid-action handler="cancel_hold"
label="[% l('Cancel Hold') %]"></eg-grid-action>
s.HOLD_STATUS_8 = "[% l('Wrong Shelf') %]";
s.ACTIVATE_HOLDS = "[% l('Activate [_1] Hold(s)?', '{{num_holds}}') %]"
s.SUSPEND_HOLDS = "[% l('Suspend [_1] Hold(s)?', '{{num_holds}}') %]"
+s.SET_TOP_OF_QUEUE =
+ "[% l('Move [_1] Hold(s) to the front of the holds queue above other holds that are not likewise flagged as Top of Queue?',
+ '{{num_holds}}') %]";
+s.CLEAR_TOP_OF_QUEUE =
+ "[% l('Unset the Top of Queue flag for [_1] Hold(s)?', '{{num_holds}}') %]";
}]);
</script>
}).result;
}
- service.activate_holds = function(hold_ids) {
+ service.update_field_with_confirm = function(hold_ids, msg_key, field, value) {
if (!hold_ids.length) return $q.when();
+
return egConfirmDialog.open(
- egCore.strings.ACTIVATE_HOLDS, '', {num_holds : hold_ids.length})
+ egCore.strings[msg_key], '', {num_holds : hold_ids.length})
.result.then(function() {
+
var vals = hold_ids.map(function(hold_id) {
- return {id : hold_id, frozen : false}
+ val = {id : hold_id};
+ val[field] = value;
+ return val;
});
return service.update_holds(vals);
});
}
service.suspend_holds = function(hold_ids) {
- if (!hold_ids.length) return $q.when();
- return egConfirmDialog.open(
- egCore.strings.SUSPEND_HOLDS, '', {num_holds : hold_ids.length})
- .result.then(function() {
- var vals = hold_ids.map(function(hold_id) {
- return {id : hold_id, frozen : true}
- });
- return service.update_holds(vals);
- });
+ return service.update_field_with_confirm(
+ hold_ids, 'SUSPEND_HOLDS', 'frozen', true);
+ }
+
+ service.activate_holds = function(hold_ids) {
+ return service.update_field_with_confirm(
+ hold_ids, 'ACTIVATE_HOLDS', 'frozen', false);
+ }
+
+ service.set_top_of_queue = function(hold_ids) {
+ return service.update_field_with_confirm(
+ hold_ids, 'SET_TOP_OF_QUEUE', 'cut_in_line', true);
}
+ service.clear_top_of_queue = function(hold_ids) {
+ return service.update_field_with_confirm(
+ hold_ids, 'CLEAR_TOP_OF_QUEUE', 'cut_in_line', null);
+ }
return service;
}])