module.exports=[92e3,a=>{"use strict";let b=(0,a.i(70106).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);a.s(["AlertCircle",()=>b],92e3)},14548,a=>{"use strict";let b=(0,a.i(70106).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);a.s(["Save",()=>b],14548)},408,a=>{"use strict";let b=(0,a.i(70106).default)("move-left",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);a.s(["MoveLeft",()=>b],408)},9424,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(50944),e=a.i(408),f=a.i(14548),g=a.i(92e3),h=a.i(38246),i=a.i(78560),j=a.i(5050);let k=(0,j.createServerReference)("4020321960004b317c089dac60deb2af0e4d3ebbfe",j.callServer,void 0,j.findSourceMapURL,"createAdminUser");function l(){let a=(0,d.useRouter)(),[j,l]=(0,c.useState)(null),[m,n]=(0,c.useState)({nombre:"",correo:"",role:"comercial",password:""}),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(null);(0,c.useEffect)(()=>{(async()=>{let{data:{user:a}}=await i.supabase.auth.getUser();if(a){let{data:b}=await i.supabase.from("profiles").select("role").eq("id",a.id).single();l(b)}})()},[]);let s=a=>{n({...m,[a.target.name]:a.target.value}),q&&r(null)},t=async b=>{b.preventDefault(),p(!0),r(null);let c=await k(m);p(!1),c.success?(alert(`Usuario creado correctamente.

Clave generada/asignada: ${c.password}`),a.push("/gestion-corpadein/usuarios"),a.refresh()):r(c.error||"Error al crear el usuario.")};return(0,b.jsxs)("div",{className:"p-6 max-w-2xl mx-auto h-full overflow-y-auto",children:[(0,b.jsxs)(h.default,{href:"/gestion-corpadein/usuarios",className:"text-gray-500 hover:text-navy flex items-center gap-2 text-sm font-bold uppercase tracking-widest mb-6",children:[(0,b.jsx)(e.MoveLeft,{size:16})," Volver a Usuarios"]}),(0,b.jsxs)("div",{className:"bg-white p-8 rounded-lg shadow-sm border border-gray-100",children:[(0,b.jsx)("h1",{className:"text-2xl font-serif font-bold text-navy mb-8",children:"Crear Nuevo Usuario"}),q&&(0,b.jsxs)("div",{className:"bg-red-50 text-red-700 p-4 rounded-lg flex items-start gap-3 mb-6 border border-red-200",children:[(0,b.jsx)(g.AlertCircle,{size:20,className:"mt-0.5 flex-shrink-0"}),(0,b.jsx)("div",{className:"text-sm",children:q})]}),(0,b.jsxs)("form",{onSubmit:t,className:"space-y-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-bold text-navy uppercase tracking-widest mb-2",children:"Nombre Completo *"}),(0,b.jsx)("input",{type:"text",name:"nombre",required:!0,value:m.nombre,onChange:s,className:"w-full border border-gray-300 rounded p-3 text-sm focus:outline-none focus:border-yellow focus:ring-1 focus:ring-yellow"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-bold text-navy uppercase tracking-widest mb-2",children:"Correo Electrónico *"}),(0,b.jsx)("input",{type:"email",name:"correo",required:!0,value:m.correo,onChange:s,className:"w-full border border-gray-300 rounded p-3 text-sm focus:outline-none focus:border-yellow focus:ring-1 focus:ring-yellow"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-bold text-navy uppercase tracking-widest mb-2",children:"Rol en el Sistema *"}),(0,b.jsxs)("select",{name:"role",required:!0,value:m.role,onChange:s,className:"w-full border border-gray-300 rounded p-3 text-sm focus:outline-none focus:border-yellow focus:ring-1 focus:ring-yellow",children:[(0,b.jsx)("option",{value:"comercial",children:"Comercial (CRM Leads)"}),(0,b.jsx)("option",{value:"tecnologia",children:"Soporte Técnico (PQRs)"}),(0,b.jsx)("option",{value:"contabilidad",children:"Contabilidad (PQRs)"}),(0,b.jsx)("option",{value:"academia",children:"Academia (PQRs)"}),(0,b.jsx)("option",{value:"admin_crm",children:"Adm. General CRM (Sin Web)"}),j?.role!=="admin_crm"&&(0,b.jsx)("option",{value:"admin",children:"Administrador Total"}),(0,b.jsx)("option",{value:"candidato",children:"Candidato (Interesado)"}),(0,b.jsx)("option",{value:"estudiante",children:"Estudiante"})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-bold text-navy uppercase tracking-widest mb-2",children:"Contraseña (Opcional)"}),(0,b.jsx)("input",{type:"text",name:"password",value:m.password,onChange:s,placeholder:"Dejar en blanco para generar una aleatoria automáticamente",className:"w-full border border-gray-300 rounded p-3 text-sm focus:outline-none focus:border-yellow focus:ring-1 focus:ring-yellow"})]}),(0,b.jsx)("div",{className:"flex justify-end pt-4 border-t",children:(0,b.jsx)("button",{type:"submit",disabled:o,className:"bg-navy text-white px-8 py-3 text-sm font-bold uppercase tracking-widest flex items-center gap-2 hover:bg-[#8C1515] transition-colors rounded disabled:opacity-50",children:o?"Guardando...":(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(f.Save,{size:18})," Crear Usuario"]})})})]})]})]})}a.s(["default",()=>l],9424)}];

//# sourceMappingURL=_2a72c616._.js.map