chore: build

This commit is contained in:
2026-06-13 14:49:22 +02:00
parent e30d394c0a
commit dd861fd7be
@@ -73,21 +73,19 @@ interface ToastMessage {
* Somme des prix individuels (pas de multiplication) * Somme des prix individuels (pas de multiplication)
*/ */
const getTotalAmount = (order: OrderWithTracking): number => { const getTotalAmount = (order: OrderWithTracking): number => {
let gross = 0; if (typeof order.total_prix === "number" && order.total_prix > 0) {
return order.total_prix;
}
if (typeof order.total === "number" && order.total > 0) { if (typeof order.total === "number" && order.total > 0) {
gross = order.total; return order.total;
} else if (typeof order.total_prix === "number" && order.total_prix > 0) { }
gross = order.total_prix; if (order.items && order.items.length > 0) {
} else if (order.items && order.items.length > 0) { return order.items.reduce((sum, item) => {
gross = order.items.reduce((sum, item) => {
const itemPrice = item.prix || item.price || 0; const itemPrice = item.prix || item.price || 0;
return sum + itemPrice; return sum + itemPrice;
}, 0); }, 0);
} }
return 0;
const referralUsed = typeof order.referral_used === "number" ? order.referral_used : 0;
return Math.max(0, gross - referralUsed);
}; };
const getClientInfo = (order: OrderWithTracking) => { const getClientInfo = (order: OrderWithTracking) => {
@@ -931,7 +929,7 @@ function SuiviLivraison() {
)} )}
<p className="total-amount"> <p className="total-amount">
<strong> <strong>
{getTotalAmount(order).toFixed(2)} € {Math.max(0, getTotalAmount(order) - (order.referral_used ?? 0)).toFixed(2)} €
</strong> </strong>
</p> </p>
{(order.referral_used ?? 0) > 0 && ( {(order.referral_used ?? 0) > 0 && (