UI優化: 全系統狀態標籤 (StatusBadge) 統一化重構完成 (Phase 3 & 4)
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
TableRow,
|
||||
} from "@/Components/ui/table";
|
||||
import { Button } from "@/Components/ui/button";
|
||||
import { Badge } from "@/Components/ui/badge";
|
||||
import { StatusBadge } from "@/Components/shared/StatusBadge";
|
||||
import { ArrowLeft, FileText, Package } from "lucide-react";
|
||||
import Pagination from "@/Components/shared/Pagination";
|
||||
import { formatDate } from "@/utils/format";
|
||||
@@ -69,17 +69,18 @@ interface ShowProps extends PageProps {
|
||||
export default function InventoryReportShow({ product, transactions, filters, reportFilters, warehouses }: ShowProps) {
|
||||
|
||||
// 類型 Badge 顏色映射
|
||||
const getTypeBadgeVariant = (type: string) => {
|
||||
// 類型 Badge 顏色映射
|
||||
const getTypeBadgeVariant = (type: string): "success" | "destructive" | "neutral" => {
|
||||
switch (type) {
|
||||
case '入庫':
|
||||
case '手動入庫':
|
||||
case '調撥入庫':
|
||||
return "default";
|
||||
return "success";
|
||||
case '出庫':
|
||||
case '調撥出庫':
|
||||
return "destructive";
|
||||
default:
|
||||
return "secondary";
|
||||
return "neutral";
|
||||
}
|
||||
};
|
||||
|
||||
@@ -128,9 +129,9 @@ export default function InventoryReportShow({ product, transactions, filters, re
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center gap-3">
|
||||
<h3 className="text-xl font-bold text-grey-0">{product.name}</h3>
|
||||
<Badge variant="outline" className="text-sm px-2 py-0.5 bg-gray-50">
|
||||
<StatusBadge variant="neutral" className="text-sm px-2 py-0.5">
|
||||
{product.code}
|
||||
</Badge>
|
||||
</StatusBadge>
|
||||
</div>
|
||||
<div className="flex items-center gap-6 text-sm text-gray-500">
|
||||
<span className="flex items-center gap-1.5">
|
||||
@@ -212,9 +213,9 @@ export default function InventoryReportShow({ product, transactions, filters, re
|
||||
{formatDate(tx.actual_time)}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Badge variant={getTypeBadgeVariant(tx.type)}>
|
||||
<StatusBadge variant={getTypeBadgeVariant(tx.type)}>
|
||||
{tx.type}
|
||||
</Badge>
|
||||
</StatusBadge>
|
||||
</TableCell>
|
||||
<TableCell>{tx.warehouse_name}</TableCell>
|
||||
<TableCell className={`text-right font-medium ${tx.quantity > 0 ? 'text-emerald-600' :
|
||||
|
||||
Reference in New Issue
Block a user