diff --git a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc index ea57762..af194db 100644 Binary files a/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc and b/gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc differ diff --git a/gestaoRaul/balcao/__pycache__/urls.cpython-313.pyc b/gestaoRaul/balcao/__pycache__/urls.cpython-313.pyc index cfc2799..8a2f325 100644 Binary files a/gestaoRaul/balcao/__pycache__/urls.cpython-313.pyc and b/gestaoRaul/balcao/__pycache__/urls.cpython-313.pyc differ diff --git a/gestaoRaul/balcao/htmx_views.py b/gestaoRaul/balcao/htmx_views.py index cc330c3..63699b7 100644 --- a/gestaoRaul/balcao/htmx_views.py +++ b/gestaoRaul/balcao/htmx_views.py @@ -6,12 +6,12 @@ from payments.models import Payments from typePay.models import TypePay -def listProduct(request, comanda_id): +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}) -def addProduct(request, product_id, comanda_id): +def addProductBalcao(request, product_id, comanda_id): product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id) product_comanda.save() consumo = ProductComanda.objects.filter(comanda=comanda_id) @@ -21,7 +21,7 @@ def addProduct(request, product_id, comanda_id): return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total}) -def removeProductComanda(request, productComanda_id): +def removeProductBalcao(request, productComanda_id): product_comanda = ProductComanda.objects.get(id=productComanda_id) consumo = ProductComanda.objects.filter(comanda=product_comanda.comanda) product_comanda.delete() @@ -31,16 +31,26 @@ def removeProductComanda(request, productComanda_id): return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total}) -def paymentComanda(request, comanda_id): +def paymentBalcao(request, comanda_id): typePayment = TypePay.objects.get(id=1) consumo = ProductComanda.objects.filter(comanda=comanda_id) + vendasBalcao = Comanda.objects.get(name='VENDAS BALCAO') + print('ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg') + print(f'ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg{vendasBalcao.id}') comanda = Comanda.objects.get(name='VENDA BALCÃO') total = 0 for produto in consumo: total += produto.product.price - removeProductComanda(request, produto.id) - pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description='VENDA BALÃO') + produto.comanda = 14 + produto.save() + # newObject = ProductComanda.objects.get(comanda=produto.id) + # newObject.comanda= 14 + + # newObject.save() + + + pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description='VENDA BALCÃO') pagamento.save() - comanda.save() + # comanda.save() return redirect('comandas') diff --git a/gestaoRaul/balcao/templates/viewBalcao.html b/gestaoRaul/balcao/templates/viewBalcao.html index 6fc5ee8..76d76be 100644 --- a/gestaoRaul/balcao/templates/viewBalcao.html +++ b/gestaoRaul/balcao/templates/viewBalcao.html @@ -5,7 +5,7 @@ {% block 'title' %} -Detalhes {{comanda.name}} +{{comanda.name}} {% endblock %} @@ -70,7 +70,7 @@ Detalhes {{comanda.name}}