Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. initialize: function() {
  2. ...
  3.  
  4. var blackout = '#vanilla_configuration_autopay_blackout'
  5. this.blackoutStartLabel = blackout+'_start_input > label'
  6. this.blackoutStart = blackout+'_start'
  7. this.blackoutEndLabel = blackout+'_end_input > label'
  8. this.blackoutEnd = blackout+'_end'
  9.  
  10. ...
  11. },
  12.  
  13. checkBlackoutDates: function () {
  14. var hasDates = $('#vanilla_configuration_has_autopay_blackout_dates:checkbox:checked').length > 0
  15. if (hasDates) {
  16. $(this.blackoutStartLabel).removeClass('muted');
  17. $(this.blackoutStart).prop('disabled', false);
  18. } else {
  19. $(`${this.blackoutStartLabel}, ${this.blackoutEndLabel}`).addClass('muted');
  20. $(`${this.blackoutStart}, ${this.blackoutEnd}`).prop('disabled', true);
  21. $(`${this.blackoutStart}, ${this.blackoutEnd}`).val('');
  22. }
  23. },
  24.  
  25. setBlackoutEndDateChoices: function () {
  26. var startDate = parseInt($(this.blackoutStart).val());
  27.  
  28. if (startDate > 0) {
  29. $(this.blackoutEndLabel).removeClass('muted');
  30. var blackoutEndSelect = $(this.blackoutEnd);
  31.  
  32. blackoutEndSelect.prop('disabled', false);
  33. blackoutEndSelect.empty();
  34. blackoutEndSelect.append($("<option />"));
  35.  
  36. for(i = startDate + 1; i <= 27; i++ ) {
  37. blackoutEndSelect.append($("<option />").val(i).text(i));
  38. }
  39.  
  40. var onLoadBlackoutEnd = blackoutEndSelect.data('id');
  41. if (onLoadBlackoutEnd > 0) {
  42. $('#vanilla_configuration_autopay_blackout_end').val(onLoadBlackoutEnd);
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement