(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63209,e=>{"use strict";let a=(0,e.i(75254).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"}]]);e.s(["AlertCircle",()=>a],63209)},56909,e=>{"use strict";let a=(0,e.i(75254).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"}]]);e.s(["Save",()=>a],56909)},15209,e=>{"use strict";let a=(0,e.i(75254).default)("move-left",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);e.s(["MoveLeft",()=>a],15209)},79290,e=>{"use strict";var a=e.i(43476),r=e.i(71645),s=e.i(18566),t=e.i(15209),l=e.i(56909),o=e.i(63209),i=e.i(22016),n=e.i(17927),d=e.i(95187);let c=(0,d.createServerReference)("4020321960004b317c089dac60deb2af0e4d3ebbfe",d.callServer,void 0,d.findSourceMapURL,"createAdminUser");function u(){let e=(0,s.useRouter)(),[d,u]=(0,r.useState)(null),[m,x]=(0,r.useState)({nombre:"",correo:"",role:"comercial",password:""}),[p,b]=(0,r.useState)(!1),[f,h]=(0,r.useState)(null);(0,r.useEffect)(()=>{(async()=>{let{data:{user:e}}=await n.supabase.auth.getUser();if(e){let{data:a}=await n.supabase.from("profiles").select("role").eq("id",e.id).single();u(a)}})()},[]);let v=e=>{x({...m,[e.target.name]:e.target.value}),f&&h(null)},y=async a=>{a.preventDefault(),b(!0),h(null);let r=await c(m);b(!1),r.success?(alert(`Usuario creado correctamente.

Clave generada/asignada: ${r.password}`),e.push("/gestion-corpadein/usuarios"),e.refresh()):h(r.error||"Error al crear el usuario.")};return(0,a.jsxs)("div",{className:"p-6 max-w-2xl mx-auto h-full overflow-y-auto",children:[(0,a.jsxs)(i.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,a.jsx)(t.MoveLeft,{size:16})," Volver a Usuarios"]}),(0,a.jsxs)("div",{className:"bg-white p-8 rounded-lg shadow-sm border border-gray-100",children:[(0,a.jsx)("h1",{className:"text-2xl font-serif font-bold text-navy mb-8",children:"Crear Nuevo Usuario"}),f&&(0,a.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,a.jsx)(o.AlertCircle,{size:20,className:"mt-0.5 flex-shrink-0"}),(0,a.jsx)("div",{className:"text-sm",children:f})]}),(0,a.jsxs)("form",{onSubmit:y,className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-bold text-navy uppercase tracking-widest mb-2",children:"Nombre Completo *"}),(0,a.jsx)("input",{type:"text",name:"nombre",required:!0,value:m.nombre,onChange:v,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,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-bold text-navy uppercase tracking-widest mb-2",children:"Correo Electrónico *"}),(0,a.jsx)("input",{type:"email",name:"correo",required:!0,value:m.correo,onChange:v,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,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-bold text-navy uppercase tracking-widest mb-2",children:"Rol en el Sistema *"}),(0,a.jsxs)("select",{name:"role",required:!0,value:m.role,onChange:v,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,a.jsx)("option",{value:"comercial",children:"Comercial (CRM Leads)"}),(0,a.jsx)("option",{value:"tecnologia",children:"Soporte Técnico (PQRs)"}),(0,a.jsx)("option",{value:"contabilidad",children:"Contabilidad (PQRs)"}),(0,a.jsx)("option",{value:"academia",children:"Academia (PQRs)"}),(0,a.jsx)("option",{value:"admin_crm",children:"Adm. General CRM (Sin Web)"}),d?.role!=="admin_crm"&&(0,a.jsx)("option",{value:"admin",children:"Administrador Total"}),(0,a.jsx)("option",{value:"candidato",children:"Candidato (Interesado)"}),(0,a.jsx)("option",{value:"estudiante",children:"Estudiante"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-xs font-bold text-navy uppercase tracking-widest mb-2",children:"Contraseña (Opcional)"}),(0,a.jsx)("input",{type:"text",name:"password",value:m.password,onChange:v,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,a.jsx)("div",{className:"flex justify-end pt-4 border-t",children:(0,a.jsx)("button",{type:"submit",disabled:p,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:p?"Guardando...":(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Save,{size:18})," Crear Usuario"]})})})]})]})]})}e.s(["default",()=>u],79290)}]);