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):
|
def command_json(c):
|
||||||
ingredient = " - ".join([s.id for s in c.content])
|
ingredient = " - ".join([s.id for s in c.content])
|
||||||
sauces = " - ".join([s.id for s in c.sauce])
|
sauces = " - ".join([s.id for s in c.sauce])
|
||||||
sandwich = None
|
|
||||||
if c.error:
|
if c.error:
|
||||||
state = "error"
|
state = "error"
|
||||||
elif c.give:
|
elif c.give:
|
||||||
|
@ -35,13 +34,16 @@ def command_json(c):
|
||||||
state = "waiting"
|
state = "waiting"
|
||||||
else:
|
else:
|
||||||
state = "unknown"
|
state = "unknown"
|
||||||
if c.sandwich_id:
|
try:
|
||||||
|
client = User.query.get(c.client_id).username
|
||||||
|
except AttributeError:
|
||||||
|
client = None
|
||||||
try:
|
try:
|
||||||
sandwich = User.query.get(c.sandwich_id).username
|
sandwich = User.query.get(c.sandwich_id).username
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
sandwich = None
|
||||||
return {"id": c.number, "plate": c.plate_id, "ingredient": ingredient, "sauce": sauces, "drink": c.drink_id,
|
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")
|
@socketio.on("connect")
|
||||||
|
|
|
@ -729,11 +729,11 @@ audio{
|
||||||
color: rgb(122, 233, 105);
|
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;
|
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;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ let WIP = document.getElementById("encours");
|
||||||
let done = document.getElementById("realisee");
|
let done = document.getElementById("realisee");
|
||||||
let waiting = document.getElementById("attente");
|
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)
|
if (!sandwich)
|
||||||
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}`);
|
let e = document.getElementById(`cmd${id}`);
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case "WIP":
|
case "WIP":
|
||||||
|
@ -75,7 +75,7 @@ socket.on("list command", data => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let c of data.list) {
|
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();
|
waiter();
|
||||||
});
|
});
|
||||||
|
@ -88,7 +88,7 @@ socket.on("list service", data => {
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("new command", 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();
|
waiter();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ let current = {"plate": null, "ingredient": [], "sauce": [], "drink": null, "des
|
||||||
let radios = {"plate": null, "drink": null, "dessert": null};
|
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)
|
if (!sandwich)
|
||||||
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}`);
|
let e = document.querySelector(`.liste #cmd${id}`);
|
||||||
e.addEventListener( "click" ,ev => {
|
e.addEventListener( "click" ,ev => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
@ -172,7 +172,7 @@ socket.on("list command", data => {
|
||||||
child = list.lastElementChild;
|
child = list.lastElementChild;
|
||||||
}
|
}
|
||||||
for (let c of data.list) {
|
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 => {
|
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 => {
|
socket.on("cleared command", data => {
|
||||||
|
|
Reference in a new issue