label="[% l('Set Desired Copy Quality') %]"></eg-grid-action>
<eg-grid-action handler="edit_pickup_lib"
label="[% l('Edit Pickup Library') %]"></eg-grid-action>
+ <eg-grid-action handler="edit_notify_prefs"
+ label="[% l('Edit Notification Settings') %]"></eg-grid-action>
<eg-grid-action handler="cancel_hold"
label="[% l('Cancel Hold') %]"></eg-grid-action>
--- /dev/null
+<div class="modal-content" id='hold-notify-settings'>
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 class="modal-title">
+ [% l('Edit Hold Notification Settings') %]
+ </h4>
+ </div>
+ <div class="modal-body">
+ <div class="row header-row">
+ <div class="col-md-12">
+ [% l('Check the checkbox next to each field you wish to modify.') %]
+ </div>
+ </div>
+ <hr/>
+ <div class="row">
+ <div class="col-md-1">
+ <input id='use-email' ng-model="args.update_email_notify" type="checkbox"/>
+ </div>
+ <div class="col-md-4">
+ <label for='use-email'>[% l("Send Emails") %]</label>
+ </div>
+ <div class="col-md-7">
+ <input id='use-email' ng-model="args.email_notify"
+ type="checkbox" ng-disabled="!args.update_email_notify"/>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-1">
+ <input id='use-phone' ng-model="args.update_phone_notify" type="checkbox"/>
+ </div>
+ <div class="col-md-4">
+ <label for='use-phone'>[% l("Phone #") %]</label>
+ </div>
+ <div class="col-md-7">
+ <input type='tel' ng-model="args.phone_notify" ng-disabled="!args.update_phone_notify"/>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-1">
+ <input id='use-sms' ng-model="args.update_sms_notify" type="checkbox"/>
+ </div>
+ <div class="col-md-4">
+ <label for='use-sms'>[% l("Text/SMS #") %]</label>
+ </div>
+ <div class="col-md-7">
+ <input type='tel' ng-model="args.sms_notify" ng-disabled="!args.update_sms_notify"/>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-1">
+ <input id='sms-carrier' ng-model="args.update_sms_carrier" type="checkbox"/>
+ </div>
+ <div class="col-md-4">
+ <label for='sms-carrier'>[% l("SMS Carrier") %]</label>
+ </div>
+ <div class="col-md-7">
+ <select ng-model="args.sms_carrier" ng-disabled="!args.update_sms_carrier"
+ ng-options="carrier.name() for carrier in sms_carriers">
+ </select>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-default" ng-click="ok()">[% l('Submit') %]</button>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+ </div>
+</div>
+
+
margin-bottom: 0px; /* bootstrap default is 20px */
}
+#hold-notify-settings div.row { margin-top: 12px; }
+#hold-notify-settings div.row:not(.header-row):nth-child(odd) {
+ background-color: rgb(248, 248, 248);
+}
+#hold-notify-settings div.row:not(.header-row) {
+ border-bottom: 1px solid #CCC;
+}
+
+
[%#
vim: ft=css
%]
$scope.set_copy_quality = function(items) {
generic_update(items, 'set_copy_quality');
}
-
$scope.edit_pickup_lib = function(items) {
generic_update(items, 'edit_pickup_lib');
}
-
+ $scope.edit_notify_prefs = function(items) {
+ generic_update(items, 'edit_notify_prefs');
+ }
}])
service.get_cancel_reasons = function() {
if (egCore.env.ahrcc) return $q.when(egCore.env.ahrcc.list);
return egCore.pcrud.retrieveAll('ahrcc', {}, {atomic : true})
- .then(function(list) {
- egCore.env.absorbList(list, 'ahrcc')
- return list;
- });
+ .then(function(list) { return egCore.env.absorbList(list, 'ahrcc').list });
}
// Updates a batch of holds, notifies on each response.
}).result;
}
+ service.get_sms_carriers = function() {
+ if (egCore.env.csc) return $q.when(egCore.env.csc.list);
+ return egCore.pcrud.retrieveAll('csc', {}, {atomic : true})
+ .then(function(list) { return egCore.env.absorbList(list, 'csc').list });
+ }
+
+ service.edit_notify_prefs = function(hold_ids) {
+ if (!hold_ids.length) return $q.when();
+ return $modal.open({
+ templateUrl : './circ/share/t_hold_notification_prefs',
+ controller :
+ ['$scope', '$modalInstance', 'sms_carriers',
+ function($scope, $modalInstance, sms_carriers) {
+ $scope.args = {}
+ $scope.sms_carriers = sms_carriers;
+ $scope.ok = function() {
+
+ var vals = hold_ids.map(function(hold_id) {
+ var val = {id : hold_id};
+ angular.forEach(
+ ['email', 'phone', 'sms'],
+ function(type) {
+ var key = type + '_notify';
+ if ($scope.args['update_' + key])
+ val[key] = $scope.args[key];
+ }
+ );
+ if ($scope.args.update_sms_carrier)
+ val.sms_carrier = $scope.args.sms_carrier.id();
+ return val;
+ });
+
+ service.update_holds(vals).finally(function() {
+ $modalInstance.close();
+ });
+ }
+ $scope.cancel = function() { $modalInstance.dismiss() }
+ }
+ ],
+ resolve : {
+ sms_carriers : service.get_sms_carriers
+ }
+ }).result;
+ }
+
return service;
}])