refactor(ui): single shared documentStatus map across offers/invoices/orders (fix issued color drift, add offers status chip)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-09 16:12:44 +02:00
parent d341db2e51
commit 66235ff567
9 changed files with 200 additions and 131 deletions

View File

@@ -34,26 +34,10 @@ import {
LoadingState,
type DataColumn,
} from "../ui";
import { ORDER_STATUS, statusLabel, statusColor } from "../lib/documentStatus";
const API_BASE = "/api/admin";
const STATUS_LABELS: Record<string, string> = {
prijata: "Přijatá",
v_realizaci: "V realizaci",
dokoncena: "Dokončená",
stornovana: "Stornována",
};
const STATUS_COLORS: Record<
string,
"default" | "success" | "error" | "warning" | "info"
> = {
prijata: "info",
v_realizaci: "warning",
dokoncena: "success",
stornovana: "error",
};
interface Order {
id: number;
order_number: string;
@@ -381,8 +365,8 @@ export default function OrdersReceived({
sortKey: "status",
render: (o) => (
<StatusChip
label={STATUS_LABELS[o.status] || o.status}
color={STATUS_COLORS[o.status] || "default"}
label={statusLabel(ORDER_STATUS, o.status)}
color={statusColor(ORDER_STATUS, o.status)}
/>
),
},