// Lead form (short / extended) const COUNTRIES = [ { c: '+33', n: 'França' }, { c: '+41', n: 'Suíça' }, { c: '+352', n: 'Luxemburgo' }, { c: '+44', n: 'Reino Unido' }, { c: '+1', n: 'EUA / Canadá' }, { c: '+351', n: 'Portugal' }, { c: '+49', n: 'Alemanha' }, ]; const LeadForm = ({ extended = false }) => { const [submitted, setSubmitted] = React.useState(false); const [sending, setSending] = React.useState(false); const [error, setError] = React.useState(''); const [data, setData] = React.useState({ name: '', code: '+33', phone: '', email: '', country: 'França', stayDates: '', situation: '', consent: false, }); const update = (k) => (e) => setData({ ...data, [k]: e.target.type === 'checkbox' ? e.target.checked : e.target.value }); const submit = async (e) => { e.preventDefault(); if (!data.name || !data.phone || !data.email) return; setSending(true); setError(''); const payload = { _subject: `Novo pedido de avaliação — ${data.name}`, Nome: data.name, Telefone: `${data.code} ${data.phone}`, Email: data.email, 'País onde vive': data.country, 'Próxima estadia em Portugal': data.stayDates || '—', 'Situação atual': data.situation || '—', Consentimento: data.consent ? 'Sim' : 'Não', }; try { const res = await fetch('https://formsubmit.co/ajax/andre@r0.pt', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify(payload), }); if (!res.ok) throw new Error('network'); setSubmitted(true); } catch (err) { setError('Não foi possível enviar o pedido. Tente novamente ou contacte-nos por telefone.'); } finally { setSending(false); } }; if (submitted) { return (
A nossa coordenadora clínica entra em contacto consigo em menos de 24h úteis.