- Updated DoctorPage component to accept bookingResources prop for appointment list. - Added serviceQuery function to serialize service item UUIDs for API requests. - Introduced new API endpoints for fetching booking resources and resource slots. - Enhanced tests for new resource-based booking functionality, including resource selection and service availability. - Created ResourceSelect component for selecting appointment types, including doctor and resource options. - Updated appointment submission logic to include resource_uuid in payload when applicable. - Ensured UI reflects changes in booking flow without disrupting existing doctor-centric experience.
57 lines
1.8 KiB
JavaScript
57 lines
1.8 KiB
JavaScript
"use client";
|
||
|
||
import { Button } from "@mui/material";
|
||
import ItemAppointment from "./ItemAppointment";
|
||
import ArrowLeftD from "@/components/icons/ArrowLeftD";
|
||
import Link from "next/link";
|
||
import { bookingState } from "./bookingState";
|
||
|
||
function AppointmentList({ doctor, loading, doctorSlug, bookingLocations = [], bookingResources = [] }) {
|
||
const booking = bookingState(doctor, bookingLocations, bookingResources);
|
||
return (
|
||
<>
|
||
<ul className="hidden sticky top-[122px] sm:top-[150px] mt:top-[178px] lg:top-[206px] lg:flex w-[38%] flex-col justify-start items-center gap-8">
|
||
{doctor && (
|
||
<ItemAppointment
|
||
loading={loading}
|
||
turn={doctor}
|
||
key={doctor.id}
|
||
doctorSlug={doctorSlug}
|
||
booking={booking}
|
||
/>
|
||
)}
|
||
</ul>
|
||
<div
|
||
className="fixed lg:hidden bg-[#FFF] border-t border-transparent border-t-[#D7D7D7] border-solid bottom-0 right-0 w-full p-4 flex items-center justify-between"
|
||
>
|
||
<p className="text-[#05BA58] text-[11px] font-normal">
|
||
{booking.label}
|
||
</p>
|
||
{!booking.enabled ? (
|
||
<Button
|
||
variant="contained"
|
||
className="!py-2 !px-4 gap-1 !text-[14px] !font-medium"
|
||
disabled
|
||
>
|
||
نوبتدهی غیرفعال
|
||
</Button>
|
||
) : (
|
||
<Link href={`/appointment/${doctorSlug}`}>
|
||
<Button
|
||
variant="contained"
|
||
className="!py-2 !px-4 gap-1 !text-[14px] !font-medium"
|
||
>
|
||
دریافت نوبت
|
||
<div className="w-[20px] h-[20px]">
|
||
<ArrowLeftD />
|
||
</div>
|
||
</Button>
|
||
</Link>
|
||
)}
|
||
</div>
|
||
</>
|
||
);
|
||
}
|
||
|
||
export default AppointmentList;
|