Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- initialize: function() {
- ...
- var blackout = '#vanilla_configuration_autopay_blackout'
- this.blackoutStartLabel = blackout+'_start_input > label'
- this.blackoutStart = blackout+'_start'
- this.blackoutEndLabel = blackout+'_end_input > label'
- this.blackoutEnd = blackout+'_end'
- ...
- },
- checkBlackoutDates: function () {
- var hasDates = $('#vanilla_configuration_has_autopay_blackout_dates:checkbox:checked').length > 0
- if (hasDates) {
- $(this.blackoutStartLabel).removeClass('muted');
- $(this.blackoutStart).prop('disabled', false);
- } else {
- $(`${this.blackoutStartLabel}, ${this.blackoutEndLabel}`).addClass('muted');
- $(`${this.blackoutStart}, ${this.blackoutEnd}`).prop('disabled', true);
- $(`${this.blackoutStart}, ${this.blackoutEnd}`).val('');
- }
- },
- setBlackoutEndDateChoices: function () {
- var startDate = parseInt($(this.blackoutStart).val());
- if (startDate > 0) {
- $(this.blackoutEndLabel).removeClass('muted');
- var blackoutEndSelect = $(this.blackoutEnd);
- blackoutEndSelect.prop('disabled', false);
- blackoutEndSelect.empty();
- blackoutEndSelect.append($("<option />"));
- for(i = startDate + 1; i <= 27; i++ ) {
- blackoutEndSelect.append($("<option />").val(i).text(i));
- }
- var onLoadBlackoutEnd = blackoutEndSelect.data('id');
- if (onLoadBlackoutEnd > 0) {
- $('#vanilla_configuration_autopay_blackout_end').val(onLoadBlackoutEnd);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement