From 929dea72498c04cd77777ac049b0ec6d77baf63a Mon Sep 17 00:00:00 2001 From: Xor290 Date: Tue, 19 May 2026 18:54:36 +0200 Subject: [PATCH] chore: update --- backend/gestion/handlers/panier.go | 5 +++++ .../src/screens/admin/ProductsScreen.tsx | 15 +++++++++++---- frontend-prep/src/components/ProductCard.tsx | 8 +++++--- frontend-prep/src/pages/User/ProductDetail.tsx | 6 ++++-- mobile/src/components/ProductCard.tsx | 6 ++++-- mobile/src/screens/client/ProductDetailScreen.tsx | 8 +++++--- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/backend/gestion/handlers/panier.go b/backend/gestion/handlers/panier.go index c8620bba..da8d9b80 100644 --- a/backend/gestion/handlers/panier.go +++ b/backend/gestion/handlers/panier.go @@ -51,6 +51,11 @@ func AddProductsBasket(c *gin.Context) { return } + if p, err := database.GetProductByID(req.ProductID); err == nil && p.ComingSoon { + c.JSON(http.StatusBadRequest, gin.H{"error": "Ce produit n'est pas encore disponible"}) + return + } + panier, err := database.AddToBasket(req.Username, req.ProductID, req.Quantity) if err != nil { log.Printf("❌ [ADD_PANIER] product_id=%d qty=%.3f: %v", req.ProductID, req.Quantity, err) diff --git a/frontend-admin/src/screens/admin/ProductsScreen.tsx b/frontend-admin/src/screens/admin/ProductsScreen.tsx index d88c1b24..4020ec24 100644 --- a/frontend-admin/src/screens/admin/ProductsScreen.tsx +++ b/frontend-admin/src/screens/admin/ProductsScreen.tsx @@ -642,11 +642,11 @@ export default function ProductsScreen() { alignItems: "center", }, comingSoonBtnActive: { - borderColor: "#f59e0b", - backgroundColor: "#f59e0b20", + borderColor: "#22c55e", + backgroundColor: "#22c55e20", }, comingSoonBtnText: { color: colors.textMuted, fontSize: fontSize.sm }, - comingSoonBtnTextActive: { color: "#f59e0b", fontWeight: "700" }, + comingSoonBtnTextActive: { color: "#22c55e", fontWeight: "700" }, // Prices sectionHeader: { @@ -1027,7 +1027,14 @@ export default function ProductsScreen() { form.comingSoon && styles.comingSoonBtnActive, ]} onPress={() => - setForm((f) => ({ ...f, comingSoon: !f.comingSoon })) + setForm((f) => { + const next = !f.comingSoon; + return { + ...f, + comingSoon: next, + prices: f.prices.map((p) => ({ ...p, active: !next })), + }; + }) } > diff --git a/frontend-prep/src/pages/User/ProductDetail.tsx b/frontend-prep/src/pages/User/ProductDetail.tsx index 1730d99a..44962dea 100644 --- a/frontend-prep/src/pages/User/ProductDetail.tsx +++ b/frontend-prep/src/pages/User/ProductDetail.tsx @@ -306,12 +306,14 @@ function ProductDetail() { diff --git a/mobile/src/components/ProductCard.tsx b/mobile/src/components/ProductCard.tsx index 8341a764..01a0b06c 100644 --- a/mobile/src/components/ProductCard.tsx +++ b/mobile/src/components/ProductCard.tsx @@ -218,13 +218,13 @@ export default function ProductCard({ product, onPress, categoryColor }: Product style={[ styles.quickAddBtn, { backgroundColor: catColor }, - isSoldOut && { + (isSoldOut || isComingSoon) && { backgroundColor: colors.textMuted, opacity: 0.6, }, ]} onPress={handleQuickAdd} - disabled={isSoldOut} + disabled={isSoldOut || isComingSoon} activeOpacity={0.7} > {isSoldOut ? "Rupture de stock" + : isComingSoon + ? "Bientôt disponible" : "Ajouter rapidement"} diff --git a/mobile/src/screens/client/ProductDetailScreen.tsx b/mobile/src/screens/client/ProductDetailScreen.tsx index 780404e0..798356b7 100644 --- a/mobile/src/screens/client/ProductDetailScreen.tsx +++ b/mobile/src/screens/client/ProductDetailScreen.tsx @@ -615,24 +615,26 @@ export default function ProductDetailScreen() { {isOutOfStock ? "Rupture de stock" + : isComingSoon + ? "Bientôt disponible" : "Ajouter au panier"}