chore: build
Backend - Build & Lint / build (push) Canceled after 24m25s
Frontend Admin - EAS Build / build (push) Successful in 1h35m12s

This commit is contained in:
Xor290
2026-09-13 22:07:04 +02:00
parent d7d7496a66
commit d9688acbc2
4 changed files with 212 additions and 21 deletions
@@ -75,7 +75,7 @@ interface EnrichedDelivery extends DeliveryItem {
clientUsername?: string;
clientNom?: string;
clientPrenom?: string;
items?: Array<{ produit: string; quantite: number; prix: number; unit?: string; is_reward?: boolean }>;
items?: Array<{ produit: string; quantite: number; prix: number; unit?: string; is_reward?: boolean; promo_discount?: number }>;
}
export default function DashboardScreen() {
@@ -707,7 +707,14 @@ export default function DashboardScreen() {
</Text>
</View>
)}
{item.items.map((prod, idx) => (
{item.items.map((prod, idx) => {
const promoDiscount = prod.promo_discount ?? 0;
const hasPromo = !prod.is_reward && promoDiscount > 0;
const originalPrice = (prod.prix ?? 0) + promoDiscount;
const promoPercent = hasPromo && originalPrice > 0
? Math.round((promoDiscount / originalPrice) * 100)
: 0;
return (
<View key={idx} style={styles.itemRow}>
<View style={{ flex: 1 }}>
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
@@ -718,16 +725,34 @@ export default function DashboardScreen() {
<Text style={{ fontSize: 10, color: "#f59e0b", fontWeight: "700" }}>Récompense</Text>
</View>
)}
{hasPromo && (
<View style={{ flexDirection: "row", alignItems: "center", gap: 2, backgroundColor: "rgba(34,197,94,0.15)", borderRadius: 4, paddingHorizontal: 4, paddingVertical: 1 }}>
<Ionicons name="pricetag-outline" size={10} color="#22c55e" />
<Text style={{ fontSize: 10, color: "#22c55e", fontWeight: "700" }}>-{promoPercent}%</Text>
</View>
)}
</View>
<Text style={styles.itemQty}>
Quantité: {prod.quantite}{prod.unit || ""}
</Text>
</View>
<Text style={[styles.itemPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
{prod.is_reward && (prod.prix ?? 0) === 0 ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}`}
</Text>
{hasPromo ? (
<View style={{ alignItems: "flex-end" }}>
<Text style={{ fontSize: 12, color: colors.textMuted, textDecorationLine: "line-through" }}>
{originalPrice.toFixed(2)}
</Text>
<Text style={[styles.itemPrice, { color: "#22c55e" }]}>
{(prod.prix ?? 0).toFixed(2)}
</Text>
</View>
) : (
<Text style={[styles.itemPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
{prod.is_reward && (prod.prix ?? 0) === 0 ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}`}
</Text>
)}
</View>
))}
);
})}
<View style={styles.totalRow}>
<Text style={styles.totalLabel}>Total</Text>
<Text style={styles.totalValue}>
@@ -2010,7 +2035,14 @@ export default function DashboardScreen() {
</Text>
</View>
)}
{detailsDelivery.items.map((prod, idx) => (
{detailsDelivery.items.map((prod, idx) => {
const promoDiscount = prod.promo_discount ?? 0;
const hasPromo = !prod.is_reward && promoDiscount > 0;
const originalPrice = (prod.prix ?? 0) + promoDiscount;
const promoPercent = hasPromo && originalPrice > 0
? Math.round((promoDiscount / originalPrice) * 100)
: 0;
return (
<View key={idx} style={styles.detailProductRow}>
<View style={{ flex: 1 }}>
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
@@ -2021,16 +2053,34 @@ export default function DashboardScreen() {
<Text style={{ fontSize: 11, color: "#f59e0b", fontWeight: "700" }}>Récompense</Text>
</View>
)}
{hasPromo && (
<View style={{ flexDirection: "row", alignItems: "center", gap: 2, backgroundColor: "rgba(34,197,94,0.15)", borderRadius: 4, paddingHorizontal: 4, paddingVertical: 1 }}>
<Ionicons name="pricetag-outline" size={11} color="#22c55e" />
<Text style={{ fontSize: 11, color: "#22c55e", fontWeight: "700" }}>-{promoPercent}%</Text>
</View>
)}
</View>
<Text style={styles.detailProductQty}>
Quantité : {prod.quantite}{prod.unit || ""}
</Text>
</View>
<Text style={[styles.detailProductPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
{prod.is_reward && (prod.prix ?? 0) === 0 ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}`}
</Text>
{hasPromo ? (
<View style={{ alignItems: "flex-end" }}>
<Text style={{ fontSize: 12, color: colors.textMuted, textDecorationLine: "line-through" }}>
{originalPrice.toFixed(2)}
</Text>
<Text style={[styles.detailProductPrice, { color: "#22c55e" }]}>
{(prod.prix ?? 0).toFixed(2)}
</Text>
</View>
) : (
<Text style={[styles.detailProductPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
{prod.is_reward && (prod.prix ?? 0) === 0 ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}`}
</Text>
)}
</View>
))}
);
})}
</>
) : (
<Text style={styles.detailEmpty}>Aucun produit</Text>