feat: update frontend components and page layouts

This commit is contained in:
2026-09-15 11:25:56 +05:30
parent d46f78bbd0
commit 85a3275268
8 changed files with 530 additions and 78 deletions
+8 -2
View File
@@ -8,7 +8,7 @@ import { MoreHorizontal } from 'lucide-react';
export interface TableProps<T> {
data: T[];
columns: any[];
getRowId?: (row: T) => string;
getRowId?: (row: T, index?: number) => string;
emptyMessage?: string;
}
@@ -17,7 +17,13 @@ export const Table = <T,>({ data, columns, getRowId, emptyMessage = 'No data ava
data,
columns,
getCoreRowModel: getCoreRowModel(),
getRowId,
getRowId: (row: any, index: number) => {
let customId = getRowId ? getRowId(row) : null;
if (customId !== undefined && customId !== null && customId !== '') {
return `${customId}_${index}`;
}
return row.id || row.batch_no || row.product_id || row.dispensing_id || `row-${index}`;
},
});
return (