feat: update multiple tomtom keys and switch tomtom key and add comming soon button

This commit is contained in:
2026-05-19 17:35:39 +02:00
parent 48bdba750e
commit 93120f6bfe
18 changed files with 341 additions and 69 deletions
@@ -78,6 +78,7 @@ interface FormState {
stock: string;
unit: string;
prices: PriceRow[];
comingSoon: boolean;
}
const emptyForm = (firstCategory = ""): FormState => ({
@@ -87,6 +88,7 @@ const emptyForm = (firstCategory = ""): FormState => ({
stock: "",
unit: "u",
prices: [{ quantity: "1", price: "", active: true }],
comingSoon: false,
});
// ==================================================
@@ -163,6 +165,7 @@ export default function ProductsScreen() {
description: product.description || "",
stock: product.stock.toString(),
unit: product.unit || "u",
comingSoon: product.coming_soon ?? false,
prices:
product.prices && product.prices.length > 0
? product.prices.map((p) => ({
@@ -339,6 +342,7 @@ export default function ProductsScreen() {
stock: parseFloat(form.stock),
unit: form.unit,
prices,
coming_soon: form.comingSoon,
});
productId = editingProduct.id;
} else {
@@ -349,6 +353,7 @@ export default function ProductsScreen() {
fd.append("description", form.description.trim());
fd.append("stock", form.stock);
fd.append("unit", form.unit);
fd.append("coming_soon", form.comingSoon ? "true" : "false");
prices.forEach((p, i) => {
fd.append(`prices[${i}][quantity]`, String(p.quantity));
@@ -627,6 +632,22 @@ export default function ProductsScreen() {
catBtnText: { color: colors.textMuted, fontSize: fontSize.sm },
catBtnTextActive: { color: colors.accent, fontWeight: "600" },
comingSoonBtn: {
borderWidth: 1,
borderColor: colors.textMuted,
borderRadius: 8,
paddingVertical: 10,
paddingHorizontal: 14,
marginBottom: 16,
alignItems: "center",
},
comingSoonBtnActive: {
borderColor: "#f59e0b",
backgroundColor: "#f59e0b20",
},
comingSoonBtnText: { color: colors.textMuted, fontSize: fontSize.sm },
comingSoonBtnTextActive: { color: "#f59e0b", fontWeight: "700" },
// Prices
sectionHeader: {
flexDirection: "row",
@@ -999,6 +1020,24 @@ export default function ProductsScreen() {
keyboardType="numeric"
/>
{/* À venir */}
<TouchableOpacity
style={[
styles.comingSoonBtn,
form.comingSoon && styles.comingSoonBtnActive,
]}
onPress={() =>
setForm((f) => ({ ...f, comingSoon: !f.comingSoon }))
}
>
<Text style={[
styles.comingSoonBtnText,
form.comingSoon && styles.comingSoonBtnTextActive,
]}>
{form.comingSoon ? "🔜 À venir (activé)" : "🔜 Marquer comme «À venir»"}
</Text>
</TouchableOpacity>
{/* Unité de mesure */}
<Text style={styles.label}>Unité de mesure *</Text>
<View style={styles.catRow}>