chore: build
This commit is contained in:
@@ -203,6 +203,8 @@ func (d *Database) GetCommandItems(commandID int) ([]map[string]any, error) {
|
|||||||
ProductID *int64 `gorm:"column:product_id"`
|
ProductID *int64 `gorm:"column:product_id"`
|
||||||
Quantite float64 `gorm:"column:quantite"`
|
Quantite float64 `gorm:"column:quantite"`
|
||||||
Prix float64 `gorm:"column:prix"`
|
Prix float64 `gorm:"column:prix"`
|
||||||
|
IsReward bool `gorm:"column:is_reward"`
|
||||||
|
RewardPoolKey string `gorm:"column:reward_pool_key"`
|
||||||
ClientUsername string `gorm:"column:client_username"`
|
ClientUsername string `gorm:"column:client_username"`
|
||||||
ClientNom string `gorm:"column:client_nom"`
|
ClientNom string `gorm:"column:client_nom"`
|
||||||
ClientPrenom string `gorm:"column:client_prenom"`
|
ClientPrenom string `gorm:"column:client_prenom"`
|
||||||
@@ -230,6 +232,8 @@ func (d *Database) GetCommandItems(commandID int) ([]map[string]any, error) {
|
|||||||
ci.product_id,
|
ci.product_id,
|
||||||
ci.quantite,
|
ci.quantite,
|
||||||
ci.prix,
|
ci.prix,
|
||||||
|
ci.is_reward,
|
||||||
|
ci.reward_pool_key,
|
||||||
ci.client_username,
|
ci.client_username,
|
||||||
ci.client_nom,
|
ci.client_nom,
|
||||||
ci.client_prenom,
|
ci.client_prenom,
|
||||||
@@ -276,6 +280,8 @@ func (d *Database) GetCommandItems(commandID int) ([]map[string]any, error) {
|
|||||||
"product_id": productIDValue,
|
"product_id": productIDValue,
|
||||||
"quantite": row.Quantite,
|
"quantite": row.Quantite,
|
||||||
"prix": row.Prix,
|
"prix": row.Prix,
|
||||||
|
"is_reward": row.IsReward,
|
||||||
|
"reward_pool_key": row.RewardPoolKey,
|
||||||
"client_username": row.ClientUsername,
|
"client_username": row.ClientUsername,
|
||||||
"client_nom": row.ClientNom,
|
"client_nom": row.ClientNom,
|
||||||
"client_prenom": row.ClientPrenom,
|
"client_prenom": row.ClientPrenom,
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ func GetMyDeliveries(c *gin.Context) {
|
|||||||
"produit": item["produit"],
|
"produit": item["produit"],
|
||||||
"quantite": item["quantite"],
|
"quantite": item["quantite"],
|
||||||
"prix": item["prix"],
|
"prix": item["prix"],
|
||||||
|
"is_reward": item["is_reward"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ interface EnrichedDelivery extends DeliveryItem {
|
|||||||
clientUsername?: string;
|
clientUsername?: string;
|
||||||
clientNom?: string;
|
clientNom?: string;
|
||||||
clientPrenom?: 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() {
|
export default function DashboardScreen() {
|
||||||
@@ -699,18 +699,32 @@ export default function DashboardScreen() {
|
|||||||
Produits ({item.items.length})
|
Produits ({item.items.length})
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
{item.items.some(p => p.is_reward) && (
|
||||||
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 6, backgroundColor: "rgba(245,158,11,0.12)", borderRadius: 6, padding: 6, marginBottom: 6 }}>
|
||||||
|
<Ionicons name="gift-outline" size={15} color="#f59e0b" />
|
||||||
|
<Text style={{ fontSize: 13, color: "#f59e0b", fontWeight: "700" }}>
|
||||||
|
Cette commande contient un article offert (récompense client)
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
{item.items.map((prod, idx) => (
|
{item.items.map((prod, idx) => (
|
||||||
<View key={idx} style={styles.itemRow}>
|
<View key={idx} style={styles.itemRow}>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<Text style={styles.itemName}>
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
|
||||||
{prod.produit}
|
<Text style={styles.itemName}>{prod.produit}</Text>
|
||||||
</Text>
|
{prod.is_reward && (
|
||||||
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 2, backgroundColor: "rgba(245,158,11,0.15)", borderRadius: 4, paddingHorizontal: 4, paddingVertical: 1 }}>
|
||||||
|
<Ionicons name="gift-outline" size={10} color="#f59e0b" />
|
||||||
|
<Text style={{ fontSize: 10, color: "#f59e0b", fontWeight: "700" }}>Offert</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
<Text style={styles.itemQty}>
|
<Text style={styles.itemQty}>
|
||||||
Quantité: {prod.quantite}{prod.unit || ""}
|
Quantité: {prod.quantite}{prod.unit || ""}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<Text style={styles.itemPrice}>
|
<Text style={[styles.itemPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
|
||||||
{(prod.prix ?? 0).toFixed(2)}€
|
{prod.is_reward ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}€`}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
@@ -1987,21 +2001,37 @@ export default function DashboardScreen() {
|
|||||||
</Text>
|
</Text>
|
||||||
{detailsDelivery?.items &&
|
{detailsDelivery?.items &&
|
||||||
detailsDelivery.items.length > 0 ? (
|
detailsDelivery.items.length > 0 ? (
|
||||||
detailsDelivery.items.map((prod, idx) => (
|
<>
|
||||||
|
{detailsDelivery.items.some(p => p.is_reward) && (
|
||||||
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 6, backgroundColor: "rgba(245,158,11,0.12)", borderRadius: 8, padding: 8, marginBottom: 8 }}>
|
||||||
|
<Ionicons name="gift-outline" size={16} color="#f59e0b" />
|
||||||
|
<Text style={{ fontSize: 13, color: "#f59e0b", fontWeight: "700" }}>
|
||||||
|
Cette commande contient un article offert (récompense client)
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
{detailsDelivery.items.map((prod, idx) => (
|
||||||
<View key={idx} style={styles.detailProductRow}>
|
<View key={idx} style={styles.detailProductRow}>
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<Text style={styles.detailProductName}>
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
|
||||||
{prod.produit}
|
<Text style={styles.detailProductName}>{prod.produit}</Text>
|
||||||
</Text>
|
{prod.is_reward && (
|
||||||
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 2, backgroundColor: "rgba(245,158,11,0.15)", borderRadius: 4, paddingHorizontal: 4, paddingVertical: 1 }}>
|
||||||
|
<Ionicons name="gift-outline" size={11} color="#f59e0b" />
|
||||||
|
<Text style={{ fontSize: 11, color: "#f59e0b", fontWeight: "700" }}>Offert</Text>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
<Text style={styles.detailProductQty}>
|
<Text style={styles.detailProductQty}>
|
||||||
Quantité : {prod.quantite}{prod.unit || ""}
|
Quantité : {prod.quantite}{prod.unit || ""}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<Text style={styles.detailProductPrice}>
|
<Text style={[styles.detailProductPrice, prod.is_reward ? { color: "#10b981" } : {}]}>
|
||||||
{(prod.prix ?? 0).toFixed(2)}€
|
{prod.is_reward ? "Offert" : `${(prod.prix ?? 0).toFixed(2)}€`}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
))
|
))}
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Text style={styles.detailEmpty}>Aucun produit</Text>
|
<Text style={styles.detailEmpty}>Aucun produit</Text>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user