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:
@@ -33,14 +33,18 @@
|
|||||||
<script>
|
<script>
|
||||||
// 1. Fonction qui affiche le formulaire
|
// 1. Fonction qui affiche le formulaire
|
||||||
function mockEditProduct(id) {
|
function mockEditProduct(id) {
|
||||||
const categories = ["Fruits", "Légumes", "Boissons", "Épicerie", "Surgelés"];
|
// 1. On va chercher les catégories directement dans la mémoire de l'appli.
|
||||||
let optionsHTML = categories.map(cat => `<option value="${cat}">${cat}</option>`).join('');
|
// Si 'categories' n'est pas définie, on prévoit une liste de secours.
|
||||||
|
const appCategories = (typeof categories !== 'undefined') ? categories : ["Fruits", "Légumes", "Boissons", "Épicerie", "Surgelés"];
|
||||||
|
|
||||||
|
// 2. On construit les options dynamiquement
|
||||||
|
let optionsHTML = appCategories.map(cat => `<option value="${cat}">${cat}</option>`).join('');
|
||||||
|
|
||||||
const container = document.querySelector('.modal-preview');
|
const container = document.querySelector('.modal-preview');
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<h3>Modification du produit #${id}</h3>
|
<h3>Modification du produit #${id}</h3>
|
||||||
<form onsubmit="event.preventDefault(); alert('Catégorie ' + document.getElementById('cat-select').value + ' enregistrée !'); location.reload();">
|
<form onsubmit="event.preventDefault(); alert('Catégorie ' + document.getElementById('cat-select').value + ' appliquée !'); location.reload();">
|
||||||
<label>Choisir la catégorie :</label><br>
|
<label>Catégories EverShelf :</label><br>
|
||||||
<select id="cat-select" style="width:100%; padding:8px; margin: 10px 0;">
|
<select id="cat-select" style="width:100%; padding:8px; margin: 10px 0;">
|
||||||
${optionsHTML}
|
${optionsHTML}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user