mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
bug: search products balcao
This commit is contained in:
Binary file not shown.
@@ -9,10 +9,8 @@ from products.models import Product
|
||||
from payments.models import Payments
|
||||
from typePay.models import TypePay
|
||||
|
||||
@csrf_exempt
|
||||
def listProductBalcao(request, comanda_id, search_product):
|
||||
print(search_product)
|
||||
if len(search_product) == 0:
|
||||
if search_product == '*':
|
||||
produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate(
|
||||
quantidade=Count('product'),
|
||||
nome=F('product__name') ).order_by('-quantidade'))
|
||||
@@ -24,7 +22,7 @@ def listProductBalcao(request, comanda_id, search_product):
|
||||
if p.name == produto['nome']:
|
||||
products_ordenados.append(p)
|
||||
|
||||
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products,'comanda_id':comanda_id})
|
||||
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products_ordenados,'comanda_id':comanda_id})
|
||||
else:
|
||||
product = search_product
|
||||
products = Product.objects.filter(name__icontains=product)
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<h2 style="text-align: center;">Buscar Produto </h2>
|
||||
<div class="grid-container">
|
||||
<input
|
||||
onkeypress="searchProduct()"
|
||||
oninput="searchProduct()"
|
||||
type="text"
|
||||
id="search-product"
|
||||
name="search-product"
|
||||
@@ -143,7 +143,7 @@
|
||||
<ul>
|
||||
</ul>
|
||||
<footer>
|
||||
<button class="secondary" hx-get="{% url 'paymentBalcao' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="backPage()">
|
||||
<button class="secondary" hx-get="{% url 'paymentBalcao' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="reloadPage()">
|
||||
Comfimar
|
||||
</button>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user