diff --git a/backend/gestion/db/db_command_items.go b/backend/gestion/db/db_command_items.go
index 6c5e6a28..ed5e9865 100644
--- a/backend/gestion/db/db_command_items.go
+++ b/backend/gestion/db/db_command_items.go
@@ -203,6 +203,8 @@ func (d *Database) GetCommandItems(commandID int) ([]map[string]any, error) {
ProductID *int64 `gorm:"column:product_id"`
Quantite float64 `gorm:"column:quantite"`
Prix float64 `gorm:"column:prix"`
+ IsReward bool `gorm:"column:is_reward"`
+ RewardPoolKey string `gorm:"column:reward_pool_key"`
ClientUsername string `gorm:"column:client_username"`
ClientNom string `gorm:"column:client_nom"`
ClientPrenom string `gorm:"column:client_prenom"`
@@ -230,6 +232,8 @@ func (d *Database) GetCommandItems(commandID int) ([]map[string]any, error) {
ci.product_id,
ci.quantite,
ci.prix,
+ ci.is_reward,
+ ci.reward_pool_key,
ci.client_username,
ci.client_nom,
ci.client_prenom,
@@ -276,6 +280,8 @@ func (d *Database) GetCommandItems(commandID int) ([]map[string]any, error) {
"product_id": productIDValue,
"quantite": row.Quantite,
"prix": row.Prix,
+ "is_reward": row.IsReward,
+ "reward_pool_key": row.RewardPoolKey,
"client_username": row.ClientUsername,
"client_nom": row.ClientNom,
"client_prenom": row.ClientPrenom,
diff --git a/backend/gestion/handlers/deleviry.go b/backend/gestion/handlers/deleviry.go
index 5ff17a05..81546cc2 100644
--- a/backend/gestion/handlers/deleviry.go
+++ b/backend/gestion/handlers/deleviry.go
@@ -59,9 +59,10 @@ func GetMyDeliveries(c *gin.Context) {
itemsSummary := make([]gin.H, len(items))
for j, item := range items {
itemsSummary[j] = gin.H{
- "produit": item["produit"],
- "quantite": item["quantite"],
- "prix": item["prix"],
+ "produit": item["produit"],
+ "quantite": item["quantite"],
+ "prix": item["prix"],
+ "is_reward": item["is_reward"],
}
}
diff --git a/frontend-admin/src/screens/delivery/DashboardScreen.tsx b/frontend-admin/src/screens/delivery/DashboardScreen.tsx
index 1be784ff..734ad1a5 100644
--- a/frontend-admin/src/screens/delivery/DashboardScreen.tsx
+++ b/frontend-admin/src/screens/delivery/DashboardScreen.tsx
@@ -75,7 +75,7 @@ interface EnrichedDelivery extends DeliveryItem {
clientUsername?: string;
clientNom?: string;
clientPrenom?: string;
- items?: Array<{ produit: string; quantite: number; prix: number; unit?: string }>;
+ items?: Array<{ produit: string; quantite: number; prix: number; unit?: string; is_reward?: boolean }>;
}
export default function DashboardScreen() {
@@ -699,18 +699,32 @@ export default function DashboardScreen() {
Produits ({item.items.length})
+ {item.items.some(p => p.is_reward) && (
+
+
+
+ Cette commande contient un article offert (récompense client)
+
+
+ )}
{item.items.map((prod, idx) => (
-
- {prod.produit}
-
+
+ {prod.produit}
+ {prod.is_reward && (
+
+
+ Offert
+
+ )}
+
Quantité: {prod.quantite}{prod.unit || ""}
-
- {(prod.prix ?? 0).toFixed(2)}€
+
+ {prod.is_reward ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}€`}
))}
@@ -1987,21 +2001,37 @@ export default function DashboardScreen() {
{detailsDelivery?.items &&
detailsDelivery.items.length > 0 ? (
- detailsDelivery.items.map((prod, idx) => (
-
-
-
- {prod.produit}
-
-
- Quantité : {prod.quantite}{prod.unit || ""}
+ <>
+ {detailsDelivery.items.some(p => p.is_reward) && (
+
+
+
+ Cette commande contient un article offert (récompense client)
-
- {(prod.prix ?? 0).toFixed(2)}€
-
-
- ))
+ )}
+ {detailsDelivery.items.map((prod, idx) => (
+
+
+
+ {prod.produit}
+ {prod.is_reward && (
+
+
+ Offert
+
+ )}
+
+
+ Quantité : {prod.quantite}{prod.unit || ""}
+
+
+
+ {prod.is_reward ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}€`}
+
+
+ ))}
+ >
) : (
Aucun produit
)}