Items
{/* Table header */}
{(form.items.length > 0 || hasSpecialRows) && (
{["Description", "Unit Cost €", "Disc %", "Qty", "Unit", "VAT %", "Line Total", ""].map((h, i) => (
= 1 && i <= 6 ? "right" : "left", paddingRight: i >= 1 && i <= 6 ? 4 : 0 }}>{h}
))}
)}
{/* Items */}
{form.items.map((item, idx) => (
setItemField(idx, "description", e.target.value)}
placeholder="Description..."
className="px-2 py-1.5 text-sm rounded border"
style={inputStyle}
/>
setItemField(idx, "unit_cost", parseFloat(e.target.value) || 0)}
min={0} step="0.01"
className="px-2 py-1.5 text-sm rounded border text-right"
style={inputStyle}
/>
setItemField(idx, "discount_percent", parseFloat(e.target.value) || 0)}
min={0} max={100} step="0.5"
className="px-2 py-1.5 text-sm rounded border text-right"
style={inputStyle}
/>
setItemField(idx, "quantity", parseFloat(e.target.value) || 0)}
min={0} step="1"
className="px-2 py-1.5 text-sm rounded border text-right"
style={inputStyle}
/>
setItemField(idx, "vat_percent", parseFloat(e.target.value) ?? 0)}
min={0} max={100} step="1"
className="px-2 py-1.5 text-sm rounded border text-right"
style={inputStyle}
/>
{fmt(calcLineTotal(item))}
))}
{form.items.length === 0 && !hasSpecialRows && (
No items yet — add from catalogue or add a blank row
)}
{hasSpecialRows && form.items.length > 0 && (
)}
{/* Shipping row */}
{showShipping && (
Shipping
setField("shipping_cost", parseFloat(e.target.value) || 0)}
min={0} step="0.01"
placeholder="Cost"
className="px-2 py-1.5 text-sm rounded border text-right"
style={inputStyle}
/>
{fmt(parseFloat(form.shipping_cost) || 0)}
)}
{/* Install row */}
{showInstall && (
Installation
setField("install_cost", parseFloat(e.target.value) || 0)}
min={0} step="0.01"
className="px-2 py-1.5 text-sm rounded border text-right"
style={inputStyle}
/>
{fmt(parseFloat(form.install_cost) || 0)}
)}
{/* Add shipping/install buttons */}
{!showShipping && (
)}
{!showInstall && (
)}
Totals
{/* Both rows use identical layout: label | wide text field | number field | symbol */}
{/* Row 1: Global Discount */}
{/* Row 2: Other Costs — same grid as above */}
{/* Row 3: 4 summary boxes */}
{[
{ label: "Subtotal excl. VAT", value: fmt(totals.subtotal_before_discount), muted: true },
{ label: "After Discount", value: fmt(totals.new_subtotal), muted: true },
{ label: "Total VAT", value: fmt(totals.vat_amount), muted: true },
{ label: "Total Due", value: fmt(totals.final_total), accent: true },
].map(({ label, value, accent }) => (
))}
Notes / Comments
{/* Quick Notes — left-aligned columns: checkbox | label (flex) | input | suffix */}
Quick Notes
{[
{
key: "payment_advance",
label: "Payment Advance",
fieldKey: "percent",
suffix: "%",
},
{
key: "lead_time",
label: "Lead Time",
fieldKey: "days",
suffix: "days",
},
{
key: "backup_relays",
label: "Backup Relays",
fieldKey: "count",
suffix: `relay${parseInt(quickNotes.backup_relays.count) === 1 ? "" : "s"}`,
},
].map(({ key, label, fieldKey, suffix }) => (
setQuickNote(key, "enabled", e.target.checked)}
style={{ cursor: "pointer" }}
/>
{label}
setQuickNote(key, fieldKey, e.target.value)}
min={1} step={1}
disabled={!quickNotes[key].enabled}
className="px-2 py-1 text-sm rounded border"
style={{ ...inputStyle, opacity: quickNotes[key].enabled ? 1 : 0.4, width: "100%" }}
/>
{suffix}
))}
{/* Dynamic comments */}
{form.comments.length === 0 && (
No notes. Click "Add Note" to add one.
)}
{form.comments.map((comment, idx) => (
))}