9acf952c10
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
78 lines
3.1 KiB
HTML
78 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>⚡ Sandbox - Debug Catégories</title>
|
|
<style>
|
|
body { font-family: sans-serif; background: #333; padding: 50px; color: white; }
|
|
.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-blue { background: #1976d2; color: white; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="modal" id="app-container">
|
|
<h3>Produit : Jus Ananas</h3>
|
|
<p>Catégorie actuelle : <b>Boissons</b></p>
|
|
<button class="btn btn-blue" onclick="editCategory()">✏️ Modifier la catégorie</button>
|
|
</div>
|
|
|
|
<div class="debug-panel">
|
|
<strong>Debug - État de CATEGORY_LABELS :</strong>
|
|
<pre id="debug-log">Chargement...</pre>
|
|
</div>
|
|
|
|
<script>
|
|
// 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');
|
|
log.innerText = JSON.stringify(CATEGORY_LABELS, null, 2);
|
|
}
|
|
|
|
// Initialisation
|
|
updateDebugView();
|
|
|
|
function editCategory() {
|
|
const container = document.getElementById('app-container');
|
|
// 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;">
|
|
${entries.map(([key, label]) => `<option value="${key}">${label}</option>`).join('')}
|
|
</select>
|
|
<br>
|
|
<button class="btn btn-blue" onclick="save()">Enregistrer</button>
|
|
<button class="btn" onclick="location.reload()">Annuler</button>
|
|
`;
|
|
}
|
|
|
|
function save() {
|
|
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>
|
|
</body>
|
|
</html> |