diff --git a/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/htmx_views.cpython-310.pyc index 72a74a0..61034de 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 f654cbf..26a1836 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 44580ae..b0aeeda 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 d946d19..1adb6be 100644 --- a/gestaoRaul/comandas/htmx_views.py +++ b/gestaoRaul/comandas/htmx_views.py @@ -4,12 +4,16 @@ from comandas.models import Comanda, ProductComanda from products.models import Product -def listProduct(request): +def listProduct(request, comanda_id): product = request.GET.get("search-product") products = Product.objects.filter(name__icontains=product) - return render(request, "htmx_components/htmx_list_products.html", {"products": products}) + return render(request, "htmx_components/htmx_list_products.html", {"products": products,'comanda_id':comanda_id}) def addProduct(request, product_id, comanda_id): product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id) product_comanda.save() - return render(request, "htmx_components/htmx_add_product.html",) \ No newline at end of file + 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}) \ No newline at end of file diff --git a/gestaoRaul/comandas/templates/comandas.html b/gestaoRaul/comandas/templates/comandas.html index 1bfd0ef..3c71c9b 100644 --- a/gestaoRaul/comandas/templates/comandas.html +++ b/gestaoRaul/comandas/templates/comandas.html @@ -2,13 +2,14 @@ {% load static %} - - {% block 'title' %} -Comandas{% endblock %} +Comandas +{% endblock %} + {% block 'head' %} {% endblock %} + {% block 'body' %} @@ -17,12 +18,11 @@ Comandas{% endblock %} {% for comanda in comandas %} -
- {{comanda.name}}
- {{comanda.mesa}} +
+ {{comanda.name}}
+ {{comanda.mesa}} - -
+
{% endfor %} @@ -41,11 +41,6 @@ Comandas{% endblock %} {% endfor %} - - - diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html index dc9dfa9..c8da7db 100644 --- a/gestaoRaul/comandas/templates/viewcomanda.html +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -19,7 +19,7 @@ Detalhes {{comanda.name}} {% block 'body' %} -
+

{{comanda.name}}

@@ -27,7 +27,7 @@ Detalhes {{comanda.name}}

{{comanda.dt_open}}

- +
@@ -58,12 +58,13 @@ Detalhes {{comanda.name}} + + + + +{% for item in consumo%} + + + + + + +{% endfor %} + + + + + + +
Produto Preço
ProdutoPreço
{{item.product.name}}R$ {{item.product.price}}
Total R$ {{total}}
diff --git a/gestaoRaul/templates/static/comandas/css/viewcomanda.css b/gestaoRaul/templates/static/comandas/css/viewcomanda.css index 09c07cf..412ccb5 100644 --- a/gestaoRaul/templates/static/comandas/css/viewcomanda.css +++ b/gestaoRaul/templates/static/comandas/css/viewcomanda.css @@ -17,15 +17,16 @@ .card { width: 120px; height: 120px; - background-color: #f2f2f2; + background-color: #c9ffbc; border-radius: 15px; box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); text-align: center; - line-height: 120px; /* Centraliza o texto verticalmente */ + line-height: 40px; /* Centraliza o texto verticalmente */ font-size: 20px; font-weight: bold; color: #333; transition: transform 0.2s; + cursor: pointer; } .card:hover { diff --git a/gestaoRaul/templates/static/products/js/products.js b/gestaoRaul/templates/static/products/js/products.js index 53c34a0..7e135a4 100644 --- a/gestaoRaul/templates/static/products/js/products.js +++ b/gestaoRaul/templates/static/products/js/products.js @@ -1,20 +1,21 @@ function openModal() { - document.getElementById('myModal').style.display = 'block'; + document.getElementById('Modal-create-product').style.display = 'block'; } function closeModal() { - document.getElementById('myModal').style.display = 'none'; + document.getElementById('Modal-create-product').style.display = 'none'; } document.getElementById('openModal').addEventListener('click', openModal); -document.getElementById('productForm').addEventListener('submit', function(event) { - event.preventDefault(); +// 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