PageSourceSearch

https://cbtkd.org.br/assets/DashboardCertificadosColoridasPage-2fe75d97.js

js cbtkd.org.br collected 2026-10-10 00:49:23 UTC 8,555 bytes, 2 lines download raw bytes

1import{j as e}from"./vendor-ui-bootstrap-613dad89.js";import{r as u}from"./vendor-react-4c7f50f2.js";import{u as I,v as w}from"./main-722823a7.js";import{D as F}from"./DashboardCertificadosColoridas.service-ea0dc0cf.js";import{R as y,B,d as M,X as G,Y as $,T as q,a as z,C as K,g as P}from"./vendor-charts-6c028842.js";import{t as _,f as O,e as X}from"./rankingCertificados-29cc0ca2.js";import"./vendor-ui-material-b69ee68f.js";import"./vendor-firebase-7ea6fd91.js";import"./vendor-utils-de6b936e.js";import"./api.service-846da950.js";function Y({badge:l,titulo:m,descricao:k,accent:j={strong:"#2563eb",soft:"rgba(37, 99, 235, 0.12)"},ano:g,anosDisponiveis:A=[],onAnoChange:C,loading:a,erro:v,kpis:b=[],itens:t=[],unidade:x="certificados",colunaLabel:R="Item",maxBarras:r=15,onExportar:S,avisos:D=[],atualizadoEm:i=null}){const[o,f]=u.useState(null),c=async s=>{f(s);try{await S(s)}catch(d){console.error(`Erro ao exportar (${s}):`,d),alert("Não foi possível gerar o arquivo. Tente novamente.")}finally{f(null)}},N=a||!!v||!!o||t.length===0,p=u.useMemo(()=>t.slice(0,r).map(s=>({id:s.id,nome:s.label,sublabel:s.sublabel,value:s.value})),[t,r]),L=Math.max(260,p.length*38+40),n={"--dcc-accent-strong":j.strong,"--dcc-accent-soft":j.soft},h=({active:s,payload:d})=>{if(!s||!d||!d.length)return null;const T=d[0].payload;return e.jsxs("div",{className:"dcc-tooltip",children:[e.jsx("strong",{children:T.nome}),T.sublabel?e.jsx("div",{children:T.sublabel}):null,e.jsxs("div",{children:[T.value.toLocaleString("pt-BR")," ",x]})]})};return e.jsxs("div",{className:"dcc-wrap",style:n,children:[e.jsxs("div",{className:"dcc-header",children:[e.jsxs("div",{children:[l?e.jsx("span",{className:"dcc-badge",children:l}):null,e.jsx("h2",{className:"dcc-title",children:m}),k?e.jsx("p",{className:"dcc-subtitle",children:k}):null,i?e.jsxs("p",{className:"dcc-updated",children:["Números calculados em ",i," · atualizados a cada 6 horas"]}):null]}),e.jsxs("div",{className:"dcc-actions",children:[e.jsxs("label",{className:"dcc-yearfilter",children:["Período",e.jsxs("select",{value:g||"",onChange:s=>C(s.target.value?Number(s.target.value):null),disabled:a,children:[e.jsx("option",{value:"",children:"Todos os anos"}),A.map(s=>e.jsx("option",{value:s,children:s},s))]})]}),S?e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:"dcc-btn",onClick:()=>c("pdf"),disabled:N,children:[e.jsx("span",{className:"material-icons-outlined dcc-btn-icon",children:"picture_as_pdf"}),o==="pdf"?"Gerando…":"PDF"]}),e.jsxs("button",{type:"button",className:"dcc-btn",onClick:()=>c("xlsx"),disabled:N,children:[e.jsx("span",{className:"material-icons-outlined dcc-btn-icon",children:"table_view"}),o==="xlsx"?"Gerando…":"XLSX"]})]}):null]})]}),a?e.jsx("div",{className:"dcc-loading",children:"Carregando dados…"}):v?e.jsx("div",{className:"dcc-error",children:v}):e.jsxs(e.Fragment,{children:[D.map(s=>e.jsxs("div",{className:"dcc-alert",children:[e.jsx("span",{className:"material-icons-outlined",children:"info"}),e.jsx("span",{children:s})]},s)),e.jsx("div",{className:"dcc-kpis",children:b.map((s,d)=>e.jsxs("div",{className:"dcc-kpi",children:[e.jsx("div",{className:"dcc-kpi-label",children:s.label}),e.jsx("div",{className:"dcc-kpi-value",children:typeof s.value=="number"?s.value.toLocaleString("pt-BR"):s.value}),s.hint?e.jsx("div",{className:"dcc-kpi-hint",children:s.hint}):null]},d))}),t.length===0?e.jsx("div",{className:"dcc-panel",children:e.jsx("div",{className:"dcc-empty",children:"Nenhum certificado de faixa colorida encontrado para o período selecionado."})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"dcc-panel",children:[e.jsx("h3",{className:"dcc-panel-title",children:p.length<t.length?`Top ${p.length}`:"Ranking"}),e.jsxs("p",{className:"dcc-panel-sub",children:[x.charAt(0).toUpperCase()+x.slice(1)," emitidos",g?` em ${g}`:" (total acumulado)","."]}),e.jsx(y,{width:"100%",height:L,children:e.jsxs(B,{data:p,layout:"vertical",margin:{top:4,right:56,bottom:4,left:8},barCategoryGap:"28%",children:[e.jsx(M,{horizontal:!1,stroke:"var(--dcc-border)",strokeDasharray:"3 3"}
1),e.jsx(G,{type:"number",allowDecimals:!1,tick:{fill:"var(--dcc-ink-3)",fontSize:12},axisLine:!1,tickLine:!1}),e.jsx($,{type:"category",dataKey:"nome",width:170,tick:{fill:"var(--dcc-ink-2)",fontSize:12.5},axisLine:!1,tickLine:!1}),e.jsx(q,{cursor:{fill:"var(--dcc-accent-soft)"},content:h}),e.jsxs(z,{dataKey:"value",radius:[0,4,4,0],maxBarSize:22,isAnimationActive:!1,children:[p.map(s=>e.jsx(K,{fill:j.strong},s.id)),e.jsx(P,{dataKey:"value",position:"right",formatter:s=>s.toLocaleString("pt-BR"),style:{fill:"var(--dcc-ink-2)",fontSize:12,fontWeight:700}})]})]})})]}),e.jsxs("div",{className:"dcc-panel",children:[e.jsx("h3",{className:"dcc-panel-title",children:"Detalhamento completo"}),e.jsxs("p",{className:"dcc-panel-sub",children:[t.length.toLocaleString("pt-BR")," registro(s)."]}),e.jsx("div",{className:"dcc-table-scroll",children:e.jsxs("table",{className:"dcc-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:56},children:"#"}),e.jsx("th",{children:R}),e.jsx("th",{className:"dcc-num",children:"Certificados"})]})}),e.jsx("tbody",{children:t.map((s,d)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("span",{className:`dcc-rank${d<3?" top":""}`,children:d+1})}),e.jsxs("td",{children:[e.jsx("div",{style:{fontWeight:600},children:s.label}),s.sublabel?e.jsx("div",{style:{fontSize:"0.78rem",color:"var(--dcc-ink-3)"},children:s.sublabel}):null]}),e.jsx("td",{className:"dcc-num",children:s.value.toLocaleString("pt-BR")})]},s.id))})]})})]})]})]})]})}const V=new Date().getFullYear(),E=!1;function ie(){var D;const{domainDetails:l}=I(),[m,k]=u.useState(V),[j,g]=u.useState(!0),[A,C]=u.useState(null),[a,v]=u.useState(null),b=l&&l.domainId===w,t=l==null?void 0:l.domainId,x=u.useRef(0),R=u.useCallback(async()=>{var o,f;if(!l||!t)return;const i=++x.current;g(!0),C(null);try{const c=b?await F.getPorFederacao({ano:m}):await F.getRankingMestres({federacaoId:t,ano:m});if(i!==x.current)return;v(c)}catch(c){if(i!==x.current)return;console.error("Erro ao carregar dashboard de certificados coloridas:",c),v(null),C(((f=(o=c==null?void 0:c.response)==null?void 0:o.data)==null?void 0:f.error)||"Não foi possível carregar os dados. Verifique seu acesso a este dashboard e tente novamente.")}finally{i===x.current&&g(!1)}},[l,t,b,m]);u.useEffect(()=>{R()},[R]);const r=((D=a==null?void 0:a.kpis)==null?void 0:D.anosDisponiveis)||[],S=u.useMemo(()=>{var c,N,p,L;const i=((c=a==null?void 0:a.kpis)==null?void 0:c.totalSaldoInicial)??0,o={label:"Total emitido",value:((N=a==null?void 0:a.kpis)==null?void 0:N.totalGeral)??0,hint:E&&i>0?`inclui ${i} de saldo inicial`:void 0};if(b){const n=(a==null?void 0:a.federacoes)||[];return{badge:"CBTKD · Visão nacional",titulo:"Certificados de Faixas Coloridas por Federação",descricao:"Total de certificados de faixas coloridas emitidos, agregado por federação.",accent:{strong:"#4f46e5",soft:"rgba(79, 70, 229, 0.12)"},colunaLabel:"Federação",unidade:"certificados",kpis:[o,{label:"Federações com emissão",value:((p=a==null?void 0:a.kpis)==null?void 0:p.qtdFederacoes)??0},{label:"Anos com dados",value:r.length,hint:r.length?r.join(", "):void 0}],itens:n.map(h=>({id:h.federacaoId,label:h.sigla||h.nome,sublabel:h.sigla?h.nome:`${h.qtdMestres} mestre(s)`,value:h.total}))}}const f=(a==null?void 0:a.ranking)||[];return{badge:`${(l==null?void 0:l.sigla)||"Federação"} · Ranking de mestres`,titulo:"Mestres com mais Certificados de Faixas Coloridas",descricao:"Ranking dos mestres da federação por quantidade de certificados de faixas coloridas emitidos.",accent:{strong:"#2563eb",soft:"rgba(37, 99, 235, 0.12)"},colunaLabel:"Mestre",unidade:"certificados",kpis:[o,{label:"Mestres no ranking",value:((L=a==null?void 0:a.kpis)==null?void 0:L.qtdMestres)??0},{label:"Anos com dados",value:r.length,hint:r.length?r.join(", "):void 0}],itens:f.map(n=>({id:n.mestreId,label:n.nome,sublabel:E&&n.saldoInicial>0?`${n.contador??0} pelo sistema + ${n.saldoInicial} de saldo inicial`:void 0,value:n.total}))}},[b,a,r,l]);return l?e.jsx(Y,{...S,ano:m,anosDisponiveis:[...new Set([...m?[m]:[],...r])].sort((i,o)=>o-i),onAnoChange:k,avisos:_(a),atualizadoEm:O(a==null?void 0:a.geradoEm),onExportar:i=>X(i,a,{sigla:l.sigla,prefixoArquivo:"certificados-coloridas",detalharOrigem:E}),loading:j,erro:A}):e.jsx("div",{className:"p-4",children:"Carregando…"})}export{ie as default};
2//# sourceMappingURL=DashboardCertificadosColoridasPage-2fe75d97.js.map

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.