1import{j as e,u as q}from"./vendor-query-CAW0R6Fd.js";import{r as i}from"./vendor-react-BIBNHc4z.js";import{a1 as M,a2 as z,a3 as O,a4 as R,o as B,ay as H,av as k,aa as G,B as F,aA as T,aD as V,ap as Y,F as K,c as P,aq as Q,D as U,a5 as J}from"./index-C_R5rWGT.js";import{T as W}from"./TransparenciaHeader-4ORKcxC3.js";import{B as X,a as Z,b as w,c as A,d as $,e as ee}from"./breadcrumb-C1LuqwtI.js";import{u as ae,T as se}from"./TransparenciaFilters-0xVAN1rB.js";import{T as oe,a as E}from"./TransparenciaTable-e4Ma-pK-.js";import{T as re}from"./TransparenciaPagination-C91D0Ze-.js";import{g as I,r as te}from"./editais-acessos.service-DL0iLoty.js";import{o as ne,s as S,b as ie,u as le}from"./forms-uwRdMfcM.js";import{t as ce}from"./zod-IqxFUo6k.js";import{I as D}from"./input-4p3IH3lf.js";import{C as de}from"./checkbox-_pU9_FFU.js";import{F as me,a as b,b as _,c as C,d as v,e as N}from"./form-BwZFk0jt.js";import{g as pe}from"./utils-objBp_8x.js";import"./ui-radix-UbxzYNKV.js";import"./menu-items-transparencia.service-DbQntYnO.js";import"./select-Dl--n7zR.js";import"./popover-CnuUUnrt.js";import"./table-C-bqv7aZ.js";function ue(){const[r,d]=i.useState(!1),[t,m]=i.useState(null),[o,h]=i.useState(null),[c,p]=i.useState(null),f=i.useCallback(async(j,g)=>{let s=c;return s||(s=await I(),p(s)),!(s!=null&&s.modulo_ativo)||!s.tipos_documento_habilitados.includes(j.tipo)?(window.open(g,"_blank"),!0):(m(j),h(g),d(!0),!1)},[c]),y=i.useCallback(()=>{o&&(window.open(o,"_blank"),h(null),m(null))},[o]),l=i.useCallback(()=>{h(null),m(null),d(!1)},[]);return{modalOpen:r,setModalOpen:d,documento:t,checkAccess:f,proceedDownload:y,cancelDownload:l,config:c}}const xe=r=>r.replace(/\D/g,"").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})/,"$1-$2").replace(/(-\d{2})\d+?$/,"$1"),he=r=>r.replace(/\D/g,"").replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2").replace(/(-\d{4})\d+?$/,"$1"),fe=ne({nome:S().min(3,"Nome deve ter pelo menos 3 caracteres"),cpf:S().min(14,"CPF inválido"),email:S().email("Email inválido"),telefone:S().optional(),lgpd_consentimento:ie().refine(r=>r===!0,{message:"Você deve aceitar os termos para continuar"})});function je({open:r,onOpenChange:d,documento:t,onSuccess:m}){const[o,h]=i.useState(null),[c,p]=i.useState(!1),[f,y]=i.useState(!0),l=le({resolver:ce(fe),defaultValues:{nome:"",cpf:"",email:"",telefone:"",lgpd_consentimento:!1}});i.useEffect(()=>{r&&(y(!0),I().then(h).finally(()=>y(!1)))},[r]);const j=async s=>{var x;p(!0);try{const a={nome:s.nome,cpf:s.cpf.replace(/\D/g,""),email:s.email,telefone:((x=s.telefone)==null?void 0:x.replace(/\D/g,""))||void 0,documento_tipo:t.tipo,documento_id:t.id,documento_titulo:t.titulo,documento_numero:t.numero,documento_ano:t.ano,documento_mes:t.mes,arquivo_nome:t.arquivo_nome,arquivo_url:t.arquivo_url,lgpd_consentimento:s.lgpd_consentimento,lgpd_texto_aceito:o==null?void 0:o.texto_lgpd};await te(a),T.success("Acesso registrado com sucesso"),l.reset(),d(!1),m()}catch(a){T.error("Erro ao registrar acesso"),console.error(a)}finally{p(!1)}},g={licitacao:"Licitação",contrato:"Contrato",ata_srp:"Ata de Registro de Preços",edital:"Edital"};return e.jsx(M,{open:r,onOpenChange:d,children:e.jsxs(z,{className:"sm:max-w-[500px]",children:[e.jsxs(O,{children:[e.jsxs(R,{className:"flex items-center gap-2",children:[e.jsx(B,{className:"h-5 w-5 text-primary"}),"Acesso a Documento Público"]}),e.jsx(H,{children:"Para baixar o documento, preencha seus dados abaixo. Este registro é obrigatório para fins de auditoria e conformidade com a Lei de Acesso à Informação."})]}),f?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(k,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.jsx(me,{...l,children:e.jsxs("form",{onSubmit:l.handleSubmit(j),className:"space-y-4",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 text-sm",children:[e.jsx("p",{className:"font-medium",children:t.titulo}),e.jsxs("p",{className:"text-muted-foreground",children:[g[t.tipo]||t.tipo,t.numero&&` ⢠Nº ${t.numero}`,t.ano&&` ⢠${t.ano}`]})]}),e.jsx(b,{control:l.control,name:"nome",render:({field:s})=>e.jsxs(_,{children:[e.jsxs(C,{children:["Nome completo"," ",(o==null?void 0:o.campo_nome_obrigatorio)&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(v,{children:e.jsx(D,{placeholder:"Seu nome completo",...s})}),e.jsx(N,{})]})}),e.jsx(b,{control:l.control,name:"cpf",render:({field:s})=>e.jsxs(_,{children:[e.jsxs(C,{children:["CPF"," ",(o==null?void 0:o.campo_cpf_obrigatorio)&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(v,{children:e.jsx(D,{placeholder:"000.000.000-00",...s,onChange:x=>s.onChange(xe(x.target.value)),maxLength:14})}),e.jsx(N,{})]})}),e.jsx(b,{control:l.control,name:"email",render:({field:s})=>e.jsxs(_,{children:[e.jsxs(C,{children:["E-mail"," ",(o==null?void 0:o.campo_email_obrigatorio)&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(v,{children:e.jsx(D,{type:"email",placeholder:"[email protected]",...s})}),e.jsx(N,{})]})}),e.jsx(b,{control:l.control,name:"telefone",render:({field:s})=>e.jsxs(_,{children:[e.jsxs(C,{children:["Telefone"," ",(o==null?void 0:o.campo_telefone_obrigatorio)&&e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(v,{children:e.jsx(D,{placeholder:"(00) 00000-0000",...s,onChange:x=>s.onChange(he(x.target.value)),maxLength:15})}),e.jsx(N,{})]})}),e.jsx(b,{control:l.control,name:"lgpd_consentimento",render:({field:s})=>e.jsxs(_,{className:"flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4",children:[e.jsx(v,{children:e.jsx(de,{checked:s.value,onCheckedChange:s.onChange})}),e.jsxs("div",{className:"space-y-2 leading-none",children:[e.jsxs(C,{className:"flex items-center gap-1 text-sm font-normal",children:[e.jsx(G,{className:"h-4 w-4 text-primary"}),"Consentimento LGPD"]}),o!=null&&o.texto_lgpd?e.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-line",children:o.texto_lgpd}):e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsx("p",{children:"Ao prosseguir, você autoriza o registro dos seus dados para fins de auditoria e conformidade com a Lei de Acesso à Informação (LAI) e a Lei Geral de Proteção de Dados (LGPD)."}),e.jsxs("ul",{className:"ml-4 list-disc space-y-0.5",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"Dados coletados:"})," nome, e-mail, telefone (opcional) e CPF armazenado apenas como hash SHA-256 (não recuperável)."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Finalidade:"})," auditoria de acesso a documentos públicos e conformidade legal."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Retenção:"})," 2 anos a contar da data do acesso."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Direito de exclusão:"})," solicite pelo canal da Ouvidoria."]})]})]}),e.jsx(N,{})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(F,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancelar"}
1),e.jsxs(F,{type:"submit",disabled:c,children:[c&&e.jsx(k,{className:"mr-2 h-4 w-4 animate-spin"}),"Continuar e Baixar"]})]})]})})]})})}function ge(r){if(!r)return"inherit";const d=["ffff00","ffd700","ffa500","ffeb3b","ffc107","ffee58","ffd54f"],t=r.toLowerCase().replace("#","");return d.some(m=>t.includes(m))?"#1a1a1a":r}function ze(){const{filters:r,updateFilters:d}=ae({year:"todos"}),[t,m]=i.useState(1),[o,h]=i.useState(10),c=ue();i.useEffect(()=>{m(1)},[r.search,r.year]);const{data:p,isLoading:f}=q({queryKey:["transparencia","editais",r.search,r.year,t,o],queryFn:async()=>{const a=new URLSearchParams;return r.search&&a.append("search",r.search),r.year&&r.year!=="todos"&&a.append("ano",r.year),a.append("page",String(t)),a.append("pageSize",String(o)),V(`/transparencia/editais?${a.toString()}`)}}),y=(p==null?void 0:p.data)??[],l=(p==null?void 0:p.pagination.total)??0,j=new Date().getFullYear(),g=i.useMemo(()=>Array.from({length:8},(a,n)=>j-n),[j]),s=async a=>{var L;const n=(L=a.anexos)==null?void 0:L[0];if(!n)return;const u=n.url||n.file_path||"";!u||await c.checkAccess({tipo:"edital",id:a.id,titulo:a.titulo,numero:a.numero||void 0,ano:a.ano||void 0,arquivo_nome:n.nome||n.file_name,arquivo_url:u},u)},x=[{key:"numero",header:"Nº/Ano",width:"120px",render:(a,n)=>n.numero||(n.ano?String(n.ano):"-")},{key:"orgao_responsavel",header:"Ãrgão",width:"200px",render:a=>e.jsx(E,{text:a||"-",maxLength:40})},{key:"titulo",header:"Objeto",render:(a,n)=>e.jsx(E,{text:n.titulo,maxLength:60})},{key:"modalidade_nome",header:"Modalidade",width:"140px",render:a=>a?e.jsx(P,{variant:"outline",children:a}):"-"},{key:"situacao_nome",header:"Situação",width:"120px",render:(a,n)=>{if(!n.situacao_nome)return"-";const u=n.situacao_cor||"gray";return e.jsx(P,{variant:"outline",style:{borderColor:u,color:ge(u),backgroundColor:`${u}25`},children:n.situacao_nome})}},{key:"data_publicacao",header:"Data",width:"110px",render:a=>{const n=Q(a);return n?pe(n,"dd/MM/yyyy",{locale:J}):"-"}},{key:"acoes",header:"Ações",width:"150px",render:(a,n)=>{var u;return e.jsxs(F,{size:"sm",variant:"outline",onClick:()=>s(n),disabled:!((u=n.anexos)!=null&&u.length),children:[e.jsx(U,{className:"h-4 w-4 mr-1"}),"Ver Edital"]})}}];return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsx("title",{children:"Editais | Portal da Transparência"}),e.jsx("meta",{name:"description",content:"Consulte todos os editais publicados de licitações do municÃpio de forma transparente."})]}),e.jsx(W,{}),e.jsxs("main",{className:"container mx-auto px-4 py-8",children:[e.jsx(X,{className:"mb-6",children:e.jsxs(Z,{children:[e.jsx(w,{children:e.jsx(A,{href:"/",children:"InÃcio"})}),e.jsx($,{}),e.jsx(w,{children:e.jsx(A,{href:"/transparencia",children:"Transparência"})}),e.jsx($,{}),e.jsx(w,{children:e.jsx(ee,{children:"Editais"})})]})}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("h1",{className:"text-4xl font-bold mb-2 flex items-center gap-3",children:[e.jsx(B,{className:"h-9 w-9 text-primary"}),"Editais"]}),e.jsx("p",{className:"text-muted-foreground",children:"Consulte os editais publicados de licitações e processos disponÃveis para download."})]}),e.jsx(se,{config:{showSearch:!0,searchPlaceholder:"Buscar por tÃtulo, número ou órgãoâ¦",showYear:!0,years:g},values:r,onChange:d,totalResults:l,isLoading:f}),e.jsx(oe,{data:y,columns:x,isLoading:f,emptyMessage:"Nenhum edital encontrado com os filtros aplicados"}),!f&&l>0&&e.jsx(re,{page:t,pageSize:o,total:l,onPageChange:m,onPageSizeChange:a=>{h(a),m(1)}})]}),e.jsx(K,{}),c.documento&&e.jsx(je,{open:c.modalOpen,onOpenChange:c.setModalOpen,documento:c.documento,onSuccess:c.proceedDownload})]})}export{ze 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.