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 from django.shortcuts import render
from comandas.models import Comanda, ProductComanda from comandas.models import Comanda, ProductComanda
from products.models import Product from products.models import Product
@@ -21,7 +21,6 @@ def viewBalcao(request):
if p.name == produto['nome'] and p.active == True: if p.name == produto['nome'] and p.active == True:
products_ordenados.append(p) products_ordenados.append(p)
total = 0 total = 0
for produto in consumo: for produto in consumo:
total += produto.product.price total += produto.product.price

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

View File

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

View File

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

Binary file not shown.

View File

@@ -4,8 +4,6 @@
{% block 'head' %} {% block 'head' %}
<link rel="stylesheet" href="{% static 'products/css/products.css' %}"> <link rel="stylesheet" href="{% static 'products/css/products.css' %}">
{% endblock %} {% endblock %}
{% block 'title' %} {% block 'title' %}
@@ -13,19 +11,15 @@ Produtos
{% endblock %} {% endblock %}
{% block 'body' %} {% block 'body' %}
<body> <body>
<div class="grid-container"> <div class="grid-container">
<div class="grid-top"> <div class="grid-top">
<button style=" <button style="
width: 30%; width: 30%;
margin: 5px 10px 20px 10px; margin: 5px 10px 20px 10px;"
onclick="openModal()" id="openModal">Novo Produto</button>
"
onclick="openModal()" id="openModal">Adicionar Novo Produto</button>
<input type="text" id="search-product" name="search-product" placeholder="Buscar Produto" hx-get="{% url 'searchProduct' %}" hx-trigger="keyup" hx-target="#product-list"> <input type="text" id="search-product" name="search-product" placeholder="Buscar Produto" hx-get="{% url 'searchProduct' %}" hx-trigger="keyup" hx-target="#product-list">
</div> </div>
@@ -84,20 +78,14 @@ Produtos
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
</div> </div>
</body> </body>
<dialog id='Modal-create-product' > <dialog id='Modal-create-product' >
<article > <article >
<form action="{% url 'create_product' %}" id="productForm" method="post" > <form action="{% url 'create_product' %}" id="productForm" method="post" >
{% csrf_token %} {% csrf_token %}

View File

@@ -2,7 +2,12 @@
{% for product in products %} {% for product in products %}
<article onclick="addProductComanda({{product.id}})" style="background-color: #293552;" hx-get="{% url 'addProduct' product.id comanda_id %} " hx-trigger="click" hx-target="#list-products-comanda"> <article
onclick="addProductComanda({{product.id}})"
style="background-color: #293552;"
hx-get="{% url 'addProduct' product.id comanda_id %} "
hx-trigger="click"
hx-target="#list-products-comanda">
{{product.name}} <br> {{product.name}} <br>
R$ {{product.price}} R$ {{product.price}}
</article> </article>

View File

@@ -117,5 +117,6 @@ body {
} }
.open { .open {
display: block; display: block;
transition: transform 0.2s;
} }
} }

View File

@@ -10,14 +10,14 @@
.card-comanda { .card-comanda {
width: 80%; width: 80%;
/* gap: 5px; */ gap: 3px;
/* min-width: 220px; /* min-width: 220px;
min-height: 250px; */ min-height: 250px; */
background-color: #292929; background-color: #292929;
border-radius: 5px; border-radius: 5px;
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
text-align: center; text-align: center;
line-height: 15px; line-height: 12px;
font-size: 15px; font-size: 15px;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
@@ -87,11 +87,13 @@ input, textarea {
.grid-container { .grid-container {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: center;
} }
.card-comanda { .card-comanda {
width: 31%; width: 31%;
gap: 3px;
flex-wrap: wrap;
font-size: 15px; font-size: 15px;
font-weight: bold; font-weight: bold;
color: #333; color: #333;

View File

@@ -2,16 +2,18 @@
display: grid; display: grid;
grid-template-columns: repeat(1, 2fr); grid-template-columns: repeat(1, 2fr);
gap: 10px; gap: 10px;
max-width: 800px; /* Define a largura máxima do grid */ max-width: 800px;
margin: 0 auto; /* Centraliza o grid na página */ margin: 0 auto;
} }
.grid-list-products { .grid-list-products {
justify-items: center;
display: grid; display: grid;
grid-template-columns: repeat(3, 2fr); grid-template-columns: repeat(3, 1fr);
gap: 10px; gap: 8px;
max-width: 800px; /* Define a largura máxima do grid */ max-width: 800px;
margin: 0 auto; /* Centraliza o grid na página */ margin: 0 auto;
} }
.card { .card {
@@ -21,7 +23,7 @@
border-radius: 15px; border-radius: 15px;
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
text-align: center; text-align: center;
line-height: 40px; /* Centraliza o texto verticalmente */ line-height: 40px;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
@@ -39,8 +41,6 @@
} }
button { button {
background-color: #007BFF; background-color: #007BFF;
color: white; color: white;

View File

@@ -6,10 +6,6 @@ function openModal() {
} }
// function open_remove_product_comanda() {
// document.getElementById('remove-product-comanda').style.display = 'block';
// // alert('Produto removido com sucesso!');
// }
function modal_payment_comanda() { function modal_payment_comanda() {
document.getElementById('payment-comanda').style.display = 'block'; document.getElementById('payment-comanda').style.display = 'block';
@@ -24,9 +20,6 @@ function closeModal() {
} }
// function removeCloseModal() {
// document.getElementById('remove-product-comanda').style.display = 'none';
// }
function imprimirFichas() { function imprimirFichas() {
const element = document.getElementById("list-products-comanda"); const element = document.getElementById("list-products-comanda");