From cc448b5cd43939019af68b140852025b3bbd77fc Mon Sep 17 00:00:00 2001 From: CnxiFly Dev Date: Sat, 13 Dec 2025 21:16:57 +0100 Subject: [PATCH] v1.27.5: Fix multi-currency in CashflowChart and dashboard widgets --- CHANGELOG.md | 13 +++++++++++++ VERSION | 2 +- frontend/src/components/dashboard/CashflowChart.jsx | 4 ++-- frontend/src/components/dashboard/OverdueWidget.jsx | 8 ++++---- .../src/components/dashboard/UpcomingWidget.jsx | 4 ++-- frontend/src/i18n/locales/en.json | 1 + frontend/src/i18n/locales/es.json | 1 + frontend/src/i18n/locales/pt-BR.json | 1 + frontend/src/pages/Dashboard.jsx | 9 +++++---- 9 files changed, 30 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e67404e..b07032b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ O formato segue [Keep a Changelog](https://keepachangelog.com/pt-BR/). Este projeto adota [Versionamento Semântico](https://semver.org/pt-BR/). +## [1.27.5] - 2025-12-13 + +### Fixed +- **Dashboard Multi-Divisa Completo** - Corrigido Flujo de Caja para usar divisa dinâmica + - CashflowChart agora recebe `primaryCurrency` como prop + - Tooltips do gráfico mostram a divisa correta + - Totais do período (receita, despesa, médias) usam `primary_currency` + +- **Widgets Vencidos/Futuros** - Removidas divisas fixas (BRL/EUR) + - UpcomingWidget: Footer mostra contagem de items em vez de totais monetários + - OverdueWidget: Rangos mostram contagem, footer mostra média de dias + + ## [1.27.4] - 2025-12-13 ### Added diff --git a/VERSION b/VERSION index d620158..bd9c637 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.27.4 +1.27.5 diff --git a/frontend/src/components/dashboard/CashflowChart.jsx b/frontend/src/components/dashboard/CashflowChart.jsx index ad4207a..281ea6e 100644 --- a/frontend/src/components/dashboard/CashflowChart.jsx +++ b/frontend/src/components/dashboard/CashflowChart.jsx @@ -32,7 +32,7 @@ ChartJS.register( Filler ); -const CashflowChart = ({ data, loading, scale = 'monthly' }) => { +const CashflowChart = ({ data, loading, scale = 'monthly', primaryCurrency = 'EUR' }) => { const { t } = useTranslation(); const { currency } = useFormatters(); const chartRef = useRef(null); @@ -134,7 +134,7 @@ const CashflowChart = ({ data, loading, scale = 'monthly' }) => { label: (context) => { const value = context.parsed.y; const label = context.dataset.label || ''; - return `${label}: ${currency(value, 'BRL')}`; + return `${label}: ${currency(value, primaryCurrency)}`; }, }, }, diff --git a/frontend/src/components/dashboard/OverdueWidget.jsx b/frontend/src/components/dashboard/OverdueWidget.jsx index 16b7995..256640f 100644 --- a/frontend/src/components/dashboard/OverdueWidget.jsx +++ b/frontend/src/components/dashboard/OverdueWidget.jsx @@ -146,8 +146,8 @@ const OverdueWidget = () => {
- - {currency(range.total, 'BRL')} + + {range.count} {range.count === 1 ? t('common.item') : t('common.items')}
@@ -246,10 +246,10 @@ const OverdueWidget = () => {
- {t('dashboard.totalAmount')} + {t('dashboard.avgDays')} - {currency(data.summary.total_amount || 0, 'BRL')} + ~{Math.round(data.summary.max_days_overdue / 2)} {t('common.days')}
diff --git a/frontend/src/components/dashboard/UpcomingWidget.jsx b/frontend/src/components/dashboard/UpcomingWidget.jsx index 5a7b726..7adefbd 100644 --- a/frontend/src/components/dashboard/UpcomingWidget.jsx +++ b/frontend/src/components/dashboard/UpcomingWidget.jsx @@ -161,7 +161,7 @@ const UpcomingWidget = () => { {t('dashboard.income')} - +{currency(data.summary.total_credit || 0, 'EUR')} + {data.summary.credit_count || 0} {t('common.items')}
@@ -169,7 +169,7 @@ const UpcomingWidget = () => { {t('dashboard.expenses')} - -{currency(data.summary.total_debit || 0, 'EUR')} + {data.summary.debit_count || 0} {t('common.items')}
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index 6efcdce..3719be8 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -173,6 +173,7 @@ "totalOverdue": "Total Overdue", "totalAmount": "Total Amount", "maxDelay": "Max Delay", + "avgDays": "Average", "overdueRange": { "critical": "Critical (> 30 days)", "high": "High (15-30 days)", diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json index 447936f..aad3c8a 100644 --- a/frontend/src/i18n/locales/es.json +++ b/frontend/src/i18n/locales/es.json @@ -173,6 +173,7 @@ "totalOverdue": "Total Vencido", "totalAmount": "Monto Total", "maxDelay": "Mayor Retraso", + "avgDays": "Promedio", "overdueRange": { "critical": "Crítico (> 30 días)", "high": "Alto (15-30 días)", diff --git a/frontend/src/i18n/locales/pt-BR.json b/frontend/src/i18n/locales/pt-BR.json index 5514839..2d7ba7a 100644 --- a/frontend/src/i18n/locales/pt-BR.json +++ b/frontend/src/i18n/locales/pt-BR.json @@ -174,6 +174,7 @@ "totalOverdue": "Total em Atraso", "totalAmount": "Valor Total", "maxDelay": "Maior Atraso", + "avgDays": "Média", "overdueRange": { "critical": "Crítico (> 30 dias)", "high": "Alto (15-30 dias)", diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx index 8cebae4..ac655fb 100644 --- a/frontend/src/pages/Dashboard.jsx +++ b/frontend/src/pages/Dashboard.jsx @@ -338,6 +338,7 @@ const Dashboard = () => { {/* Resumo do período */} @@ -348,7 +349,7 @@ const Dashboard = () => { {t('dashboard.totalIncome')} - {currency(cashflow.totals?.income || 0, 'BRL')} + {currency(cashflow.totals?.income || 0, summary?.primary_currency || 'EUR')}
@@ -356,7 +357,7 @@ const Dashboard = () => { {t('dashboard.totalExpenses')} - {currency(cashflow.totals?.expense || 0, 'BRL')} + {currency(cashflow.totals?.expense || 0, summary?.primary_currency || 'EUR')}
@@ -364,7 +365,7 @@ const Dashboard = () => { {t('dashboard.avgIncome')} - {currency(cashflow.totals?.average_income || 0, 'BRL')} + {currency(cashflow.totals?.average_income || 0, summary?.primary_currency || 'EUR')}
@@ -372,7 +373,7 @@ const Dashboard = () => { {t('dashboard.avgExpense')} - {currency(cashflow.totals?.average_expense || 0, 'BRL')} + {currency(cashflow.totals?.average_expense || 0, summary?.primary_currency || 'EUR')}