Replace selector with variable

This commit is contained in:
Alex Tselegidis 2023-02-20 08:06:12 +01:00
parent 9ec281640e
commit 0d52732489

View file

@ -21,6 +21,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
const $end = $('#working-plan-exceptions-end');
const $breaks = $('#working-plan-exceptions-breaks');
const $save = $('#working-plan-exceptions-save');
const $addBreak = $('.working-plan-exceptions-add-break');
let deferred = null;
let enableSubmit = false;
let enableCancel = false;
@ -29,6 +30,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
* Reset the modal fields back to the original empty state.
*/
function resetModal() {
$addBreak.prop('disabled', false);
$date.val('');
$start.val('');
$end.val('');
@ -298,7 +300,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
// Bind editable and event handlers.
editableTimeCell($newBreak.find('.working-plan-exceptions-break-start, .working-plan-exceptions-break-end'));
$newBreak.find('.working-plan-exceptions-edit-break').trigger('click');
$('.working-plan-exceptions-add-break').prop('disabled', true);
$addBreak.prop('disabled', true);
}
/**
@ -328,7 +330,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$tr.find('.working-plan-exceptions-save-break, .working-plan-exceptions-cancel-break').removeClass('d-none');
$tr.find('select,input:text').addClass('form-control input-sm');
$('.working-plan-exceptions-add-break').prop('disabled', true);
$addBreak.prop('disabled', true);
}
/**
@ -367,7 +369,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
$tr.closest('table')
.find('.working-plan-exceptions-edit-break, .working-plan-exceptions-delete-break')
.removeClass('d-none');
$('.working-plan-exceptions-add-break').prop('disabled', false);
$addBreak.prop('disabled', false);
}
/**
@ -383,7 +385,7 @@ App.Components.WorkingPlanExceptionsModal = (function () {
.find('.working-plan-exceptions-edit-break, .working-plan-exceptions-delete-break')
.removeClass('d-none');
$tr.find('.working-plan-exceptions-save-break, .working-plan-exceptions-cancel-break').addClass('d-none');
$('.working-plan-exceptions-add-break').prop('disabled', false);
$addBreak.prop('disabled', false);
}
/**