fix(appointment): render real slot structure in time picker

The slots API returns data.sessions[].slots[] with start_time (HH:MM),
is_available, and start/end unix timestamps — not the morning/evening +
time/status shape the UI assumed. Add lib/appointmentSlots.js to flatten
sessions into morning/evening by start_time, fetch with doctor.uuid, and
read item.start_time / item.is_available in the slot grid. Derive the
clinic address from the already-loaded doctor.address by location_id
instead of a separate auth-required call.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-15 15:40:21 +03:30
co-authored by Claude Opus 4.8
parent 0e112d2299
commit dcfdedd93c
3 changed files with 37 additions and 45 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ function List({ appo, hour, setHour, value }) {
<li key={idx}>
<Button
onClick={() => setHour(item)}
disabled={item.status !== "available"}
disabled={!item.is_available}
className={`
!w-full !rounded-[8px] !bg-[#EFEFEF] !flex !justify-center !items-center !py-[10px] !px-[14px] !h-[40px] md:!h-[42px] lg:!h-[44px]
${checkHour(item) ? "!bg-[#F79463] " : ""}
@@ -21,11 +21,11 @@ function List({ appo, hour, setHour, value }) {
<p
className={`
text-[16px] font-semibold text-[#525252]
${item.status === "available" ? "text-[#525252]" : "text-[#D7D7D7]"}
${item.is_available ? "text-[#525252]" : "text-[#D7D7D7]"}
${checkHour(item) ? "!text-[#FAFAFA] " : ""}
`}
>
{item.time}
{item.start_time}
</p>
</Button>
</li>