// ============ Booking Modal — multi-step consultation flow ============ function BookingModal({ open, onClose }) { const [step, setStep] = React.useState(0); const [data, setData] = React.useState({ specialty: null, doctor: null, date: null, slot: null, name: "", phone: "", email: "", contactPref: "whatsapp", notes: "", }); React.useEffect(() => { if (!open) { setStep(0); } }, [open]); if (!open) return null; const D = window.EUROMED_DATA; const set = (k, v) => setData((x) => ({ ...x, [k]: v })); // Calendar — next 14 days, weekends "limited" (clinic note) const today = new Date(2026, 4, 25); // demo fixed: 25 May 2026 Mon const days = Array.from({ length: 14 }, (_, i) => { const d = new Date(today); d.setDate(d.getDate() + i); return d; }); const SLOTS = ["10:00", "10:30", "11:00", "11:30", "14:00", "14:30", "15:30", "16:00", "16:30", "17:00", "17:30", "18:00"]; const dayLabel = (d) => d.toLocaleDateString("en", { weekday: "short" }); const dayNum = (d) => d.getDate(); const isFri = (d) => d.getDay() === 5; const stepNames = ["Specialty", "Doctor", "Date & time", "Your details", "Confirm"]; const canNext = [ !!data.specialty, !!data.doctor, !!data.date && !!data.slot, data.name.trim().length > 1 && data.phone.trim().length > 5, true, ][step]; const doctorsForSpec = data.specialty ? D.DOCTORS.filter((d) => { const s = data.specialty; if (s.id === "dental") return d.specialty === "Dental"; if (s.id === "hair-transplant" || s.id === "plastic-surgery") return d.specialty === "Plastic Surgery"; if (s.id === "cosmetic-aesthetic") return d.specialty === "Dermatology & Skin" || d.specialty === "Plastic Surgery"; if (s.id === "family-medicine") return d.specialty === "Family Medicine"; if (s.id === "wellness") return d.specialty === "Wellness"; return true; }) : []; return (
e.stopPropagation()}>
{step < 4 ? `Step ${step + 1} / 5 · ${stepNames[step]}` : "All set"}

{step === 0 && "Book a free consultation"} {step === 1 && "Choose a doctor"} {step === 2 && "Pick a date & time"} {step === 3 && "Your contact details"} {step === 4 && "Consultation requested"}

{[0, 1, 2, 3, 4].map((i) =>
)}
{/* Step 0 — Specialty */} {step === 0 && ( <>

Which area is your visit about? Your initial consultation is free — typically 30 minutes with a doctor.

{D.SPECIALTIES.map((s) => ( ))}
)} {/* Step 1 — Doctor */} {step === 1 && ( <>

Pick a consultant, or choose "any available" and we'll match you.

{doctorsForSpec.map((d) => ( ))} {doctorsForSpec.length === 0 && (
No verified profiles yet for this specialty. Select "any available" — we'll call to confirm.
)}
)} {/* Step 2 — Date & time */} {step === 2 && ( <>

Next available slots in the coming two weeks:

{days.map((d, i) => ( ))}
{data.date && ( <>
{SLOTS.map((s) => ( ))}
)} )} {/* Step 3 — Details */} {step === 3 && ( <>

We only collect what's needed to confirm your appointment. No medical history fields at this stage.

set("name", e.target.value)} placeholder="Your name" />
set("phone", e.target.value)} placeholder="+971 …" />
set("email", e.target.value)} placeholder="you@example.com" />
{["whatsapp", "phone", "email"].map((m) => ( ))}