1import{n as v,r as s,j as o,c as x,Y as b,a4 as a}from"./index-Coi58JqR.js";import{A}from"./AlunoForm-qv3E315W.js";import{c as j}from"./useStudents-BcSf-T0a.js";import{u as w}from"./useStudentDetail-D3glBKri.js";import"./tabs-CQfs-406.js";import"./index-C69U7ulk.js";import"./index-DHkygX1h.js";import"./AlunoTabPerfil-x4n92KAI.js";import"./select-CfkUYNxU.js";import"./index-BdQq_4o_.js";import"./chevron-down-C0lGxdYF.js";import"./useViaCep-gvrZVah7.js";import"./progress-CZBZ3dPt.js";import"./table-CXaT2fmm.js";import"./command-yujp8iyB.js";import"./popover-CaFUYbbi.js";import"./book-open-cd04T4tA.js";import"./plus-CTPRHN3_.js";import"./calendar-C_R62Ldb.js";import"./eye-BV0R-M7h.js";import"./external-link-BOPeWfy5.js";import"./barcode-DpZbWmCd.js";import"./circle-check-PSnuJ-Wt.js";import"./circle-x-DJ1Bo91T.js";import"./rotate-ccw-CjkHQw_T.js";import"./useCertificateGeneration-D-FFIEOd.js";import"./generateCertificatePdf-DsDODyxx.js";import"./copy-CRsgCX2g.js";import"./download-DY2vzCg4.js";import"./save-B0rPVN71.js";const y={full_name:"",cpf:"",phone:"",birth_date:"",email:"",password:"",status:"active"},N={cep:"",street:"",number:"",complement:"",neighborhood:"",city:"",state:""};function et(){const n=v(),i=j(),c=w(),[t,l]=s.useState(y),[r,p]=s.useState(N),[d,u]=s.useState({}),f=()=>{const e={};return t.full_name.trim()||(e.full_name="Nome completo é obrigatório"),(!t.cpf||t.cpf.replace(/\D/g,"").length!==11)&&(e.cpf="CPF inválido"),t.email.trim()||(e.email="E-mail é obrigatório"),(!t.password||t.password.length<6)&&(e.password="Senha deve ter no mÃnimo 6 caracteres"),u(e),Object.keys(e).length===0},h=async()=>{if(!f()){a.error("Preencha os campos obrigatórios corretamente.");return}try{const e=await i.mutateAsync({full_name:t.full_name,cpf:t.cpf,phone:t.phone,birth_date:t.birth_date,email:t.email,password:t.password,status:t.status});Object.values(r).some(g=>g.trim())&&e&&await c.mutateAsync({studentId:e,data:{cep:r.cep.replace(/\D/g,"")||null,street:r.street||null,number:r.number||null,complement:r.complement||null,neighborhood:r.neighborhood||null,city:r.city||null,state:r.state||null}}),a.success("Aluno cadastrado com sucesso!"),n("/admin/alunos")}catch(e){const m=e instanceof Error?e.message:"Erro ao cadastrar aluno";a.error(m)}};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx(x,{variant:"ghost",size:"icon",onClick:()=>n("/admin/alunos"),children:o.jsx(b,{className:"h-5 w-5"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Novo Aluno"}),o.jsx("p",{className:"text-muted-foreground",children:"Cadastre um novo aluno na plataforma"})]})]}),o.jsx(A,{mode:"create",profileData:t,addressData:r,onProfileChange:l,onAddressChange:p,onSave:h,saving:i.isPending,errors:d})]})}export{et 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.