From afe06721f763e3fcf21e7a084078645b2d35d0b3 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Tue, 20 Jun 2023 19:02:32 +0300 Subject: [PATCH] Keep the same provider while changing services (if possible). --- assets/js/components/appointments_modal.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/js/components/appointments_modal.js b/assets/js/components/appointments_modal.js index 47356f1a..053661cf 100755 --- a/assets/js/components/appointments_modal.js +++ b/assets/js/components/appointments_modal.js @@ -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); + } }); });