mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: pagamento parcial comanda part2
This commit is contained in:
@@ -36,15 +36,15 @@
|
|||||||
|
|
||||||
<table id="list-products-balcao">
|
<table id="list-products-balcao">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: left;">Produto</th>
|
<th style="text-align: left;"><b>Produto</b></th>
|
||||||
<th style="text-align: left;">Preço</th>
|
<th style="text-align: left;"><b>Preço</b></th>
|
||||||
</tr>
|
</tr>
|
||||||
{% for item in consumo%}
|
{% for item in consumo%}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{item.product.name}}</td>
|
<td>{{item.product.name}}</td>
|
||||||
<td>R$ {{item.product.price}} </td>
|
<td>R$ {{item.product.price}} </td>
|
||||||
<td><button class="btn-cancel" onclick="removeProductBalcao({{item.id}})">🗑️ Excluir</button></td>
|
<td><button class="btn-cancel" onclick="removeProductBalcao({{item.id}})">Excluir</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
Binary file not shown.
@@ -27,7 +27,7 @@ def listProduct(request, comanda_id):
|
|||||||
for p in allProducts:
|
for p in allProducts:
|
||||||
if p.active == True:
|
if p.active == True:
|
||||||
products.append(p)
|
products.append(p)
|
||||||
return render(request, "htmx_components/htmx_list_products.html", {"products": products,'comanda_id':comanda_id})
|
return render(request, "htmx_components/comandas/htmx_list_products.html", {"products": products,'comanda_id':comanda_id})
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
def addProduct(request, product_id, comanda_id):
|
def addProduct(request, product_id, comanda_id):
|
||||||
@@ -36,12 +36,13 @@ def addProduct(request, product_id, comanda_id):
|
|||||||
product_comanda.save()
|
product_comanda.save()
|
||||||
product = Product.objects.get(id=product_id)
|
product = Product.objects.get(id=product_id)
|
||||||
comanda = Comanda.objects.get(id=comanda_id)
|
comanda = Comanda.objects.get(id=comanda_id)
|
||||||
|
parcial = Payments.objects.filter(comanda=comanda)
|
||||||
if product.cuisine == True:
|
if product.cuisine == True:
|
||||||
order = Order(id_comanda=comanda, id_product=product, productComanda=product_comanda, obs='')
|
order = Order(id_comanda=comanda, id_product=product, productComanda=product_comanda, obs='')
|
||||||
order.save()
|
order.save()
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||||
total = somar(consumo,comanda)
|
total = somar(consumo,comanda)
|
||||||
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total, 'comanda':comanda})
|
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda})
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
def editOrders(request, productComanda_id, obs):
|
def editOrders(request, productComanda_id, obs):
|
||||||
@@ -55,10 +56,11 @@ def editOrders(request, productComanda_id, obs):
|
|||||||
def removeProductComanda(request, productComanda_id):
|
def removeProductComanda(request, productComanda_id):
|
||||||
product_comanda = ProductComanda.objects.get(id=productComanda_id)
|
product_comanda = ProductComanda.objects.get(id=productComanda_id)
|
||||||
comanda = Comanda.objects.get(id= product_comanda.comanda.id)
|
comanda = Comanda.objects.get(id= product_comanda.comanda.id)
|
||||||
|
parcial = Payments.objects.filter(comanda=comanda)
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda)
|
consumo = ProductComanda.objects.filter(comanda=comanda)
|
||||||
product_comanda.delete()
|
product_comanda.delete()
|
||||||
total = somar(consumo, comanda)
|
total = somar(consumo, comanda)
|
||||||
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total, 'comanda':comanda})
|
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'parcials':parcial,'consumo': consumo, 'total': total, 'comanda':comanda})
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
def closeComanda(request, comanda_id):
|
def closeComanda(request, comanda_id):
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ Detalhes {{comanda.name}}
|
|||||||
<img hidden src="{% static 'midia/logo.png' %}" style="width: 240px; height: 200px;">
|
<img hidden src="{% static 'midia/logo.png' %}" style="width: 240px; height: 200px;">
|
||||||
<table id="list-products-comanda">
|
<table id="list-products-comanda">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: left;">Produto</th>
|
<th style="text-align: left;"><b>Produto</b></th>
|
||||||
<th style="text-align: left;">Preço</th>
|
<th style="text-align: left;"><b>Preço</b></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for item in consumo%}
|
{% for item in consumo%}
|
||||||
@@ -117,11 +117,13 @@ Detalhes {{comanda.name}}
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if parcials%}
|
||||||
|
<td colspan="2" style="text-align: center;"><b>Pagamentos parciais</b></td>
|
||||||
|
{% endif %}
|
||||||
{% for parcial in parcials %}
|
{% for parcial in parcials %}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: left; color: chartreuse;">{{parcial.datetime}}</td>
|
<td>{{parcial.description}} ás {{parcial.datetime|date:"H:i"}}</td>
|
||||||
<td style="text-align: left; color: chartreuse;">R$ -{{parcial.value}}</td>
|
<td>R$ -{{parcial.value}}</td>
|
||||||
<td style="text-align: left; color: chartreuse;">{{parcial.description}}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@@ -130,7 +132,7 @@ Detalhes {{comanda.name}}
|
|||||||
|
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" style="text-align: center;">Total R$ {{total}}</td>
|
<td colspan="2" style="text-align: center;"><b>Total R$ {{total}}</b></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
@@ -201,7 +203,7 @@ Detalhes {{comanda.name}}
|
|||||||
<h2>Pagamento Parcial</h2>
|
<h2>Pagamento Parcial</h2>
|
||||||
<form method="post" action="{% url 'paymentParcial' comanda.id %} ">
|
<form method="post" action="{% url 'paymentParcial' comanda.id %} ">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input id="value-parcial" name="value-parcial" type="number" step="0.01" placeholder="Valor">
|
<input id="value-parcial" name="value-parcial" type="number" step="0.01" max="{{total}}" placeholder="Valor">
|
||||||
<input id="name-parcial" name="name-parcial" type="text" placeholder="Nome" >
|
<input id="name-parcial" name="name-parcial" type="text" placeholder="Nome" >
|
||||||
<footer>
|
<footer>
|
||||||
<div style="display: flex;gap: 10px;">
|
<div style="display: flex;gap: 10px;">
|
||||||
|
|||||||
Binary file not shown.
@@ -1,8 +1,8 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: left;">Produto</th>
|
<th style="text-align: left;"><b>Produto</b></th>
|
||||||
<th style="text-align: left;">Preço</th>
|
<th style="text-align: left;"><b>Preço</b></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for item in consumo%}
|
{% for item in consumo%}
|
||||||
@@ -41,6 +41,15 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if parcials%}
|
||||||
|
<td colspan="2" style="text-align: center;"><b>Pagamentos parciais</b></td>
|
||||||
|
{% endif %}
|
||||||
|
{% for parcial in parcials %}
|
||||||
|
<tr>
|
||||||
|
<td>{{parcial.description}} ás {{parcial.datetime|date:"H:i"}}</td>
|
||||||
|
<td>R$ -{{parcial.value}}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" style="text-align: center;">Total R$ {{total}}</td>
|
<td colspan="2" style="text-align: center;">Total R$ {{total}}</td>
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th style="text-align: left;">Produto</th>
|
<th style="text-align: left;"><b>Produto</b></th>
|
||||||
<th style="text-align: left;">Preço</th>
|
<th style="text-align: left;"><b>Preço</b></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for item in consumo%}
|
{% for item in consumo%}
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{item.product.name}}</td>
|
<td>{{item.product.name}}</td>
|
||||||
<td>R$ {{item.product.price}}</td>
|
<td>R$ {{item.product.price}} </td>
|
||||||
<td><button class="btn-cancel" onclick="removeProductBalcao({{item.id}})"
|
<td><button class="btn-cancel" onclick="removeProductBalcao({{item.id}})"
|
||||||
|
|
||||||
>🗑️ Excluir</button></td>
|
>Excluir</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ document.cookie = `pronto=0`;
|
|||||||
|
|
||||||
function openModal() {
|
function openModal() {
|
||||||
document.getElementById('Modal-create-comanda').style.display = 'block';
|
document.getElementById('Modal-create-comanda').style.display = 'block';
|
||||||
// HTMLDialogElement.show()
|
textField = document.getElementById('name-comanda')
|
||||||
// HTMLDialogElement.showModal()
|
textField.focus()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeModal() {
|
function closeModal() {
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
function openModal() {
|
function openModal() {
|
||||||
document.getElementById('Modal-add-product').style.display = 'block';
|
document.getElementById('Modal-add-product').style.display = 'block';
|
||||||
|
textField = document.getElementById('search-product')
|
||||||
|
textField.value = '';
|
||||||
|
textField.focus()
|
||||||
}
|
}
|
||||||
function openModalAlter() {
|
function openModalAlter() {
|
||||||
document.getElementById('Modal-alter-comanda').style.display = 'block';
|
document.getElementById('Modal-alter-comanda').style.display = 'block';
|
||||||
@@ -23,8 +26,9 @@ function openModalObs(id) {
|
|||||||
document.getElementById('modal-obs').style.display = 'block';
|
document.getElementById('modal-obs').style.display = 'block';
|
||||||
idd = document.getElementById('id-temp').value = id;
|
idd = document.getElementById('id-temp').value = id;
|
||||||
obs = document.getElementById('obs').value;
|
obs = document.getElementById('obs').value;
|
||||||
console.log(id);
|
textField = document.getElementById('obs')
|
||||||
console.log(obs);
|
textField.focus()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -35,15 +39,15 @@ function modal_payment_comanda() {
|
|||||||
}
|
}
|
||||||
function modal_payment_parcial() {
|
function modal_payment_parcial() {
|
||||||
document.getElementById('payment-parcial').style.display = 'block';
|
document.getElementById('payment-parcial').style.display = 'block';
|
||||||
// recebido = document.getElementById('recebido')
|
value = document.getElementById('value-parcial')
|
||||||
// recebido.focus()
|
value.focus()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function modal_conta_client() {
|
function modal_conta_client() {
|
||||||
document.getElementById('conta-cliente').style.display = 'block';
|
document.getElementById('conta-cliente').style.display = 'block';
|
||||||
// recebido = document.getElementById('recebido')
|
|
||||||
// recebido.focus()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function close_modal_conta_client() {
|
function close_modal_conta_client() {
|
||||||
@@ -51,6 +55,9 @@ function close_modal_conta_client() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function close_modal_payment_parcial() {
|
||||||
|
document.getElementById('payment-parcial').style.display = 'none';
|
||||||
|
}
|
||||||
function close_modal_payment_comanda() {
|
function close_modal_payment_comanda() {
|
||||||
document.getElementById('payment-comanda').style.display = 'none';
|
document.getElementById('payment-comanda').style.display = 'none';
|
||||||
}
|
}
|
||||||
@@ -136,7 +143,7 @@ function imprimirConta() {
|
|||||||
|
|
||||||
|
|
||||||
var printWindow = window.open('', '_blank');
|
var printWindow = window.open('', '_blank');
|
||||||
printWindow.document.write('<table>'+content+'</table><b>Volte Sempre!😁😊</b>'+style);
|
printWindow.document.write('<table>'+content+'</table><br><b>Volte Sempre!😁😊</b><br>'+style);
|
||||||
printWindow.document.close();
|
printWindow.document.close();
|
||||||
printWindow.print();
|
printWindow.print();
|
||||||
printWindow.close();
|
printWindow.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user