mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
style: toast ao add product na comanda
This commit is contained in:
Binary file not shown.
@@ -330,9 +330,9 @@ white-space: nowrap;
|
|||||||
|
|
||||||
.toast {
|
.toast {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 40px;
|
top: 4px;
|
||||||
width: 30%;
|
width: 30%;
|
||||||
left: 50%;
|
left: 30%;
|
||||||
justify-items: center;
|
justify-items: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
@@ -344,7 +344,7 @@ white-space: nowrap;
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
|
transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
|
||||||
z-index: 999 ;
|
z-index: 999999999999 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toast p {
|
.toast p {
|
||||||
@@ -462,4 +462,11 @@ white-space: nowrap;
|
|||||||
body {
|
body {
|
||||||
margin: 8px 0px 0px 0px;
|
margin: 8px 0px 0px 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.toast {
|
||||||
|
position: fixed;
|
||||||
|
top: 5px;
|
||||||
|
width: 70%;
|
||||||
|
left: 40%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,115 +19,86 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function verificarCookieNotificacao() {
|
|
||||||
var iconNotify = document.getElementById('icon-notify');
|
|
||||||
if (document.cookie.indexOf('notificacao=') === -1) {
|
|
||||||
document.cookie = 'notificacao=true; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/';
|
|
||||||
iconNotify.style.backgroundColor = 'green';
|
|
||||||
iconNotify.textContent = '🔊';
|
|
||||||
}else{
|
|
||||||
let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
|
||||||
iconNotify.style.backgroundColor = valorAtual === 'true' ? 'green' : 'red';
|
|
||||||
iconNotify.textContent = valorAtual === 'true' ? '🔊' : '🔇';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
verificarCookieNotificacao();
|
|
||||||
|
|
||||||
function cookieNotificacao() {
|
|
||||||
if (document.cookie.indexOf('notificacao=') !== -1) {
|
|
||||||
let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
|
||||||
var iconNotify = document.getElementById('icon-notify');
|
|
||||||
let novoValor = valorAtual === 'true' ? 'false' : 'true';
|
|
||||||
if (novoValor === 'true') {
|
|
||||||
iconNotify.style.backgroundColor = 'green';
|
|
||||||
iconNotify.textContent = '🔊';
|
|
||||||
}else{
|
|
||||||
iconNotify.style.backgroundColor = 'red';
|
|
||||||
iconNotify.textContent = '🔇';
|
|
||||||
}
|
|
||||||
document.cookie = 'notificacao=' + novoValor + '; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/';
|
|
||||||
} else {
|
|
||||||
document.cookie = 'notificacao=true; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const websocket = new WebSocket('ws://192.168.0.150:8765');
|
|
||||||
const nomeUsuario = document.getElementById('user-info').textContent;
|
|
||||||
|
|
||||||
websocket.addEventListener('open', (event) => {
|
|
||||||
console.log('Conectado ao servidor WebSocket');
|
|
||||||
});
|
|
||||||
|
|
||||||
websocket.addEventListener('message', (event) => {
|
|
||||||
const data = JSON.parse(event.data);
|
|
||||||
|
|
||||||
switch (data.local) {
|
|
||||||
case 'cozinha':
|
|
||||||
|
|
||||||
if (document.getElementById('Fila') !== null && data.tipo === 'add'){
|
|
||||||
|
|
||||||
|
|
||||||
var novoElemento = document.createElement('div');
|
|
||||||
novoElemento.innerHTML = data.message;
|
// const websocket = new WebSocket('ws://192.168.0.150:8765');
|
||||||
document.getElementById('Fila').appendChild(novoElemento);
|
// const nomeUsuario = document.getElementById('user-info').textContent;
|
||||||
let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
|
||||||
if (valorAtual === 'true') {
|
// websocket.addEventListener('open', (event) => {
|
||||||
texto = new SpeechSynthesisUtterance(data.speak);
|
// console.log('Conectado ao servidor WebSocket');
|
||||||
window.speechSynthesis.speak(texto);
|
// });
|
||||||
|
|
||||||
|
// websocket.addEventListener('message', (event) => {
|
||||||
|
// const data = JSON.parse(event.data);
|
||||||
|
|
||||||
|
// switch (data.local) {
|
||||||
|
// case 'cozinha':
|
||||||
|
|
||||||
|
// if (document.getElementById('Fila') !== null && data.tipo === 'add'){
|
||||||
|
|
||||||
|
|
||||||
|
// var novoElemento = document.createElement('div');
|
||||||
|
// novoElemento.innerHTML = data.message;
|
||||||
|
// document.getElementById('Fila').appendChild(novoElemento);
|
||||||
|
// let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
||||||
|
// if (valorAtual === 'true') {
|
||||||
|
// texto = new SpeechSynthesisUtterance(data.speak);
|
||||||
|
// window.speechSynthesis.speak(texto);
|
||||||
|
// // setTimeout(function() {
|
||||||
|
// // location.reload();
|
||||||
|
// // }, 6000);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if (document.getElementById('obs-'+data.id) !== null && data.tipo === 'edit'){
|
||||||
|
// const obs = document.getElementById('obs-'+data.id)
|
||||||
|
// const card = obs.parentNode;
|
||||||
|
// card.style.backgroundColor = 'rgb(243, 165, 75)';
|
||||||
|
// obs.innerHTML = data.message;
|
||||||
|
// let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
||||||
|
|
||||||
|
// if (valorAtual === 'true') {
|
||||||
|
// texto = new SpeechSynthesisUtterance(data.speak);
|
||||||
|
// window.speechSynthesis.speak(texto);
|
||||||
|
// // setTimeout(function() {
|
||||||
|
// // location.reload();
|
||||||
|
// // }, 6000);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else if (document.getElementById('m-card-'+data.id) !== null && data.tipo === 'delete'){
|
||||||
|
// // const card = document.getElementById('m-card-'+data.id)
|
||||||
|
// // card.style.backgroundColor = 'rgb(253, 69, 69)';
|
||||||
|
// let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
||||||
|
// if (valorAtual === 'true') {
|
||||||
|
// texto = new SpeechSynthesisUtterance(data.speak);
|
||||||
|
// window.speechSynthesis.speak(texto);
|
||||||
// setTimeout(function() {
|
// setTimeout(function() {
|
||||||
// location.reload();
|
// location.reload();
|
||||||
// }, 6000);
|
// }, 6000);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (document.getElementById('obs-'+data.id) !== null && data.tipo === 'edit'){
|
|
||||||
const obs = document.getElementById('obs-'+data.id)
|
|
||||||
const card = obs.parentNode;
|
|
||||||
card.style.backgroundColor = 'rgb(243, 165, 75)';
|
|
||||||
obs.innerHTML = data.message;
|
|
||||||
let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
|
||||||
|
|
||||||
if (valorAtual === 'true') {
|
// break;
|
||||||
texto = new SpeechSynthesisUtterance(data.speak);
|
// case 'praca':
|
||||||
window.speechSynthesis.speak(texto);
|
// console.log('Mensagem para a praca:', data);
|
||||||
// setTimeout(function() {
|
// break;
|
||||||
// location.reload();
|
// case 'guarita':
|
||||||
// }, 6000);
|
// console.log('Mensagem para a guarita:', data);
|
||||||
}
|
// break;
|
||||||
}
|
// case 'balcao':
|
||||||
else if (document.getElementById('m-card-'+data.id) !== null && data.tipo === 'delete'){
|
// console.log('Mensagem para a balcao:', data);
|
||||||
// const card = document.getElementById('m-card-'+data.id)
|
// break;
|
||||||
// card.style.backgroundColor = 'rgb(253, 69, 69)';
|
// default:
|
||||||
let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
|
// console.log('Local desconhecido:', data);
|
||||||
if (valorAtual === 'true') {
|
// }
|
||||||
texto = new SpeechSynthesisUtterance(data.speak);
|
|
||||||
window.speechSynthesis.speak(texto);
|
|
||||||
setTimeout(function() {
|
|
||||||
location.reload();
|
|
||||||
}, 6000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
// });
|
||||||
case 'praca':
|
// websocket.addEventListener('error', (event) => {
|
||||||
console.log('Mensagem para a praca:', data);
|
// console.error('Erro no WebSocket:', event);
|
||||||
break;
|
// });
|
||||||
case 'guarita':
|
// websocket.addEventListener('close', (event) => {
|
||||||
console.log('Mensagem para a guarita:', data);
|
// console.log("conexão fechada");
|
||||||
break;
|
// });
|
||||||
case 'balcao':
|
|
||||||
console.log('Mensagem para a balcao:', data);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
console.log('Local desconhecido:', data);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
websocket.addEventListener('error', (event) => {
|
|
||||||
console.error('Erro no WebSocket:', event);
|
|
||||||
});
|
|
||||||
websocket.addEventListener('close', (event) => {
|
|
||||||
console.log("conexão fechada");
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -154,7 +125,7 @@ function openFullscreen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showToast(message, type ,duration = 3000) {
|
function showToast(message, type ,duration = 2500) {
|
||||||
const toast = document.getElementById('toast');
|
const toast = document.getElementById('toast');
|
||||||
|
|
||||||
if (type === 'success') {
|
if (type === 'success') {
|
||||||
|
|||||||
@@ -396,6 +396,7 @@ async function addProductComanda(productId, comandaId, cuisine) {
|
|||||||
|
|
||||||
const result = await response.text();
|
const result = await response.text();
|
||||||
console.log(response);
|
console.log(response);
|
||||||
|
showToast('Produto adicionado com sucesso!', 'success');
|
||||||
|
|
||||||
// Atualiza a lista de produtos
|
// Atualiza a lista de produtos
|
||||||
const listElement = document.getElementById("list-products-comanda");
|
const listElement = document.getElementById("list-products-comanda");
|
||||||
|
|||||||
@@ -82,7 +82,6 @@
|
|||||||
position: sticky;
|
position: sticky;
|
||||||
top: 60px;
|
top: 60px;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
/* cursor: pointer; */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
@@ -95,5 +94,10 @@
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
max-width: 100px;
|
max-width: 100px;
|
||||||
width: 80px;
|
width: 80px;
|
||||||
|
}
|
||||||
|
#product-list th {
|
||||||
|
position: sticky;
|
||||||
|
top: 0px;
|
||||||
|
z-index: 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,18 +81,7 @@ function editProduct(id) {
|
|||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
// document.getElementById('openModal').addEventListener('click', openModal);
|
|
||||||
|
|
||||||
// document.getElementById('productForm').addEventListener('submit', function(event) {
|
|
||||||
// event.preventDefault();
|
|
||||||
|
|
||||||
// const productName = document.getElementById('productName').value;
|
|
||||||
// const productPrice = document.getElementById('productPrice').value;
|
|
||||||
// const productDescription = document.getElementById('productDescription').value;
|
|
||||||
|
|
||||||
// closeModal();
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
|
|
||||||
function listerSortTeable(){
|
function listerSortTeable(){
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user