Files
RRBEC/gestaoRaul/comandas/templates/viewcomanda.html

338 lines
10 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% load custom_filter_tag %}
{% block 'title' %}
Detalhes {{comanda.name}}
{% endblock %}
{% block 'head' %}
<link rel="stylesheet" href="{% static 'comandas/css/viewcomanda.css' %}">
<style>
.swal2-popup {
position: relative; /* Necessário para o posicionamento absoluto do botão */
}
.posi {
position: absolute !important;
background-color: rgba(72, 72, 72, 0.151);
color: rgba(255, 255, 255, 0.452);
border: 2px solid rgba(239, 239, 239, 0.107);
border-radius: 35px;
padding: 0px 15px 3px 15px ;
align-self: center;
font-size: 32px;
top: 0.1em;
right: 0.1em;
scale: 0.8;
}
.posi:hover{
background-color: rgba(183, 3, 3, 0.598);
color: rgb(255, 255, 255);
}
.custom-toast-container {
z-index: 99999 !important;
}
.swal2-container {
z-index: 9999 !important;
}
</style>
{% endblock %}
{% block 'body' %}
<body>
<input hidden id="id-temp" type="number">
<div class="grid-container" >
<div style="display: flex;padding: 5px;gap:8px">
<button class="btn-primary" id="openModal" onclick="modalAddProduct()"
{% if comanda.status != 'OPEN'%}
disabled
{% endif %}
>Add Produto</button>
<button class="btn-cancel" id="closeComanda" onclick="closeConta({{comanda.id}})"
{% if comanda.status != 'OPEN' %}
style="display: none;"
{% endif %}
>Fechar Conta</button>
{% if comanda.status == 'PAYING' or comanda.status == 'FIADO'%}
<button class="btn-secondary" id="pagarComanda"
onclick="modal_payment_comanda()"
>Receber</button>
<button class="btn-primary" id="printComanda"
style="display: flex;"
onclick="imprimirConta()"
>Imprimir Conta</button>
{% else %}
<button class="btn-secondary" id="pagarComanda"
onclick="modal_payment_comanda()"
style="display: none;"
>Receber</button>
<button class="btn-primary" id="printComanda"
style="display: none;"
onclick="imprimirConta()"
>Imprimir Conta</button>
{% endif %}
{% if user|groupUser:"Gerente" %}
<button class="btn-primary" id="reOpenComanda" hx-get="{% url 'reopenComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="reloadPage()"
{% if comanda.status == 'OPEN'%}
style="display: none;"
{% elif comanda.status == 'CLOSED' %}
style="display: none;"
{% endif %}
>Reabrir</button>
{% endif %}
</div>
<div>
<input hidden type="text" id="h-mesaId" value="{{comanda.mesa.id}}">
<input hidden type="text" id="id-comanda" value="{{comanda.id}}">
<span id="name-comanda">Nome: {{comanda.name}} | </span>
<span id="mesa-comanda">Local: {{comanda.mesa}}</span>
<img
onclick="openModalAlter()"
src="{% static 'midia/icons/pen.svg' %}"
style="width: 30px; height: 35px; cursor: pointer;">
</img>
</div>
<p id="open-comanda">Aberta em: {{comanda.dt_open|date:"D"}} {{comanda.dt_open|date:"d/m/Y - H:i"}}</p>
<img hidden src="{% static 'midia/logo.png' %}" style="width: 240px; height: 200px;">
<table id="list-products-comanda">
<tr>
<th style="text-align: left;"><b>Produto</b></th>
<th style="text-align: left;"><b>Preço</b></th>
</tr>
{% for item in consumo%}
<tr id="item-{{item.id}}">
<td id="id-for-print-{{item.id}}">
<spam style="cursor: pointer;" onclick="inforOrders({{item.id}})">
{{item.product.name}}</spam>
{% if item.product.cuisine == True %}
<input hidden id="{{item.id}}-obsOrder" type="order" value="{{item.id | obsOrder}}">
<img
onclick="openModalObs({{item.id}})"
src="{% static 'midia/icons/note.svg' %}"
style="width: 25px; height: 35px; cursor: pointer;">
</img>
<img
onclick="printOrder({{item.id}})"
src="{% static 'midia/icons/print.svg' %}"
style="width: 35px; height: 35px; cursor: pointer;">
</img>
{% endif %}
</td>
<td>R$ {{item.product.price}}</td>
{% if comanda.status != 'OPEN'%}
{% else %}
<td>
<img
onclick="removeProductComanda({{item.id}}, '{{item.product.name}}')"
src="{% static 'midia/icons/delete.svg' %}"
style="width: 35px; height: 35px; cursor: pointer;"
>
</img>
</td>
{% endif %}
</tr>
{% endfor %}
{% if config.taxa %}
<tr>
<td>
Taxa de serviço 10%
</td>
<td>
R$ {{valores.taxa}}
</td>
</tr>
{% endif %}
{% 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>
<tr>
{% if config.taxa %}
<td colspan="2" style="text-align: center;"><b>Total R$ {{valores.totalComTaxa}}</b></td>
{% else %}
<td colspan="2" style="text-align: center;"><b>Total R$ {{valores.totalSemTaxa}}</b></td>
{% endif %}
</tr>
</tfoot>
</table>
<button class="btn-secondary" onclick="modal_payment_parcial()">Pagamento Parcial</button>
</div>
<div hidden id="addProduct" >
{% csrf_token %}
<input type="text" oninput="searchProduct()" id="search-product" name="search-product" placeholder="Buscar Produto" ><br>
<div id="product-list" class="grid-list-products">
{% for product in products %}
<div
style="background-image: url('{{product.image}}');"
class="card-product"
onclick="addProductComanda({{product.id}}, {{comanda.id}}, '{{product.cuisine}}')" >
<p class="card-product-p"> {{product.name}}</p>
<p class="card-product-p"> R$ {{product.price}}</p>
</div >
{% endfor %}
</div>
</div>
<dialog id="payment-comanda" style="display: none;" >
<article>
<form action="{% url 'paymentComanda' comanda.id %}" method="post">
{% csrf_token %}
<h2>Pagamento</h2>
<div style="display: flex; align-content: space-around; align-items: center; justify-self: center;gap: 50px;">
{% if config.taxa %}
<h1 id="first-total">R$ {{ valores.totalComTaxa }}</h1>
<h1 hidden id="totalComTaxa">R$ {{ valores.totalComTaxa }}</h1>
<h1 hidden id="totalSemTaxa">R$ {{ valores.totalSemTaxa }}</h1>
<div>
<input id="taxa" name="taxa" type="checkbox" value="True" label="Taxa de serviço" checked >Taxa de serviço
{% else %}
<h1 id="first-total">R$ {{ valores.totalSemTaxa }}</h1>
{% endif %}
</div>
</div>
<div>
<p>Recebido:</p> <input id="recebido" oninput="troco()" name="recebido" type="number">
<h4 id="troco">Troco: </h4>
</div>
<footer>
<div style="display: flex;gap: 10px;">
<button type="submit" class="btn-secondary" onclick="backPage()">Receber</button>
{% if comanda.status != 'FIADO' %}
<button type="button" class="btn-primary" onclick=" modal_conta_client()">
Conta
</button>
{% endif %}
<button type="button" class="btn-cancel" onclick="close_modal_payment_comanda()">Cancelar</button>
</div>
</footer>
</form>
</article>
</dialog>
<dialog id="payment-parcial" style="display: none;" >
<article>
<h2>Pagamento Parcial</h2>
<form method="post" action="{% url 'paymentParcial' comanda.id %} ">
{% csrf_token %}
<input required 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" >
<footer>
<div style="display: flex;gap: 10px;">
<button type="submit" class="btn-secondary" >Receber</button>
<button type="button" class="btn-cancel" onclick="close_modal_payment_parcial()">Cancelar</button>
</div>
</footer>
</form>
</article>
</dialog>
<dialog id="Modal-alter-comanda">
<article >
<form id="form-comanda" method="post" action="{% url 'editComanda' %}">
{% csrf_token %}
<h2>Editar Comanda</h2>
<input hidden type="text" name="h-comandaId" id="h-comandaId" value="{{comanda.id}}">
<input type="text" id="nameComanda" name="nameComanda" required placeholder="Nome"><br>
<select name="select-mesa" id="select-mesa" required >
{% for mesa in mesas %}
<option value="{{mesa.id}}">{{mesa.name}}</option>
{% endfor %}
</select>
<div style="display: flex;gap: 10px;">
<button type="submit" class="btn-primary">Alterar</button>
<button type="button" class="btn-cancel" onclick="closeModalAlter()">Cancelar</button>
</div>
</form>
</article>
</dialog >
<dialog id="conta-cliente" style="display: none;" >
<article>
<form id="form-comanda" method="post" action="{% url 'addContaCliente' %}">
{% csrf_token %}
<h2>Adicionar na Conta</h2>
<h1>R$ {{ valores.totalSemTaxa }}</h1>
<div>
<input hidden type="text" name="valor-conta" value="{{ total }}">
<input hidden type="text" name="idComanda" value="{{ comanda.id }}">
<p>Selecione o Cliente:</p>
<select name="select-client" id="select-client" required>
<option value="">Selecione um cliente</option>
{% for client in clients %}
<option value="{{client.id}}">{{client.name}}</option>
{% endfor %}
</select>
</div>
<footer>
<div style="display: flex;gap: 10px;">
<button type="submit" class="btn-primary"> Adicionar a conta</button>
<button type="button" class="btn-cancel" onclick="close_modal_conta_client()">Cancelar</button>
</div>
</form>
</footer>
</article>
</dialog>
<script src="{% static 'comandas/js/viewcomanda.js' %}"></script>
</body>
{% endblock %}