mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
Binary file not shown.
Binary file not shown.
@@ -16,23 +16,13 @@ from gestaoRaul.decorators import group_required
|
|||||||
def listProductBalcao(request, comanda_id, search_product):
|
def listProductBalcao(request, comanda_id, search_product):
|
||||||
comanda_id = request.GET.get("id-comanda-balcao")
|
comanda_id = request.GET.get("id-comanda-balcao")
|
||||||
if search_product == '*':
|
if search_product == '*':
|
||||||
produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate(
|
products_ordenados = ProductComanda.maisVendidos()
|
||||||
quantidade=Count('product'),
|
|
||||||
nome=F('product__name') ).order_by('-quantidade'))
|
|
||||||
products = Product.objects.all()
|
|
||||||
products_ordenados = []
|
|
||||||
|
|
||||||
for produto in produtos_mais_vendidos:
|
|
||||||
for p in products:
|
|
||||||
if p.active == True and p.name == produto['nome']:
|
|
||||||
products_ordenados.append(p)
|
|
||||||
|
|
||||||
|
|
||||||
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products_ordenados,'comanda_id':comanda_id})
|
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products_ordenados,'comanda_id':comanda_id})
|
||||||
else:
|
else:
|
||||||
product = search_product
|
product = search_product
|
||||||
products = Product.objects.filter(name__icontains=product, active=True)
|
products = Product.objects.filter(name__icontains=product, active=True)
|
||||||
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[:15],'comanda_id':comanda_id})
|
||||||
|
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
|
|||||||
@@ -73,29 +73,31 @@
|
|||||||
{% if forloop.counter0 == 0 %}
|
{% if forloop.counter0 == 0 %}
|
||||||
|
|
||||||
<article
|
<article
|
||||||
|
style="background-image: url('{{product.image}}');"
|
||||||
name="productBox"
|
name="productBox"
|
||||||
id="productId-{{ product.id }}"
|
id="productId-{{ product.id }}"
|
||||||
class="card-product"
|
class="card-product"
|
||||||
onclick="addProductClick({{product.id}} , {{comanda.id}})"
|
onclick="addProductClick({{product.id}} )"
|
||||||
>
|
>
|
||||||
<p hidden id="{{forloop.counter0}}">{{product.id}}</p>
|
<p hidden id="{{forloop.counter0}}" >{{product.id}}</p>
|
||||||
<p hidden id="comanda{{forloop.counter0}}">{{comanda.id}}</p>
|
<p hidden id="comanda{{forloop.counter0}}" >{{comanda.id}}</p>
|
||||||
{{product.name}} <br>
|
<p class="card-product-p"> {{product.name}}</p>
|
||||||
<p id="{{product.id}}"></p>
|
<p id="{{product.id}}"></p>
|
||||||
R$ {{product.price}}
|
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||||
</article>
|
</article >
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<article
|
<article
|
||||||
|
style="background-image: url('{{product.image}}');"
|
||||||
name="productBox"
|
name="productBox"
|
||||||
id="productId-{{ product.id }}"
|
id="productId-{{ product.id }}"
|
||||||
class="card-product"
|
class="card-product"
|
||||||
onclick="addProductClick({{product.id}} , {{comanda.id}})"
|
onclick="addProductClick({{product.id}})"
|
||||||
>
|
>
|
||||||
{{product.name}} <br>
|
<p class="card-product-p"> {{product.name}}</p>
|
||||||
R$ {{product.price}}
|
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||||
</article>
|
</article >
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -20,17 +20,7 @@ def viewBalcao(request):
|
|||||||
comanda.save()
|
comanda.save()
|
||||||
|
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda.id)
|
consumo = ProductComanda.objects.filter(comanda=comanda.id)
|
||||||
produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate(
|
products_ordenados = ProductComanda.maisVendidos()
|
||||||
quantidade=Count('product'),
|
|
||||||
nome=F('product__name') ).order_by('-quantidade'))
|
|
||||||
products = Product.objects.all()
|
|
||||||
products_ordenados = []
|
|
||||||
|
|
||||||
for produto in produtos_mais_vendidos:
|
|
||||||
for p in products:
|
|
||||||
if p.name == produto['nome'] and p.active == True:
|
|
||||||
products_ordenados.append(p)
|
|
||||||
|
|
||||||
total = 0
|
total = 0
|
||||||
for produto in consumo:
|
for produto in consumo:
|
||||||
total += produto.product.price
|
total += produto.product.price
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.db.models import Count, F
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -7,7 +8,6 @@ from clients.models import Client
|
|||||||
from products.models import Product
|
from products.models import Product
|
||||||
from mesas.models import Mesa
|
from mesas.models import Mesa
|
||||||
from typePay.models import TypePay
|
from typePay.models import TypePay
|
||||||
# from payments.models import Payments
|
|
||||||
|
|
||||||
class Comanda(models.Model):
|
class Comanda(models.Model):
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
@@ -32,3 +32,15 @@ class ProductComanda(models.Model):
|
|||||||
return self.comanda.name + " - " + self.product.name
|
return self.comanda.name + " - " + self.product.name
|
||||||
|
|
||||||
|
|
||||||
|
def maisVendidos():
|
||||||
|
produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate(
|
||||||
|
quantidade=Count('product'),
|
||||||
|
nome=F('product__name') ).order_by('-quantidade'))
|
||||||
|
|
||||||
|
products = Product.objects.all()
|
||||||
|
products_ordenados = []
|
||||||
|
for produto in produtos_mais_vendidos:
|
||||||
|
for p in products:
|
||||||
|
if p.name == produto['nome'] and p.active == True:
|
||||||
|
products_ordenados.append(p)
|
||||||
|
return products_ordenados[:15]
|
||||||
@@ -203,9 +203,12 @@ Detalhes {{comanda.name}}
|
|||||||
<input type="text" oninput="searchProduct()" id="search-product" name="search-product" placeholder="Buscar Produto" ><br>
|
<input type="text" oninput="searchProduct()" id="search-product" name="search-product" placeholder="Buscar Produto" ><br>
|
||||||
<div id="product-list" class="grid-list-products">
|
<div id="product-list" class="grid-list-products">
|
||||||
{% for product in products %}
|
{% for product in products %}
|
||||||
<div class="card-product" onclick="addProductComanda({{product.id}}, {{comanda.id}}, '{{product.cuisine}}')" >
|
<div
|
||||||
{{product.name}} <br>
|
style="background-image: url('{{product.image}}');"
|
||||||
R$ {{product.price}}
|
class="card-product"
|
||||||
|
onclick="addProductComanda({{product.id}}, {{comanda.id}}, '{{product.cuisine}}')" >
|
||||||
|
<p class="card-product-p"> {{product.name}}</p>
|
||||||
|
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||||
</div >
|
</div >
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -32,24 +32,12 @@ def viewComanda(request):
|
|||||||
comanda_id = int(id)
|
comanda_id = int(id)
|
||||||
comanda = Comanda.objects.get(id=comanda_id)
|
comanda = Comanda.objects.get(id=comanda_id)
|
||||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||||
# consumo[0].product.
|
|
||||||
parcial = Payments.objects.filter(comanda=comanda_id)
|
parcial = Payments.objects.filter(comanda=comanda_id)
|
||||||
mesas = Mesa.objects.all()
|
mesas = Mesa.objects.all()
|
||||||
clients = Client.objects.filter(active=True)
|
clients = Client.objects.filter(active=True)
|
||||||
|
products_ordenados = ProductComanda.maisVendidos()
|
||||||
produtos_mais_vendidos = list(ProductComanda.objects.values('product').annotate(
|
|
||||||
quantidade=Count('product'),
|
|
||||||
nome=F('product__name') ).order_by('-quantidade'))
|
|
||||||
|
|
||||||
products = Product.objects.all()
|
|
||||||
products_ordenados = []
|
|
||||||
for produto in produtos_mais_vendidos:
|
|
||||||
for p in products:
|
|
||||||
if p.name == produto['nome'] and p.active == True:
|
|
||||||
products_ordenados.append(p)
|
|
||||||
valores = somar(consumo,comanda)
|
valores = somar(consumo,comanda)
|
||||||
|
return render(request, 'viewcomanda.html', {'config':config, 'valores':valores,'parcials':parcial,'clients':clients,'comanda': comanda, 'consumo': consumo, 'products': products_ordenados[:15],'mesas':mesas})
|
||||||
return render(request, 'viewcomanda.html', {'config':config, 'valores':valores,'parcials':parcial,'clients':clients,'comanda': comanda, 'consumo': consumo, 'products': products_ordenados,'mesas':mesas})
|
|
||||||
|
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
@@ -153,6 +141,7 @@ def closeComanda(request, comanda_id):
|
|||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
def addProduct(request, product_id, comanda_id):
|
def addProduct(request, product_id, comanda_id):
|
||||||
|
print('chamouuuuuuuuuuu')
|
||||||
config = {
|
config = {
|
||||||
'taxa': False
|
'taxa': False
|
||||||
}
|
}
|
||||||
@@ -202,9 +191,12 @@ def addProduct(request, product_id, comanda_id):
|
|||||||
|
|
||||||
|
|
||||||
def listProduct(request, comanda_id, product):
|
def listProduct(request, comanda_id, product):
|
||||||
|
if product == '*':
|
||||||
|
allProducts = ProductComanda.maisVendidos()
|
||||||
|
else:
|
||||||
allProducts = Product.objects.filter(name__icontains=product)
|
allProducts = Product.objects.filter(name__icontains=product)
|
||||||
products = []
|
products = []
|
||||||
for p in allProducts:
|
for p in allProducts:
|
||||||
if p.active == True:
|
if p.active == True:
|
||||||
products.append(p)
|
products.append(p)
|
||||||
return render(request, "htmx_components/comandas/htmx_list_products.html", {"products": products,'comanda_id':comanda_id})
|
return render(request, "htmx_components/comandas/htmx_list_products.html", {"products": products[:15],'comanda_id':comanda_id})
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,6 +2,7 @@ from django.db import models
|
|||||||
|
|
||||||
from categories.models import Categories
|
from categories.models import Categories
|
||||||
|
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Product(models.Model):
|
class Product(models.Model):
|
||||||
id = models.AutoField(primary_key=True)
|
id = models.AutoField(primary_key=True)
|
||||||
@@ -15,4 +16,4 @@ class Product(models.Model):
|
|||||||
active = models.BooleanField(default=True)
|
active = models.BooleanField(default=True)
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return self.name
|
return f"{self.id} - {self.name} - {self.price} - {self.category} - {self.cuisine} - {self.active} "
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ Produtos
|
|||||||
<button class="btn-primary"
|
<button class="btn-primary"
|
||||||
onclick="openModal()" id="openModal">Novo Produto</button>
|
onclick="openModal()" id="openModal">Novo Produto</button>
|
||||||
<input type="text" id="search-product" name="search-product" placeholder="Buscar Produto" hx-get="{% url 'searchProduct' %}" hx-trigger="keyup" hx-target="#product-list">
|
<input type="text" id="search-product" name="search-product" placeholder="Buscar Produto" hx-get="{% url 'searchProduct' %}" hx-trigger="keyup" hx-target="#product-list">
|
||||||
|
<a href="https://raulrockbar.blogspot.com/p/cardapio.html" target="_blank">Cardápio Digital</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table id="product-list">
|
<table id="product-list">
|
||||||
@@ -36,6 +37,8 @@ Produtos
|
|||||||
<td id="name-{{product.id}}" >{{product.name}}</td>
|
<td id="name-{{product.id}}" >{{product.name}}</td>
|
||||||
<td id="price-{{product.id}}" >R$ {{product.price}}</td>
|
<td id="price-{{product.id}}" >R$ {{product.price}}</td>
|
||||||
<td class="hide-on-mobile" id="quantity-{{product.id}}" >{{product.quantity}}</td>
|
<td class="hide-on-mobile" id="quantity-{{product.id}}" >{{product.quantity}}</td>
|
||||||
|
<td hidden class="hide-on-mobile" id="image-{{product.id}}" >{{product.image}}</td>
|
||||||
|
|
||||||
<td class="hide-on-mobile" id="category-{{product.id}}" >{{product.category.name}}</td>
|
<td class="hide-on-mobile" id="category-{{product.id}}" >{{product.category.name}}</td>
|
||||||
<td >
|
<td >
|
||||||
<div class="grid-buttons">
|
<div class="grid-buttons">
|
||||||
@@ -86,15 +89,20 @@ Produtos
|
|||||||
</body>
|
</body>
|
||||||
|
|
||||||
<dialog id='Modal-create-product' >
|
<dialog id='Modal-create-product' >
|
||||||
<article >
|
<article id="modal-product" class="modal-product">
|
||||||
<form action="{% url 'create_product' %}" id="productForm" method="post" >
|
<form style="z-index: 1000; position: relative;" action="{% url 'create_product' %}" id="productForm" method="post" >
|
||||||
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<h2>Cadastro de Produto</h2>
|
<h2>Cadastro de Produto</h2>
|
||||||
|
<!-- <div style="height: 200px;border-radius: 15px;">
|
||||||
|
<img id="image-product" src="" alt="">
|
||||||
|
</div> -->
|
||||||
<input type="text" id="productId" name="productId" hidden >
|
<input type="text" id="productId" name="productId" hidden >
|
||||||
<input type="text" id="productName" name="name" required placeholder="Nome">
|
<input type="text" id="productName" name="name" required placeholder="Nome">
|
||||||
<input type="number" step="0.01" id="productPrice" name="price" required placeholder="Preço">
|
<input type="number" step="0.01" id="productPrice" name="price" required placeholder="Preço">
|
||||||
<input type="number" step="1" id="productqtd" name="qtd" placeholder="Quantidade">
|
<input type="number" step="1" id="productqtd" name="qtd" placeholder="Quantidade">
|
||||||
|
<input type="text" id="url-image" name="image" required placeholder="URL da imagem">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input type="checkbox" id="cuisine" name="cuisine" placeholder="Cozinha">Cozinha
|
<input type="checkbox" id="cuisine" name="cuisine" placeholder="Cozinha">Cozinha
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ urlpatterns = [
|
|||||||
path('onOffproduct', views.onOffProduct, name='onOffproduct'),
|
path('onOffproduct', views.onOffProduct, name='onOffproduct'),
|
||||||
path('searchProduct', views.searchProduct, name='searchProduct'),
|
path('searchProduct', views.searchProduct, name='searchProduct'),
|
||||||
path('editProduct/<int:productId>/', views.editProduct, name='editProduct'),
|
path('editProduct/<int:productId>/', views.editProduct, name='editProduct'),
|
||||||
|
path('createJson', views.createJson, name='createJson'),
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
from django.shortcuts import render, redirect
|
from django.shortcuts import render, redirect
|
||||||
|
from django.http import HttpResponse
|
||||||
|
import json
|
||||||
|
from django.db.models import Q
|
||||||
|
|
||||||
from categories.models import Categories
|
from categories.models import Categories
|
||||||
from products.models import Product
|
from products.models import Product
|
||||||
@@ -8,14 +11,14 @@ from gestaoRaul.decorators import group_required
|
|||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
def products(request):
|
def products(request):
|
||||||
protucts = Product.objects.all()
|
protucts = Product.objects.all().order_by('-active', 'category')
|
||||||
categories = Categories.objects.all()
|
categories = Categories.objects.all()
|
||||||
return render(request, 'products.html', {'products': protucts, 'categories': categories})
|
return render(request, 'products.html', {'products': protucts, 'categories': categories})
|
||||||
|
|
||||||
@group_required(groupName='Garçom')
|
@group_required(groupName='Garçom')
|
||||||
def searchProduct(request):
|
def searchProduct(request):
|
||||||
product = request.GET.get("search-product")
|
product = request.GET.get("search-product")
|
||||||
products = Product.objects.filter(name__icontains=product)
|
products = Product.objects.filter(name__icontains=product).order_by('-active', 'category')
|
||||||
return render(request, "htmx_components/products/htmx_search_products.html", {"products": products})
|
return render(request, "htmx_components/products/htmx_search_products.html", {"products": products})
|
||||||
|
|
||||||
|
|
||||||
@@ -38,7 +41,7 @@ def onOffProduct(request):
|
|||||||
product = Product.objects.get(id=product_id)
|
product = Product.objects.get(id=product_id)
|
||||||
product.active = not product.active
|
product.active = not product.active
|
||||||
product.save()
|
product.save()
|
||||||
products = Product.objects.all()
|
products = Product.objects.all().order_by('-active', 'category')
|
||||||
return render(request, "htmx_components/products/htmx_search_products.html", {"products": products})
|
return render(request, "htmx_components/products/htmx_search_products.html", {"products": products})
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +54,7 @@ def editProduct(request, productId):
|
|||||||
product.description = request.POST.get('description')
|
product.description = request.POST.get('description')
|
||||||
product.price = request.POST.get('price')
|
product.price = request.POST.get('price')
|
||||||
product.quantity = request.POST.get('qtd')
|
product.quantity = request.POST.get('qtd')
|
||||||
|
product.image = request.POST.get('image')
|
||||||
product.cuisine = True if request.POST.get('cuisine') else False
|
product.cuisine = True if request.POST.get('cuisine') else False
|
||||||
product.category = Categories.objects.get(id = int(request.POST.get('select-categorie')))
|
product.category = Categories.objects.get(id = int(request.POST.get('select-categorie')))
|
||||||
product.save()
|
product.save()
|
||||||
@@ -59,3 +63,34 @@ def editProduct(request, productId):
|
|||||||
product = ''
|
product = ''
|
||||||
products = Product.objects.filter(name__icontains=product)
|
products = Product.objects.filter(name__icontains=product)
|
||||||
return render(request, "htmx_components/products/htmx_search_products.html", {"products": products})
|
return render(request, "htmx_components/products/htmx_search_products.html", {"products": products})
|
||||||
|
|
||||||
|
def createJson(request):
|
||||||
|
products = Product.objects.filter(active=True).exclude(
|
||||||
|
category__name__in=['Insumos',
|
||||||
|
'Adicional',
|
||||||
|
'Bomboniere',
|
||||||
|
'Lojinha',
|
||||||
|
'Utensilios',
|
||||||
|
'Litros',
|
||||||
|
'Ingressos',
|
||||||
|
'Cigarros',
|
||||||
|
'Outros']
|
||||||
|
)
|
||||||
|
product_list = []
|
||||||
|
for product in products:
|
||||||
|
product_data = {
|
||||||
|
"id": product.id,
|
||||||
|
"name": product.name,
|
||||||
|
"description": product.description or "",
|
||||||
|
"price": float(product.price),
|
||||||
|
"category": product.category.name if product.category else "",
|
||||||
|
"image": str(product.image) if product.image else f"https://placehold.co/400x250/efc7b8/49291c?text={product.name.replace(' ', '+')}"
|
||||||
|
}
|
||||||
|
product_list.append(product_data)
|
||||||
|
|
||||||
|
# Retorna como JSON em texto simples
|
||||||
|
return HttpResponse(
|
||||||
|
json.dumps(product_list, indent=4, ensure_ascii=False),
|
||||||
|
content_type="application/json; charset=utf-8"
|
||||||
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
{% for product in products %}
|
{% for product in products %}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
onclick="addProductComanda({{product.id}}, {{comanda_id}}, '{{product.cuisine}}')"
|
style="background-image: url('{{product.image}}');"
|
||||||
class="card-product"
|
class="card-product"
|
||||||
>
|
onclick="addProductComanda({{product.id}}, {{comanda_id}}, '{{product.cuisine}}')" >
|
||||||
{{product.name}} <br>
|
<p class="card-product-p"> {{product.name}}</p>
|
||||||
R$ {{product.price}}
|
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||||
</div>
|
</div >
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
{% if forloop.counter0 == 0 %}
|
{% if forloop.counter0 == 0 %}
|
||||||
|
|
||||||
<article
|
<article
|
||||||
|
style="background-image: url('{{product.image}}');"
|
||||||
name="productBox"
|
name="productBox"
|
||||||
id="productId-{{ product.id }}"
|
id="productId-{{ product.id }}"
|
||||||
class="card-product"
|
class="card-product"
|
||||||
@@ -12,20 +13,22 @@
|
|||||||
>
|
>
|
||||||
<p hidden id="{{forloop.counter0}}" >{{product.id}}</p>
|
<p hidden id="{{forloop.counter0}}" >{{product.id}}</p>
|
||||||
<p hidden id="comanda{{forloop.counter0}}" >{{comanda.id}}</p>
|
<p hidden id="comanda{{forloop.counter0}}" >{{comanda.id}}</p>
|
||||||
{{product.name}} <br> <p id="{{product.id}}"></p>
|
<p class="card-product-p"> {{product.name}}</p>
|
||||||
R$ {{product.price}}
|
<p id="{{product.id}}"></p>
|
||||||
|
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||||
</article >
|
</article >
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<article
|
<article
|
||||||
|
style="background-image: url('{{product.image}}');"
|
||||||
name="productBox"
|
name="productBox"
|
||||||
id="productId-{{ product.id }}"
|
id="productId-{{ product.id }}"
|
||||||
class="card-product"
|
class="card-product"
|
||||||
onclick="addProductClick({{product.id}})"
|
onclick="addProductClick({{product.id}})"
|
||||||
>
|
>
|
||||||
{{product.name}} <br>
|
<p class="card-product-p"> {{product.name}}</p>
|
||||||
R$ {{product.price}}
|
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||||
</article >
|
</article >
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -37,6 +40,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="background-image: url('{{product.image}}');"
|
||||||
|
class="card-product"
|
||||||
|
onclick="addProductComanda({{product.id}}, {{comanda.id}}, '{{product.cuisine}}')" >
|
||||||
|
<p class="card-product-p"> {{product.name}}</p>
|
||||||
|
<p class="card-product-p"> R$ {{product.price}}</p>
|
||||||
|
</div >
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
<td id="price-{{product.id}}" >R$ {{product.price}}</td>
|
<td id="price-{{product.id}}" >R$ {{product.price}}</td>
|
||||||
<td class="hide-on-mobile" id="quantity-{{product.id}}" >{{product.quantity}}</td>
|
<td class="hide-on-mobile" id="quantity-{{product.id}}" >{{product.quantity}}</td>
|
||||||
<td class="hide-on-mobile" id="category-{{product.id}}" >{{product.category.name}}</td>
|
<td class="hide-on-mobile" id="category-{{product.id}}" >{{product.category.name}}</td>
|
||||||
|
<td hidden class="hide-on-mobile" id="image-{{product.id}}" >{{product.image}}</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<div class="grid-buttons">
|
<div class="grid-buttons">
|
||||||
<img
|
<img
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ input, textarea, select {
|
|||||||
|
|
||||||
|
|
||||||
.card-product {
|
.card-product {
|
||||||
|
position: relative;
|
||||||
height: 130px;
|
height: 130px;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
@@ -153,18 +154,46 @@ input, textarea, select {
|
|||||||
align-content: center;
|
align-content: center;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
background: var(--main-gradient);
|
/* background: var(--main-gradient); */
|
||||||
box-shadow: 3px 3px 10px rgba(2, 2, 2, 0.678);
|
/* box-shadow: 3px 3px 10px rgba(2, 2, 2, 0.678); */
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
transition: transform 0.4s, box-shadow 0.4s;
|
transition: transform 0.4s, box-shadow 0.4s;
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-product::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.595);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-product-p {
|
||||||
|
position: relative;
|
||||||
|
z-index: 0;
|
||||||
|
color: #ffffff;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
.card-product:hover {
|
.card-product:hover {
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
transition: transform 0.4s, box-shadow 0.4s;
|
transition: transform 0.4s, box-shadow 0.4s;
|
||||||
box-shadow: 0px 0px 10px rgba(86, 187, 255, 0.815);
|
box-shadow: 0px 0px 10px rgba(86, 187, 255, 0.815);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media screen and (max-width: 1028px) {
|
||||||
|
.card-product {
|
||||||
|
background-size: cover !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.p-header {
|
.p-header {
|
||||||
background-color: #24252a;
|
background-color: #24252a;
|
||||||
box-shadow: 0px 3px 10px #464646;
|
box-shadow: 0px 3px 10px #464646;
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ function searchProduct() {
|
|||||||
var search_product = document.getElementById('search-product-modal').value.trim()
|
var search_product = document.getElementById('search-product-modal').value.trim()
|
||||||
var productListElement = document.getElementById("product-list-modal");
|
var productListElement = document.getElementById("product-list-modal");
|
||||||
var comanda_id = document.getElementById("id-comanda").value;
|
var comanda_id = document.getElementById("id-comanda").value;
|
||||||
|
|
||||||
if(search_product.length == 0 ){search_product ='*';}
|
if(search_product.length == 0 ){search_product ='*';}
|
||||||
fetch(`/comandas/listProduct/${comanda_id}/${search_product}`, {
|
fetch(`/comandas/listProduct/${comanda_id}/${search_product}`, {
|
||||||
method: 'GET',}
|
method: 'GET',}
|
||||||
|
|||||||
@@ -30,6 +30,26 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-product{
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
/* height: 750; */
|
||||||
|
background-image: url('https://placehold.co/600x800/efc7b8/49291c?text=Sem_Imagem'); /* URL da imagem */
|
||||||
|
background-size: cover;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
|
}
|
||||||
|
.modal-product::before{
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.hide-on-mobile {
|
.hide-on-mobile {
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ function openModal() {
|
|||||||
var productPrice = document.getElementById('productPrice');
|
var productPrice = document.getElementById('productPrice');
|
||||||
var productDescription = document.getElementById('productDescription');
|
var productDescription = document.getElementById('productDescription');
|
||||||
var productqtd = document.getElementById('productqtd');
|
var productqtd = document.getElementById('productqtd');
|
||||||
|
var urlImage = document.getElementById('url-image');
|
||||||
|
var imageProduct = document.getElementById('image-product');
|
||||||
|
|
||||||
var productCuisine = document.getElementById('cuisine');
|
var productCuisine = document.getElementById('cuisine');
|
||||||
|
|
||||||
var categorie = document.getElementById('select-categorie');
|
var categorie = document.getElementById('select-categorie');
|
||||||
@@ -18,6 +21,7 @@ function openModal() {
|
|||||||
productPrice.value = '';
|
productPrice.value = '';
|
||||||
productDescription.value ='';
|
productDescription.value ='';
|
||||||
productqtd.value = '';
|
productqtd.value = '';
|
||||||
|
urlImage.value = '';
|
||||||
productCuisine.checked = false
|
productCuisine.checked = false
|
||||||
categorie.value = 1;
|
categorie.value = 1;
|
||||||
}
|
}
|
||||||
@@ -38,6 +42,10 @@ function editProduct(id) {
|
|||||||
var productPrice = document.getElementById('productPrice');
|
var productPrice = document.getElementById('productPrice');
|
||||||
var productDescription = document.getElementById('productDescription');
|
var productDescription = document.getElementById('productDescription');
|
||||||
var productqtd = document.getElementById('productqtd');
|
var productqtd = document.getElementById('productqtd');
|
||||||
|
var urlImage = document.getElementById('url-image');
|
||||||
|
var imageProduct = document.getElementById('modal-product');
|
||||||
|
|
||||||
|
|
||||||
var productCuisine = document.getElementById('cuisine');
|
var productCuisine = document.getElementById('cuisine');
|
||||||
var categorie = document.getElementById('select-categorie');
|
var categorie = document.getElementById('select-categorie');
|
||||||
|
|
||||||
@@ -49,6 +57,8 @@ function editProduct(id) {
|
|||||||
productPrice.value = preco;
|
productPrice.value = preco;
|
||||||
productDescription.value = document.getElementById('description-'+id).value;
|
productDescription.value = document.getElementById('description-'+id).value;
|
||||||
productqtd.value = document.getElementById('quantity-'+id).innerHTML;
|
productqtd.value = document.getElementById('quantity-'+id).innerHTML;
|
||||||
|
urlImage.value = document.getElementById('image-'+id).innerHTML;
|
||||||
|
imageProduct.style.backgroundImage = urlImage.value != '' ?`url('${urlImage.value}'` : `url('https://placehold.co/600x800/efc7b8/49291c?text=${productName.value}')`;
|
||||||
productCuisine.checked = document.getElementById('cuisine-'+id).value == 'True' ? true : false;
|
productCuisine.checked = document.getElementById('cuisine-'+id).value == 'True' ? true : false;
|
||||||
categorie.value = document.getElementById('h-category-'+id).value;
|
categorie.value = document.getElementById('h-category-'+id).value;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user