Keep the same provider while changing services (if possible).

This commit is contained in:
Alex Tselegidis 2023-06-20 19:02:32 +03:00
parent 03fbc518da
commit afe06721f7

View file

@ -328,6 +328,8 @@ App.Components.AppointmentsModal = (function () {
*/
$selectService.on('change', () => {
const serviceId = $selectService.val();
const providerId = $selectProvider.val();
$selectProvider.empty();
@ -364,6 +366,10 @@ App.Components.AppointmentsModal = (function () {
$selectProvider.append(new Option(provider.first_name + ' ' + provider.last_name, provider.id));
}
});
if ($selectProvider.find(`option[value="${providerId}"]`).length) {
$selectProvider.val(providerId);
}
});
});