chore: update
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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 })),
|
||||
};
|
||||
})
|
||||
}
|
||||
>
|
||||
<Text style={[
|
||||
|
||||
@@ -183,17 +183,19 @@ function ProductCard({
|
||||
) : (
|
||||
<>
|
||||
<button
|
||||
className={`quick-add-btn ${isOutOfStock ? "disabled" : ""}`}
|
||||
className={`quick-add-btn ${isOutOfStock || isComingSoon ? "disabled" : ""}`}
|
||||
onClick={handleQuickAddClick}
|
||||
disabled={isOutOfStock}
|
||||
disabled={isOutOfStock || isComingSoon}
|
||||
style={
|
||||
categoryColor && !isOutOfStock
|
||||
categoryColor && !isOutOfStock && !isComingSoon
|
||||
? { background: categoryColor, color: getTextColor(categoryColor) }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{isOutOfStock
|
||||
? "Rupture de stock"
|
||||
: isComingSoon
|
||||
? "Bientôt disponible"
|
||||
: "Ajouter rapidement"}
|
||||
</button>
|
||||
|
||||
|
||||
@@ -306,12 +306,14 @@ function ProductDetail() {
|
||||
</div>
|
||||
|
||||
<button
|
||||
className={`add-to-cart-button ${isOutOfStock || selectedGrams === null ? "disabled" : ""}`}
|
||||
className={`add-to-cart-button ${isOutOfStock || isComingSoon || selectedGrams === null ? "disabled" : ""}`}
|
||||
onClick={handleAddToCart}
|
||||
disabled={isOutOfStock || selectedGrams === null}
|
||||
disabled={isOutOfStock || isComingSoon || selectedGrams === null}
|
||||
>
|
||||
{isOutOfStock
|
||||
? "Rupture de stock"
|
||||
: isComingSoon
|
||||
? "Bientôt disponible"
|
||||
: "Ajouter au panier"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -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}
|
||||
>
|
||||
<Text
|
||||
@@ -235,6 +235,8 @@ export default function ProductCard({ product, onPress, categoryColor }: Product
|
||||
>
|
||||
{isSoldOut
|
||||
? "Rupture de stock"
|
||||
: isComingSoon
|
||||
? "Bientôt disponible"
|
||||
: "Ajouter rapidement"}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
@@ -615,24 +615,26 @@ export default function ProductDetailScreen() {
|
||||
<TouchableOpacity
|
||||
style={[
|
||||
styles.addToCartBtn,
|
||||
(isOutOfStock || selectedGrams === null) &&
|
||||
(isOutOfStock || isComingSoon || selectedGrams === null) &&
|
||||
styles.addToCartBtnDisabled,
|
||||
]}
|
||||
onPress={handleAddToCart}
|
||||
disabled={
|
||||
isOutOfStock || selectedGrams === null || adding
|
||||
isOutOfStock || isComingSoon || selectedGrams === null || adding
|
||||
}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
<Text
|
||||
style={[
|
||||
styles.addToCartText,
|
||||
(isOutOfStock || selectedGrams === null) &&
|
||||
(isOutOfStock || isComingSoon || selectedGrams === null) &&
|
||||
styles.addToCartTextDisabled,
|
||||
]}
|
||||
>
|
||||
{isOutOfStock
|
||||
? "Rupture de stock"
|
||||
: isComingSoon
|
||||
? "Bientôt disponible"
|
||||
: "Ajouter au panier"}
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
Reference in New Issue
Block a user