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

@@ -76,6 +76,7 @@ import {
PageEnter,
headerActionsSx,
} from "../ui";
import { OFFER_STATUS, statusLabel, statusColor } from "../lib/documentStatus";
const API_BASE = "/api/admin";
const DRAFT_KEY = "boha_offer_draft";
@@ -1124,10 +1125,17 @@ export default function OfferDetail() {
<Typography variant="h4">
{isEdit ? `Nabídka ${form.quotation_number}` : "Nová nabídka"}
</Typography>
{isInvalidated && (
<StatusChip label="Zneplatněna" color="error" />
)}
{isCompleted && <StatusChip label="Dokončeno" color="success" />}
{isEdit &&
(isCompleted ? (
// Completed is derived from the linked order, not the offer's
// own status — surface it (success) over the base chip.
<StatusChip label="Dokončená" color="success" />
) : (
<StatusChip
label={statusLabel(OFFER_STATUS, offerStatus)}
color={statusColor(OFFER_STATUS, offerStatus)}
/>
))}
</Box>
</Box>
<Box sx={headerActionsSx}>