feat: Implement snapshot and export management, including API endpoints, database schema, and UI for listing, saving, loading, and deleting.

This commit is contained in:
Michael committed 2026-02-22 13:49:51 +01:00
1 parent 7288b3da72
commit a93b1b36fc
7 files changed
+48 -20

No files matched your search

@@ -44,7 +44,7 @@ export function FloatingSummaryBar() {
}
};
const handleSnapshot = async (labelOverride?: string) => {
const handleSnapshot = async (labelOverride?: string, type: "snapshot" | "export" = "snapshot") => {
if (rows.length === 0) return;
setIsSavingSnapshot(true);
try {
@@ -63,8 +63,9 @@ export function FloatingSummaryBar() {
codeFournisseur: filters.codeFournisseur || rows[0].codeFournisseur,
nomFournisseur: rows[0].nomFournisseur,
magasin: filters.magasin || "TOTAL",
label: labelOverride || `Session ${rows[0].nomFournisseur} — ${new Date().toLocaleTimeString()}`,
label: labelOverride || `${type === 'export' ? 'Export' : 'Session'} ${rows[0].nomFournisseur} — ${new Date().toLocaleTimeString()}`,
changes,
type,
summary: {
totalRows: summary.totalRows,
totalCa: summary.totalCa,
@@ -167,7 +168,7 @@ export function FloatingSummaryBar() {
const nomFournisseur = modifiedRows[0].nomFournisseur;
// Auto-save snapshot for history
await handleSnapshot(`Export ${nomFournisseur} — ${new Date().toLocaleTimeString()}`);
await handleSnapshot(`Export ${nomFournisseur} — ${new Date().toLocaleTimeString()}`, "export");
try {
const res = await fetch("/api/export/modified-gammes", {