feat(dashboard): show article subtotal, discount, and transport in order detail receipt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-25 22:39:21 +00:00
parent af78ee181a
commit f07946b489
2 changed files with 18 additions and 4 deletions

View File

@@ -747,10 +747,24 @@ function renderReceipt(items, order) {
return;
}
const articole = items.reduce((s, i) => s + Number(i.price || 0) * Number(i.quantity || 0), 0);
const discount = Number(order.discount_total || 0);
const transport = Number(order.delivery_cost || 0);
const total = order.order_total != null ? fmtNum(order.order_total) : '-';
const html = `<span><strong>Total: ${total} lei</strong></span>`;
desktop.innerHTML = html;
mobile.innerHTML = html;
// Desktop: full labels
let dHtml = `<span class="text-muted">Articole: <strong class="text-body">${fmtNum(articole)}</strong></span>`;
if (discount > 0) dHtml += `<span class="text-muted">Discount: <strong class="text-danger">\u2013${fmtNum(discount)}</strong></span>`;
if (transport > 0) dHtml += `<span class="text-muted">Transport: <strong class="text-body">${fmtNum(transport)}</strong></span>`;
dHtml += `<span>Total: <strong>${total} lei</strong></span>`;
desktop.innerHTML = dHtml;
// Mobile: shorter labels
let mHtml = `<span class="text-muted">Art: <strong class="text-body">${fmtNum(articole)}</strong></span>`;
if (discount > 0) mHtml += `<span class="text-muted">Disc: <strong class="text-danger">\u2013${fmtNum(discount)}</strong></span>`;
if (transport > 0) mHtml += `<span class="text-muted">Transp: <strong class="text-body">${fmtNum(transport)}</strong></span>`;
mHtml += `<span>Total: <strong>${total} lei</strong></span>`;
mobile.innerHTML = mHtml;
}
// ── Quick Map Modal (uses shared openQuickMap) ───

View File

@@ -168,5 +168,5 @@
{% endblock %}
{% block scripts %}
<script src="{{ request.scope.get('root_path', '') }}/static/js/dashboard.js?v=24"></script>
<script src="{{ request.scope.get('root_path', '') }}/static/js/dashboard.js?v=25"></script>
{% endblock %}