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
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:
+26
-17
@@ -25,33 +25,37 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Fonction pour afficher ce qui est trouvé dans la variable
|
||||
// DONNÉES RÉELLES (Extrait d'EverShelf/app.js)
|
||||
// Ajoute ici toutes les entrées présentes dans ton fichier app.js
|
||||
const CATEGORY_LABELS = {
|
||||
"latticini": "🥛 Produits laitiers",
|
||||
"carne": "🥩 Viande",
|
||||
"pesce": "🐟 Poisson",
|
||||
"frutta": "🍎 Fruits",
|
||||
"verdura": "🥦 Légumes",
|
||||
"bevande": "🍷 Boissons",
|
||||
"dispensa": "🥫 Épicerie",
|
||||
"surgelati": "❄️ Surgelés"
|
||||
};
|
||||
|
||||
// Mise à jour de l'affichage de debug
|
||||
function updateDebugView() {
|
||||
const log = document.getElementById('debug-log');
|
||||
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);
|
||||
// Initialisation
|
||||
updateDebugView();
|
||||
|
||||
function editCategory() {
|
||||
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;
|
||||
}
|
||||
// On récupère les entrées de l'objet pour avoir accès à la fois à la clé et à la valeur
|
||||
const entries = Object.entries(CATEGORY_LABELS);
|
||||
|
||||
container.innerHTML = `
|
||||
<h3>Changer la catégorie</h3>
|
||||
<select id="cat-select" style="width:100%; padding:10px; margin: 10px 0;">
|
||||
${categories.map(c => `<option value="${c}">${c}</option>`).join('')}
|
||||
${entries.map(([key, label]) => `<option value="${key}">${label}</option>`).join('')}
|
||||
</select>
|
||||
<br>
|
||||
<button class="btn btn-blue" onclick="save()">Enregistrer</button>
|
||||
@@ -60,8 +64,13 @@
|
||||
}
|
||||
|
||||
function save() {
|
||||
const selected = document.getElementById('cat-select').value;
|
||||
alert("Réconciliation : Envoi de " + selected + " vers EverShelf");
|
||||
const selectedKey = document.getElementById('cat-select').value;
|
||||
const selectedLabel = CATEGORY_LABELS[selectedKey];
|
||||
|
||||
// Logique de réconciliation
|
||||
alert("Réconciliation : Envoi de la clé '" + selectedKey + "' (" + selectedLabel + ") vers EverShelf");
|
||||
console.log("Donnée prête pour envoi API :", { category: selectedKey });
|
||||
|
||||
location.reload();
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user