PageSourceSearch

https://democrata.org.br/sistema/assets/CaixaEntradaPage-CQV096D0.js

js democrata.org.br collected 2026-10-09 16:57:39 UTC 10,287 bytes, 1 lines download raw bytes

1import{j as e,O as V,m as q,K as z,t as U,r,o as y,A as G,B as M,R as X,F as C,c as H,N as J,g as K}from"./index-DEXqc8fB.js";import{m as Q,A as W,a as Y}from"./AvisoFalha-LbRQ-MD5.js";import{I as h}from"./inbox-aOrIW9P2.js";import{S as Z}from"./search-CkuHA81f.js";import{D as I}from"./dollar-sign-B2ZDctdF.js";import{T as ee}from"./triangle-alert-CEfUEOmw.js";const T={RECEITA:{label:"Receita",icon:I,color:"green"},DESPESA:{label:"Despesa",icon:I,color:"red"},CONCILIACAO:{label:"Conciliação",icon:J,color:"cyan"},DOCUMENTO:{label:"Documento",icon:C,color:"blue"},VALIDACAO:{label:"Validação",icon:H,color:"teal"},APROVACAO:{label:"Aprovação",icon:C,color:"purple"}},E={PENDENTE:{label:"Pendente",color:"yellow"},EM_ANALISE:{label:"Em Análise",color:"blue"},APROVADO:{label:"Aprovado",color:"green"},REJEITADO:{label:"Rejeitado",color:"red"},ARQUIVADO:{label:"Arquivado",color:"gray"}},ae={BAIXA:{label:"Baixa",color:"gray"},MEDIA:{label:"Média",color:"blue"},ALTA:{label:"Alta",color:"orange"},CRITICA:{label:"Crítica",color:"red"}};function te(){const f=q(),{orgao:o,periodo:m,contexto:j,isLoading:S}=z(),{prestacao:se}=U(),[s,g]=r.useState([]),[b,N]=r.useState(!0),[n,O]=r.useState(""),[i,D]=r.useState(""),[c,R]=r.useState(""),[v,L]=r.useState(0),[d,p]=r.useState(null),[k,P]=r.useState(!1),x=r.useCallback(async()=>{if(o)try{N(!0);const a=new URLSearchParams({orgao_id:String(o.id),ano:String(m.ano),contexto:j});i&&a.append("tipo",i),c&&a.append("status",c),n&&a.append("q",n);const t=await fetch(`/api/v1/financeiro/caixa-entrada?${a}`,{headers:{Authorization:`Bearer ${localStorage.getItem("token")}`}});if(!t.ok){g([]),p(await Q(t,"a caixa de entrada"));return}const l=await t.json();g(l.items||[]),P((l==null?void 0:l.nao_implementado)===!0),p(null)}catch(a){g([]),p(`Não consegui falar com o servidor: ${a.message}`)}finally{N(!1)}},[o,m,j,i,c,n]);r.useEffect(()=>{x()},[x]);const _=a=>new Date(a).toLocaleDateString("pt-BR"),F=a=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(a),A=(a=>{switch(a){case 1:return s.filter(t=>t.status==="PENDENTE");case 2:return s.filter(t=>t.urgencia==="ALTA"||t.urgencia==="CRITICA");case 3:return s.filter(t=>t.tipo==="VALIDACAO"||t.validacao_erros&&t.validacao_erros>0);default:return s}})(v),B=[{label:"Todos",count:s.length},{label:"Pendentes",count:s.filter(a=>a.status==="PENDENTE").length},{label:"Urgentes",count:s.filter(a=>a.urgencia==="ALTA"||a.urgencia==="CRITICA").length},{label:"Validação",count:s.filter(a=>a.tipo==="VALIDACAO"||a.validacao_erros&&a.validacao_erros>0).length}],u=a=>({green:"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",red:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",blue:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",yellow:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",orange:"bg-orange-100 text-orange-700 dark:bg-orange-900/50 dark:text-orange-300",cyan:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",teal:"bg-teal-100 text-teal-700 dark:bg-teal-900/50 dark:text-teal-300",purple:"bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300",gray:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300"})[a]||"bg-slate-100 text-slate-700";return S?e.jsx("div",{className:"flex items-center justify-center h-96",children:e.jsx(y,{className:"h-8 w-8 animate-spin text-orange-500"})}):o?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>f("/financeiro/hub"),className:"p-2 rounded-lg hover:bg-slate-100 dark:hover:bg-slate-800",children:e.jsx(G,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"})}),e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-slate-900 dark:text-white flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-orange-500 to-orange-600 rounded-xl flex items-center justify-center",children:e.jsx(h,{size:20,className:"text-white"})}),"Caixa de Entrada"]}),e.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:d||k?"não consigo confirmar quantos itens existem":`${s.length} itens • ${s.filter(a=>a.status==="PENDENTE").length} pendentes`})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 bg-slate-100 dar
1k:bg-slate-800 rounded-xl",children:[e.jsx("div",{className:"w-10 h-10 bg-gradient-to-br from-blue-500 to-blue-600 rounded-xl flex items-center justify-center",children:e.jsx(M,{size:20,className:"text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-slate-800 dark:text-white text-sm",children:o.nome}),e.jsxs("p",{className:"text-slate-500 dark:text-slate-400 text-xs",children:[m.ano," • Anual"]})]})]}),e.jsxs("button",{onClick:x,disabled:b,className:"flex items-center gap-2 px-4 py-2.5 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl hover:bg-slate-50 dark:hover:bg-slate-700 text-slate-700 dark:text-slate-300 font-medium transition-colors",children:[e.jsx(X,{className:`h-4 w-4 ${b?"animate-spin":""}`}),"Atualizar"]})]})]}),d&&e.jsx(W,{motivo:d,onTentarDeNovo:x}),!d&&k&&e.jsx(Y,{titulo:"A caixa de entrada ainda não lê dados reais",motivo:"O servidor respondeu, mas declarou que esta funcionalidade não está implementada (`nao_implementado: true`). A lista abaixo estar vazia NÃO significa que não há receitas ou despesas aguardando ação — significa que ninguém está olhando por elas aqui."}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(Z,{size:18,className:"absolute left-4 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("input",{type:"text",placeholder:"Buscar...",value:n,onChange:a=>O(a.target.value),className:"w-full pl-11 pr-4 py-3 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl focus:outline-none focus:ring-2 focus:ring-orange-500"})]}),e.jsxs("select",{value:i,onChange:a=>D(a.target.value),className:"px-4 py-3 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl focus:outline-none focus:ring-2 focus:ring-orange-500 text-slate-700 dark:text-slate-300",children:[e.jsx("option",{value:"",children:"Todos os tipos"}),Object.entries(T).map(([a,t])=>e.jsx("option",{value:a,children:t.label},a))]}),e.jsxs("select",{value:c,onChange:a=>R(a.target.value),className:"px-4 py-3 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-xl focus:outline-none focus:ring-2 focus:ring-orange-500 text-slate-700 dark:text-slate-300",children:[e.jsx("option",{value:"",children:"Todos os status"}),Object.entries(E).map(([a,t])=>e.jsx("option",{value:a,children:t.label},a))]})]}),e.jsx("div",{className:"flex gap-2",children:B.map((a,t)=>e.jsx("button",{onClick:()=>L(t),className:`px-4 py-2 rounded-xl font-medium transition-all ${v===t?"bg-orange-500 text-white":"bg-white dark:bg-slate-800 text-slate-600 dark:text-slate-300 border border-slate-200 dark:border-slate-700 hover:bg-slate-50 dark:hover:bg-slate-700"}`,children:a.label},t))}),b?e.jsx("div",{className:"flex items-center justify-center py-10",children:e.jsx(y,{className:"h-8 w-8 animate-spin text-orange-500"})}):A.length===0?e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-12 text-center",children:[e.jsx(h,{className:"h-16 w-16 mx-auto text-slate-300 dark:text-slate-600 mb-4"}),e.jsx("p",{className:"text-lg font-medium text-slate-600 dark:text-slate-400",children:"Nenhum item encontrado"})]}):e.jsx("div",{className:"space-y-3",children:A.map(a=>{const t=T[a.tipo],l=E[a.status],w=ae[a.urgencia],$=t.icon;return e.jsx("div",{className:"bg-white dark:bg-slate-800 rounded-xl border border-slate-200 dark:border-slate-700 p-4 hover:shadow-md transition-all",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`p-2.5 rounded-xl ${u(t.color)}`,children:e.jsx($,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-slate-900 dark:text-white cursor-pointer hover:text-orange-600",children:a.titulo}),a.urgencia==="CRITICA"&&e.jsx(ee,{className:"h-4 w-4 text-red-500"})]}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mt-0.5",children:a.descricao}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-2",children:[e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${u(t.color)}`,children:t.label}),e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${u(l.color)}`,children:l.label}),a.urgencia!=="BAIXA"&&e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${u(w.color)}`,children:w.label}),a.validacao_erros&&a.validacao_erros>0&&e.jsxs("span",{className:"rounded-full bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300 px-2 py-0.5 text-xs font-medium",children:[a.validacao_erros," erro(s)"]})]}),e.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs text-slate-500 dark:text-slate-400",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(K,{className:"h-3 w-3"}),_(a.created_at)]}),a.valor!==void 0&&e.jsx("span",{className:"font-semibold text-slate-700 dark:text-slate-300",children:F(a.valor)})]})]})]}),e.jsx("span",{className:"text-xs text-slate-400 dark:text-slate-500 italic",children:"ações indisponíveis"})]})},a.id)})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-96 text-center",children:[e.jsx(h,{className:"h-16 w-16 text-slate-300 dark:text-slate-600 mb-4"}
1),e.jsx("p",{className:"text-lg font-medium text-slate-600 dark:text-slate-400 mb-2",children:"Nenhum contexto selecionado"}),e.jsx("button",{onClick:()=>f("/financeiro"),className:"text-orange-600 hover:text-orange-500 font-medium",children:"Selecionar órgão"})]})}function xe(){return e.jsx(V,{children:e.jsx("div",{className:"p-6",children:e.jsx(te,{})})})}export{xe 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.