Actualiser test.html
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
This commit is contained in:
@@ -87,8 +87,10 @@
|
|||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
btn.textContent = "Traitement en cours...";
|
btn.textContent = "Traitement en cours...";
|
||||||
|
|
||||||
|
let successCount = 0;
|
||||||
|
let errorCount = 0;
|
||||||
|
|
||||||
for (const checkbox of checkedBoxes) {
|
for (const checkbox of checkedBoxes) {
|
||||||
// On crée une COPIE de l'objet pour ne pas modifier la référence originale par erreur
|
|
||||||
let p = { ...fullProductList[checkbox.dataset.index] };
|
let p = { ...fullProductList[checkbox.dataset.index] };
|
||||||
p.category = newCat;
|
p.category = newCat;
|
||||||
|
|
||||||
@@ -99,17 +101,26 @@
|
|||||||
body: JSON.stringify(p)
|
body: JSON.stringify(p)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!res.ok) console.error("Erreur serveur sur " + p.name);
|
let data = await res.json();
|
||||||
await new Promise(r => setTimeout(r, 200));
|
|
||||||
|
if (res.ok) {
|
||||||
|
successCount++;
|
||||||
|
} else {
|
||||||
|
console.error("Erreur serveur sur " + p.name, data);
|
||||||
|
errorCount++;
|
||||||
|
}
|
||||||
|
await new Promise(r => setTimeout(r, 250));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Erreur réseau sur " + p.name, e);
|
console.error("Erreur réseau sur " + p.name, e);
|
||||||
|
errorCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await loadData();
|
await loadData();
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
btn.textContent = "APPLIQUER AUX COCHÉS";
|
btn.textContent = "APPLIQUER AUX COCHÉS";
|
||||||
alert("Traitement terminé.");
|
|
||||||
|
alert(`Traitement terminé :\n- Succès : ${successCount}\n- Erreurs : ${errorCount}\n\nVoir la console (F12) pour les détails.`);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user