mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 05:25:40 +00:00
320 lines
10 KiB
HTML
320 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' %}">
|
|
{% 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="openModal()" popovertarget="addProduct"
|
|
{% 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}}">
|
|
<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>
|
|
<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
|
|
src="{% static 'midia/icons/delete.svg' %}"
|
|
style="width: 35px; height: 35px; cursor: pointer;"
|
|
hx-get="{% url 'removeProductComanda' item.id %} "
|
|
hx-trigger="click"
|
|
hx-target="#list-products-comanda"
|
|
hx-confirm="Tem certeza que deseja excluir o produto {{item.product.name}}?" >
|
|
</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 id="addProduct" popover class="popover">
|
|
<div id="toast-add" class="toast-add">
|
|
<p id="toast-message-add"></p>
|
|
</div>
|
|
<form id="productForm" >
|
|
<div style="display: flex;justify-content: space-between;">
|
|
<h2>Adicionar Produto</h2> <img class="close" src="{% static 'midia/icons/close-circle.svg' %}" onclick="closeModal()">
|
|
</div>
|
|
|
|
<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>
|
|
<div id="product-list" class="grid-list-products">
|
|
{% for product in products %}
|
|
|
|
<div class="card-product" onclick="addProductComanda({{product.id}}, {{comanda.id}}, '{{product.cuisine}}')" >
|
|
{{product.name}} <br>
|
|
R$ {{product.price}}
|
|
</div >
|
|
{% endfor %}
|
|
</div>
|
|
</form>
|
|
</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 %} |