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:
+27
-18
@@ -25,33 +25,37 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<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() {
|
function updateDebugView() {
|
||||||
const log = document.getElementById('debug-log');
|
const log = document.getElementById('debug-log');
|
||||||
if (typeof CATEGORY_LABELS !== 'undefined') {
|
log.innerText = JSON.stringify(CATEGORY_LABELS, null, 2);
|
||||||
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
|
// Initialisation
|
||||||
setInterval(updateDebugView, 1000);
|
updateDebugView();
|
||||||
|
|
||||||
function editCategory() {
|
function editCategory() {
|
||||||
const container = document.getElementById('app-container');
|
const container = document.getElementById('app-container');
|
||||||
const rawData = typeof CATEGORY_LABELS !== 'undefined' ? CATEGORY_LABELS : {};
|
// On récupère les entrées de l'objet pour avoir accès à la fois à la clé et à la valeur
|
||||||
const categories = Object.values(rawData);
|
const entries = Object.entries(CATEGORY_LABELS);
|
||||||
|
|
||||||
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;">
|
||||||
${categories.map(c => `<option value="${c}">${c}</option>`).join('')}
|
${entries.map(([key, label]) => `<option value="${key}">${label}</option>`).join('')}
|
||||||
</select>
|
</select>
|
||||||
<br>
|
<br>
|
||||||
<button class="btn btn-blue" onclick="save()">Enregistrer</button>
|
<button class="btn btn-blue" onclick="save()">Enregistrer</button>
|
||||||
@@ -60,8 +64,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
const selected = document.getElementById('cat-select').value;
|
const selectedKey = document.getElementById('cat-select').value;
|
||||||
alert("Réconciliation : Envoi de " + selected + " vers EverShelf");
|
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();
|
location.reload();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user