From c23f74d32de4b1ed6468ae5c0e29e54ff87d6c31 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Feb 2026 13:10:10 +0100 Subject: [PATCH] feat: Add Excel export for modified gammes via a new API route and a button in the floating summary bar. --- src/app/api/export/modified-gammes/route.ts | 7 ++++--- src/features/grid/components/floating-summary-bar.tsx | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/api/export/modified-gammes/route.ts b/src/app/api/export/modified-gammes/route.ts index f65d767..5178b45 100644 --- a/src/app/api/export/modified-gammes/route.ts +++ b/src/app/api/export/modified-gammes/route.ts @@ -7,6 +7,7 @@ const ExportModifiedGammesSchema = z.object({ changes: z.array(z.object({ codein: z.string(), gtin: z.string(), + codeFournisseur: z.string().optional(), gamme: z.string(), })), }); @@ -36,7 +37,7 @@ export async function POST(req: NextRequest) { }; sheet.columns = [ - { header: "CODE FOURNISSEUR", key: "codein", width: 22 }, + { header: "CODE FOURNISSEUR", key: "codeFournisseur", width: 22 }, { header: "GENCOD", key: "gtin", width: 18 }, { header: "GAMME", key: "gamme", width: 12 }, ]; @@ -47,7 +48,7 @@ export async function POST(req: NextRequest) { for (const row of changes) { sheet.addRow({ - codein: row.codein, + codeFournisseur: row.codeFournisseur || "—", gtin: row.gtin || "—", gamme: row.gamme || "—", }); @@ -58,7 +59,7 @@ export async function POST(req: NextRequest) { gammeCol.alignment = { horizontal: "center" }; // Format codein et gtin en texte pour eviter la notation scientifique excel - sheet.getColumn("codein").numFmt = "@"; + sheet.getColumn("codeFournisseur").numFmt = "@"; sheet.getColumn("gtin").numFmt = "@"; // Generate buffer diff --git a/src/features/grid/components/floating-summary-bar.tsx b/src/features/grid/components/floating-summary-bar.tsx index ccec628..c965638 100644 --- a/src/features/grid/components/floating-summary-bar.tsx +++ b/src/features/grid/components/floating-summary-bar.tsx @@ -91,6 +91,7 @@ export function FloatingSummaryBar() { const changes = modifiedRows.map(r => ({ codein: r.codein, gtin: r.gtin, + codeFournisseur: r.codeFournisseur, gamme: (currentDrafts[r.codein] ?? r.codeGamme) as string, }));