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

Binary file not shown.

View File

@@ -4,8 +4,6 @@
{% block 'head' %}
<link rel="stylesheet" href="{% static 'products/css/products.css' %}">
{% endblock %}
{% block 'title' %}
@@ -13,19 +11,15 @@ Produtos
{% endblock %}
{% block 'body' %}
<body>
<div class="grid-container">
<div class="grid-top">
<button style="
width: 30%;
margin: 5px 10px 20px 10px;
"
onclick="openModal()" id="openModal">Adicionar Novo Produto</button>
margin: 5px 10px 20px 10px;"
onclick="openModal()" id="openModal">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">
</div>
@@ -84,20 +78,14 @@ Produtos
</td>
</tr>
{% endfor %}
</table>
</div>
</body>
<dialog id='Modal-create-product' >
<article >
<form action="{% url 'create_product' %}" id="productForm" method="post" >
{% csrf_token %}

View File

@@ -2,10 +2,15 @@
{% 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>
R$ {{product.price}}
</article>
</article>
{% endfor %}

View File

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

View File

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

View File

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