feat: pagamento parcial comanda part2

This commit is contained in:
2025-02-15 17:14:14 -03:00
parent a86bd2fb45
commit e6beb6f4b5
10 changed files with 49 additions and 28 deletions

View File

@@ -27,7 +27,7 @@ def listProduct(request, comanda_id):
for p in allProducts:
if p.active == True:
products.append(p)
return render(request, "htmx_components/htmx_list_products.html", {"products": products,'comanda_id':comanda_id})
return render(request, "htmx_components/comandas/htmx_list_products.html", {"products": products,'comanda_id':comanda_id})
@group_required(groupName='Garçom')
def addProduct(request, product_id, comanda_id):
@@ -36,12 +36,13 @@ def addProduct(request, product_id, comanda_id):
product_comanda.save()
product = Product.objects.get(id=product_id)
comanda = Comanda.objects.get(id=comanda_id)
parcial = Payments.objects.filter(comanda=comanda)
if product.cuisine == True:
order = Order(id_comanda=comanda, id_product=product, productComanda=product_comanda, obs='')
order.save()
consumo = ProductComanda.objects.filter(comanda=comanda_id)
total = somar(consumo,comanda)
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total, 'comanda':comanda})
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda})
@group_required(groupName='Garçom')
def editOrders(request, productComanda_id, obs):
@@ -55,10 +56,11 @@ def editOrders(request, productComanda_id, obs):
def removeProductComanda(request, productComanda_id):
product_comanda = ProductComanda.objects.get(id=productComanda_id)
comanda = Comanda.objects.get(id= product_comanda.comanda.id)
parcial = Payments.objects.filter(comanda=comanda)
consumo = ProductComanda.objects.filter(comanda=comanda)
product_comanda.delete()
total = somar(consumo, comanda)
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total, 'comanda':comanda})
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda})
@group_required(groupName='Garçom')
def closeComanda(request, comanda_id):