Files
star-erp/resources/js/constants/purchase-order.ts
sky121113 4fa87925a2
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Has been skipped
Koori-ERP-Deploy-System / deploy-production (push) Successful in 1m8s
UI優化: 全系統狀態標籤 (StatusBadge) 統一化重構完成 (Phase 3 & 4)
2026-02-13 13:16:05 +08:00

65 lines
2.0 KiB
TypeScript

/**
* 採購單相關常數
*/
import type { PurchaseOrderStatus, PaymentMethod, InvoiceType } from "@/types/purchase-order";
import { StatusVariant } from "@/Components/shared/StatusBadge";
// 狀態標籤配置
export const STATUS_CONFIG: Record<
PurchaseOrderStatus,
{ label: string; variant: StatusVariant }
> = {
draft: { label: "草稿", variant: "neutral" },
pending: { label: "簽核中", variant: "warning" },
approved: { label: "已核准", variant: "success" },
partial: { label: "部分收貨", variant: "neutral" },
completed: { label: "全數收貨", variant: "success" },
closed: { label: "已結案", variant: "neutral" },
cancelled: { label: "已作廢", variant: "destructive" },
};
// 供下單/編輯頁面使用的手動狀態選項 (排除系統自動狀態)
export const MANUAL_STATUS_OPTIONS = [
{ value: 'draft', label: '草稿' },
{ value: 'pending', label: '送審中' },
{ value: 'approved', label: '已核准' },
{ value: 'cancelled', label: '已作廢' },
];
export const STATUS_OPTIONS = Object.entries(STATUS_CONFIG).map(([value, config]) => ({
value,
label: (config as any).label,
}));
// 付款方式選項
export const PAYMENT_METHODS: Record<PaymentMethod, string> = {
cash: "現金",
bank_transfer: "銀行轉帳",
credit_card: "信用卡",
check: "支票",
};
// 發票類型選項
export const INVOICE_TYPES: Record<InvoiceType, string> = {
duplicate: "二聯式",
triplicate: "三聯式",
electronic: "電子發票",
};
// 退回原因選項
export const REJECTION_REASONS = [
{ value: "預算不足", label: "預算不足" },
{ value: "非必要採購", label: "非必要採購" },
{ value: "數量過多", label: "數量過多" },
{ value: "價格過高", label: "價格過高" },
{ value: "資訊不完整", label: "資訊不完整" },
{ value: "其他", label: "其他" },
];
/**
* 價格警示閾值(百分比)
* 當單價比上次採購價高出此百分比時,顯示警示
*/
export const PRICE_ALERT_THRESHOLD = 5;