forked from mirrors/easyappointments
Do not save the unavailability if no provider was selected
This commit is contained in:
parent
b88952497c
commit
482b0077cd
1 changed files with 6 additions and 1 deletions
|
@ -65,6 +65,11 @@ App.Components.UnavailabilitiesModal = (function () {
|
||||||
$unavailabilitiesModal.find('.modal-message').addClass('d-none');
|
$unavailabilitiesModal.find('.modal-message').addClass('d-none');
|
||||||
$unavailabilitiesModal.find('.is-invalid').removeClass('is-invalid');
|
$unavailabilitiesModal.find('.is-invalid').removeClass('is-invalid');
|
||||||
|
|
||||||
|
if (!$selectProvider.val()) {
|
||||||
|
$selectProvider.addClass('is-invalid');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const startMoment = moment($startDatetime[0]._flatpickr.selectedDates[0]);
|
const startMoment = moment($startDatetime[0]._flatpickr.selectedDates[0]);
|
||||||
|
|
||||||
if (!startMoment.isValid()) {
|
if (!startMoment.isValid()) {
|
||||||
|
@ -100,7 +105,7 @@ App.Components.UnavailabilitiesModal = (function () {
|
||||||
start_datetime: startMoment.format('YYYY-MM-DD HH:mm:ss'),
|
start_datetime: startMoment.format('YYYY-MM-DD HH:mm:ss'),
|
||||||
end_datetime: endMoment.format('YYYY-MM-DD HH:mm:ss'),
|
end_datetime: endMoment.format('YYYY-MM-DD HH:mm:ss'),
|
||||||
notes: $unavailabilitiesModal.find('#unavailability-notes').val(),
|
notes: $unavailabilitiesModal.find('#unavailability-notes').val(),
|
||||||
id_users_provider: $('#unavailability-provider').val()
|
id_users_provider: $selectProvider.val()
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($id.val() !== '') {
|
if ($id.val() !== '') {
|
||||||
|
|
Loading…
Reference in a new issue