mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: create page balcao
This commit is contained in:
0
gestaoRaul/balcao/__init__.py
Normal file
0
gestaoRaul/balcao/__init__.py
Normal file
BIN
gestaoRaul/balcao/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/admin.cpython-310.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/admin.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/admin.cpython-313.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/admin.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/apps.cpython-310.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/apps.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/apps.cpython-313.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/apps.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/htmx_views.cpython-310.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/htmx_views.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/htmx_views.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/models.cpython-310.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/models.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/models.cpython-313.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/models.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/urls.cpython-310.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/urls.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/urls.cpython-313.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/urls.cpython-313.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/views.cpython-310.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/views.cpython-310.pyc
Normal file
Binary file not shown.
BIN
gestaoRaul/balcao/__pycache__/views.cpython-313.pyc
Normal file
BIN
gestaoRaul/balcao/__pycache__/views.cpython-313.pyc
Normal file
Binary file not shown.
3
gestaoRaul/balcao/admin.py
Normal file
3
gestaoRaul/balcao/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
6
gestaoRaul/balcao/apps.py
Normal file
6
gestaoRaul/balcao/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ComandasConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'balcao'
|
||||
46
gestaoRaul/balcao/htmx_views.py
Normal file
46
gestaoRaul/balcao/htmx_views.py
Normal file
@@ -0,0 +1,46 @@
|
||||
from django.shortcuts import render, redirect
|
||||
|
||||
from comandas.models import Comanda, ProductComanda
|
||||
from products.models import Product
|
||||
from payments.models import Payments
|
||||
from typePay.models import TypePay
|
||||
|
||||
|
||||
def listProduct(request, comanda_id):
|
||||
product = request.GET.get("search-product")
|
||||
products = Product.objects.filter(name__icontains=product)
|
||||
return render(request, "htmx_components/htmx_list_products_balcao.html", {"products": products,'comanda_id':comanda_id})
|
||||
|
||||
def addProduct(request, product_id, comanda_id):
|
||||
product_comanda = ProductComanda(comanda_id=comanda_id, product_id=product_id)
|
||||
product_comanda.save()
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total})
|
||||
|
||||
|
||||
def removeProductComanda(request, productComanda_id):
|
||||
product_comanda = ProductComanda.objects.get(id=productComanda_id)
|
||||
consumo = ProductComanda.objects.filter(comanda=product_comanda.comanda)
|
||||
product_comanda.delete()
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
return render(request, "htmx_components/htmx_list_products_in_comanda.html",{'consumo': consumo, 'total': total})
|
||||
|
||||
|
||||
def paymentComanda(request, comanda_id):
|
||||
typePayment = TypePay.objects.get(id=1)
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda_id)
|
||||
comanda = Comanda.objects.get(name='VENDA BALCÃO')
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
removeProductComanda(request, produto.id)
|
||||
pagamento = Payments(value=total, comanda=comanda, type_pay=typePayment,description='VENDA BALÃO')
|
||||
pagamento.save()
|
||||
comanda.save()
|
||||
return redirect('comandas')
|
||||
|
||||
30
gestaoRaul/balcao/migrations/0001_initial.py
Normal file
30
gestaoRaul/balcao/migrations/0001_initial.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 5.1.4 on 2024-12-10 01:19
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('clients', '0001_initial'),
|
||||
('mesas', '0001_initial'),
|
||||
('typePay', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Comanda',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('dt_open', models.DateTimeField(auto_now_add=True)),
|
||||
('dt_close', models.DateTimeField(blank=True, null=True)),
|
||||
('name', models.CharField(max_length=255)),
|
||||
('client', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='clients.client')),
|
||||
('mesa', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mesas.mesa')),
|
||||
('type_pay', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='typePay.typepay')),
|
||||
],
|
||||
),
|
||||
]
|
||||
25
gestaoRaul/balcao/migrations/0002_productcomanda.py
Normal file
25
gestaoRaul/balcao/migrations/0002_productcomanda.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.1.4 on 2024-12-10 01:20
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('comandas', '0001_initial'),
|
||||
('products', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ProductComanda',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('data_time', models.DateTimeField(auto_now_add=True)),
|
||||
('applicant', models.CharField(blank=True, max_length=255, null=True)),
|
||||
('comanda', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='comandas.comanda')),
|
||||
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.product')),
|
||||
],
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 5.1.4 on 2024-12-20 12:36
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('comandas', '0002_productcomanda'),
|
||||
('products', '0002_product_image_product_quantity'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='comanda',
|
||||
name='status',
|
||||
field=models.CharField(default='OPEN', max_length=255),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='productcomanda',
|
||||
name='product',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='products.product'),
|
||||
),
|
||||
]
|
||||
0
gestaoRaul/balcao/migrations/__init__.py
Normal file
0
gestaoRaul/balcao/migrations/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
27
gestaoRaul/balcao/models.py
Normal file
27
gestaoRaul/balcao/models.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# from django.db import models
|
||||
|
||||
# from clients.models import Client
|
||||
# from products.models import Product
|
||||
# from mesas.models import Mesa
|
||||
# from typePay.models import TypePay
|
||||
|
||||
# class Comanda(models.Model):
|
||||
# id = models.AutoField(primary_key=True)
|
||||
# mesa = models.ForeignKey(Mesa, on_delete=models.CASCADE)
|
||||
# type_pay = models.ForeignKey(TypePay, on_delete=models.SET_NULL, null=True)
|
||||
# dt_open = models.DateTimeField(auto_now_add=True)
|
||||
# dt_close = models.DateTimeField(null=True, blank=True)
|
||||
# client = models.ForeignKey(Client, on_delete=models.SET_NULL, null=True, blank=True)
|
||||
# name = models.CharField(max_length=255)
|
||||
# status = models.CharField(max_length=255, default="OPEN")
|
||||
# def __str__(self) -> str:
|
||||
# return self.name
|
||||
|
||||
# class ProductComanda(models.Model):
|
||||
# id = models.AutoField(primary_key=True)
|
||||
# comanda = models.ForeignKey(Comanda, on_delete=models.CASCADE)
|
||||
# data_time = models.DateTimeField(auto_now_add=True)
|
||||
# product = models.ForeignKey(Product, on_delete=models.PROTECT)
|
||||
# applicant = models.CharField(max_length=255, null=True, blank=True)
|
||||
# def __str__(self) -> str:
|
||||
# return self.comanda.name + " - " + self.product.name
|
||||
201
gestaoRaul/balcao/templates/viewBalcao.html
Normal file
201
gestaoRaul/balcao/templates/viewBalcao.html
Normal file
@@ -0,0 +1,201 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% block 'title' %}
|
||||
Detalhes {{comanda.name}}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
||||
{% block 'head' %}
|
||||
<link rel="stylesheet" href="{% static 'comandas/css/viewbalcao.css' %}">
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block 'body' %}
|
||||
|
||||
|
||||
<body>
|
||||
<div class="grid-container" >
|
||||
<div>
|
||||
<h1>Venda Balcão</h1>
|
||||
<div>
|
||||
<button class="primary" id="openModal" >Adicionar Produto</button>
|
||||
|
||||
<button id="pagarComanda" hx-get="{% url 'closeComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="imprimirConta()"
|
||||
{% if comanda.status != 'OPEN' %}
|
||||
style="display: none;"
|
||||
{% endif %}
|
||||
>Fechar Comanda</button>
|
||||
|
||||
<button id="pagarComanda" onclick="modal_payment_comanda()"
|
||||
|
||||
>Receber</button>
|
||||
|
||||
<button class="button" id="imprimirFichas" onclick="imprimirFichas()"
|
||||
|
||||
>Imprimir Fichas</button>
|
||||
|
||||
<!-- <button class="button" id="imprimirFichas" hx-get="{% url 'reopenComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="reloadPage()"
|
||||
{% if comanda.status == 'OPEN'%}
|
||||
style="display: none;"
|
||||
{% elif comanda.status == 'CLOSED' %}
|
||||
style="display: none;"
|
||||
{% endif %}
|
||||
>Reabrir</button> -->
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <p>Aberta em: {{comanda.dt_open|date:"D"}} {{comanda.dt_open|date:"d/m/Y - H:i"}}</p> -->
|
||||
|
||||
|
||||
<table id="list-products-comanda">
|
||||
<tr>
|
||||
<th style="text-align: left;">Produto</th>
|
||||
<th style="text-align: left;">Preço</th>
|
||||
</tr>
|
||||
|
||||
{% for item in consumo%}
|
||||
|
||||
<tr>
|
||||
<td>{{item.product.name}}</td>
|
||||
<td>R$ {{item.product.price}}</td>
|
||||
<td><button
|
||||
hx-get="{% url 'removeProductComanda' item.id %} " hx-trigger="click" hx-target="#list-products-comanda"
|
||||
onclick="reloadPage()">🗑️ Excluir</button></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
{% endfor %}
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: center;">Total R$ {{total}}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="add-produto">
|
||||
|
||||
|
||||
|
||||
<article>
|
||||
|
||||
<form id="productForm" >
|
||||
<h2>Adicionar Produto </h2>
|
||||
<input type="text" id="search-product" name="search-product" placeholder="Buscar Produto" hx-get="{% url 'listProduct' comanda.id %}" hx-trigger="keyup" hx-target="#product-list"><br>
|
||||
<div id="product-list" class="grid-list-products">
|
||||
{% for product in products %}
|
||||
|
||||
<article onclick="reloadPage()" style="background-color: #293552;" hx-get="{% url 'addProduct' product.id comanda.id %} " hx-trigger="click" hx-target="#list-products-comanda">
|
||||
{{product.name}} <br>
|
||||
R$ {{product.price}}
|
||||
</article >
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- <dialog id="Modal-add-product" style="display: none;" >
|
||||
<article>
|
||||
|
||||
<form id="productForm" >
|
||||
<h2>Adicionar Produto <button type="button" onclick="closeModal()" style="background-color:red;" >Fechar</button></h2>
|
||||
<input type="text" id="search-product" name="search-product" placeholder="Buscar Produto" hx-get="{% url 'listProduct' comanda.id %}" hx-trigger="keyup" hx-target="#product-list"><br>
|
||||
<div id="product-list" class="grid-list-products">
|
||||
{% for product in products %}
|
||||
|
||||
<article onclick="reloadPage()" style="background-color: #293552;" hx-get="{% url 'addProduct' product.id comanda.id %} " hx-trigger="click" hx-target="#list-products-comanda">
|
||||
{{product.name}} <br>
|
||||
R$ {{product.price}}
|
||||
</article >
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</article>
|
||||
</dialog> -->
|
||||
|
||||
|
||||
|
||||
<dialog id="remove-product-comanda" style="display: none;" >
|
||||
<article>
|
||||
<h2>Produto Excluido!</h2>
|
||||
<h1>✅</h1>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<ul>
|
||||
|
||||
</ul>
|
||||
<footer>
|
||||
<button class="secondary" onclick="removeCloseModal()">
|
||||
OK
|
||||
</button>
|
||||
<!-- <button >Excluir</button> -->
|
||||
</footer>
|
||||
</article>
|
||||
</dialog>
|
||||
|
||||
<dialog id="payment-comanda" style="display: none;" >
|
||||
<article>
|
||||
<h2>Receber</h2>
|
||||
<h1>R$ {{ total }}</h1>
|
||||
<p>
|
||||
</p>
|
||||
<ul>
|
||||
</ul>
|
||||
<footer>
|
||||
<button class="secondary" hx-get="{% url 'paymentComanda' comanda.id %} " hx-trigger="click" hx-swap="none" onclick="backPage()">
|
||||
Comfimar
|
||||
</button>
|
||||
|
||||
<button onclick="close_modal_payment_comanda()" >Cancelar</button>
|
||||
</footer>
|
||||
</article>
|
||||
</dialog>
|
||||
|
||||
|
||||
|
||||
<script src="{% static 'comandas/js/viewbalcao.js' %}"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
3
gestaoRaul/balcao/tests.py
Normal file
3
gestaoRaul/balcao/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
25
gestaoRaul/balcao/urls.py
Normal file
25
gestaoRaul/balcao/urls.py
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
from django.urls import path
|
||||
|
||||
from balcao import htmx_views
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
# path('', views.comandas, name='comandas'),
|
||||
path('', views.viewBalcao, name='viewBalcao'),
|
||||
# path('createComanda/', views.createComanda, name='createComanda'),
|
||||
|
||||
]
|
||||
|
||||
|
||||
htmx_urlpatterns = [
|
||||
# path('listProduct/', htmx_views.listProduct, name='listProduct'),
|
||||
path('listProduct/<int:comanda_id>/', htmx_views.listProduct, name='listProduct'),
|
||||
path('addProduct<int:product_id>/<int:comanda_id>/', htmx_views.addProduct, name='addProduct'),
|
||||
path('removeProductComanda<int:productComanda_id>/', htmx_views.removeProductComanda, name='removeProductComanda'),
|
||||
# path('closeComanda<int:comanda_id>/', htmx_views.closeComanda, name='closeComanda'),
|
||||
# path('reopenComanda<int:comanda_id>/', htmx_views.reopenComanda, name='reopenComanda'),
|
||||
path('paymentComanda<int:comanda_id>/', htmx_views.paymentComanda, name='paymentComanda'),
|
||||
]
|
||||
|
||||
urlpatterns += htmx_urlpatterns
|
||||
36
gestaoRaul/balcao/views.py
Normal file
36
gestaoRaul/balcao/views.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from django.shortcuts import render, redirect
|
||||
|
||||
from comandas.models import Comanda, ProductComanda
|
||||
from products.models import Product
|
||||
from mesas.models import Mesa
|
||||
|
||||
|
||||
# def balcao(request):
|
||||
# comandas = Comanda.objects.filter(status__in=["OPEN", "PAYING"])
|
||||
# mesas = Mesa.objects.all()
|
||||
# return render(request, 'comandas.html', {'comandas': comandas, 'mesas': mesas})
|
||||
|
||||
|
||||
|
||||
def viewBalcao(request):
|
||||
|
||||
comanda = Comanda.objects.get(name='VENDA BALCÃO')
|
||||
consumo = ProductComanda.objects.filter(comanda=comanda.id)
|
||||
products = Product.objects.all()
|
||||
total = 0
|
||||
for produto in consumo:
|
||||
total += produto.product.price
|
||||
|
||||
return render(request, 'viewBalcao.html', {'comanda': comanda, 'consumo': consumo, 'total': total, 'products': products})
|
||||
|
||||
|
||||
|
||||
# def createComanda(request):
|
||||
# name = request.POST.get('name-comanda')
|
||||
# mesa_id = int(request.POST.get('select-mesa')[0])
|
||||
# mesa = Mesa.objects.get(id=mesa_id)
|
||||
# comanda = Comanda(name=name, mesa=mesa)
|
||||
# comanda.save()
|
||||
|
||||
# return redirect('comandas')
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -53,6 +53,7 @@ INSTALLED_APPS = [
|
||||
'categories',
|
||||
'home',
|
||||
'payments',
|
||||
'balcao',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
@@ -26,6 +26,7 @@ urlpatterns = [
|
||||
path('clients/', include('clients.urls')),
|
||||
path('comandas/', include('comandas.urls')),
|
||||
path('categories/', include('categories.urls')),
|
||||
path('balcao/', include('balcao.urls')),
|
||||
|
||||
|
||||
]
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<li><a href="{% url 'comandas' %}">Comandas</a></li>
|
||||
<li><a href="{% url 'products' %}">Produtos</a></li>
|
||||
<li><a href="#">Categorias</a></li>
|
||||
<li><a href="#">Sobre</a></li>
|
||||
<li><a href="{% url 'viewBalcao' %}">Balcao</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<!-- <div class="content">
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
{% for product in products %}
|
||||
{{co}}
|
||||
|
||||
<article onclick="reloadPage()" style="background-color: #293552;" hx-get="{% url 'addProduct' product.id comanda_id %} " hx-trigger="click" hx-target="#list-products-comanda">
|
||||
{{product.name}} <br>
|
||||
R$ {{product.price}}
|
||||
</article>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
95
gestaoRaul/templates/static/comandas/css/viewbalcao.css
Normal file
95
gestaoRaul/templates/static/comandas/css/viewbalcao.css
Normal file
@@ -0,0 +1,95 @@
|
||||
.grid-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 2fr);
|
||||
gap: 10px;
|
||||
max-width: 1300px; /* Define a largura máxima do grid */
|
||||
margin: 0 auto; /* Centraliza o grid na página */
|
||||
}
|
||||
|
||||
.grid-list-products {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 2fr);
|
||||
gap: 10px;
|
||||
max-width: 800px; /* Define a largura máxima do grid */
|
||||
margin: 0 auto; /* Centraliza o grid na página */
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
background-color: #c9ffbc;
|
||||
border-radius: 15px;
|
||||
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
|
||||
text-align: center;
|
||||
line-height: 40px; /* Centraliza o texto verticalmente */
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
transition: transform 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: scale(1.05);
|
||||
box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
table td th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
button {
|
||||
background-color: #007BFF;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
.modal {
|
||||
display: none;
|
||||
position: fixed;
|
||||
padding: 20px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: #fefefe;
|
||||
margin: 15% auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #888;
|
||||
border-radius: 10px;
|
||||
width: 90%;
|
||||
height: 90%;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
width: 95%;
|
||||
max-width: 95%;
|
||||
padding: 8px;
|
||||
margin-top: 5px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
115
gestaoRaul/templates/static/comandas/js/viewbalcao.js
Normal file
115
gestaoRaul/templates/static/comandas/js/viewbalcao.js
Normal file
@@ -0,0 +1,115 @@
|
||||
function openModal() {
|
||||
document.getElementById('Modal-add-product').style.display = 'block';
|
||||
}
|
||||
|
||||
|
||||
function open_remove_product_comanda() {
|
||||
document.getElementById('remove-product-comanda').style.display = 'block';
|
||||
}
|
||||
|
||||
function modal_payment_comanda() {
|
||||
document.getElementById('payment-comanda').style.display = 'block';
|
||||
}
|
||||
|
||||
function close_modal_payment_comanda() {
|
||||
document.getElementById('payment-comanda').style.display = 'none';
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
document.getElementById('Modal-add-product').style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
function removeCloseModal() {
|
||||
document.getElementById('remove-product-comanda').style.display = 'none';
|
||||
}
|
||||
|
||||
function imprimirFichas() {
|
||||
const element = document.getElementById("list-products-comanda");
|
||||
const style = `<style>
|
||||
td, th {
|
||||
|
||||
border-collapse: collapse;
|
||||
padding-top: 35px;
|
||||
margin: 20px;
|
||||
text-align: center;
|
||||
font-size: 24px;}
|
||||
</style>`;
|
||||
const agora = new Date();
|
||||
var dateString = agora.getDay() + '/' + agora.getMonth() + '/' + agora.getFullYear() + ' - ' + agora.getHours() + ':' + agora.getMinutes()+' - Raul Rock Bar & Café';
|
||||
|
||||
if (element) {
|
||||
var content = element.innerHTML;
|
||||
// console.log(content);
|
||||
content = content.replace(/<button[^>]*>(?:(?!<\/button>)[\s\S])*<\/button>/gi,'');
|
||||
content = content.replace(/<th[^>]*>(?:(?!<\/th>)[\s\S])*<\/th>/gi,'');
|
||||
content = content.replace(/<\/tr>/g,'</tr><tr><td colspan="2" style="font-size: 12px">'+dateString+'</td></tr>');
|
||||
console.log(content);
|
||||
|
||||
var printWindow = window.open('', '_blank');
|
||||
printWindow.document.write('<table>'+content+'</table>'+style);
|
||||
printWindow.document.close();
|
||||
printWindow.print();
|
||||
printWindow.close();
|
||||
} else {
|
||||
console.error(`Element with ID not found`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function imprimirConta() {
|
||||
reloadPage();
|
||||
const element = document.getElementById("list-products-comanda");
|
||||
const style = `<style>
|
||||
td, th {
|
||||
|
||||
border-collapse: collapse;
|
||||
padding-top: 15px;
|
||||
margin: 15px;
|
||||
text-align: center;
|
||||
font-size: 18px;}
|
||||
</style>`;
|
||||
const agora = new Date();
|
||||
var dateString = agora.getDay() + '/' + agora.getMonth() + '/' + agora.getFullYear() + ' - ' + agora.getHours() + ':' + agora.getMinutes()+' - Raul Rock Bar & Café';
|
||||
|
||||
if (element) {
|
||||
var content = element.innerHTML;
|
||||
// console.log(content);
|
||||
content = content.replace(/<button[^>]*>(?:(?!<\/button>)[\s\S])*<\/button>/gi,'');
|
||||
content = content.replace(/<th[^>]*>(?:(?!<\/th>)[\s\S])*<\/th>/gi,'');
|
||||
// content = content.replace(/<\/tr>/g,'</tr><tr><td colspan="2" style="font-size: 12px">'+dateString+'</td></tr>');
|
||||
console.log(content);
|
||||
|
||||
var printWindow = window.open('', '_blank');
|
||||
printWindow.document.write('<table>'+content+'</table>'+style);
|
||||
printWindow.document.close();
|
||||
printWindow.print();
|
||||
printWindow.close();
|
||||
} else {
|
||||
console.error(`Element with ID not found`);
|
||||
}
|
||||
}
|
||||
|
||||
function reloadPage(){
|
||||
setTimeout(function() {
|
||||
location.reload();}, 100);
|
||||
}
|
||||
|
||||
function backPage() {
|
||||
setTimeout(function() {
|
||||
history.back();}, 100);
|
||||
setTimeout(function() {
|
||||
location.reload();}, 100);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
document.getElementById('openModal').addEventListener('click', openModal);
|
||||
|
||||
document.getElementById('productForm').addEventListener('submit', function(event) {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user