mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
refactor: remoção do htmx do excluir item da comanda | feedback da exclusão
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -53,12 +53,22 @@ def removeProductComanda(request, productComanda_id):
|
||||
'id':order.id,
|
||||
'speak': f'Pedido cancelado! {order.id_product.name}.'
|
||||
})
|
||||
asyncio.run(enviar_mensagem(msg))
|
||||
# asyncio.run(enviar_mensagem(msg))
|
||||
# order.delete()
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda)
|
||||
valores = somar(consumo,comanda)
|
||||
else:
|
||||
product_comanda.delete()
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda)
|
||||
valores = somar(consumo,comanda)
|
||||
|
||||
return render(request, "htmx_components/comandas/htmx_list_products_in_comanda.html",{'config':config, '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})
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ Detalhes {{comanda.name}}
|
||||
|
||||
{% for item in consumo%}
|
||||
|
||||
<tr>
|
||||
<tr id="item-{{item.id}}">
|
||||
<td id="id-for-print-{{item.id}}">
|
||||
<spam style="cursor: pointer;" onclick="inforOrders({{item.id}})">
|
||||
{{item.product.name}}</spam>
|
||||
@@ -131,13 +131,12 @@ Detalhes {{comanda.name}}
|
||||
{% 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 %}
|
||||
@@ -180,30 +179,21 @@ Detalhes {{comanda.name}}
|
||||
<button class="btn-secondary" onclick="modal_payment_parcial()">Pagamento Parcial</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="addProduct" class="popover">
|
||||
<!-- <div id="productForm" > -->
|
||||
<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 class="card-product" onclick="addProductComanda({{product.id}}, {{comanda.id}}, '{{product.cuisine}}')" >
|
||||
{{product.name}} <br>
|
||||
R$ {{product.price}}
|
||||
</div >
|
||||
{% endfor %}
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<dialog id="payment-comanda" style="display: none;" >
|
||||
<article>
|
||||
<form action="{% url 'paymentComanda' comanda.id %}" method="post">
|
||||
|
||||
@@ -22,7 +22,7 @@ urlpatterns = [
|
||||
|
||||
|
||||
htmx_urlpatterns = [
|
||||
path('removeProductComanda<int:productComanda_id>/', htmx_views.removeProductComanda, name='removeProductComanda'),
|
||||
path('removeProductComanda/<int:productComanda_id>/', htmx_views.removeProductComanda, name='removeProductComanda'),
|
||||
path('reopenComanda<int:comanda_id>/', htmx_views.reopenComanda, name='reopenComanda'),
|
||||
path('paymentComanda<int:comanda_id>/', htmx_views.paymentComanda, name='paymentComanda'),
|
||||
path('paymentParcial<int:comanda_id>/', htmx_views.paymentParcial, name='paymentParcial'),
|
||||
|
||||
Reference in New Issue
Block a user