1
0
Fork 0

No more null in interface

This commit is contained in:
Ethanell 2020-02-04 22:52:28 +01:00
parent 9f4d5cf440
commit 03357f1a5b
2 changed files with 6 additions and 4 deletions

View file

@ -4,8 +4,9 @@ let done = document.getElementById("realisee");
let waiting = document.getElementById("attente"); let waiting = document.getElementById("attente");
function addcmd(id, plate, ingredient, sauce, drink, dessert, state, client, sandwich) { function addcmd(id, plate, ingredient, sauce, drink, dessert, state, client, sandwich) {
if (!sandwich) for (let i of ["plate", "ingredient", "sauce", "drink", "dessert", "state", "sandwich"])
sandwich = ""; if (!eval(i))
eval(`${i} = ""`);
done.insertAdjacentHTML("beforeend", `<div id=cmd${id}> <h1>${id}</h1><h2>${sandwich}</h2><h3>${client}</h3><p>${plate} | ${ingredient}</p><p>${sauce}</p><p>${drink}</p><p>${dessert}</p> </div>`); done.insertAdjacentHTML("beforeend", `<div id=cmd${id}> <h1>${id}</h1><h2>${sandwich}</h2><h3>${client}</h3><p>${plate} | ${ingredient}</p><p>${sauce}</p><p>${drink}</p><p>${dessert}</p> </div>`);
let e = document.getElementById(`cmd${id}`); let e = document.getElementById(`cmd${id}`);
switch (state) { switch (state) {

View file

@ -10,8 +10,9 @@ let radios = {"plate": null, "drink": null, "dessert": null};
function addcmd(id, plate, ingredient, sauce, drink, dessert, state, client, sandwich) { function addcmd(id, plate, ingredient, sauce, drink, dessert, state, client, sandwich) {
if (!sandwich) for (let i of ["plate", "ingredient", "sauce", "drink", "dessert", "state", "sandwich"])
sandwich = ""; if (!eval(i))
eval(`${i} = ""`);
list.insertAdjacentHTML("beforeend", `<div class="com" id="cmd${id}"> <button class="donner">Donnée</button> <h1>${id}</h1> <div class="spec"> <h2>${sandwich}</h2><h3>${client}</h3><p>${plate}</p><p>${ingredient}</p><p>${sauce}</p><p>${drink}</p><p>${dessert}</p><button class="annuler">Annuler</button><button class="erreur">Erreur</button> </div> </div>`); list.insertAdjacentHTML("beforeend", `<div class="com" id="cmd${id}"> <button class="donner">Donnée</button> <h1>${id}</h1> <div class="spec"> <h2>${sandwich}</h2><h3>${client}</h3><p>${plate}</p><p>${ingredient}</p><p>${sauce}</p><p>${drink}</p><p>${dessert}</p><button class="annuler">Annuler</button><button class="erreur">Erreur</button> </div> </div>`);
let e = document.querySelector(`.liste #cmd${id}`); let e = document.querySelector(`.liste #cmd${id}`);
e.addEventListener( "click" ,ev => { e.addEventListener( "click" ,ev => {