feat: update frontend components and page layouts
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user