mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-22 06:28:09 +02:00
feat: add client-side data table components for negative stock and stagnant inventory with sorting and Excel export capabilities
This commit is contained in:
1 parent
ac1c9a5522
commit
2264ced494
1 file changed
+3
-2
@@ -134,8 +134,9 @@ function TabStockNegatif({ rows, magasin }: { rows: PgStockNegatifRow[]; magasin
|
|||||||
|
|
||||||
function TabEntreesSansVente({ rows, magasin }: { rows: PgStockSansVenteRow[]; magasin: string }) {
|
function TabEntreesSansVente({ rows, magasin }: { rows: PgStockSansVenteRow[]; magasin: string }) {
|
||||||
type SK = keyof PgStockSansVenteRow;
|
type SK = keyof PgStockSansVenteRow;
|
||||||
|
const filteredRows = useMemo(() => rows.filter(r => r.stock_actuel !== 0), [rows]);
|
||||||
const { sorted, sortKey, sortDir, handleSort } = useSortedRows<PgStockSansVenteRow>(
|
const { sorted, sortKey, sortDir, handleSort } = useSortedRows<PgStockSansVenteRow>(
|
||||||
rows.length ? rows : [] as PgStockSansVenteRow[],
|
filteredRows,
|
||||||
["stock_actuel"]
|
["stock_actuel"]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -288,7 +289,7 @@ export function GestionStockClient({ rowsNegatif, rowsSansVente, magasin, tab, s
|
|||||||
"ml-2 rounded-full px-2 py-0.5 text-xs font-semibold",
|
"ml-2 rounded-full px-2 py-0.5 text-xs font-semibold",
|
||||||
activeTab === t.key ? "bg-blue-100 text-blue-700" : "bg-gray-100 text-gray-500",
|
activeTab === t.key ? "bg-blue-100 text-blue-700" : "bg-gray-100 text-gray-500",
|
||||||
].join(" ")}>
|
].join(" ")}>
|
||||||
{t.key === "negatif" ? rowsNegatif.length : rowsSansVente.length}
|
{t.key === "negatif" ? rowsNegatif.length : rowsSansVente.filter(r => r.stock_actuel !== 0).length}
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in new issue
Block a user