diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html index 737c49e..c13ab05 100644 --- a/gestaoRaul/comandas/templates/viewcomanda.html +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -19,8 +19,26 @@ Detalhes {{comanda.name}} } .posi { position: absolute !important; - top: 0.5em; - right: 0.5em; + background-color: rgba(72, 72, 72, 0.151); + color: rgba(255, 255, 255, 0.452); + border: 2px solid rgba(239, 239, 239, 0.107); + border-radius: 35px; + padding: 0px 15px 3px 15px ; + align-self: center; + font-size: 32px; + top: 0.1em; + right: 0.1em; + scale: 0.8; + } + .posi:hover{ + background-color: rgba(183, 3, 3, 0.598); + color: rgb(255, 255, 255); + } + .custom-toast-container { + z-index: 99999 !important; + } + .swal2-container { + z-index: 9999 !important; } {% endblock %} diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 20f68e2..c60fbf7 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc index 0ea64b8..09a277c 100644 Binary files a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc and b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-312.pyc differ diff --git a/gestaoRaul/orders/__pycache__/models.cpython-312.pyc b/gestaoRaul/orders/__pycache__/models.cpython-312.pyc index 69d7e7f..727c9d4 100644 Binary files a/gestaoRaul/orders/__pycache__/models.cpython-312.pyc and b/gestaoRaul/orders/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/orders/models.py b/gestaoRaul/orders/models.py index 6744de9..bbf91f1 100644 --- a/gestaoRaul/orders/models.py +++ b/gestaoRaul/orders/models.py @@ -1,5 +1,6 @@ from django.db import models from django.utils.formats import date_format +from datetime import timedelta from products.models import Product from comandas.models import Comanda, ProductComanda @@ -18,6 +19,8 @@ class Order(models.Model): def __str__(self): status = 'Em espera' + datetime = self.queue - timedelta(hours=3) + if self.preparing: status = 'Preparando' if self.finished: @@ -25,4 +28,4 @@ class Order(models.Model): if self.delivered: status = 'Entregue' - return f"{self.id_product}| {self.obs}|{status}|{self.id_comanda.name}|{self.id_comanda.mesa.name}|{date_format(self.queue, 'd/m/Y H:i')}" \ No newline at end of file + return f"{self.id_product}| {self.obs}|{status}|{self.id_comanda.name}|{self.id_comanda.mesa.name}|{date_format(datetime, 'd/m/Y H:i')}" \ No newline at end of file diff --git a/gestaoRaul/payments/__pycache__/models.cpython-312.pyc b/gestaoRaul/payments/__pycache__/models.cpython-312.pyc index d0cb77a..4ff6d21 100644 Binary files a/gestaoRaul/payments/__pycache__/models.cpython-312.pyc and b/gestaoRaul/payments/__pycache__/models.cpython-312.pyc differ diff --git a/gestaoRaul/templates/static/base.js b/gestaoRaul/templates/static/base.js index 9a0f4d5..04c9f03 100644 --- a/gestaoRaul/templates/static/base.js +++ b/gestaoRaul/templates/static/base.js @@ -181,8 +181,6 @@ function openFullscreen() { var feedbackMsg = Swal.fire({ color: 'white', title: message, - // toast: true, - // position: 'top', text: subMessage || '', icon: icon || 'info', background: 'rgb(23, 38, 54)', @@ -190,4 +188,23 @@ function openFullscreen() { }); -} \ No newline at end of file +} +function toast(){ + + const Toast = Swal.mixin({ + toast: true, + theme:"dark", + position: "top", + showConfirmButton: false, + background: 'rgb(30, 42, 58)', + color: 'white', + showCloseButton: true, + timer: 2500, + timerProgressBar: true, + didOpen: (toast) => { + toast.onmouseenter = Swal.stopTimer; + toast.onmouseleave = Swal.resumeTimer; + } + }); + return Toast; + } \ No newline at end of file diff --git a/gestaoRaul/templates/static/comandas/js/viewcomanda.js b/gestaoRaul/templates/static/comandas/js/viewcomanda.js index 24e4da4..169911d 100644 --- a/gestaoRaul/templates/static/comandas/js/viewcomanda.js +++ b/gestaoRaul/templates/static/comandas/js/viewcomanda.js @@ -1,26 +1,21 @@ - async function openModal() { var htmlModal = document.getElementById('addProduct').innerHTML htmlModal = htmlModal.replace('search-product','search-product-modal') htmlModal = htmlModal.replace('product-list','product-list-modal') -const { value: formValues } = await Swal.fire({ +Swal.fire({ title: "Adicionar Produto", html: htmlModal, - width: '100em', position:"top", theme: "dark", - didOpen: () => { - Swal.getPopup().classList.add('swal2-noautoclose'); - }, + showConfirmButton: false, showCancelButton: true, cancelButtonText: '×', customClass:{ cancelButton:'posi' }, - focusConfirm: false, }); @@ -396,7 +391,16 @@ async function addProductComanda(productId, comandaId, cuisine) { // Trata resposta if (!response.ok) { const errorData = await response.json().catch(() => ({})); + Swal.update({ + title: 'Falha ao adicionar!', + html: `
+ ${error.message || 'Erro desconhecido'} +
`, + icon: 'error', + + }); throw new Error(errorData.message || `Erro HTTP: ${response.status}`); + } const result = await response.text(); @@ -407,12 +411,12 @@ async function addProductComanda(productId, comandaId, cuisine) { listElement.innerHTML = result; } - // Feedback de sucesso + Swal.update({ - title: 'Produto adicionado! 😁', + title: '✅ Produto adicionado!', }); - // Reseta após 2.5 segundos + setTimeout(() => { Swal.update({ title: 'Adicionar Produto'