Actualiser test2.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

This commit is contained in:
2026-06-17 17:21:02 +00:00
parent d35f975ab9
commit e0deb3481b
+31 -10
View File
@@ -2,10 +2,11 @@
<html lang="fr"> <html lang="fr">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>⚡ Sandbox - Fixe</title> <title>⚡ Sandbox - Debug Catégories</title>
<style> <style>
body { font-family: sans-serif; background: #333; padding: 50px; } body { font-family: sans-serif; background: #333; padding: 50px; color: white; }
.modal { background: white; padding: 20px; border-radius: 12px; width: 400px; margin: 0 auto; box-shadow: 0 4px 15px rgba(0,0,0,0.3); } .modal { background: white; padding: 20px; border-radius: 12px; width: 400px; margin: 0 auto; color: black; box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
.debug-panel { margin-top: 20px; padding: 15px; background: #222; border-radius: 8px; border: 1px solid #444; font-size: 12px; }
.btn { padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; margin: 5px; font-weight: bold; } .btn { padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; margin: 5px; font-weight: bold; }
.btn-blue { background: #1976d2; color: white; } .btn-blue { background: #1976d2; color: white; }
</style> </style>
@@ -18,19 +19,39 @@
<button class="btn btn-blue" onclick="editCategory()">✏️ Modifier la catégorie</button> <button class="btn btn-blue" onclick="editCategory()">✏️ Modifier la catégorie</button>
</div> </div>
<div class="debug-panel">
<strong>Debug - État de CATEGORY_LABELS :</strong>
<pre id="debug-log">Chargement...</pre>
</div>
<script> <script>
// On force les données ici pour ne plus dépendre de l'onglet EverShelf // Fonction pour afficher ce qui est trouvé dans la variable
const VRAIES_CATEGORIES = [ function updateDebugView() {
"Produits laitiers", "Viande", "Poisson", "Fruits", const log = document.getElementById('debug-log');
"Légumes", "Boissons", "Épicerie", "Surgelés" if (typeof CATEGORY_LABELS !== 'undefined') {
]; log.innerText = JSON.stringify(CATEGORY_LABELS, null, 2);
} else {
log.innerText = "ERREUR : CATEGORY_LABELS non trouvé dans cet onglet.";
}
}
// On vérifie toutes les secondes si la variable apparaît
setInterval(updateDebugView, 1000);
function editCategory() { function editCategory() {
const container = document.getElementById('app-container'); const container = document.getElementById('app-container');
const rawData = typeof CATEGORY_LABELS !== 'undefined' ? CATEGORY_LABELS : {};
const categories = Object.values(rawData);
if (categories.length === 0) {
alert("La liste est vide, vérifie le Debug en bas de page !");
return;
}
container.innerHTML = ` container.innerHTML = `
<h3>Changer la catégorie</h3> <h3>Changer la catégorie</h3>
<select id="cat-select" style="width:100%; padding:10px; margin: 10px 0;"> <select id="cat-select" style="width:100%; padding:10px; margin: 10px 0;">
${VRAIES_CATEGORIES.map(c => `<option value="${c}">${c}</option>`).join('')} ${categories.map(c => `<option value="${c}">${c}</option>`).join('')}
</select> </select>
<br> <br>
<button class="btn btn-blue" onclick="save()">Enregistrer</button> <button class="btn btn-blue" onclick="save()">Enregistrer</button>
@@ -40,7 +61,7 @@
function save() { function save() {
const selected = document.getElementById('cat-select').value; const selected = document.getElementById('cat-select').value;
alert("Simulation : Appel de la fonction réelle d'EverShelf avec la valeur : " + selected); alert("Réconciliation : Envoi de " + selected + " vers EverShelf");
location.reload(); location.reload();
} }
</script> </script>