diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc
index 61034de..26484d6 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 26a1836..2cd3918 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/htmx_views.py b/gestaoRaul/comandas/htmx_views.py
index 1adb6be..658a6d8 100644
--- a/gestaoRaul/comandas/htmx_views.py
+++ b/gestaoRaul/comandas/htmx_views.py
@@ -14,6 +14,16 @@ def addProduct(request, product_id, comanda_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})
+
+
+def removeProductComanda(request, productComanda_id):
+ 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})
\ No newline at end of file
diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html
index c8da7db..9875a15 100644
--- a/gestaoRaul/comandas/templates/viewcomanda.html
+++ b/gestaoRaul/comandas/templates/viewcomanda.html
@@ -20,11 +20,20 @@ Detalhes {{comanda.name}}
-
+
+
+
+
+
+
+
-
{{comanda.name}}
-
{{comanda.mesa}}
-
{{comanda.dt_open}}
+
+ Nome: {{comanda.name}} |
+ Mesa: {{comanda.mesa}}
+
+
+
Aberta em: {{comanda.dt_open|date:"D"}} {{comanda.dt_open|date:"d/m/Y - H:i"}}
@@ -38,6 +47,8 @@ Detalhes {{comanda.name}}
| {{item.product.name}} |
R$ {{item.product.price}} |
+
+ |
@@ -77,6 +88,27 @@ Detalhes {{comanda.name}}
+
+
+
+
diff --git a/gestaoRaul/comandas/urls.py b/gestaoRaul/comandas/urls.py
index b754e85..2e2f6dd 100644
--- a/gestaoRaul/comandas/urls.py
+++ b/gestaoRaul/comandas/urls.py
@@ -18,6 +18,7 @@ htmx_urlpatterns = [
# path('listProduct/', htmx_views.listProduct, name='listProduct'),
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'),
]
diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3
index dd1af23..f3e23f1 100644
Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ
diff --git a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-310.pyc b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-310.pyc
index 8f54d6a..5d456f0 100644
Binary files a/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-310.pyc and b/gestaoRaul/gestaoRaul/__pycache__/settings.cpython-310.pyc differ
diff --git a/gestaoRaul/gestaoRaul/settings.py b/gestaoRaul/gestaoRaul/settings.py
index 92ebb30..7b4f20e 100644
--- a/gestaoRaul/gestaoRaul/settings.py
+++ b/gestaoRaul/gestaoRaul/settings.py
@@ -126,6 +126,7 @@ USE_I18N = True
USE_TZ = True
+DATE_FORMAT = 'd/m/Y - H:M'
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.1/howto/static-files/
diff --git a/gestaoRaul/templates/htmx_components/htmx_list_products_in_comanda.html b/gestaoRaul/templates/htmx_components/htmx_list_products_in_comanda.html
index 545fc4d..df1c9e7 100644
--- a/gestaoRaul/templates/htmx_components/htmx_list_products_in_comanda.html
+++ b/gestaoRaul/templates/htmx_components/htmx_list_products_in_comanda.html
@@ -8,6 +8,7 @@
| {{item.product.name}} |
R$ {{item.product.price}} |
+ |
{% endfor %}
diff --git a/gestaoRaul/templates/static/comandas/js/viewcomanda.js b/gestaoRaul/templates/static/comandas/js/viewcomanda.js
index 149ed10..8f1c8de 100644
--- a/gestaoRaul/templates/static/comandas/js/viewcomanda.js
+++ b/gestaoRaul/templates/static/comandas/js/viewcomanda.js
@@ -2,19 +2,29 @@ function openModal() {
document.getElementById('Modal-add-product').style.display = 'block';
}
+
+function open_remove_product_comanda() {
+ document.getElementById('remove-product-comanda').style.display = 'block';
+}
+
function closeModal() {
document.getElementById('Modal-add-product').style.display = 'none';
}
+
+function removeCloseModal() {
+ document.getElementById('remove-product-comanda').style.display = 'none';
+}
+
+
+
+
+
document.getElementById('openModal').addEventListener('click', openModal);
document.getElementById('productForm').addEventListener('submit', function(event) {
event.preventDefault();
- // const productName = document.getElementById('productName').value;
- // const productPrice = document.getElementById('productPrice').value;
- // const productDescription = document.getElementById('productDescription').value;
- // closeModal();
});
\ No newline at end of file