diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-313.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-313.pyc index 49ba024..26337a7 100644 Binary files a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-313.pyc and b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-313.pyc differ diff --git a/gestaoRaul/comandas/htmx_views.py b/gestaoRaul/comandas/htmx_views.py index f6fd66a..2204efc 100644 --- a/gestaoRaul/comandas/htmx_views.py +++ b/gestaoRaul/comandas/htmx_views.py @@ -34,7 +34,7 @@ def addProduct(request, product_id, 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_comanda.html",{'consumo': consumo, 'total': total, 'comanda':comanda}) @group_required(groupName='Garçom') def editOrders(request, productComanda_id, obs): @@ -48,12 +48,14 @@ def editOrders(request, productComanda_id, obs): @group_required(groupName='Garçom') def removeProductComanda(request, productComanda_id): product_comanda = ProductComanda.objects.get(id=productComanda_id) - consumo = ProductComanda.objects.filter(comanda=product_comanda.comanda) + comanda = Comanda.objects.get(id= product_comanda.comanda.id) + consumo = ProductComanda.objects.filter(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_comanda.html",{'consumo': consumo, 'total': total, 'comanda':comanda}) @group_required(groupName='Garçom') def closeComanda(request, comanda_id): diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html index eef0db0..5ca2186 100644 --- a/gestaoRaul/comandas/templates/viewcomanda.html +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -85,7 +85,6 @@ Detalhes {{comanda.name}}