Files
RRBEC/gestaoRaul/comandas/templates/viewcomanda.html
2024-12-19 11:30:08 -03:00

120 lines
3.0 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block 'title' %}
Detalhes {{comanda.name}}
{% endblock %}
{% block 'head' %}
<link rel="stylesheet" href="{% static 'comandas/css/viewcomanda.css' %}">
{% endblock %}
{% block 'body' %}
<body>
<div class="grid-container" >
<div>
<button class="primary" id="openModal">Adicionar Produto</button>
<button id="pagarComanda">Pagar Comanda</button>
<button class="button" id="imprimirFichas" onclick="imprimirFichas()">Imprimir Fichas</button>
</div>
<!-- <p>{{comanda.id}}</p> -->
<div>
<span>Nome: {{comanda.name}} | </span>
<span>Mesa: {{comanda.mesa}}</span>
</div>
<p>Aberta em: {{comanda.dt_open|date:"D"}} {{comanda.dt_open|date:"d/m/Y - H:i"}}</p>
<table id="list-products-comanda">
<tr>
<th style="text-align: left;">Produto</th>
<th style="text-align: left;">Preço</th>
</tr>
{% for item in consumo%}
<tr>
<td>{{item.product.name}}</td>
<td>R$ {{item.product.price}}</td>
<!-- <td><button id="open_remove_product_comanda" onclick="open_remove_product_comanda()">🗑️ Apagar</button></td> -->
<td><button hx-get="{% url 'removeProductComanda' item.id %} " hx-trigger="click" hx-target="#list-products-comanda" onclick="open_remove_product_comanda()">🗑️ Apagar</button></td>
</tr>
{% endfor %}
<tfoot>
<tr>
<td colspan="2" style="text-align: center;">Total R$ {{total}}</td>
</tr>
</tfoot>
</table>
</div>
<div class="modal" id="Modal-add-product">
<div class="modal-content">
<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>
<div id="product-list" class="grid-list-products">
{% for product in products %}
<div class="card" hx-get="{% url 'addProduct' product.id comanda.id %} " hx-trigger="click" hx-target="#list-products-comanda">
{{product.name}} <br>
R$ {{product.price}}
</div>
{% endfor %}
</div>
<!-- <input type="number" step="1" id="product-qtd" name="qtd" required placeholder="Quantidade"><br> -->
<!-- <button type="submit">Salvar</button> -->
</form>
</div>
</div>
<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>
<script src="{% static 'comandas/js/viewcomanda.js' %}"></script>
</body>
{% endblock %}