feat: create page balcao

This commit is contained in:
2024-12-21 11:43:09 -03:00
parent 59e4eb6039
commit 0ef1c0a61b
44 changed files with 657 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
from django.shortcuts import render, redirect
from comandas.models import Comanda, ProductComanda
from products.models import Product
from mesas.models import Mesa
# def balcao(request):
# comandas = Comanda.objects.filter(status__in=["OPEN", "PAYING"])
# mesas = Mesa.objects.all()
# return render(request, 'comandas.html', {'comandas': comandas, 'mesas': mesas})
def viewBalcao(request):
comanda = Comanda.objects.get(name='VENDA BALCÃO')
consumo = ProductComanda.objects.filter(comanda=comanda.id)
products = Product.objects.all()
total = 0
for produto in consumo:
total += produto.product.price
return render(request, 'viewBalcao.html', {'comanda': comanda, 'consumo': consumo, 'total': total, 'products': products})
# def createComanda(request):
# name = request.POST.get('name-comanda')
# mesa_id = int(request.POST.get('select-mesa')[0])
# mesa = Mesa.objects.get(id=mesa_id)
# comanda = Comanda(name=name, mesa=mesa)
# comanda.save()
# return redirect('comandas')