Show client on command and better kitchen command information display
This commit is contained in:
parent
7b533fd9a7
commit
9f4d5cf440
4 changed files with 19 additions and 17 deletions
|
@ -22,7 +22,6 @@ def authenticated_only(f):
|
|||
def command_json(c):
|
||||
ingredient = " - ".join([s.id for s in c.content])
|
||||
sauces = " - ".join([s.id for s in c.sauce])
|
||||
sandwich = None
|
||||
if c.error:
|
||||
state = "error"
|
||||
elif c.give:
|
||||
|
@ -35,13 +34,16 @@ def command_json(c):
|
|||
state = "waiting"
|
||||
else:
|
||||
state = "unknown"
|
||||
if c.sandwich_id:
|
||||
try:
|
||||
client = User.query.get(c.client_id).username
|
||||
except AttributeError:
|
||||
client = None
|
||||
try:
|
||||
sandwich = User.query.get(c.sandwich_id).username
|
||||
except AttributeError:
|
||||
pass
|
||||
sandwich = None
|
||||
return {"id": c.number, "plate": c.plate_id, "ingredient": ingredient, "sauce": sauces, "drink": c.drink_id,
|
||||
"dessert": c.dessert_id, "state": state, "sandwich": sandwich}
|
||||
"dessert": c.dessert_id, "state": state, "sandwich": sandwich, "client": client}
|
||||
|
||||
|
||||
@socketio.on("connect")
|
||||
|
|
|
@ -729,11 +729,11 @@ audio{
|
|||
color: rgb(122, 233, 105);
|
||||
}
|
||||
|
||||
#attente div :nth-child(2), #attente div :nth-child(3) {
|
||||
#attente div :nth-child(2), #attente div :nth-child(4), #attente div :nth-child(5) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#realisee div :nth-child(2), #realisee div :nth-child(3){
|
||||
#realisee div :nth-child(2), #realisee div :nth-child(4), #realisee div :nth-child(5){
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ let WIP = document.getElementById("encours");
|
|||
let done = document.getElementById("realisee");
|
||||
let waiting = document.getElementById("attente");
|
||||
|
||||
function addcmd(id, plate, ingredient, sauce, drink, dessert, state, sandwich) {
|
||||
function addcmd(id, plate, ingredient, sauce, drink, dessert, state, client, sandwich) {
|
||||
if (!sandwich)
|
||||
sandwich = "";
|
||||
done.insertAdjacentHTML("beforeend", `<div id=cmd${id}> <h1>${id}</h1><h2>${sandwich}</h2><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}`);
|
||||
switch (state) {
|
||||
case "WIP":
|
||||
|
@ -75,7 +75,7 @@ socket.on("list command", data => {
|
|||
}
|
||||
}
|
||||
for (let c of data.list) {
|
||||
addcmd(c.id, c.plate, c.ingredient, c.sauce, c.drink, c.dessert, c.state, c.sandwich);
|
||||
addcmd(c.id, c.plate, c.ingredient, c.sauce, c.drink, c.dessert, c.state, c.client,c.sandwich);
|
||||
}
|
||||
waiter();
|
||||
});
|
||||
|
@ -88,7 +88,7 @@ socket.on("list service", data => {
|
|||
});
|
||||
|
||||
socket.on("new command", data => {
|
||||
addcmd(data.id, data.plate, data.ingredient, data.sauce, data.drink, data.dessert, data.state, data.sandwich);
|
||||
addcmd(data.id, data.plate, data.ingredient, data.sauce, data.drink, data.dessert, data.state, data.client, data.sandwich);
|
||||
waiter();
|
||||
});
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ let current = {"plate": null, "ingredient": [], "sauce": [], "drink": null, "des
|
|||
let radios = {"plate": null, "drink": null, "dessert": null};
|
||||
|
||||
|
||||
function addcmd(id, plate, ingredient, sauce, drink, dessert, state, sandwich) {
|
||||
function addcmd(id, plate, ingredient, sauce, drink, dessert, state, client, sandwich) {
|
||||
if (!sandwich)
|
||||
sandwich = "";
|
||||
list.insertAdjacentHTML("beforeend", `<div class="com" id="cmd${id}"> <button class="donner">Donnée</button> <h1>${id}</h1> <div class="spec"> <h2>${sandwich}</h2><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}`);
|
||||
e.addEventListener( "click" ,ev => {
|
||||
ev.stopPropagation();
|
||||
|
@ -172,7 +172,7 @@ socket.on("list command", data => {
|
|||
child = list.lastElementChild;
|
||||
}
|
||||
for (let c of data.list) {
|
||||
addcmd(c.id, c.plate, c.ingredient, c.sauce, c.drink, c.dessert, c.state, c.sandwich);
|
||||
addcmd(c.id, c.plate, c.ingredient, c.sauce, c.drink, c.dessert, c.state, c.client, c.sandwich);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -232,7 +232,7 @@ socket.on("list dessert", data => {
|
|||
});
|
||||
|
||||
socket.on("new command", data => {
|
||||
addcmd(data.id, data.plate, data.ingredient, data.sauce, data.drink, data.dessert, data.state, data.sandwich);
|
||||
addcmd(data.id, data.plate, data.ingredient, data.sauce, data.drink, data.dessert, data.state, data.client, data.sandwich);
|
||||
});
|
||||
|
||||
socket.on("cleared command", data => {
|
||||
|
|
Reference in a new issue