From 1de07d334273283bb45271a84314fa7aee1b1039 Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Sat, 17 Jan 2026 11:54:46 +0100 Subject: [PATCH] feat: add filtered totals summary above Grid table --- components/DataGrid.tsx | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/components/DataGrid.tsx b/components/DataGrid.tsx index 1757c19..0bbc01b 100644 --- a/components/DataGrid.tsx +++ b/components/DataGrid.tsx @@ -630,6 +630,48 @@ const DataGrid: React.FC = ({ data }) => { )} + {/* Filter Totals Summary */} +
+
+
+ + Filtered Totals: +
+ {years.map((year) => { + const yearTotals = processedRows.reduce( + (acc, row) => { + const data = row.totalsByYear[year]; + if (data) { + acc.sellOut += data.sellOut; + acc.units += data.units; + } + return acc; + }, + { sellOut: 0, units: 0 } + ); + return ( +
+ {year} +
+ S.O: + + €{yearTotals.sellOut.toLocaleString(undefined, { maximumFractionDigits: 0 })} + +
+
+
+ Units: + + {yearTotals.units.toLocaleString()} + +
+
+ ); + })} +
+
+ + {/* Data Table */}