diff --git a/src/db/schema.ts b/src/db/schema.ts index 489b0f2..f011245 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -14,10 +14,6 @@ export const ventesProduits = pgTable("ventes_produits", { // Gamme & Nomenclature codeGamme: varchar("code_gamme", { length: 20 }), - code1: varchar("code1", { length: 20 }), - libelleNiveau1: varchar("libelle_niveau1", { length: 500 }), - code2: varchar("code2", { length: 20 }), - libelleNiveau2: varchar("libelle_niveau2", { length: 500 }), code3: varchar("code3", { length: 20 }), libelle3: varchar("libelle3", { length: 500 }), diff --git a/src/features/grid/api/get-product-rows.ts b/src/features/grid/api/get-product-rows.ts index 167d8f8..d7bdbc7 100644 --- a/src/features/grid/api/get-product-rows.ts +++ b/src/features/grid/api/get-product-rows.ts @@ -73,6 +73,19 @@ export async function getProductRows(input: GetProductRowsInput): Promise 0 ? (existing.totalMarge / existing.totalCa) * 100 : 0; } else { + const c3 = row.code3 || ""; + const c1 = c3.slice(0, 2); + const c2 = c3.slice(0, 4); + + const L1_LABELS: Record = { + "30": "ÉPICERIE", + "31": "CRÉMERIE / FRAIS", + "32": "LIQUIDES", + "33": "DPH", + "34": "BAZAR", + "35": "TEXTILE", + }; + productMap.set(codein, { codein, codeFournisseur: row.codeFournisseur ?? "", @@ -80,11 +93,11 @@ export async function getProductRows(input: GetProductRowsInput): Promise