From 03357f1a5b1ac571aa9c0fa246fc8346ff025722 Mon Sep 17 00:00:00 2001 From: flifloo Date: Tue, 4 Feb 2020 22:52:28 +0100 Subject: [PATCH] No more null in interface --- app/static/js/kitchen.js | 5 +++-- app/static/js/pc.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/static/js/kitchen.js b/app/static/js/kitchen.js index e95a566..2a4c659 100644 --- a/app/static/js/kitchen.js +++ b/app/static/js/kitchen.js @@ -4,8 +4,9 @@ let done = document.getElementById("realisee"); let waiting = document.getElementById("attente"); function addcmd(id, plate, ingredient, sauce, drink, dessert, state, client, sandwich) { - if (!sandwich) - sandwich = ""; + for (let i of ["plate", "ingredient", "sauce", "drink", "dessert", "state", "sandwich"]) + if (!eval(i)) + eval(`${i} = ""`); done.insertAdjacentHTML("beforeend", `

${id}

${sandwich}

${client}

${plate} | ${ingredient}

${sauce}

${drink}

${dessert}

`); let e = document.getElementById(`cmd${id}`); switch (state) { diff --git a/app/static/js/pc.js b/app/static/js/pc.js index fb1a76d..0bfeaed 100644 --- a/app/static/js/pc.js +++ b/app/static/js/pc.js @@ -10,8 +10,9 @@ let radios = {"plate": null, "drink": null, "dessert": null}; function addcmd(id, plate, ingredient, sauce, drink, dessert, state, client, sandwich) { - if (!sandwich) - sandwich = ""; + for (let i of ["plate", "ingredient", "sauce", "drink", "dessert", "state", "sandwich"]) + if (!eval(i)) + eval(`${i} = ""`); list.insertAdjacentHTML("beforeend", `

${id}

${sandwich}

${client}

${plate}

${ingredient}

${sauce}

${drink}

${dessert}

`); let e = document.querySelector(`.liste #cmd${id}`); e.addEventListener( "click" ,ev => {