feat: edit comanda

This commit is contained in:
2025-01-15 16:49:41 -03:00
parent 0d6a164872
commit c19b6e5fca
8 changed files with 62 additions and 2 deletions

View File

@@ -60,7 +60,7 @@ Comandas
</select>
<button type="submit">Abrir</button>
<button type="button" onclick="closeModal()" style="background-color:red;">Fechar</button>
<button type="button" onclick="closeModal()" style="background-color:red;">Cancelar</button>
</form>
</article>
</dialog >

View File

@@ -63,9 +63,16 @@ Detalhes {{comanda.name}}
</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">Mesa: {{comanda.mesa}}</span>
<img
onclick="openModalAlter()"
src="{% static 'midia/icons/edit.svg' %}"
style="width: 35px; 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>
@@ -164,6 +171,31 @@ Detalhes {{comanda.name}}
</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" >
{% for mesa in mesas %}
<option value="{{mesa.id}}">{{mesa.name}}</option>
{% endfor %}
</select>
<button type="submit">Alterar</button>
<button type="button" onclick="closeModalAlter()" style="background-color:red;">Cancelar</button>
</form>
</article>
</dialog >
<script src="{% static 'comandas/js/viewcomanda.js' %}"></script>
</body>