diff --git a/frontend/src/lib/components/account/UserBookingModal.svelte b/frontend/src/lib/components/account/UserBookingModal.svelte index 029a8cf..63e8a92 100644 --- a/frontend/src/lib/components/account/UserBookingModal.svelte +++ b/frontend/src/lib/components/account/UserBookingModal.svelte @@ -146,6 +146,30 @@ return jsDate < todayStart; } + function formatTime(time: string): string { + const parts = time.split(':').map(Number); + const hours = parts[0]; + const minutes = parts.length > 1 ? parts[1] : 0; + if (hours === 12 && minutes === 0) return 'Noon'; + if (hours === 0 && minutes === 0) return 'Midnight'; + const period = hours >= 12 ? 'PM' : 'AM'; + const displayHours = hours % 12 || 12; + return `${displayHours}:${minutes.toString().padStart(2, '0')} ${period}`; + } + + function generateTimeSlots(): string[] { + const slots: string[] = []; + for (let h = 8; h <= 18; h++) { + for (let m = 0; m < 60; m += 30) { + if (h === 18 && m > 0) break; + slots.push(`${String(h).padStart(2, '0')}:${String(m).padStart(2, '0')}`); + } + } + return slots; + } + + const timeSlots = generateTimeSlots(); + async function submitReschedule() { if (!selectedBooking || !rescheduleDate || !rescheduleTime) return; rescheduleSubmitting = true; @@ -427,70 +451,79 @@ {/if} {#if showRescheduleForm} -
-

+
+

Request Reschedule

-
+ +
{ rescheduleDate = d; }} + onchange={(d) => { rescheduleDate = d; rescheduleTime = ''; }} onPlaceholderChange={(p) => { reschedulePlaceholder = p; }} /> +
-
- Preferred Time * - -

We'll confirm the exact time based on availability

+ {#if rescheduleDate} +
+
+ {rescheduleDate.toDate(getLocalTimeZone()).toLocaleDateString('en-GB', { weekday: 'long', day: 'numeric', month: 'short' })} +
+
+ {#each timeSlots as slot (slot)} + + {/each} +
+ {/if} -
- Reason (optional) - -
+
+ Reason (optional) + +
-
- - -
+
+ +
{/if}
{/if} - +
{#if isCancellable}
- +