`;
//Todas las comandas
TS_IndexElement(
"supercafe",
[
{
key: "Persona",
type: "persona",
default: "",
label: "Persona",
},
{
key: "Estado",
type: "comanda-status",
default: "",
label: "Estado",
},
{
key: "Comanda",
type: "comanda",
default: "",
label: "Comanda",
},
],
gun.get(TABLE).get("supercafe"),
document.querySelector("#cont1"),
(data, new_tr) => {
// new_tr.style.backgroundColor = "#FFCCCB";
if (data.Estado == "Pedido") {
new_tr.style.backgroundColor = "#FFFFFF";
}
if (data.Estado == "En preparación") {
new_tr.style.backgroundColor = "#FFCCCB";
}
if (data.Estado == "Listo") {
new_tr.style.backgroundColor = "gold";
}
if (data.Estado == "Entregado") {
new_tr.style.backgroundColor = "lightgreen";
}
if (data.Estado == "Deuda") {
new_tr.style.backgroundColor = "#f5d3ff";
}
},
(data) => {
if (data.Estado == "Deuda") {
return true;
}
var key = data._key;
if (old[key] == undefined) {
old[key] = "";
}
if (old[key] != data.Estado) {
if (tts && document.getElementById(tts_check).checked) {
var msg = `Comanda de ${SC_Personas[data.Persona].Region}. - ${
JSON.parse(data.Comanda)["Selección"]
}. - ${SC_Personas[data.Persona].Nombre}. - ${data.Estado}`;
console.log("TTS: " + msg);
let utterance = new SpeechSynthesisUtterance(msg);
utterance.rate = 0.9;
// utterance.voice = speechSynthesis.getVoices()[7]
speechSynthesis.speak(utterance);
}
}
old[key] = data.Estado;
}
);
//Deudas
TS_IndexElement(
"supercafe",
[
{
key: "Persona",
type: "persona",
default: "",
label: "Persona",
},
{
key: "Estado",
type: "comanda-status",
default: "",
label: "Estado",
},
{
key: "Comanda",
type: "comanda",
default: "",
label: "Comanda",
},
],
gun.get(TABLE).get("supercafe"),
document.querySelector("#cont2"),
(data, new_tr) => {
// new_tr.style.backgroundColor = "#FFCCCB";
if (data.Estado == "Pedido") {
new_tr.style.backgroundColor = "#FFFFFF";
}
if (data.Estado == "En preparación") {
new_tr.style.backgroundColor = "#FFCCCB";
}
if (data.Estado == "Listo") {
new_tr.style.backgroundColor = "gold";
}
if (data.Estado == "Entregado") {
new_tr.style.backgroundColor = "lightgreen";
}
if (data.Estado == "Deuda") {
new_tr.style.backgroundColor = "#f5d3ff";
}
},
(data) => {
if (data.Estado != "Deuda") {
return true;
}
var key = data._key;
if (old[key] == undefined) {
old[key] = "";
}
if (old[key] != data.Estado) {
if (tts && document.getElementById(tts_check).checked) {
var msg = `Comanda de ${SC_Personas[data.Persona].Region}. - ${
JSON.parse(data.Comanda)["Selección"]
}. - ${SC_Personas[data.Persona].Nombre}. - ${data.Estado}`;
console.log("TTS: " + msg);
let utterance = new SpeechSynthesisUtterance(msg);
utterance.rate = 0.9;
// utterance.voice = speechSynthesis.getVoices()[7]
speechSynthesis.speak(utterance);
}
}
old[key] = data.Estado;
}
);
document.getElementById(btn_new).onclick = () => {
setUrlHash("supercafe," + safeuuid(""));
};
},
}