refactor(inventory): 重構倉庫管理邏輯,移除 is_sellable 欄位並改由類型判定可用庫存
This commit is contained in:
@@ -100,12 +100,18 @@ export default function WarehouseCard({
|
||||
|
||||
{/* 統計區塊 - 狀態標籤 */}
|
||||
<div className="space-y-3">
|
||||
{/* 銷售狀態 */}
|
||||
{/* 銷售狀態與可用性說明 */}
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm text-gray-500">銷售狀態</span>
|
||||
<Badge variant={warehouse.is_sellable ? "default" : "secondary"} className={warehouse.is_sellable ? "bg-green-600" : "bg-gray-400"}>
|
||||
{warehouse.is_sellable ? "可銷售" : "暫停銷售"}
|
||||
</Badge>
|
||||
<span className="text-sm text-gray-500">庫存可用性</span>
|
||||
{warehouse.type === 'quarantine' ? (
|
||||
<Badge variant="secondary" className="bg-red-100 text-red-700 border-red-200">
|
||||
不計入可用
|
||||
</Badge>
|
||||
) : (
|
||||
<Badge variant="default" className="bg-green-600">
|
||||
計入可用
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 低庫存警告狀態 */}
|
||||
|
||||
@@ -62,7 +62,6 @@ export default function WarehouseDialog({
|
||||
address: string;
|
||||
description: string;
|
||||
type: WarehouseType;
|
||||
is_sellable: boolean;
|
||||
license_plate: string;
|
||||
driver_name: string;
|
||||
}>({
|
||||
@@ -71,7 +70,6 @@ export default function WarehouseDialog({
|
||||
address: "",
|
||||
description: "",
|
||||
type: "standard",
|
||||
is_sellable: true,
|
||||
license_plate: "",
|
||||
driver_name: "",
|
||||
});
|
||||
@@ -86,7 +84,6 @@ export default function WarehouseDialog({
|
||||
address: warehouse.address || "",
|
||||
description: warehouse.description || "",
|
||||
type: warehouse.type || "standard",
|
||||
is_sellable: warehouse.is_sellable ?? true,
|
||||
license_plate: warehouse.license_plate || "",
|
||||
driver_name: warehouse.driver_name || "",
|
||||
});
|
||||
@@ -97,7 +94,6 @@ export default function WarehouseDialog({
|
||||
address: "",
|
||||
description: "",
|
||||
type: "standard",
|
||||
is_sellable: true,
|
||||
license_plate: "",
|
||||
driver_name: "",
|
||||
});
|
||||
@@ -219,25 +215,7 @@ export default function WarehouseDialog({
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 銷售設定 */}
|
||||
<div className="space-y-4">
|
||||
<div className="border-b pb-2">
|
||||
<h4 className="text-sm text-gray-700">銷售設定</h4>
|
||||
</div>
|
||||
<div className="flex items-center space-x-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="is_sellable"
|
||||
className="h-4 w-4 rounded border-gray-300 text-primary-main focus:ring-primary-main"
|
||||
checked={formData.is_sellable}
|
||||
onChange={(e) => setFormData({ ...formData, is_sellable: e.target.checked })}
|
||||
/>
|
||||
<Label htmlFor="is_sellable">此倉庫可進行銷售扣庫</Label>
|
||||
</div>
|
||||
<p className="text-xs text-gray-500 ml-6">
|
||||
啟用後,該倉庫庫存可用於 POS 或訂單銷售扣減。總倉通常不啟用,門市與行動販賣車需啟用。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
{/* 區塊 B:位置 */}
|
||||
<div className="space-y-4">
|
||||
|
||||
Reference in New Issue
Block a user