This commit is contained in:
NotII
2025-06-30 16:56:57 +01:00
parent 6516c6d2f9
commit 84e4515a26
4 changed files with 122 additions and 218 deletions

View File

@@ -39,32 +39,6 @@ export default function ProductPerformanceChart() {
fetchProductData();
}, [toast]);
const getStockStatusColor = (status: string) => {
switch (status) {
case 'in_stock':
return 'bg-green-100 text-green-800';
case 'low_stock':
return 'bg-yellow-100 text-yellow-800';
case 'out_of_stock':
return 'bg-red-100 text-red-800';
default:
return 'bg-gray-100 text-gray-800';
}
};
const getStockStatusText = (status: string) => {
switch (status) {
case 'in_stock':
return 'In Stock';
case 'low_stock':
return 'Low Stock';
case 'out_of_stock':
return 'Out of Stock';
default:
return 'Unknown';
}
};
if (isLoading) {
return (
<Card>
@@ -157,7 +131,6 @@ export default function ProductPerformanceChart() {
<TableHeader>
<TableRow>
<TableHead>Product</TableHead>
<TableHead>Stock</TableHead>
<TableHead className="text-right">Sold</TableHead>
<TableHead className="text-right">Revenue</TableHead>
<TableHead className="text-right">Orders</TableHead>
@@ -185,19 +158,6 @@ export default function ProductPerformanceChart() {
</div>
</div>
</TableCell>
<TableCell>
<div className="flex flex-col gap-1">
<Badge
variant="secondary"
className={getStockStatusColor(product.stockStatus)}
>
{getStockStatusText(product.stockStatus)}
</Badge>
<span className="text-xs text-muted-foreground">
{product.currentStock} available
</span>
</div>
</TableCell>
<TableCell className="text-right font-medium">
{product.totalSold.toFixed(2)}
</TableCell>