diff --git a/src/components/add-appointment-modal/add-appointment-modal.tsx b/src/components/add-appointment-modal/add-appointment-modal.tsx index 3bf7857..27aff8d 100644 --- a/src/components/add-appointment-modal/add-appointment-modal.tsx +++ b/src/components/add-appointment-modal/add-appointment-modal.tsx @@ -10,6 +10,13 @@ export const AddAppointmentModal = component$( isAddAppointmentModalOpen: Signal }) => { const action = useAddAppointment() + // Default date for the date input comes form ?day on the url or today + const url = new URL(window.location.href) + const day = url.searchParams.get('day') + + const defaultOptionForDate = day + ? day + : new Date().toISOString().split('T')[0] useOn( 'click', @@ -24,6 +31,14 @@ export const AddAppointmentModal = component$( }) ) + useOn( + 'submit', + $(() => { + isAddAppointmentModalOpen.value = false + document.body.style.overflow = 'auto' + }) + ) + return (
@@ -69,12 +84,13 @@ export const AddAppointmentModal = component$( id="date" type="date" class="w-full border border-grayBrandMedium rounded-md px-4 py-2" + defaultValue={defaultOptionForDate} />
{/* time_start and time_end */}
-
+
-
+