mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-19 05:06:56 +02:00
feat(grid): implement hierarchical nomenclature filter (Secteur > Rayon > Famille)
This commit is contained in:
1 parent
de7aa1560e
commit
33615bb1bd
10 files changed
+310
-57
No files matched your search
@@ -1,20 +1,32 @@
|
||||
import { getFournisseurs, getGridData, getMagasins } from "@/features/grid/actions";
|
||||
import { getAvailableNomenclature, getFournisseurs, getGridData, getMagasins } from "@/features/grid/actions";
|
||||
import { GridClient } from "@/features/grid/components/grid-client";
|
||||
import { SupplierSelectionLanding } from "@/features/grid/components/supplier-selection-landing";
|
||||
|
||||
interface GridPageProps {
|
||||
searchParams: Promise<{ fournisseur?: string; magasin?: string }>;
|
||||
searchParams: Promise<{
|
||||
fournisseur?: string;
|
||||
magasin?: string;
|
||||
code1?: string;
|
||||
code2?: string;
|
||||
code3?: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export default async function GridPage({ searchParams }: GridPageProps) {
|
||||
const params = await searchParams;
|
||||
const codeFournisseur = params.fournisseur;
|
||||
const magasin = params.magasin ?? "TOTAL";
|
||||
const filters = {
|
||||
code1: params.code1 || null,
|
||||
code2: params.code2 || null,
|
||||
code3: params.code3 || null,
|
||||
};
|
||||
|
||||
// 1. Fetch available suppliers & stores
|
||||
const [fournisseurs, magasins] = await Promise.all([
|
||||
// 1. Fetch available suppliers, stores & nomenclature hierarchy
|
||||
const [fournisseurs, magasins, nomenclature] = await Promise.all([
|
||||
getFournisseurs(),
|
||||
getMagasins()
|
||||
getMagasins(),
|
||||
getAvailableNomenclature()
|
||||
]);
|
||||
|
||||
// 2. If no supplier selected, show compact selection UI
|
||||
@@ -23,8 +35,8 @@ export default async function GridPage({ searchParams }: GridPageProps) {
|
||||
}
|
||||
|
||||
// 3. Load real product data for the selected supplier
|
||||
const rows = await getGridData(codeFournisseur, magasin);
|
||||
const selectedFournisseur = fournisseurs.find((f) => f.code === codeFournisseur);
|
||||
const rows = await getGridData(codeFournisseur, magasin, filters);
|
||||
const selectedFournisseur = fournisseurs.find((f: { code: string; nom: string }) => f.code === codeFournisseur);
|
||||
|
||||
return (
|
||||
<GridClient
|
||||
@@ -34,6 +46,7 @@ export default async function GridPage({ searchParams }: GridPageProps) {
|
||||
fournisseurs={fournisseurs}
|
||||
magasins={magasins}
|
||||
magasin={magasin}
|
||||
nomenclature={nomenclature}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user