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
1 changed files with 6 additions and 0 deletions

View File

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