PageSourceSearch

https://effervescent-cupcake-210607.netlify.app/assets/PublicEnrollment-CwxP1wyr.js

js effervescent-cupcake-210607.netlify.app collected 2026-10-03 10:41:06 UTC 15,629 bytes, 1 lines download raw bytes

1import{r as c,j as e,s as v}from"./index-bMFZPluE.js";import{a as j}from"./emailApi-BQfIvn0G.js";import{f as N,P as w}from"./PrivacyPolicy-B2143qp5.js";import{e as k,f as C}from"./educationCatalog-pqwMnMBs.js";import{v as S,n as _}from"./phoneFormatting-bIoASOCT.js";import{C as q}from"./CompactPrivacyNotice-Dx4_VTkN.js";const z=()=>{const d=typeof window<"u"&&["localhost","127.0.0.1"].includes(window.location.hostname),[u,l]=c.useState(!1),[x,m]=c.useState(!1),[n,b]=c.useState(!1),g=[...C],[a,r]=c.useState({studentFirstName:"",studentLastName:"",parentFirstName:"",parentLastName:"",email:"",phone:"",address:"",location:"",province:"Granada",level:"",subjects:[],modality:"",schoolName:"",availability:"",notes:""}),h=t=>{r(s=>({...s,subjects:s.subjects.includes(t)?s.subjects.filter(o=>o!==t):[...s.subjects,t]}))},f=async t=>{if(t.preventDefault(),a.subjects.length===0){alert("Por favor, selecciona al menos una asignatura a reforzar.");return}if(!a.level){alert("Por favor, selecciona el curso exacto del alumno.");return}if(!a.modality){alert("Por favor, selecciona si las clases serán en la academia, a domicilio u online.");return}if(!n){alert("Antes de enviar la matrícula, necesitamos que confirmes la información básica de privacidad.");return}const s=S(a.phone,"telefono de WhatsApp del tutor");if(!s.ok){alert(s.error);return}l(!0);try{const o={name:`${a.studentFirstName} ${a.studentLastName}`.trim(),parent_name:`${a.parentFirstName} ${a.parentLastName}`.trim(),first_name:a.studentFirstName,last_name:a.studentLastName,parent_first_name:a.parentFirstName,parent_last_name:a.parentLastName,email:a.email,phone:_(a.phone),address:a.address,location:a.location,province:a.province,level:a.level,school_name:a.schoolName,subjects:a.subjects.join(", "),modality:a.modality,availability:a.availability,notes:a.notes,privacy_accepted_at:new Date().toISOString(),privacy_version:w,privacy_source:"public_enrollment",guardian_privacy_confirmed:!0,privacy_confirmed:n};if(d){l(!1),m(!0);return}const i=await v.rpc("submit_public_enrollment",{payload:o});if(i&&i.error){console.error("Error guardando la ficha familiar:",i.error),alert("No hemos podido guardar la ficha. Los datos siguen escritos para que puedas intentarlo de nuevo dentro de unos instantes."),l(!1);return}
1const p=typeof i.data=="string"?i.data:"";if(p)try{await j({template:"family_intake_confirmation",recordId:p})}catch(y){console.error("Error al enviar email de bienvenida:",y)}l(!1),m(!0)}catch(o){console.error("Error inesperado en la ficha familiar:",o),l(!1),alert("No hemos podido completar la ficha. Los datos siguen escritos para que puedas volver a intentarlo.")}};return x?e.jsx("div",{className:"min-h-screen bg-gray-900 sm:p-6 flex justify-center items-start font-sans",children:e.jsxs("div",{className:"w-full max-w-md min-h-screen sm:min-h-[80vh] bg-[#F5F7FA] sm:rounded-[40px] flex flex-col justify-center items-center p-6 text-center shadow-2xl",children:[e.jsx("div",{className:"w-24 h-24 bg-green-500 rounded-full flex items-center justify-center text-white text-5xl mb-6 shadow-xl animate-bounce",children:"✅"}),e.jsx("h1",{className:"text-3xl font-black text-gray-900 mb-2",children:"¡Ficha recibida!"}),e.jsxs("p",{className:"text-gray-500 max-w-sm mb-4",children:["Ya tenemos los datos de ",e.jsx("b",{children:a.studentFirstName}),"."]}),e.jsx("div",{className:"bg-blue-50 border border-blue-100 p-4 rounded-xl mb-8 max-w-sm",children:e.jsx("p",{className:"text-blue-800 text-sm font-medium",children:d?"Prueba local completada. No se han guardado datos ni enviado correos.":"Coordinación revisará la solicitud y se pondrá en contacto contigo para confirmar la modalidad, el horario y la disponibilidad. La plaza todavía no queda confirmada con este envío."})}),e.jsx("button",{onClick:()=>window.location.href="/",className:"w-full py-4 bg-gray-900 text-white font-black rounded-xl uppercase tracking-widest text-xs active:scale-95 transition-transform max-w-xs",children:"Volver al inicio"})]})}):e.jsx("div",{className:"min-h-screen bg-gray-900 sm:p-6 flex justify-center items-start font-sans selection:bg-blue-200",children:e.jsxs("div",{className:"w-full max-w-md bg-[#F5F7FA] min-h-screen sm:min-h-[90vh] sm:rounded-[40px] shadow-2xl overflow-hidden relative pb-12",children:[e.jsxs("div",{className:"bg-[#1c74e9] px-6 pt-12 pb-24 sm:rounded-t-[40px] rounded-b-[40px] text-center shadow-lg relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-[-20%] left-[-10%] w-[50%] h-[150%] bg-white/10 rounded-full blur-3xl"}),e.jsx("div",{className:"text-6xl mb-4 relative z-10 transform hover:scale-110 transition-transform",children:"🚀"}),e.jsx("h1",{className:"text-3xl font-black text-white relative z-10 tracking-tight",children:"Matrícula de Alumnos"}),e.jsx("p",{className:"text-blue-200 text-xs font-bold uppercase tracking-widest mt-2 relative z-10",children:"Profe en Casa • Academia • Online"})]}),e.jsxs("form",{onSubmit:f,className:"mx-6 bg-white p-6 sm:p-8 rounded-[32px] shadow-[0_10px_40px_rgba(0,0,0,0.08)] border border-gray-100 -mt-16 relative z-20 space-y-8",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[#1c74e9] text-xs font-black uppercase tracking-widest border-b border-gray-100 pb-2 mb-4",children:"1. Datos Personales"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Nombre (Alumno)"}),e.jsx("input",{"aria-label":"Nombre del alumno",type:"text",required:!0,placeholder:"Ej: Carlos",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.studentFirstName,onChange:t=>r({...a,studentFirstName:t.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Apellidos"}),e.jsx("input",{"aria-label":"Apellidos del alumno",type:"text",required:!0,placeholder:"Ej: Sánchez",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.studentLastName,onChange:t=>r({...a,studentLastName:t.target.value})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Curso / Nivel"}),e.jsxs("select",{"aria-label":"Curso o nivel del alumno",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 roun
1ded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors cursor-pointer",value:a.level,onChange:t=>r({...a,level:t.target.value}),children:[e.jsx("option",{value:"",children:"Selecciona el curso exacto"}),k.map(t=>e.jsx("option",{value:t,children:t},t))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Teléfono (Tutor)"}),e.jsxs("div",{className:"flex items-center w-full bg-gray-50 rounded-2xl border-2 border-gray-100 focus-within:border-[#1c74e9] transition-colors overflow-hidden",children:[e.jsx("span",{className:"bg-gray-100 text-gray-500 font-black text-xs px-2 sm:px-3 py-3 sm:py-4 border-r border-gray-200",children:"+34"}),e.jsx("input",{"aria-label":"Teléfono del tutor",type:"tel",required:!0,placeholder:"600 000 000",className:"w-full bg-transparent p-3 sm:p-4 outline-none text-gray-900 text-sm font-medium",value:a.phone,onChange:t=>r({...a,phone:t.target.value})})]})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:["Colegio / instituto ",e.jsx("span",{className:"text-gray-400",children:"(opcional)"})]}),e.jsx("input",{"aria-label":"Colegio o instituto",type:"text",placeholder:"Ej: IES Trevenque, Sagrado Corazon...",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.schoolName,onChange:t=>r({...a,schoolName:t.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Nombre (Tutor)"}),e.jsx("input",{"aria-label":"Nombre del tutor",type:"text",required:!0,placeholder:"Ej: María",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.parentFirstName,onChange:t=>r({...a,parentFirstName:t.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Apellidos"}),e.jsx("input",{"aria-label":"Apellidos del tutor",type:"text",required:!0,placeholder:"Ej: Moreno",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.parentLastName,onChange:t=>r({...a,parentLastName:t.target.value})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Correo Electrónico"}),e.jsx("input",{"aria-label":"Correo electrónico de la familia",type:"email",required:!0,placeholder:"[email protected]",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.email,onChange:t=>r({...a,email:t.target.value})})]})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-[#1c74e9] text-xs font-black uppercase tracking-widest border-b border-gray-100 pb-2 mb-4",children:"2. Domicilio de Matrícula"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Dirección (Calle, número, piso)"}),e.jsx("input",{"aria-label":"Dirección de matrícula",type:"text",required:!0,placeholder:"Ej: Calle Real 15, 2B",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.address,onChange:t=>r({...a,address:t.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Localidad"}),e.jsx("input",{"aria-label":"Localidad",type:"text",required:!0,placeholder:"Ej: La Zubia",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 roun
1ded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.location,onChange:t=>r({...a,location:t.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Provincia"}),e.jsx("input",{"aria-label":"Provincia",type:"text",required:!0,className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.province,onChange:t=>r({...a,province:t.target.value})})]})]})]})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-[#1c74e9] text-xs font-black uppercase tracking-widest border-b border-gray-100 pb-2 mb-4",children:"3. Detalles de las Clases"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Modalidad de Clase"}),e.jsxs("select",{"aria-label":"Modalidad de clase",required:!0,className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors cursor-pointer",value:a.modality,onChange:t=>r({...a,modality:t.target.value}),children:[e.jsx("option",{value:"",disabled:!0,children:"Selecciona una modalidad"}),e.jsx("option",{value:"Profe en casa (Domicilio)",children:"🏠 Profe en casa (Domicilio)"}),e.jsx("option",{value:"Academia Profe a 3",children:"🏫 Academia Profe a 3"}),e.jsx("option",{value:"Clases Online",children:"💻 Clases Online"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block mb-3",children:"Asignaturas a Reforzar"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(t=>e.jsxs("button",{type:"button",onClick:()=>h(t),className:`px-3 py-2 rounded-xl text-[10px] font-black transition-all border ${a.subjects.includes(t)?"bg-blue-50 border-blue-200 text-[#1c74e9] shadow-sm":"bg-gray-50 border-gray-100 text-gray-500 hover:bg-gray-100"}`,children:[a.subjects.includes(t)&&e.jsx("span",{className:"mr-1",children:"✓"}),t]},t))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 block",children:"Tardes en las que no puede asistir"}),e.jsx("p",{className:"mb-2 pl-1 text-[11px] leading-relaxed text-gray-500",children:"Indicar estas limitaciones nos ayuda a buscar grupo, pero no confirma todavía un horario."}),e.jsx("input",{"aria-label":"Tardes en las que no puede asistir",type:"text",required:!0,placeholder:"Ej: No puede lunes ni miércoles",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.availability,onChange:t=>r({...a,availability:t.target.value})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest pl-1 truncate block",children:"Observaciones (Opcional)"}),e.jsx("textarea",{"aria-label":"Observaciones",rows:2,placeholder:"Necesidades especiales, déficit de atención...",className:"w-full bg-gray-50 text-gray-900 p-3 sm:p-4 rounded-2xl border-2 border-gray-100 outline-none focus:border-[#1c74e9] text-sm font-medium transition-colors",value:a.notes,onChange:t=>r({...a,notes:t.target.value})})]}),e.jsx(q,{summary:N,accepted:n,onChange:b,consentText:"Confirmo que soy madre, padre o tutor legal, he leído la información de privacidad y autorizo el tratamiento de estos datos para gestionar la matrícula y las clases.",footnote:"Lo hemos resumido aquí para que sea claro y cómodo. Si quieres ver el detalle completo, puedes abrir la política de privacidad.",compactHeightClass:"max-h-28"})]})]}),e.jsx("button",{type:"submit",disabled:u||a.subjects.length===0||!n,className:"w-full py-5 bg-[#1c74e9] text-white font-black rounded-2xl shadow-[0_10px_20px_rgba(28,116,233,0.3)] uppercase tracking-widest text-sm active:scale-95 transition-transform disabled:opacity-50 disabled:bg-gray-400 disabled:shadow-none",children:u?"Enviando Datos...":"Enviar Solicitud"}),e.jsx("p",{className:"text-center text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-4",children:"Usaremos tus datos solo para gestionar la solicitud y las clases"})]})]})})};export{z as PublicEnrollment};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.