(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[356],{1428:(e,a,r)=>{Promise.resolve().then(r.bind(r,9958))},9958:(e,a,r)=>{"use strict";r.r(a),r.d(a,{default:()=>n});var s=r(5155),t=r(2115),l=r(6046);function n(){let[e,a]=(0,t.useState)(""),[r,n]=(0,t.useState)(""),[i,o]=(0,t.useState)(""),u=(0,l.useRouter)();async function d(a){a.preventDefault();try{if(!(await fetch("/api/admin/admins",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,email:r,password:i})})).ok)throw Error("Erro ao criar admin");u.push("/admin/admins")}catch(e){alert(e.message)}}return(0,s.jsx)("div",{className:"flex justify-center items-center h-screen bg-gray-100",children:(0,s.jsxs)("form",{onSubmit:d,className:"w-full max-w-md bg-white shadow-md rounded px-8 py-6",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold mb-6",children:"Criar novo Admin"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{htmlFor:"username",className:"block text-gray-700 font-medium mb-1",children:"Username"}),(0,s.jsx)("input",{id:"username",className:"w-full px-3 py-2 border border-gray-300 rounded",type:"text",value:e,onChange:e=>a(e.target.value),placeholder:"Digite o username",required:!0})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{htmlFor:"email",className:"block text-gray-700 font-medium mb-1",children:"Email"}),(0,s.jsx)("input",{id:"email",className:"w-full px-3 py-2 border border-gray-300 rounded",type:"email",value:r,onChange:e=>n(e.target.value),placeholder:"Digite o email",required:!0})]}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("label",{htmlFor:"password",className:"block text-gray-700 font-medium mb-1",children:"Senha"}),(0,s.jsx)("input",{id:"password",className:"w-full px-3 py-2 border border-gray-300 rounded",type:"password",value:i,onChange:e=>o(e.target.value),placeholder:"Digite a senha",required:!0})]}),(0,s.jsx)("button",{type:"submit",className:"w-full bg-blue-600 text-white py-2 rounded font-semibold hover:bg-blue-700 transition-colors",children:"Criar Admin"})]})})}},6046:(e,a,r)=>{"use strict";var s=r(6658);r.o(s,"useParams")&&r.d(a,{useParams:function(){return s.useParams}}),r.o(s,"useRouter")&&r.d(a,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(a,{useSearchParams:function(){return s.useSearchParams}})}},e=>{var a=a=>e(e.s=a);e.O(0,[441,517,358],()=>a(1428)),_N_E=e.O()}]);