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:
@@ -747,10 +747,24 @@ function renderReceipt(items, order) {
|
|||||||
return;
|
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 total = order.order_total != null ? fmtNum(order.order_total) : '-';
|
||||||
const html = `<span><strong>Total: ${total} lei</strong></span>`;
|
|
||||||
desktop.innerHTML = html;
|
// Desktop: full labels
|
||||||
mobile.innerHTML = html;
|
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) ───
|
// ── Quick Map Modal (uses shared openQuickMap) ───
|
||||||
|
|||||||
@@ -168,5 +168,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% 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 %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user