Reset the time selection when the user changes the non-working switch

This commit is contained in:
Alex Tselegidis 2024-04-15 14:16:56 +02:00
parent 8bdb762e9a
commit b8803566df

View file

@ -215,6 +215,11 @@ App.Components.WorkingPlanExceptionsModal = (function () {
); );
} }
function resetTimeSelection() {
App.Utils.UI.setDateTimePickerValue($start, moment('08:00', 'HH:mm').toDate());
App.Utils.UI.setDateTimePickerValue($end, moment('20:00', 'HH:mm').toDate());
}
/** /**
* Open the modal and start adding a new working plan exception. * Open the modal and start adding a new working plan exception.
* *
@ -224,8 +229,8 @@ App.Components.WorkingPlanExceptionsModal = (function () {
deferred = $.Deferred(); deferred = $.Deferred();
App.Utils.UI.setDateTimePickerValue($date, new Date()); App.Utils.UI.setDateTimePickerValue($date, new Date());
App.Utils.UI.setDateTimePickerValue($start, moment('08:00', 'HH:mm').toDate());
App.Utils.UI.setDateTimePickerValue($end, moment('20:00', 'HH:mm').toDate()); resetTimeSelection();
$isNonWorkingDay.prop('checked', false); $isNonWorkingDay.prop('checked', false);
@ -450,11 +455,11 @@ App.Components.WorkingPlanExceptionsModal = (function () {
} }
/** /**
* Event: Is Non Working Day "Change" * Event: Is Non-Working Day "Change"
*/ */
function onIsNonWorkingDayChange() { function onIsNonWorkingDayChange() {
const isNonWorkingDay = $isNonWorkingDay.prop('checked'); const isNonWorkingDay = $isNonWorkingDay.prop('checked');
resetTimeSelection();
toggleFieldsByNonWorkingDay(isNonWorkingDay); toggleFieldsByNonWorkingDay(isNonWorkingDay);
} }