feat: page mesas_map, popover com lista de comandas associadas com nome, total, e link para abrir a comanda. mesas livre cor diferente e não cria popover.

This commit is contained in:
2025-01-28 20:57:53 -03:00
parent c8119609ea
commit 0534b896ad
6 changed files with 207 additions and 55 deletions

View File

@@ -1,15 +1,17 @@
from django.shortcuts import render
from django.http import JsonResponse
from comandas.models import Comanda
from mesas.models import Mesa
from gestaoRaul.decorators import group_required
def mesas(request):
mesas = Mesa.objects.all()
return render(request, 'mesas.html', {'mesas': mesas})
return render(request, 'mesas.html', {'mesas': mesas, })
@group_required(groupName='Garçom')
def mapMesas(request):
eixosXY = []
for i in range(0,27):
@@ -18,7 +20,16 @@ def mapMesas(request):
eixosXY.append(item)
mesas = Mesa.objects.all()
return render(request, 'mesas_map.html', {'mesas': mesas, 'eixosXY': eixosXY})
comandas = Comanda.objects.filter(status__in=["OPEN", "PAYING"])
for mesa in mesas:
for comanda in comandas:
if mesa.id == comanda.mesa.id:
mesa.active = True
break
for mesa in mesas:
print(mesa.active)
return render(request, 'mesas_map.html', {'comandas': comandas,'mesas': mesas, 'eixosXY': eixosXY})
def locationMesa(request, mesaId, location):
print('inicioul')