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:
@@ -28,32 +28,19 @@ import {
|
||||
LoadingState,
|
||||
type DataColumn,
|
||||
} from "../ui";
|
||||
import {
|
||||
ISSUED_ORDER_STATUS,
|
||||
statusLabel,
|
||||
statusColor,
|
||||
statusOptions,
|
||||
} from "../lib/documentStatus";
|
||||
|
||||
const API_BASE = "/api/admin";
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
draft: "Koncept",
|
||||
sent: "Odeslaná",
|
||||
confirmed: "Potvrzená",
|
||||
completed: "Dokončená",
|
||||
cancelled: "Stornovaná",
|
||||
};
|
||||
|
||||
const STATUS_COLORS: Record<
|
||||
string,
|
||||
"default" | "success" | "error" | "warning" | "info"
|
||||
> = {
|
||||
draft: "default",
|
||||
sent: "info",
|
||||
confirmed: "warning",
|
||||
completed: "success",
|
||||
cancelled: "error",
|
||||
};
|
||||
|
||||
const STATUS_OPTIONS = [
|
||||
{ value: "", label: "Všechny stavy" },
|
||||
...Object.entries(STATUS_LABELS).map(([value, label]) => ({ value, label })),
|
||||
];
|
||||
const STATUS_OPTIONS = statusOptions(ISSUED_ORDER_STATUS, {
|
||||
value: "",
|
||||
label: "Všechny stavy",
|
||||
});
|
||||
|
||||
const ViewIcon = (
|
||||
<svg
|
||||
@@ -224,8 +211,8 @@ export default function IssuedOrders({ month, year }: IssuedOrdersProps) {
|
||||
sortKey: "status",
|
||||
render: (o) => (
|
||||
<StatusChip
|
||||
label={STATUS_LABELS[o.status] || o.status}
|
||||
color={STATUS_COLORS[o.status] || "default"}
|
||||
label={statusLabel(ISSUED_ORDER_STATUS, o.status)}
|
||||
color={statusColor(ISSUED_ORDER_STATUS, o.status)}
|
||||
/>
|
||||
),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user