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:
@@ -86,9 +86,11 @@
|
||||
const btn = document.getElementById('save-btn');
|
||||
btn.disabled = true;
|
||||
btn.textContent = "Traitement en cours...";
|
||||
|
||||
let successCount = 0;
|
||||
let errorCount = 0;
|
||||
|
||||
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] };
|
||||
p.category = newCat;
|
||||
|
||||
@@ -99,17 +101,26 @@
|
||||
body: JSON.stringify(p)
|
||||
});
|
||||
|
||||
if (!res.ok) console.error("Erreur serveur sur " + p.name);
|
||||
await new Promise(r => setTimeout(r, 200));
|
||||
let data = await res.json();
|
||||
|
||||
if (res.ok) {
|
||||
successCount++;
|
||||
} else {
|
||||
console.error("Erreur serveur sur " + p.name, data);
|
||||
errorCount++;
|
||||
}
|
||||
await new Promise(r => setTimeout(r, 250));
|
||||
} catch (e) {
|
||||
console.error("Erreur réseau sur " + p.name, e);
|
||||
errorCount++;
|
||||
}
|
||||
}
|
||||
|
||||
await loadData();
|
||||
btn.disabled = false;
|
||||
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>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user