alterar modal dialog para popover em addProduct

This commit is contained in:
2025-02-21 16:59:34 -03:00
parent fdb9d9e453
commit baafa4cdec
12 changed files with 111 additions and 26 deletions

View File

@@ -38,6 +38,9 @@ def listProduct(request, comanda_id):
@group_required(groupName='Garçom')
def addProduct(request, product_id, comanda_id):
config = {
'taxa': False
}
obs = request.GET.get("obs")
product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id)
product_comanda.save()
@@ -50,7 +53,7 @@ def addProduct(request, product_id, comanda_id):
consumo = ProductComanda.objects.filter(comanda=comanda_id)
valores = somar(consumo,comanda)
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'valores':valores,'parcials':parcial,'consumo': consumo,'comanda':comanda})
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'config':config, 'valores':valores,'parcials':parcial,'consumo': consumo,'comanda':comanda})
@group_required(groupName='Garçom')
def editOrders(request, productComanda_id, obs):
@@ -62,13 +65,16 @@ def editOrders(request, productComanda_id, obs):
@group_required(groupName='Garçom')
def removeProductComanda(request, productComanda_id):
config = {
'taxa': False
}
product_comanda = ProductComanda.objects.get(id=productComanda_id)
comanda = Comanda.objects.get(id= product_comanda.comanda.id)
parcial = Payments.objects.filter(comanda=comanda)
consumo = ProductComanda.objects.filter(comanda=comanda)
product_comanda.delete()
valores = somar(consumo,comanda)
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'valores': valores,'parcials':parcial,'consumo': consumo, 'comanda':comanda})
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'config':config, 'valores': valores,'parcials':parcial,'consumo': consumo, 'comanda':comanda})
@group_required(groupName='Garçom')
def closeComanda(request, comanda_id):

View File

@@ -22,7 +22,7 @@ Detalhes {{comanda.name}}
<input hidden id="id-temp" type="number">
<div class="grid-container" >
<div>
<button class="btn-primary" id="openModal" onclick="openModal()"
<button class="btn-primary" id="openModal" onclick="openModal()" popovertarget="addProduct"
{% if comanda.status != 'OPEN'%}
disabled
{% endif %}
@@ -155,8 +155,10 @@ Detalhes {{comanda.name}}
</div>
<dialog id="Modal-add-product" style="display: none;" >
<article>
<!-- <dialog id="Modal-add-product" style="display: none;" >
<article> -->
<div id="addProduct" popover class="popover">
<form id="productForm" >
<div style="display: flex;justify-content: space-around;">
<h2>Adicionar Produto</h2> <button class="btn-cancel" type="button" onclick="closeModal()">Fechar</button>
@@ -166,15 +168,18 @@ Detalhes {{comanda.name}}
<div id="product-list" class="grid-list-products">
{% for product in products %}
<article class="card-product" onclick="addProductComanda({{product.id}}, {{comanda.id}}, '{{product.cuisine}}')" >
<div class="card-product" onclick="addProductComanda({{product.id}}, {{comanda.id}}, '{{product.cuisine}}')" >
{{product.name}} <br>
R$ {{product.price}}
</article >
</div >
{% endfor %}
</div>
</form>
</article>
</dialog>
</div>
<!-- </article>
</dialog> -->
<dialog id="modal-obs" style="display: none;">
<article>