PageSourceSearch

https://saldofacil.vercel.app/assets/YearlyReport-PI1JqGEu.js

js saldofacil.vercel.app collected 2026-10-03 07:39:35 UTC 5,066 bytes, 1 lines download raw bytes

1import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,d as n,f as r,i,l as a,m as o,n as s,o as c,u as l}from"./charts-DOzVV7pZ.js";import{l as u,n as d}from"./vendor-Bzdq3r50.js";import{a as f,n as p}from"./firebase-DrLCSqN9.js";import{a as m,c as h,s as g}from"./index-D1lem9dE.js";import{r as _}from"./helpers-CI12AsRZ.js";var v=e(o(),1),y=d(),b={primary:`#5e72e4`,success:`#2dce89`,danger:`#f5365c`,info:`#11cdef`,warning:`#fb6340`,secondary:`#8898aa`},x={margin:{top:20,right:20,left:-5,bottom:0},cartesianGrid:{stroke:`#e0e6ed`,strokeDasharray:`4 2`,vertical:!1},tooltip:{contentStyle:{backgroundColor:`rgba(255, 255, 255, 0.95)`,border:`1px solid #e0e6ed`,borderRadius:`8px`,boxShadow:`0 4px 6px rgba(0, 0, 0, 0.1)`}},legend:{wrapperStyle:{paddingTop:`1rem`,color:`#525f7f`}}};function S(){let{user:e}=g(),o=u(),[d,S]=(0,v.useState)([]),[C,w]=(0,v.useState)(!0);return(0,v.useEffect)(()=>{if(!e){w(!1);return}(async()=>{try{let t=await _(e.uid);if(console.log(`[YearlyReport] Anos disponíveis:`,t),t.length===0){console.log(`[YearlyReport] Nenhum ano disponível`),S([]),w(!1);return}let n=t.map(async t=>{try{let n=(await p(f(h,`users/${e.uid}/${t}/december`))).val();return console.log(`[YearlyReport] ${t}/december:`,n),{year:t.toString(),balance:n?.finalBalance?parseFloat(n.finalBalance):0}}catch(e){return console.error(`Erro ao buscar ${t}:`,e.message),{year:t.toString(),balance:0}}}),r=await Promise.all(n);console.log(`[YearlyReport] Resultados brutos:`,r);let i=r.filter(e=>e.balance>0);console.log(`[YearlyReport] Resultados filtrados (balance > 0):`,i),console.log(`[YearlyReport] Total de anos com dados:`,i.length),S(i.length>0?i:r),w(!1)}catch(e){console.error(`Erro ao buscar dados anuais:`,e),w(!1)}})()},[e]),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(m,{title:`Relatório Anual de Saldos`,onBack:()=>o(`/`)}),(0,y.jsx)(`div`,{className:`main-content`,children:(0,y.jsxs)(`div`,{className:`container`,children:[(0,y.jsx)(`div`,{className:`chart-pdf-header`,children:(0,y.jsxs)(`div`,{className:`chart-header-content`,children:[(0,y.jsx)(`h2`,{children:`📊 Evolução de Saldos Anuais`}),(0,y.jsx)(`p`,{className:`chart-subtitle`,children:`Comparativo do saldo final de dezembro ao longo dos anos`}),(0,y.jsx)(`span`,{className:`chart-date`,children:new Date().toLocaleDateString(`pt-BR`)})]})}),(0,y.jsxs)(`div`,{className:`chart-card`,children:[(0,y.jsx)(`div`,{className:`chart-header`,children:(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h3`,{className:`chart-title`,children:`Evolução do Saldo Final (Dezembro)`}),(0,y.jsx)(`p`,{className:`chart-subtitle`,children:`Saldos finais de dezembro por ano`})]})}),C?(0,y.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`,color:`#525f7f`},children:(0,y.jsx)(`p`,{children:`Carregando dados...`})}):d.length===0?(0,y.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`,color:`#525f7f`},children:(0,y.jsx)(`p`,{children:`Nenhum dado disponível`})}):(0,y.jsx)(`div`,{className:`chart-container`,children:(0,y.jsx)(r,{width:`100%`,height:400,children:(0,y.jsxs)(s,{data:d,...x,children:[(0,y.jsx)(a,{...x.cartesianGrid}),(0,y.jsx)(t,{dataKey:`year`,stroke:`#525f7f`,style:{fontSize:`0.875rem`}}),(0,y.jsx)(i,{stroke:`#525f7f`,style:{fontSize:`0.875rem`},tickFormatter:e=>`R$ ${(e/1e3).toFixed(0)}k`}),(0,y.jsx)(l,{...x.tooltip,formatter:e=>[`R$ ${e.toLocaleString(`pt-BR`,{minimumFractionDigits:2,maximumFractionDigits:2})}`,`Saldo`]}),(0,y.jsx)(n,{...x.legend}),(0,y.jsx)(c,{dataKey:`balance`,fill:b.primary,name:`Saldo Final`,radius:[8,8,0,0],animationDuration:1e3})]})})})]}),(0,y.jsxs)(`div`,{className:`chart-card`,children:[(0,y.jsx)(`div`,{className:`chart-header`,children:(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`h3`,{className:`chart-title`,children:`💰 Saldos Finais por Ano`}),(0,y.jsx)(`p`,{className:`chart-subtitle`,children:`Detalhes com ranking e variação de crescimento`})]})}),C?(0,y.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`,color:`#525f7f`},children:(0,y.jsx)(`p`,{children:`Carregando dados...`})}):d.length===0?(0,y.jsx)(`div`,{style:{padding:`2rem`,textAlign:`center`,color:`#525f7f`},children:(0,y.jsx)(`p`,{children:`Nenhum dado disponível`})}):(0,y.jsx)(`div`,{className:`yearly-value-grid`,children:d.map((e,t)=>{let n=t>0?d[t-1].balance:e.balance,r=t>0?((e.balance-n)/n*100).toFixed(2):0,i=r>=0;return(0,y.jsxs)(`div`,{className:`yearly-value-item`,children:[(0,y.jsxs)(`div`,{className:`yearly-value-header`,children:[(0,y.jsx)(`span`,{className:`yearly-value-year`,children:e.year}),(0,y.jsxs)(`span`,{className:`yearly-value-index ${t===0?`first`:t===1?`second`:`other`}`,children:[`#`,t+1]})]}),(0,y.jsxs)(`div`,{className:`yearly-value-amount`,children:[`R$ `,e.balance.toLocaleStr
1ing(`pt-BR`,{minimumFractionDigits:2,maximumFractionDigits:2})]}),t>0&&(0,y.jsxs)(`div`,{className:`yearly-value-change ${i?`positive`:`negative`}`,children:[(0,y.jsx)(`span`,{className:`change-arrow`,children:i?`📈`:`📉`}),(0,y.jsxs)(`span`,{className:`change-percent`,children:[Math.abs(r),`%`]})]})]},e.year)})})]})]})})]})}export{S 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.