feat(inventory): 實作過期與瑕疵庫存總計顯示,並強化庫存明細過期提示
This commit is contained in:
@@ -37,6 +37,7 @@ interface PageProps {
|
||||
available_amount: number;
|
||||
book_stock: number;
|
||||
book_amount: number;
|
||||
abnormal_amount: number;
|
||||
};
|
||||
filters: {
|
||||
search?: string;
|
||||
@@ -166,18 +167,15 @@ export default function WarehouseIndex({ warehouses, totals, filters }: PageProp
|
||||
</div>
|
||||
|
||||
{/* 統計區塊 */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
|
||||
<Card className="shadow-sm">
|
||||
<CardContent className="p-6">
|
||||
<div className="flex flex-col">
|
||||
<span className="text-sm font-medium text-gray-500 mb-1">可用庫存總計</span>
|
||||
<div className="flex items-baseline gap-2">
|
||||
<span className="text-3xl font-bold text-primary-main">
|
||||
{totals.available_stock.toLocaleString()}
|
||||
</span>
|
||||
<Can permission="inventory.view_cost">
|
||||
<span className="text-lg font-medium text-gray-400">
|
||||
( 總額:${totals.available_amount?.toLocaleString()} )
|
||||
<span className="text-3xl font-bold text-primary-main">
|
||||
${Number(totals.available_amount || 0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||
</span>
|
||||
</Can>
|
||||
</div>
|
||||
@@ -190,12 +188,24 @@ export default function WarehouseIndex({ warehouses, totals, filters }: PageProp
|
||||
<div className="flex flex-col">
|
||||
<span className="text-sm font-medium text-gray-500 mb-1">帳面庫存總計</span>
|
||||
<div className="flex items-baseline gap-2">
|
||||
<span className="text-3xl font-bold text-gray-700">
|
||||
{totals.book_stock.toLocaleString()}
|
||||
</span>
|
||||
<Can permission="inventory.view_cost">
|
||||
<span className="text-lg font-medium text-gray-400">
|
||||
( 總額:${totals.book_amount?.toLocaleString()} )
|
||||
<span className="text-3xl font-bold text-gray-700">
|
||||
${Number(totals.book_amount || 0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||
</span>
|
||||
</Can>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="shadow-sm border-red-100 bg-red-50/10">
|
||||
<CardContent className="p-6">
|
||||
<div className="flex flex-col">
|
||||
<span className="text-sm font-medium text-red-500 mb-1">過期與瑕疵總計</span>
|
||||
<div className="flex items-baseline gap-2">
|
||||
<Can permission="inventory.view_cost">
|
||||
<span className="text-3xl font-bold text-red-600">
|
||||
${Number(totals.abnormal_amount || 0).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}
|
||||
</span>
|
||||
</Can>
|
||||
</div>
|
||||
@@ -252,6 +262,8 @@ export default function WarehouseIndex({ warehouses, totals, filters }: PageProp
|
||||
warehouse={warehouse}
|
||||
stats={{
|
||||
totalQuantity: warehouse.book_stock || 0,
|
||||
totalValue: warehouse.book_amount || 0,
|
||||
abnormalValue: warehouse.abnormal_amount || 0,
|
||||
lowStockCount: warehouse.low_stock_count || 0,
|
||||
replenishmentNeeded: warehouse.low_stock_count || 0
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user