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="edit_dates"
+ label="[% l('Edit Hold Dates') %]"></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('Modify Dates for [_1] Hold(s)', '{{num_holds}}') %]
+ </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">
+ <label for="modify_thaw_date" class="sr-only">[% l('Update Activate Email') %]</label>
+ <input id='modify_thaw_date' ng-model="args.modify_thaw_date" type="checkbox"/>
+ </div>
+ <div class="col-md-4">
+ <label for='thaw_date'>[% l("Hold Activate Date") %]</label>
+ </div>
+ <div class="col-md-7">
+ <input id='thaw_date' eg-date-input
+ ng-disabled="!args.modify_thaw_date" ng-model="args.thaw_date"/>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-1">
+ <label for="modify_request_time" class="sr-only">[% l('Update Phone Number') %]</label>
+ <input id='modify_request_time' ng-model="args.modify_request_time" type="checkbox"/>
+ </div>
+ <div class="col-md-4">
+ <label for='request_time'>[% l("Hold Request Date") %]</label>
+ </div>
+ <div class="col-md-7">
+ <input id='request_time' eg-date-input
+ ng-disabled="!args.modify_request_time" ng-model="args.request_time"/>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-1">
+ <label for="modify_expire_time" class="sr-only">[% l('Update Expire Time') %]</label>
+ <input id='modify_expire_time' ng-model="args.modify_expire_time" type="checkbox"/>
+ </div>
+ <div class="col-md-4">
+ <label for='expire_time'>[% l("Hold Expire Date") %]</label>
+ </div>
+ <div class="col-md-7">
+ <input id='expire_time' eg-date-input
+ ng-disabled="!args.modify_expire_time" ng-model="args.expire_time"/>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-md-1">
+ <label for="modify_shelf_expire_time" class="sr-only">[% l('Update SMS Carrier') %]</label>
+ <input id='modify_shelf_expire_time' ng-model="args.modify_shelf_expire_time" type="checkbox"/>
+ </div>
+ <div class="col-md-4">
+ <label for='shelf_expire_time'>[% l("Shelf Expire Date") %]</label>
+ </div>
+ <div class="col-md-7">
+ <input id='shelf_expire_time' eg-date-input
+ ng-disabled="!args.modify_shelf_expire_time" ng-model="args.shelf_expire_time"/>
+ </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>
+
+
<button type="button" class="close"
ng-click="cancel()" aria-hidden="true">×</button>
<h4 class="modal-title">
- [% l('Edit Hold Notification Settings') %]
+ [% l('Edit Notification Settings for [_1] Hold(s)', '{{num_holds}}') %]
</h4>
</div>
<div class="modal-body">
<hr/>
<div class="row">
<div class="col-md-1">
- <input id='use-email' ng-model="args.update_email_notify" type="checkbox"/>
+ <label for="activate-use-email" class="sr-only">[% l('Update Activate Email') %]</label>
+ <input id='activate-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="row">
<div class="col-md-1">
- <input id='use-phone' ng-model="args.update_phone_notify" type="checkbox"/>
+ <label for="activate-phone-number" class="sr-only">[% l('Update Phone Number') %]</label>
+ <input id='activate-phone-number' ng-model="args.update_phone_notify" type="checkbox"/>
</div>
<div class="col-md-4">
- <label for='use-phone'>[% l("Phone #") %]</label>
+ <label for='phone-number'>[% l("Phone #") %]</label>
</div>
<div class="col-md-7">
- <input type='tel' ng-model="args.phone_notify" ng-disabled="!args.update_phone_notify"/>
+ <input id="phone-number" 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"/>
+ <label for="activate-sms-number" class="sr-only">[% l('Update SMS Number') %]</label>
+ <input id='activate-sms-number' ng-model="args.update_sms_notify" type="checkbox"/>
</div>
<div class="col-md-4">
- <label for='use-sms'>[% l("Text/SMS #") %]</label>
+ <label for='sms-number'>[% l("Text/SMS #") %]</label>
</div>
<div class="col-md-7">
- <input type='tel' ng-model="args.sms_notify" ng-disabled="!args.update_sms_notify"/>
+ <input id="sms-number" 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"/>
+ <label for="activate-sms-carrier" class="sr-only">[% l('Update SMS Carrier') %]</label>
+ <input id='activate-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"
+ <select id='sms-carrier'
+ ng-model="args.sms_carrier"
+ ng-disabled="!args.update_sms_carrier"
ng-options="carrier.name() for carrier in sms_carriers">
</select>
</div>
$scope.edit_notify_prefs = function(items) {
generic_update(items, 'edit_notify_prefs');
}
+ $scope.edit_dates = function(items) {
+ generic_update(items, 'edit_dates');
+ }
}])
function($scope, $modalInstance, sms_carriers) {
$scope.args = {}
$scope.sms_carriers = sms_carriers;
+ $scope.num_holds = hold_ids.length;
$scope.ok = function() {
var vals = hold_ids.map(function(hold_id) {
}).result;
}
+ service.edit_dates = function(hold_ids) {
+ if (!hold_ids.length) return $q.when();
+
+ // collects the fields from the dialog the user wishes to modify
+ function relay_to_update(modal_scope) {
+ var vals = hold_ids.map(function(hold_id) {
+ var val = {id : hold_id};
+ angular.forEach(
+ ['thaw_date', 'request_time', 'expire_time', 'shelf_expire_time'],
+ function(field) {
+ if (modal_scope.args['modify_' + field])
+ val[field] = modal_scope.args[field].toISOString();
+ }
+ );
+
+ return val;
+ });
+
+ console.log(JSON.stringify(vals,null,2));
+ return service.update_holds(vals);
+ }
+
+ return $modal.open({
+ templateUrl : './circ/share/t_hold_dates',
+ controller :
+ ['$scope', '$modalInstance',
+ function($scope, $modalInstance) {
+ var today = new Date();
+ $scope.args = {
+ thaw_date : today,
+ request_time : today,
+ expire_time : today,
+ shelf_expire_time : today
+ }
+ $scope.num_holds = hold_ids.length;
+ $scope.ok = function() {
+ relay_to_update($scope).then($modalInstance.close);
+ }
+ $scope.cancel = function() { $modalInstance.dismiss() }
+ }
+ ],
+ }).result;
+ }
+
return service;
}])
template: '<input type="date"></input>',
replace: true,
link: function(scope, elm, attrs, ngModelCtrl) {
+
+ // since this is a date-only selector, set the time
+ // portion to 00:00:00, which should better match the
+ // user's expectations. Note this allows us to retain
+ // the timezone.
+ function strip_time(date) {
+ date.setHours(0);
+ date.setMinutes(0);
+ date.setSeconds(0);
+ date.setMilliseconds(0);
+ return date;
+ }
+
ngModelCtrl.$formatters.unshift(function (modelValue) {
- return dateFilter(modelValue, 'yyyy-MM-dd');
+ // apply strip_time here in case the user never
+ // modifies the date value.
+ return dateFilter(strip_time(modelValue), 'yyyy-MM-dd');
});
ngModelCtrl.$parsers.unshift(function(viewValue) {
- return new Date(viewValue);
+ return strip_time(new Date(viewValue));
});
},
};