fix: extra_emails cast text[] + colonne Montant add cumule

This commit is contained in:
Claude
2026-05-06 17:19:56 +02:00
parent 536f0cd9d9
commit d77b96723f
2 changed files with 20 additions and 3 deletions
+18 -1
View File
@@ -436,6 +436,15 @@ export default function MyInvoices() {
const total = listData?.total ?? 0;
const totalPages = Math.ceil(total / PAGE_SIZE) || 1;
// Total cumulé par ligne (somme de toutes les lignes précédentes + la ligne courante)
const runningTotals = useMemo(() => {
let sum = 0;
return invoices.map(inv => {
sum += Number(inv.amount) || 0;
return sum;
});
}, [invoices]);
// Compact page buttons (up to 5 around current)
const pageButtons = useMemo(() => {
if (totalPages <= 5) return Array.from({ length: totalPages }, (_, i) => i + 1);
@@ -654,6 +663,9 @@ export default function MyInvoices() {
<SortHeader label="Catégorie" field="category_name" current={sortBy} dir={sortDir} onSort={handleSort} />
<SortHeader label="Fournisseur" field="supplier" current={sortBy} dir={sortDir} onSort={handleSort} />
<SortHeader label="Montant" field="amount" current={sortBy} dir={sortDir} onSort={handleSort} right />
<th className="px-3 py-3 text-right text-xs font-semibold text-indigo-400 uppercase tracking-wide whitespace-nowrap">
Montant add
</th>
<th className="px-3 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wide whitespace-nowrap">
Statut
</th>
@@ -663,7 +675,7 @@ export default function MyInvoices() {
</tr>
</thead>
<tbody className="divide-y divide-gray-50">
{invoices.map((inv) => (
{invoices.map((inv, idx) => (
<tr key={inv.id} className="hover:bg-gray-50/60 transition-colors">
{/* Date d'envoi */}
@@ -691,6 +703,11 @@ export default function MyInvoices() {
{fmtAmount(inv.amount)}
</td>
{/* Montant add (total cumulé) */}
<td className="px-3 py-3 text-right tabular-nums whitespace-nowrap text-indigo-500 text-xs font-medium">
{fmtAmount(runningTotals[idx])}
</td>
{/* Statut */}
<td className="px-3 py-3 whitespace-nowrap">
<StatusBadge