chore: fix

This commit is contained in:
2026-05-15 17:09:15 +02:00
parent 58b9a0827f
commit f951ed9187
2 changed files with 12 additions and 5 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"expo": { "expo": {
"name": "Admin Panel", "name": "Admin Panel",
"slug": "frontend-admin", "slug": "frontend-admin",
"version": "1.0.0", "version": "1.0.1",
"orientation": "portrait", "orientation": "portrait",
"icon": "./assets/icon.png", "icon": "./assets/icon.png",
"userInterfaceStyle": "dark", "userInterfaceStyle": "dark",
@@ -207,10 +207,17 @@ export default function ProductsScreen() {
return { ...f, prices }; return { ...f, prices };
}); });
const removePriceRow = (idx: number) => const removePriceRow = (idx: number) =>
setForm((f) => ({ setForm((f) => {
...f, const target = f.prices[idx];
prices: f.prices.filter((_, i) => i !== idx), if (target.id) {
})); // Prix existant en DB → désactiver au lieu de supprimer
const prices = [...f.prices];
prices[idx] = { ...target, active: false };
return { ...f, prices };
}
// Nouveau prix jamais sauvegardé → supprimer de la liste
return { ...f, prices: f.prices.filter((_, i) => i !== idx) };
});
const updatePriceField = ( const updatePriceField = (
idx: number, idx: number,
field: "quantity" | "price", field: "quantity" | "price",