feat(issued-orders)!: sections replace flat terms/notes fields; Obsah title
Per user decision the rich-text sections now carry all free-form PDF content on issued orders: dropped columns delivery_terms, payment_terms, issued_by, notes (migration applied to dev+test) and their PDF blocks + form fields. Kept: order_text (moved from the bottom card into the Zakladni udaje grid, replacing the Vystavil field) and internal_notes (now the only field in the bottom card, never printed). Sections card is titled 'Obsah' on issued orders; offers keep 'Rozsah projektu' and are untouched. Legacy clients sending the dropped keys are silently stripped (tested). PDF footer 'Vystavil:' stays - it prints the logged-in user, not the dropped column. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,11 +53,7 @@ export interface IssuedOrderDetail extends IssuedOrder {
|
||||
exchange_rate: number | string | null;
|
||||
delivery_date: string | null;
|
||||
language: string | null;
|
||||
delivery_terms: string | null;
|
||||
payment_terms: string | null;
|
||||
issued_by: string | null;
|
||||
order_text: string | null;
|
||||
notes: string | null;
|
||||
internal_notes: string | null;
|
||||
items: IssuedOrderItem[];
|
||||
sections: IssuedOrderSection[];
|
||||
|
||||
@@ -106,11 +106,7 @@ interface OrderForm {
|
||||
order_date: string;
|
||||
delivery_date: string;
|
||||
language: string;
|
||||
delivery_terms: string;
|
||||
payment_terms: string;
|
||||
issued_by: string;
|
||||
order_text: string;
|
||||
notes: string;
|
||||
internal_notes: string;
|
||||
status: string;
|
||||
}
|
||||
@@ -137,11 +133,7 @@ interface IssuedOrderSavePayload {
|
||||
order_date: string;
|
||||
delivery_date: string | null;
|
||||
language: string;
|
||||
delivery_terms: string;
|
||||
payment_terms: string;
|
||||
issued_by: string;
|
||||
order_text: string | null;
|
||||
notes: string;
|
||||
internal_notes: string;
|
||||
items: IssuedOrderItemPayload[];
|
||||
sections: IssuedOrderSectionPayload[];
|
||||
@@ -154,7 +146,7 @@ export default function IssuedOrderDetail() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
const alert = useAlert();
|
||||
const { hasPermission, user } = useAuth();
|
||||
const { hasPermission } = useAuth();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const [form, setForm] = useState<OrderForm>({
|
||||
@@ -164,11 +156,7 @@ export default function IssuedOrderDetail() {
|
||||
order_date: todayLocalStr(),
|
||||
delivery_date: "",
|
||||
language: "cs",
|
||||
delivery_terms: "",
|
||||
payment_terms: "",
|
||||
issued_by: user?.fullName || "",
|
||||
order_text: "",
|
||||
notes: "",
|
||||
internal_notes: "",
|
||||
status: "draft",
|
||||
});
|
||||
@@ -287,11 +275,7 @@ export default function IssuedOrderDetail() {
|
||||
order_date: normalizeDateStr(d.order_date),
|
||||
delivery_date: normalizeDateStr(d.delivery_date),
|
||||
language: d.language || "cs",
|
||||
delivery_terms: d.delivery_terms || "",
|
||||
payment_terms: d.payment_terms || "",
|
||||
issued_by: d.issued_by || "",
|
||||
order_text: d.order_text || "",
|
||||
notes: d.notes || "",
|
||||
internal_notes: d.internal_notes || "",
|
||||
status: d.status,
|
||||
};
|
||||
@@ -423,11 +407,7 @@ export default function IssuedOrderDetail() {
|
||||
order_date: form.order_date,
|
||||
delivery_date: form.delivery_date || null,
|
||||
language: form.language,
|
||||
delivery_terms: form.delivery_terms,
|
||||
payment_terms: form.payment_terms,
|
||||
issued_by: form.issued_by,
|
||||
order_text: form.order_text || null,
|
||||
notes: form.notes,
|
||||
internal_notes: form.internal_notes,
|
||||
items: items
|
||||
.filter((i) => i.description.trim())
|
||||
@@ -859,11 +839,15 @@ export default function IssuedOrderDetail() {
|
||||
</Field>
|
||||
</Box>
|
||||
|
||||
<Field label="Vystavil">
|
||||
<Field label="Text objednávky (na PDF)">
|
||||
<TextField
|
||||
value={form.issued_by}
|
||||
InputProps={{ readOnly: true }}
|
||||
sx={{ "& .MuiInputBase-root": { bgcolor: "action.hover" } }}
|
||||
value={form.order_text}
|
||||
InputProps={{ readOnly: !editable }}
|
||||
slotProps={{ htmlInput: { maxLength: 500 } }}
|
||||
onChange={(e) =>
|
||||
setForm((prev) => ({ ...prev, order_text: e.target.value }))
|
||||
}
|
||||
placeholder="Objednáváme si u Vás: (ponechte prázdné pro výchozí)"
|
||||
/>
|
||||
</Field>
|
||||
</Card>
|
||||
@@ -877,57 +861,17 @@ export default function IssuedOrderDetail() {
|
||||
error={errors.items}
|
||||
/>
|
||||
|
||||
{/* Rich-text PDF sections (mirrors offers' scope sections) */}
|
||||
{/* Rich-text PDF sections — the free-form PDF content lives here */}
|
||||
<SectionsEditor
|
||||
sections={sections}
|
||||
onChange={setSections}
|
||||
readOnly={!editable}
|
||||
title="Obsah"
|
||||
language={form.language}
|
||||
/>
|
||||
|
||||
{/* Notes & terms */}
|
||||
{/* Internal notes */}
|
||||
<Card sx={{ mb: 3 }}>
|
||||
<Field label="Text objednávky (na PDF)">
|
||||
<TextField
|
||||
value={form.order_text}
|
||||
InputProps={{ readOnly: !editable }}
|
||||
slotProps={{ htmlInput: { maxLength: 500 } }}
|
||||
onChange={(e) =>
|
||||
setForm((prev) => ({ ...prev, order_text: e.target.value }))
|
||||
}
|
||||
placeholder="Objednáváme si u Vás: (ponechte prázdné pro výchozí)"
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Dodací podmínky">
|
||||
<TextField
|
||||
value={form.delivery_terms}
|
||||
InputProps={{ readOnly: !editable }}
|
||||
slotProps={{ htmlInput: { maxLength: 500 } }}
|
||||
onChange={(e) =>
|
||||
setForm((prev) => ({ ...prev, delivery_terms: e.target.value }))
|
||||
}
|
||||
placeholder="Např. DAP, sklad odběratele..."
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Platební podmínky">
|
||||
<TextField
|
||||
value={form.payment_terms}
|
||||
InputProps={{ readOnly: !editable }}
|
||||
slotProps={{ htmlInput: { maxLength: 500 } }}
|
||||
onChange={(e) =>
|
||||
setForm((prev) => ({ ...prev, payment_terms: e.target.value }))
|
||||
}
|
||||
placeholder="Např. splatnost 14 dní..."
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Poznámky (na PDF)">
|
||||
<RichEditor
|
||||
value={form.notes}
|
||||
readOnly={!editable}
|
||||
onChange={(val) => setForm((prev) => ({ ...prev, notes: val }))}
|
||||
placeholder="Veřejné poznámky zobrazené na objednávce..."
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Interní poznámky" hint="Nezobrazí se na PDF.">
|
||||
<RichEditor
|
||||
value={form.internal_notes}
|
||||
|
||||
Reference in New Issue
Block a user