style | clean

This commit is contained in:
2025-01-08 19:43:53 -03:00
parent 57f6f3a7fa
commit d874b94c16
16 changed files with 43 additions and 93 deletions

View File

@@ -1,4 +1,4 @@
from django.shortcuts import render, redirect, HttpResponse
from django.shortcuts import render, redirect
from comandas.models import Comanda, ProductComanda
from products.models import Product
@@ -38,7 +38,6 @@ def closeComanda(request, comanda_id):
comanda = Comanda.objects.get(id=comanda_id)
comanda.status = "PAYING"
comanda.save()
# return redirect('back')
def reopenComanda(request, comanda_id):
@@ -48,7 +47,6 @@ def reopenComanda(request, comanda_id):
else:
comanda.status = "OPEN"
comanda.save()
# return redirect('back')
def paymentComanda(request, comanda_id):
typePayment = TypePay.objects.get(id=1)

View File

@@ -2,15 +2,13 @@
{% load static %}
{% block 'title' %}
Detalhes {{comanda.name}}
{% endblock %}
{% block 'head' %}
<link rel="stylesheet" href="{% static 'comandas/css/viewcomanda.css' %}">
{% endblock %}
@@ -25,13 +23,13 @@ Detalhes {{comanda.name}}
{% if comanda.status != 'OPEN'%}
disabled
{% endif %}
>Adicionar Produto</button>
>Add Produto</button>
<button id="pagarComanda" hx-get="{% url 'closeComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="imprimirConta()"
{% if comanda.status != 'OPEN' %}
style="display: none;"
{% endif %}
>Fechar Comanda</button>
>Fechar Conta</button>
{% if comanda.status == 'PAYING' %}
<button id="pagarComanda" onclick="modal_payment_comanda()">Receber</button>
@@ -46,7 +44,7 @@ Detalhes {{comanda.name}}
{% if comanda.status != 'OPEN'%}
style="display: none;"
{% endif %}
onclick="imprimirFichas()">Imprimir Fichas</button>
onclick="imprimirFichas()">Fichas</button>
<button class="button" id="imprimirFichas" hx-get="{% url 'reopenComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="reloadPage()"
{% if comanda.status == 'OPEN'%}
@@ -106,10 +104,8 @@ Detalhes {{comanda.name}}
</div>
<dialog id="Modal-add-product" style="display: none;" >
<article>
<dialog id="Modal-add-product" style="display: none;" >
<article>
<form id="productForm" >
<h2>Adicionar Produto <button type="button" onclick="closeModal()" style="background-color:red;">Fechar</button></h2>
<input type="text" id="search-product" name="search-product" placeholder="Buscar Produto" hx-get="{% url 'listProduct' comanda.id %}" hx-trigger="keyup" hx-target="#product-list"><br>
@@ -122,37 +118,15 @@ Detalhes {{comanda.name}}
</article >
{% endfor %}
</div>
</form>
</article>
</dialog>
<dialog id="remove-product-comanda" style="display: none;" >
<article>
<h2>Produto Excluido!</h2>
<h1></h1>
<p>
</p>
<ul>
</ul>
<footer>
<button class="secondary" onclick="removeCloseModal()">
OK
</button>
<!-- <button >Excluir</button> -->
</footer>
</article>
</dialog>
<dialog id="payment-comanda" style="display: none;" >
<article>
<h2>Receber</h2>
<h2>Pagamento</h2>
<h1>R$ {{ total }}</h1>
<p>
</p>
@@ -160,7 +134,7 @@ Detalhes {{comanda.name}}
</ul>
<footer>
<button class="secondary" hx-get="{% url 'paymentComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="backPage()">
Comfimar
Receber
</button>
<button onclick="close_modal_payment_comanda()" >Cancelar</button>
@@ -168,14 +142,9 @@ Detalhes {{comanda.name}}
</article>
</dialog>
<script src="{% static 'comandas/js/viewcomanda.js' %}"></script>
</body>
{% endblock %}

View File

@@ -12,7 +12,6 @@ def comandas(request):
return render(request, 'comandas.html', {'comandas': comandas, 'mesas': mesas})
def viewComanda(request):
id = request.GET.get('parametro')
comanda_id = int(id)
@@ -30,7 +29,6 @@ def viewComanda(request):
if p.name == produto['nome'] and p.active == True:
products_ordenados.append(p)
total = 0
for produto in consumo:
total += produto.product.price
@@ -44,8 +42,5 @@ def createComanda(request):
mesa = Mesa.objects.get(id=mesa_id)
comanda = Comanda(name=name, mesa=mesa)
comanda.save()
return redirect('comandas')