diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc index 26484d6..914d6bb 100644 Binary files a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc and b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/urls.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/urls.cpython-310.pyc index 2cd3918..557fd3e 100644 Binary files a/gestaoRaul/comandas/__pycache__/urls.cpython-310.pyc and b/gestaoRaul/comandas/__pycache__/urls.cpython-310.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-310.pyc index 6bb1871..6d10ef0 100644 Binary files a/gestaoRaul/comandas/__pycache__/views.cpython-310.pyc and b/gestaoRaul/comandas/__pycache__/views.cpython-310.pyc differ diff --git a/gestaoRaul/comandas/htmx_views.py b/gestaoRaul/comandas/htmx_views.py index 658a6d8..6aa19c7 100644 --- a/gestaoRaul/comandas/htmx_views.py +++ b/gestaoRaul/comandas/htmx_views.py @@ -26,4 +26,12 @@ def removeProductComanda(request, productComanda_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}) \ No newline at end of file + return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total}) + +def closeComanda(request, comanda_id): + # id = request.POST.get('id-comanda') + # comanda_id = int(id) + comanda = Comanda.objects.get(id=comanda_id) + comanda.status = "PAYING" + comanda.save() + return redirect('comandas') \ No newline at end of file diff --git a/gestaoRaul/comandas/templates/comandas.html b/gestaoRaul/comandas/templates/comandas.html index 67f4798..201c60b 100644 --- a/gestaoRaul/comandas/templates/comandas.html +++ b/gestaoRaul/comandas/templates/comandas.html @@ -20,7 +20,13 @@ Comandas
-
{{comanda.name}} | {{comanda.mesa}}

+
{{comanda.name}} | {{comanda.mesa}}

Aberta ás: {{comanda.dt_open|date:"H:i"}}

diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html index 3bb8ae1..45a0bd4 100644 --- a/gestaoRaul/comandas/templates/viewcomanda.html +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -21,8 +21,24 @@ Detalhes {{comanda.name}}
- - + + + + + + diff --git a/gestaoRaul/comandas/urls.py b/gestaoRaul/comandas/urls.py index 2e2f6dd..3501964 100644 --- a/gestaoRaul/comandas/urls.py +++ b/gestaoRaul/comandas/urls.py @@ -19,8 +19,7 @@ htmx_urlpatterns = [ path('listProduct//', htmx_views.listProduct, name='listProduct'), path('addProduct//', htmx_views.addProduct, name='addProduct'), path('removeProductComanda/', htmx_views.removeProductComanda, name='removeProductComanda'), - # path('removeProduct/', views.removeProduct, name='removeProduct'), - + path('closeComanda/', htmx_views.closeComanda, name='closeComanda'), ] urlpatterns += htmx_urlpatterns \ No newline at end of file diff --git a/gestaoRaul/comandas/views.py b/gestaoRaul/comandas/views.py index 6941869..bdba303 100644 --- a/gestaoRaul/comandas/views.py +++ b/gestaoRaul/comandas/views.py @@ -33,4 +33,5 @@ def createComanda(request): comanda = Comanda(name=name, mesa=mesa) comanda.save() - return redirect('comandas') \ No newline at end of file + return redirect('comandas') + diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index d6555ad..710ba1e 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ