chore: fix
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"expo": {
|
||||
"name": "Admin Panel",
|
||||
"slug": "frontend-admin",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/icon.png",
|
||||
"userInterfaceStyle": "dark",
|
||||
|
||||
@@ -207,10 +207,17 @@ export default function ProductsScreen() {
|
||||
return { ...f, prices };
|
||||
});
|
||||
const removePriceRow = (idx: number) =>
|
||||
setForm((f) => ({
|
||||
...f,
|
||||
prices: f.prices.filter((_, i) => i !== idx),
|
||||
}));
|
||||
setForm((f) => {
|
||||
const target = f.prices[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 = (
|
||||
idx: number,
|
||||
field: "quantity" | "price",
|
||||
|
||||
Reference in New Issue
Block a user