PageSourceSearch

https://schoolface.cl/build/assets/TeacherInvitationAccept-DnSJvayj.js

js schoolface.cl collected 2026-10-02 01:21:21 UTC 10,045 bytes, 1 lines download raw bytes

1import{i as r,h as $,j as q,A as z,c as a,a as t,t as i,F as f,e as L,f as x,w as R,r as O,d as v,l as g,v as y,E as Q,B as j,q as G,o as s,k as H}from"./app-BjrRHTkE.js";const J={class:"min-h-screen bg-gradient-to-br from-purple-50 via-white to-green-50 flex items-center justify-center p-4"},K={class:"max-w-lg w-full"},W={key:0,class:"bg-white rounded-2xl shadow-xl p-8 text-center"},X={key:1,class:"bg-white rounded-2xl shadow-xl p-8 text-center"},Y={class:"text-2xl font-bold text-gray-900 mb-2"},Z={class:"text-gray-600 mb-6"},ee={key:2,class:"bg-white rounded-2xl shadow-xl p-8 text-center"},te=["href"],oe={key:3,class:"bg-white rounded-2xl shadow-xl overflow-hidden"},ae={key:0,class:"p-5 border-b bg-purple-50"},se={class:"flex items-center gap-3"},le={class:"w-12 h-12 rounded-full bg-white flex items-center justify-center overflow-hidden flex-shrink-0"},ne=["src"],re={key:1,class:"text-lg font-bold text-purple-600"},ie={class:"font-bold text-gray-900"},ue={class:"text-xs text-gray-500"},de={class:"p-6 space-y-4"},ce={class:"relative"},pe={key:0,class:"flex items-center justify-between gap-2 px-3 py-2 border border-purple-300 bg-purple-50 rounded-lg"},me={class:"min-w-0 flex-1"},xe={class:"text-sm font-medium text-gray-900 truncate"},ve={key:0,class:"text-xs text-gray-500 truncate"},be={key:0,class:"absolute left-0 right-0 mt-1 bg-white border border-gray-200 rounded-lg shadow-lg z-10 max-h-64 overflow-y-auto"},fe={key:0,class:"px-3 py-3 text-sm text-gray-500 text-center"},ge={key:0,class:"px-3 py-3 text-sm text-gray-400 text-center"},ye={key:1,class:"px-3 py-3 text-sm text-gray-500 text-center"},he=["onMousedown"],we={class:"text-sm font-medium text-gray-900"},ke={key:0,class:"text-xs text-gray-500"},_e=["disabled"],Ce={__name:"TeacherInvitationAccept",setup(Se){const C=G(),_=r(!0),h=r(null),c=r(null),B=r(!1),S=r(null),I=r(!1),w=r(!1),p=r([]),m=r(""),k=r(!1),b=r(!1),d=r(null);let V=null;const l=$({name:"",email:"",school_id:"",subject_area:"",bio:""}),T=q(()=>l.name.trim()&&l.email.trim()&&l.school_id);async function D(){var n,e,u;_.value=!0;try{const o=await j.get(`/teacher/invitations/validate/${C.params.token}`);o.data.success&&(c.value=o.data.data.invited_by)}catch(o){const A=(n=o.response)==null?void 0:n.status;h.value={title:A===410?"Invitacion vencida":"Invitacion invalida",message:((u=(e=o.response)==null?void 0:e.data)==null?void 0:u.message)||"Esta invitacion no es valida. Solicita una nueva al docente que te invito."}}finally{_.value=!1}}async function E(n){k.value=!0;try{const e=await j.get("/teacher/invitations/schools",{params:{q:n}});e.data.success&&(p.value=e.data.data)}catch{p.value=[]}finally{k.value=!1}}function M(){b.value=!0,clearTimeout(V);const n=m.value.trim();if(n.length<2){p.value=[],k.value=!1;return}V=setTimeout(()=>E(n),300)}function P(n){d.value=n,l.school_id=n.id,b.value=!1,m.value="",p.value=[]}function F(){d.value=null,l.school_id=""}function N(){setTimeout(()=>{b.value=!1},150)}async function U(){var n,e;if(T.value){w.value=!0;try{const u=await j.post(`/teacher/invitations/accept/${C.params.token}`,{name:l.name,email:l.email,school_id:l.school_id,subject_area:l.subject_area||void 0,bio:l.bio||void 0});u.data.success&&(B.value=!0,S.value=u.data.data.public_url,I.value=u.data.data.promoted===!0)}catch(u){window.$toast&&window.$toast.error(((e=(n=u.response)==null?void 0:n.data)==null?void 0:e.message)||"Error al crear la cuenta")}finally{w.value=!1}}}return z(()=>{D()}),(n,e)=>{const u=O("router-link");return s(),a("div",J,[t("div",K,[_.value?(s(),a("div",W,[...e[6]||(e[6]=[t("div",{class:"animate-spin inline-block text-4xl"},"⌛",-1),t("p",{class:"text-gray-500 mt-4"},"Validando invitacion...",-1)])])):h.value?(s(),a("div",X,[e[7]||(e[7]=t("div",{class:"text-5xl mb-4"},"⚠️",-1)),t("h1",Y,i(h.value.title),1),t("p",Z,i(h.value.message),1),e[8]||(e[8]=t("a",{href:"/",class:"inline-block px-6 py-3 bg-purple-600 text-white rounded-lg font-semibold"}," Ir al inicio ",-1))])):B.value?(s(),a("div",ee,[e[16]||(e[16]=t("div",{class:"text-5xl mb-4"},"🎉",-1)),I.value?(s(),a(f,{key:0},[e[10]||(e[10]=t("h1",{class:"text-2xl font-bold text-gray-900 mb-2"},"¡Ahora tambien eres docente!",-1)),e[11]||(e[11]=t("p",{class:"text-gray-600 mb-4"},[x(" Tu cuenta existente ahora incluye el modo profesor. Inicia sesion normalmente y usa el selector de vista para cambiar entre "),t("strong",null,"Padre"),x(" y "),t("strong",null,"Profesor"),x(". ")],-1)),e[12]||(e[12]=t("div",{class:"bg-purple-50 border border-purple-200 rounded-lg p-4 text-sm text-purple-900 mb-6"}," 💡 En modo Profesor podras subir aportes al contenido educativo e invitar a otros docentes destacados. ",-1)),L(u,{to:"/login",class:"inline-block px-6 py-3 bg-gradient-to-r from-purple-600 to-green-500 text-white rounded-lg font-semibold"},{default:R(()=>[...e[9]||(e[9]=[x(" Ir a iniciar sesion ",-1)])]),_:1})],64)):(s(),a(f,{key:1},[e[13]||(e[13]=t("h1",{class:"text-2xl font-bold text-gray-900 mb-2"},"¡Bienvenido a SchoolFace!",-1)),e[14]||(e[14]=t("p",{class:"text-gray-600 mb-4"}," Tu cuenta de docente esta lista. Revisa tu correo — te enviamos un link magico para acceder al portal. ",-1)),e[15]||(e[15]=t("div",{class:"bg-purple-50 border border-purple-200 rounded-lg p-4 text-sm text-purple-900 mb-6"}," 💡 Cuando entres, podras subir aportes al contenido educativo e invitar a otros docentes que consideres destacados. ",-1)),S.value?(s(),a("a",{key:0,href:S.value,class:"text-purple-600 hover:underline text-sm"}," Ver mi perfil publico ",8,te)):v("",!0)],64))])):(s(),a("div",oe,[e[26]||(e[26]=t("div",{class:"bg-gradient-to-br from-purple-600 to-green-500 p-6 text-white text-center"},[t("div",{class:"text-4xl mb-2"},"🎓"),t("h1",{class:"text-xl font-bold"},"Invitacion a SchoolFace"),t("p",{class:"text-sm opacity-95 mt-1"},"Programa Docentes Destacados")],-1)),c.value?(s(),a("div",ae,[t("div",se,[t("div",le,[c.value.photo_url?(s(),a("img",{key:0,src:c.value.photo_url,alt:"",class:"w-full h-full object-cover"},null,8,ne)):(s(),a("span",re,i((c.value.display_name||"?").charAt(0)),1))]),t("div",null,[e[17]||(e[17]=t("p",{class:"text-xs text-purple-700 font-semibold uppercase tracking-wide"},"Invitado por",-1)),t("p",ie,i(c.value.display_name),1),t("p",ue,i(c.value.school_name),1)])])])):v("",!0),t("div",de,[e[25]||(e[25]=t("p",{class:"text-sm text-gray-600"}," Completa tus datos para unirte a la comunidad de docentes SchoolFace. Podras aportar contenido educativo y compartir tu experiencia con miles de padres y alumnos. ",-1)),t("div",null,[e[18]||(e[18]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Nombre completo *",-1)),g(t("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>l.name=o),type:"text",maxlength:"100",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:border-purple-500 focus:outline-none",placeholder:"Maria Lopez Perez"},null,512),[[y,l.name]])]),t("div",null,[e[19]||(e[19]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Correo electronico *",-1)),g(t("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>l.email=o),type:"email",maxlength:"255",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:border-purple-500 focus:outline-none",placeholder:"[email protected]"},null,512),[[y,l.email]]),e[20]||(e[20]=t("p",{class:"text-xs text-gray-500 mt-1"},"Recibiras un link magico para entrar (no necesitas contrasena).",-1))]),t("div",ce,[e[22]||(e[22]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Colegio donde ejerces *",-1)),d.value?(s(),a("div",pe,[t("div",me,[t("p",xe,i(d.value.name),1),d.value.comuna||d.value.region?(s(),a("p",ve,i([d.value.comuna,d.value.region].filter(
1Boolean).join(" — ")),1)):v("",!0)]),t("button",{onClick:F,type:"button",class:"text-purple-600 hover:text-purple-800 text-sm font-medium flex-shrink-0"},"Cambiar")])):(s(),a(f,{key:1},[g(t("input",{"onUpdate:modelValue":e[2]||(e[2]=o=>m.value=o),onInput:M,onFocus:e[3]||(e[3]=o=>b.value=!0),onBlur:N,type:"text",autocomplete:"off",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:border-purple-500 focus:outline-none",placeholder:"Escribe nombre, comuna o region..."},null,544),[[y,m.value]]),b.value?(s(),a("div",be,[k.value?(s(),a("div",fe,"Buscando...")):(s(),a(f,{key:1},[m.value.trim()?p.value.length===0?(s(),a("div",ye,' Sin resultados para "'+i(m.value)+'" ',1)):v("",!0):(s(),a("div",ge," Escribe al menos 2 letras ")),(s(!0),a(f,null,Q(p.value,o=>(s(),a("button",{key:o.id,type:"button",onMousedown:H(A=>P(o),["prevent"]),class:"w-full text-left px-3 py-2 hover:bg-purple-50 border-b border-gray-100 last:border-0"},[t("p",we,i(o.name),1),o.comuna||o.region?(s(),a("p",ke,i([o.comuna,o.region].filter(Boolean).join(" — ")),1)):v("",!0)],40,he))),128))],64))])):v("",!0),e[21]||(e[21]=t("p",{class:"text-xs text-gray-500 mt-1"},[x(" No encuentras tu colegio? "),t("a",{href:"mailto:[email protected]",class:"text-purple-600 hover:underline"},"Contacta a soporte"),x(". ")],-1))],64))]),t("div",null,[e[23]||(e[23]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Area / Asignatura (opcional)",-1)),g(t("input",{"onUpdate:modelValue":e[4]||(e[4]=o=>l.subject_area=o),type:"text",maxlength:"100",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:border-purple-500 focus:outline-none",placeholder:"Matematica 3° a 6° basico"},null,512),[[y,l.subject_area]])]),t("div",null,[e[24]||(e[24]=t("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Bio corta (opcional)",-1)),g(t("textarea",{"onUpdate:modelValue":e[5]||(e[5]=o=>l.bio=o),rows:"3",maxlength:"2000",class:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:border-purple-500 focus:outline-none text-sm",placeholder:"15 anos ensenando..."},null,512),[[y,l.bio]])]),t("button",{onClick:U,disabled:!T.value||w.value,class:"w-full px-6 py-3 bg-gradient-to-r from-purple-600 to-green-500 text-white rounded-lg font-semibold disabled:opacity-50"},i(w.value?"Creando cuenta...":"Aceptar invitacion"),9,_e)])]))])])}}};export{Ce as default};

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.