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:
BOHA
2026-06-10 17:27:08 +02:00
parent d1533ffc4d
commit 75dc97516e
8 changed files with 69 additions and 200 deletions

View File

@@ -160,9 +160,6 @@ const translations: Record<Lang, Record<string, string>> = {
col_unit_price: "Jedn. cena",
col_total: "Celkem",
total_no_vat: "Celkem bez DPH",
notes: "Poznámky",
delivery_terms: "Dodací podmínky:",
payment_terms: "Platební podmínky:",
issued_by: "Vystavil:",
ico: "IČ: ",
dic: "DIČ: ",
@@ -181,9 +178,6 @@ const translations: Record<Lang, Record<string, string>> = {
col_unit_price: "Unit price",
col_total: "Total",
total_no_vat: "Total excl. VAT",
notes: "Notes",
delivery_terms: "Delivery terms:",
payment_terms: "Payment terms:",
issued_by: "Issued by:",
ico: "Reg. No.: ",
dic: "Tax ID: ",
@@ -195,10 +189,6 @@ interface IssuedOrderPdfData {
order_date: Date | null;
delivery_date: Date | null;
currency: string | null;
notes: string | null;
delivery_terms: string | null;
payment_terms: string | null;
issued_by: string | null;
// Editable heading above the items table; null → t.billing default.
order_text?: string | null;
}
@@ -287,30 +277,9 @@ export function renderIssuedOrderHtml(
total = Math.round(total * 100) / 100;
const notesRaw = order.notes ?? "";
const notesStripped = notesRaw.replace(/<[^>]*>/g, "").trim();
const notesHtml = notesStripped
? `
<div class="invoice-notes">
<div class="invoice-notes-label">${escapeHtml(t.notes)}</div>
<div class="invoice-notes-content">${cleanQuillHtml(DOMPurify.sanitize(notesRaw))}</div>
</div>
`
: "";
const issueDateStr = formatDate(order.order_date);
const deliveryDateStr = formatDate(order.delivery_date);
// Order-specific terms (purchase-order addition; not on invoices).
let termsHtml = "";
if (order.delivery_terms) {
termsHtml += `<div class="terms-row"><span class="lbl">${escapeHtml(t.delivery_terms)}</span> ${escapeHtml(order.delivery_terms)}</div>`;
}
if (order.payment_terms) {
termsHtml += `<div class="terms-row"><span class="lbl">${escapeHtml(t.payment_terms)}</span> ${escapeHtml(order.payment_terms)}</div>`;
}
const termsBlock = termsHtml ? `<div class="terms">${termsHtml}</div>` : "";
// Quill indent CSS
const indentCSS = buildQuillIndentCss();
@@ -592,19 +561,6 @@ export function renderIssuedOrderHtml(
border-bottom: 2.5pt solid #de3a3a;
padding-bottom: 1mm;
}
/* Dodaci / platebni podminky (PO-specificke) */
.terms {
margin-top: 4mm;
font-size: 9pt;
line-height: 1.5;
color: #1a1a1a;
}
.terms-row { margin-bottom: 1mm; }
.terms-row .lbl {
font-weight: 600;
color: #555;
}
/* Vystavil */
.issued-by {
font-size: 9pt;
@@ -621,33 +577,6 @@ export function renderIssuedOrderHtml(
line-height: 1.3;
}
/* Poznamky */
.invoice-notes {
margin-top: 4mm;
font-size: 10pt;
line-height: 1.5;
color: #1a1a1a;
}
.invoice-notes-label {
font-weight: 600;
font-size: 9pt;
text-transform: uppercase;
color: #555;
margin-bottom: 1mm;
}
.invoice-notes-content p { margin: 0 0 0.4em 0; }
.invoice-notes-content ul, .invoice-notes-content ol { margin: 0 0 0.4em 1.5em; }
.invoice-notes-content li { margin-bottom: 0.2em; }
.invoice-notes-content,
.invoice-notes-content * {
font-family: Tahoma, sans-serif !important;
}
.invoice-notes-content { font-size: 14px; }
.invoice-notes-content h1 { font-size: 20px; }
.invoice-notes-content h2 { font-size: 18px; }
.invoice-notes-content h3 { font-size: 16px; }
.invoice-notes-content h4 { font-size: 15px; }
/* Sekce (scope) na vlastni strance — zrcadli offers-pdf .scope-page,
hlavicka se opakuje v cervenem stylu teto sablony */
.scope-page {
@@ -791,10 +720,6 @@ ${indentCSS}
</div>
</div>
${notesHtml}
${termsBlock}
</div><!-- /.invoice-content -->
<div class="invoice-footer">