nem sei o que fiz

This commit is contained in:
2024-12-26 16:14:01 -03:00
parent a9896730eb
commit df0d652a36
9 changed files with 166 additions and 137 deletions

View File

@@ -9,26 +9,41 @@ from typePay.models import TypePay
def listProductBalcao(request, comanda_id):
product = request.GET.get("search-product")
products = Product.objects.filter(name__icontains=product)
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products,'comanda_id':comanda_id})
print(products)
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products,})
def addProductBalcao(request, product_id, comanda_id):
product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id)
product_comanda.save()
def addProductBalcao(request, product_id, comanda_id, qtd):
for i in range(qtd):
product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id)
product_comanda.save()
consumo = ProductComanda.objects.filter(comanda=comanda_id)
total = 0
for produto in consumo:
total += produto.product.price
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total})
return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total})
def addProductBalcaoTeclado(request, product_id, comanda_id, qtd):
print('entrouuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu', product_id, comanda_id)
for i in range(qtd):
product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id)
product_comanda.save()
consumo = ProductComanda.objects.filter(comanda=comanda_id)
total = 0
for produto in consumo:
total += produto.product.price
return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total})
def removeProductBalcao(request, productComanda_id):
print(request.COOKIES['qtd'])
product_comanda = ProductComanda.objects.get(id=productComanda_id)
consumo = ProductComanda.objects.filter(comanda=product_comanda.comanda)
product_comanda.delete()
total = 0
for produto in consumo:
total += produto.product.price
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total})
return render(request, "htmx_components/htmx_list_products_in_balcao.html",{'consumo': consumo, 'total': total})
def paymentBalcao(request, comanda_id):