Fix inline edit not updating pricing breakdown on Job Details

Jobs/PatchItem now returns the full breakdown (itemsSubtotal,
subtotalBeforeDiscount, subtotalAfterDiscount, taxAmount) so all rows
in the pricing card update live without a page refresh.

Added data-pb attributes to the matching spans in the pricing panel.
Updated window.inlineItemEdit.totals config for jobs to map each
response key to its DOM selector.

updateTotals in inline-item-edit.js is now fully generic — cfg.totals
keys must match server response property names directly, eliminating
the old hardcoded tax/taxAmount and balance/balanceDue mismatches.
Updated Quote and Invoice configs accordingly (tax→taxAmount,
balance→balanceDue).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-20 22:58:26 -04:00
parent 30c644a8ec
commit eb13283e76
5 changed files with 31 additions and 21 deletions
@@ -24,17 +24,14 @@
setTimeout(() => el.remove(), 4000);
}
// cfg.totals maps response-property-name → CSS selector.
// Each key must exactly match a property returned by the server's PatchItem action.
function updateTotals(cfg, data) {
const t = cfg.totals || {};
[
[t.subtotal, data.subtotal],
[t.tax, data.taxAmount],
[t.total, data.total],
[t.finalPrice, data.finalPrice],
[t.balance, data.balanceDue],
].forEach(([sel, val]) => {
if (sel && val !== undefined && val !== null) {
document.querySelectorAll(sel).forEach(el => { el.textContent = fmt(val); });
Object.entries(t).forEach(([key, selector]) => {
const val = data[key];
if (selector && val !== undefined && val !== null) {
document.querySelectorAll(selector).forEach(el => { el.textContent = fmt(val); });
}
});
}