// Multi-step booking flow const SERVICES = [ { id: 'masazas60', name: 'Veido masažas', meta: '60 min', price: '70 €' }, { id: 'masazas90', name: 'Veido masažas', meta: '90 min', price: '100 €' }, { id: 'osteo', name: 'OsteoEstetika seansas', meta: '60 min · pilna diagnostika + korekcija', price: '100 €' }, { id: 'osteo_pratimai', name: 'OsteoEstetika + pratimai', meta: '60 min · su individualiu pratimų rinkiniu', price: '130 €' } ]; const DAYS = ['Pr','An','Tr','Kt','Pn','Št','Sk']; const MONTH_NAME = 'Gegužė 2026'; const buildCalendar = () => { const startOffset = 4; // Pr=0 const daysInMonth = 31; const cells = []; for (let i = 0; i < startOffset; i++) cells.push({ disabled: true, key: `e${i}` }); const today = 5; for (let d = 1; d <= daysInMonth; d++) { const dayOfWeek = (startOffset + d - 1) % 7; // 0=Pr const isSunday = dayOfWeek === 6; const past = d < today; cells.push({ day: d, disabled: past || isSunday, available: !past && !isSunday, key: `d${d}` }); } return cells; }; const SLOTS = ['10:00', '11:30', '13:00', '14:30', '16:00', '17:30']; const Booking = ({ open, onClose, prefill = 'masazas60' }) => { const [step, setStep] = useState(0); const [service, setService] = useState(prefill); const [date, setDate] = useState(null); const [slot, setSlot] = useState(null); const [form, setForm] = useState({ name: '', email: '', phone: '', notes: '' }); const calendar = useMemo(buildCalendar, []); const takenSlots = useMemo(() => { const t = []; if (!date) return t; const seed = date % 6; if (seed === 0) t.push('10:00', '14:30'); if (seed === 1) t.push('11:30'); if (seed === 2) t.push('13:00', '17:30'); if (seed === 3) t.push('16:00'); if (seed === 4) t.push('10:00', '11:30', '16:00'); if (seed === 5) t.push('14:30'); return t; }, [date]); useEffect(() => { if (open) { setStep(0); setService(prefill); setDate(null); setSlot(null); } }, [open, prefill]); if (!open) return null; const selectedService = SERVICES.find(s => s.id === service); const canAdvance = { 0: !!service, 1: !!date && !!slot, 2: form.name && form.email }; const next = () => { if (canAdvance[step]) setStep(step + 1); }; const back = () => setStep(Math.max(0, step - 1)); return (
e.stopPropagation()} style={{ background: 'var(--apricot)', color: 'var(--forest)', width: '100%', maxWidth: 880, padding: 0, position: 'relative' }}>
{step < 3 && ( <>
0 ? 'done' : ''}`}>
1 ? 'done' : ''}`}>
2 ? 'done' : ''}`}>
{step + 1} žingsnis iš 3

{step === 0 && 'Pasirinkite paslaugą'} {step === 1 && 'Pasirinkite laiką'} {step === 2 && 'Jūsų duomenys'}

)} {step === 0 && (
{SERVICES.map(s => ( ))}
)} {step === 1 && (
{MONTH_NAME}
Pr–Št · 10—19
{DAYS.map(d =>
{d}
)}
{calendar.map(c => ( c.disabled ?
{c.day || ''}
: ))}
{date && ( <>
Laisvi laikai · gegužės {date} d.
{SLOTS.map(s => { const taken = takenSlots.includes(s); return ( ); })}
)}
)} {step === 2 && (
setForm({...form, name:e.target.value})} placeholder="Vardas Pavardė" />
setForm({...form, email:e.target.value})} placeholder="jusu@paštas.lt" />
setForm({...form, phone:e.target.value})} placeholder="+370" />