'use client' import { useTranslations } from 'next-intl' import { TH_CLASS, TD_CLASS } from '@/components/ui/dry-table' import { cn, formatCurrency } from '@/lib/utils' import type { KPIReport } from '@/types' import { monthsTableRows } from './months-table' /** * Income, expenses and net result month by month for the selected fiscal * year, with the period totals as the last row (#2196). Full width like * KPIBreakdown: the bars pane only has room for the net column, and this * table is where the two other columns the payload already carries show. */ export function KPIMonthsTable({ report }: { report: KPIReport }) { const t = useTranslations('kpi') if (report.months.length === 0) return null const { rows, total } = monthsTableRows(report) const numeric = 'whitespace-nowrap text-right tabular-nums' return (
| {t('months_col_month')} | {t('trend_legend_income')} | {t('trend_legend_expenses')} | {t('trend_legend_net')} |
|---|---|---|---|
| {m.label} | {formatCurrency(m.income)} | {formatCurrency(m.expenses)} | {formatCurrency(m.net)} |
| {t('months_total')} | {formatCurrency(total.income)} | {formatCurrency(total.expenses)} | {formatCurrency(total.net)} |