Update OrdersTable.tsx
This commit is contained in:
@@ -215,7 +215,52 @@ export default function OrdersTable({ orders, enableModal = true }: OrdersTableP
|
|||||||
itemSize={60}
|
itemSize={60}
|
||||||
className="border"
|
className="border"
|
||||||
>
|
>
|
||||||
{Row}
|
{({ index, style }: { index: number; style: React.CSSProperties }) => {
|
||||||
|
const order = currentOrders[index];
|
||||||
|
if (!order) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={style}>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell className="font-medium">{order.orderId}</TableCell>
|
||||||
|
<TableCell>{order.userId}</TableCell>
|
||||||
|
<TableCell>{order.vendorUsername || 'N/A'}</TableCell>
|
||||||
|
<TableCell className="max-w-[200px] truncate">
|
||||||
|
{order.items.length > 0 ? order.items[0].name : 'No items'}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>£{order.total.toFixed(2)}</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<div className={`px-3 py-1 rounded-full border ${getStatusStyle(order.status)}`}>
|
||||||
|
{order.status.toUpperCase()}
|
||||||
|
</div>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>N/A</TableCell>
|
||||||
|
<TableCell>{new Date(order.createdAt).toLocaleDateString()}</TableCell>
|
||||||
|
<TableCell className="text-right">
|
||||||
|
{enableModal ? (
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
onClick={() => handleViewOrder(order.orderId)}
|
||||||
|
title="View order details (Admin only)"
|
||||||
|
>
|
||||||
|
<Eye className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
disabled
|
||||||
|
title="Order details modal disabled"
|
||||||
|
>
|
||||||
|
<Eye className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
</List>
|
</List>
|
||||||
) : (
|
) : (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
|
|||||||
Reference in New Issue
Block a user