/** * 狀態流程條組件 */ import { Check } from "lucide-react"; import type { PurchaseOrderStatus } from "@/types/purchase-order"; interface StatusProgressBarProps { currentStatus: PurchaseOrderStatus; } // 流程步驟定義 const FLOW_STEPS: { key: PurchaseOrderStatus | "approved"; label: string }[] = [ { key: "draft", label: "草稿" }, { key: "pending", label: "待審核" }, { key: "processing", label: "處理中" }, { key: "shipping", label: "運送中" }, { key: "confirming", label: "待確認" }, { key: "completed", label: "已完成" }, ]; export function StatusProgressBar({ currentStatus }: StatusProgressBarProps) { // 對於 cancelled 狀態,進度條通常不顯示或顯示特殊樣式,這裡我們顯示到最後一個有效狀態 const effectiveStatus = currentStatus === "cancelled" ? "pending" : currentStatus; // 找到當前狀態在流程中的位置 const currentIndex = FLOW_STEPS.findIndex((step) => step.key === effectiveStatus); return (
{isRejectedAtThisStep ? "已取消" : step.label}