/** * 倉庫卡片元件 * 顯示單個倉庫的資訊和統計 */ import { useState } from "react"; import { Package, AlertTriangle, MapPin, Edit, Info, FileText, } from "lucide-react"; import { Warehouse, WarehouseStats } from "@/types/warehouse"; import { Button } from "@/Components/ui/button"; import { Badge } from "@/Components/ui/badge"; import { Card, CardContent } from "@/Components/ui/card"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/Components/ui/dialog"; interface WarehouseCardProps { warehouse: Warehouse; stats: WarehouseStats; hasWarning: boolean; onViewInventory: (warehouseId: string) => void; onEdit: (warehouse: Warehouse) => void; } export default function WarehouseCard({ warehouse, stats, hasWarning, onViewInventory, onEdit, }: WarehouseCardProps) { const [showInfoDialog, setShowInfoDialog] = useState(false); return ( {/* 警告橫幅 */} {hasWarning && (
低庫存警告
)} {/* 上半部:資訊區域 */}
{/* 標題區塊 */}

{warehouse.name}

{warehouse.description || "無描述"}
{/* 統計區塊 - 狀態標籤 */}
{/* 銷售狀態 */}
銷售狀態 {warehouse.is_sellable ? "可銷售" : "暫停銷售"}
{/* 低庫存警告狀態 */}
低庫存警告
{hasWarning ? ( {stats.lowStockCount} 項 ) : ( 正常 )}
{/* 下半部:操作按鈕 */}
{/* 倉庫資訊對話框 */} {warehouse.name} {warehouse.code}

地址

{warehouse.address || "-"}

描述

{warehouse.description || "-"}

); }