fixed: timezone de orders alterado para exibição utc -3

This commit is contained in:
2025-07-02 10:29:16 -03:00
parent 09c5fd1e98
commit 7c6586bbce
8 changed files with 58 additions and 16 deletions

View File

@@ -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;
}
</style>
{% endblock %}

Binary file not shown.

View File

@@ -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')}"
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')}"

View File

@@ -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)',
@@ -191,3 +189,22 @@ function openFullscreen() {
}
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;
}

View File

@@ -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: '&times;',
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: '<span style="color: red;">Falha ao adicionar!</span>',
html: `<div style="color: white; margin-top: 10px;">
${error.message || 'Erro desconhecido'}
</div>`,
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: '<span style="color: green;">Produto adicionado! 😁</span>',
title: '<span style="color: green;">Produto adicionado!</span>',
});
// Reseta após 2.5 segundos
setTimeout(() => {
Swal.update({
title: '<span style="color: white;">Adicionar Produto</span>'