page orders | add duplicati container

This commit is contained in:
2025-06-17 17:49:44 -03:00
parent de0f6912e2
commit 132c8dcfc6
20 changed files with 202 additions and 588 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,7 @@
dev_env/lib/python3.12/site-packages/PIL/__pycache__/XVThumbImagePlugin.cpython-312.pyc dev_env/lib/python3.12/site-packages/PIL/__pycache__/XVThumbImagePlugin.cpython-312.pyc
dev_env dev_env
meu_dev_home
dev_home dev_home
gestaoRaul/static gestaoRaul/static
.env .env
gestaoRaul/db.sqlite3

View File

@@ -37,7 +37,6 @@ Armazena as informações dos funcionários do bar que utilizam o aplicativo int
|`ativo`|BOOLEAN|NOT NULL, DEFAULT TRUE| |`ativo`|BOOLEAN|NOT NULL, DEFAULT TRUE|
### 2.3. `Produtos` ### 2.3. `Produtos`
![[Product]]
Armazena os itens do cardápio do bar. Armazena os itens do cardápio do bar.

View File

@@ -13,6 +13,30 @@ services:
networks: networks:
- app_network - app_network
duplicati:
image: duplicati/duplicati:latest # Ou uma versão específica, ex: duplicati/duplicati:2.0.7.1
container_name: duplicati
hostname: duplicati
restart: unless-stopped
ports:
- "8200:8200" # Porta para a interface web do Duplicati
environment:
- PUID=1000 # ID do usuário que o Duplicati irá rodar (normalmente o seu usuário no host)
- PGID=1000 # ID do grupo que o Duplicati irá rodar (normalmente o seu grupo no host)
- TZ=America/Fortaleza # Ajuste para o seu fuso horário (Juazeiro do Norte)
volumes:
# Volume para persistir as configurações e bancos de dados do Duplicati
- ./duplicati_config:/config
# Volume para armazenar os backups (pode ser um volume nomeado ou um bind mount)
- ./duplicati_backups:/backups
# Montar o volume do PostgreSQL para que o Duplicati possa acessá-lo.
# Substitua 'seu_volume_postgresql' pelo nome real do seu volume Docker do PostgreSQL.
# Se você montou uma pasta local, use o caminho absoluto dela aqui.
- db_data:/var/lib/postgresql/data/:ro # 'ro' para somente leitura, por segurança
# EX: Se seu PostgreSQL está em uma pasta local:
# - /caminho/completo/para/sua/pasta/de/dados/do/postgresql:/source_data:ro
django_app: django_app:
build: build:
context: ./ context: ./
@@ -21,7 +45,7 @@ services:
- "8000:8000" - "8000:8000"
healthcheck: healthcheck:
test: ["CMD", "curl", "-f", "http://0.0.0.0:8000/"] test: ["CMD", "curl", "-f", "http://192.168.0.150:8000/"]
interval: 5m interval: 5m
timeout: 3s timeout: 3s
retries: 3 retries: 3
@@ -37,7 +61,7 @@ services:
DB_USER: "${DB_USER}" DB_USER: "${DB_USER}"
DB_PASSWORD: "${DB_PASSWORD}" DB_PASSWORD: "${DB_PASSWORD}"
DEBUG: "False" DEBUG: "False"
ALLOWED_HOSTS: "rrbec.local.com, 0.0.0.0, django_app" ALLOWED_HOSTS: "rrbec.local.com, 0.0.0.0, 127.0.0.1, 192.168.0.150, django_app"
networks: networks:
- app_network - app_network
@@ -50,8 +74,8 @@ services:
- static_volume:/app/gestaoRaul/static - static_volume:/app/gestaoRaul/static
ports: ports:
- "80:80" - "80:80"
depends_on: # depends_on:
- django_app # - django_app
networks: networks:
- app_network - app_network

View File

@@ -78,9 +78,10 @@ def addProduct(request, product_id, comanda_id):
<h4>{comanda.name} - {comanda.mesa.name}</h4> <h4>{comanda.name} - {comanda.mesa.name}</h4>
<h4> {order.queue.strftime("%d/%m/%Y - %H:%M")}</h4> <h4> {order.queue.strftime("%d/%m/%Y - %H:%M")}</h4>
<h4> Atendente: {comanda.user.first_name}</h4> <h4> Atendente: {comanda.user.first_name}</h4>
<button class="btn-primary" onclick="delayTab('Fila')" <form method="path" action="/pedidos/preparing/{order.id}/">
hx-get="/pedidos/preparing/{order.id}/" hx-trigger="click" hx-target="#etapas" <button class="btn-primary" type="submit">Preparar</button>
>Preparar</button></div> </form>
</div>
""", """,
'local':'cozinha', 'local':'cozinha',
'tipo':'add', 'tipo':'add',

Binary file not shown.

View File

@@ -20,25 +20,15 @@
{% endblock %} {% endblock %}
</head> </head>
<body> <body>
{% block 'body' %} {% block 'body' %}
<div class="container">
<h1>Pedidos cozinha</h1> <h1>Pedidos cozinha</h1>
<div class="kanban-board">
{% csrf_token %}
<div id="list-orders"> <div class="column">
<h2>FILA</h2>
<div class="tab"> <div id="fila" class="cards-container">
<button class="tablinks active" onclick="openTab(event, 'Fila')">Fila</button>
<button class="tablinks" onclick="openTab(event, 'Preparo')">Preparo</button>
<button class="tablinks" onclick="openTab(event, 'Finalizado')">Pronto</button>
<button class="tablinks" onclick="openTab(event, 'Entregue')">Entregue</button>
</div>
<div id="etapas">
<div id="Fila" class="tabcontent">
{% for order in orders %} {% for order in orders %}
{% if order.preparing == None and order.productComanda != Null %} {% if order.preparing == None and order.productComanda != Null %}
<div class="m-card" id="m-card-{{order.id}}" <div class="m-card" id="m-card-{{order.id}}"
@@ -54,17 +44,20 @@
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4> <h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4> <h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
{% if user|groupUser:"Cozinha" %} {% if user|groupUser:"Cozinha" %}
<button class="btn-primary" onclick="delayTab('Fila')"
hx-get="{% url 'preparing' order.id %} " hx-trigger="click" hx-target="#etapas" <form method="path" action="{% url 'preparing' order.id %}">
>Preparar</button>
<button class="btn-primary" type="submit">Preparar</button>
</form>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</div>
<div class="column">
<div id="Preparo" class="tabcontent"> <h2>PREPARANDO</h2>
<div class="cards-container">
{% for order in orders %} {% for order in orders %}
{% if order.finished == None and order.preparing != None %} {% if order.finished == None and order.preparing != None %}
<div class="m-card" id="m-card-{{order.id}}" <div class="m-card" id="m-card-{{order.id}}"
@@ -80,16 +73,19 @@
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4> <h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4> <h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
{% if user|groupUser:"Cozinha" %} {% if user|groupUser:"Cozinha" %}
<button class="btn-secondary" onclick="delayTab( 'Preparo')" <form method="path" action="{% url 'finished' order.id %}">
hx-get="{% url 'finished' order.id %} " hx-trigger="click" hx-target="#etapas" <button class="btn-primary" type="submit">Finalizar</button>
>Finalizar</button> </form>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</div>
<div id="Finalizado" class="tabcontent"> <div class="column">
<h2>PRONTO</h2>
<div class="cards-container">
{% for order in orders %} {% for order in orders %}
{% if order.delivered == None and order.finished != None %} {% if order.delivered == None and order.finished != None %}
<div class="m-card" id="m-card-{{order.id}}" <div class="m-card" id="m-card-{{order.id}}"
@@ -105,16 +101,26 @@
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4> <h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4> <h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
{% if user|groupUser:"Garçom" %} {% if user|groupUser:"Garçom" %}
<button class="btn-secondary" onclick="delayTab( 'Finalizado')" <form method="path" action="{% url 'delivered' order.id %}">
hx-get="{% url 'delivered' order.id %} " hx-trigger="click" hx-target="#etapas" <button class="btn-primary" type="submit">Entregar</button>
>Entregar</button> </form>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
</div>
<div class="column"
{% if user|groupUser:"Gerente" %}
style="display:block"
{% else %}
style="display:none"
{% endif %}
<div id="Entregue" class="tabcontent"> >
<h2>ENTREGUE</h2>
<div class="cards-container">
{% for order in orders %} {% for order in orders %}
{% if order.delivered != None %} {% if order.delivered != None %}
<div class="m-card" id="m-card-{{order.id}}" <div class="m-card" id="m-card-{{order.id}}"
@@ -135,18 +141,8 @@
</div> </div>
</div> </div>
</div> </div>
<dialog id="loading" >
<div >
<img class="loading" src="{% static 'midia/icons/loading.svg' %}" alt="">
</div> </div>
<br><br> <script src="{% static 'orders/js/orders.js' %}"></script>
<h1>Carregando...</h1> {% endblock %}
</dialog>
<script src="{% static 'orders/js/orders.js' %}"></script> {% endblock %}
</body> </body>
</html> </html>

View File

@@ -1,6 +1,6 @@
# from datetime import timezone # from datetime import timezone
from django.utils import timezone from django.utils import timezone
from django.shortcuts import render from django.shortcuts import render, redirect
from django.http import JsonResponse, HttpResponse from django.http import JsonResponse, HttpResponse
import asyncio import asyncio
import websockets import websockets
@@ -35,7 +35,7 @@ def preparing(request, order_id):
order.save() order.save()
fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15) fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15)
orders = Order.objects.filter(queue__gte=fifteen_hours_ago ) orders = Order.objects.filter(queue__gte=fifteen_hours_ago )
return render(request, 'htmx_components/orders/htmx_list_orders_fila.html',{'orders': orders}) return redirect(request.META.get('HTTP_REFERER', '/'))
@group_required(groupName='Cozinha') @group_required(groupName='Cozinha')
@@ -45,8 +45,8 @@ def finished(request, order_id):
order.save() order.save()
fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15) fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15)
orders = Order.objects.filter(queue__gte=fifteen_hours_ago ) orders = Order.objects.filter(queue__gte=fifteen_hours_ago )
asyncio.run(enviar_mensagem()) # asyncio.run(enviar_mensagem())
return render(request, 'htmx_components/orders/htmx_list_orders_fila.html',{'orders': orders}) return redirect(request.META.get('HTTP_REFERER', '/'))
@group_required(groupName='Garçom') @group_required(groupName='Garçom')
def delivered(request, order_id): def delivered(request, order_id):
@@ -55,7 +55,7 @@ def delivered(request, order_id):
order.save() order.save()
fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15) fifteen_hours_ago = timezone.now() - timezone.timedelta(hours=15)
orders = Order.objects.filter(queue__gte=fifteen_hours_ago ) orders = Order.objects.filter(queue__gte=fifteen_hours_ago )
return render(request, 'htmx_components/orders/htmx_list_orders_fila.html',{'orders': orders}) return redirect(request.META.get('HTTP_REFERER', '/'))
def notificacao(request): def notificacao(request):

View File

@@ -1,103 +0,0 @@
<div class="tab">
<button class="tablinks active" onclick="openTab(event, 'Fila')">Fila</button>
<button class="tablinks" onclick="openTab(event, 'Preparo')">Preparo</button>
<button class="tablinks" onclick="openTab(event, 'Finalizado')">Pronto</button>
<button class="tablinks" onclick="openTab(event, 'Entregue')">Entregue</button>
</div>
<div id="Fila" class="tabcontent">
{% for order in orders %}
{% if order.preparing == None and order.productComanda != Null %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button
hx-get="{% url 'preparing' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Preparar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Preparo" class="tabcontent">
{% for order in orders %}
{% if order.finished == None and order.preparing != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button
hx-get="{% url 'finished' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Finalizar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Finalizado" class="tabcontent">
{% for order in orders %}
{% if order.delivered == None and order.finished != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button
hx-get="{% url 'delivered' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Entregar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Entregue" class="tabcontent">
{% for order in orders %}
{% if order.delivered != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<!-- <button>Preparar</button> -->
</div>
{% endif %}
{% endfor %}
</div>

View File

@@ -1,94 +0,0 @@
<div id="Fila" class="tabcontent">
{% for order in orders %}
{% if order.preparing == None and order.productComanda != Null %}
<div class="m-card" id="m-card-{{order.id}}"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4 id="obs-{{order.id}}">{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button class="btn-primary" onclick="delayTab('Fila')"
hx-get="{% url 'preparing' order.id %} " hx-trigger="click" hx-target="#etapas"
>Preparar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Preparo" class="tabcontent">
{% for order in orders %}
{% if order.finished == None and order.preparing != None %}
<div class="m-card" id="m-card-{{order.id}}"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4 id="obs-{{order.id}}">{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button class="btn-secondary" onclick="delayTab('Preparo')"
hx-get="{% url 'finished' order.id %} " hx-trigger="click" hx-target="#etapas"
>Finalizar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Finalizado" class="tabcontent">
{% for order in orders %}
{% if order.delivered == None and order.finished != None %}
<div class="m-card" id="m-card-{{order.id}}"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4 id="obs-{{order.id}}">{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button class="btn-secondary" onclick="delayTab('Finalizado')"
hx-get="{% url 'delivered' order.id %} " hx-trigger="click" hx-target="#etapas"
>Entregar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Entregue" class="tabcontent">
{% for order in orders %}
{% if order.delivered != None %}
<div class="m-card" id="m-card-{{order.id}}"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4 id="obs-{{order.id}}">{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
</div>
{% endif %}
{% endfor %}
</div>

View File

@@ -1,103 +0,0 @@
<div class="tab">
<button class="tablinks active" onclick="openTab(event, 'Fila')">Fila</button>
<button class="tablinks" onclick="openTab(event, 'Preparo')">Preparo</button>
<button class="tablinks" onclick="openTab(event, 'Finalizado')">Pronto</button>
<button class="tablinks" onclick="openTab(event, 'Entregue')">Entregue</button>
</div>
<div id="Fila" class="tabcontent">
{% for order in orders %}
{% if order.preparing == None and order.productComanda != Null %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button
hx-get="{% url 'preparing' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Preparar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Preparo" class="tabcontent">
{% for order in orders %}
{% if order.finished == None and order.preparing != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button
hx-get="{% url 'finished' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Finalizar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Finalizado" class="tabcontent">
{% for order in orders %}
{% if order.delivered == None and order.finished != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button
hx-get="{% url 'delivered' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Entregar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Entregue" class="tabcontent">
{% for order in orders %}
{% if order.delivered != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<!-- <button>Preparar</button> -->
</div>
{% endif %}
{% endfor %}
</div>

View File

@@ -1,103 +0,0 @@
<div class="tab">
<button class="tablinks active" onclick="openTab(event, 'Fila')">Fila</button>
<button class="tablinks" onclick="openTab(event, 'Preparo')">Preparo</button>
<button class="tablinks" onclick="openTab(event, 'Finalizado')">Pronto</button>
<button class="tablinks" onclick="openTab(event, 'Entregue')">Entregue</button>
</div>
<div id="Fila" class="tabcontent">
{% for order in orders %}
{% if order.preparing == None and order.productComanda != Null %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button class="btn-primary"
hx-get="{% url 'preparing' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Preparar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Preparo" class="tabcontent">
{% for order in orders %}
{% if order.finished == None and order.preparing != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button class="btn-secondary"
hx-get="{% url 'finished' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Finalizar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Finalizado" class="tabcontent">
{% for order in orders %}
{% if order.delivered == None and order.finished != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<button
hx-get="{% url 'delivered' order.id %} " hx-trigger="click" hx-target="#list-orders"
>Entregar</button>
</div>
{% endif %}
{% endfor %}
</div>
<div id="Entregue" class="tabcontent">
{% for order in orders %}
{% if order.delivered != None %}
<div class="m-card"
{% if order.productComanda == Null %}
style="background-color: rgb(253, 69, 69);"
{% elif order.obs != '' %}
style="background-color: rgb(243, 165, 75);"
{% endif %}
>
<h4>{{order.id_product.name}}</h4>
<h4>{{order.obs}} </h4>
<h4>{{order.id_comanda.name}} - {{order.id_comanda.mesa.name}} </h4>
<h4> Atendente: {{order.id_comanda.user.first_name}} </h4>
<h4>{{order.queue|date:"D"}} {{order.queue|date:"d/m/Y - H:i"}}</h4>
<!-- <button>Preparar</button> -->
</div>
{% endif %}
{% endfor %}
</div>

View File

@@ -51,7 +51,7 @@ function cookieNotificacao() {
} }
} }
const websocket = new WebSocket('ws://0.0.0.0:8765'); const websocket = new WebSocket('ws://192.168.0.150:8765');
const nomeUsuario = document.getElementById('user-info').textContent; const nomeUsuario = document.getElementById('user-info').textContent;
websocket.addEventListener('open', (event) => { websocket.addEventListener('open', (event) => {
@@ -64,37 +64,34 @@ websocket.addEventListener('message', (event) => {
switch (data.local) { switch (data.local) {
case 'cozinha': case 'cozinha':
if (document.getElementById('Fila') !== null && data.tipo === 'add'){ if (document.getElementById('Fila') !== null && data.tipo === 'add'){
// const novoElemento = document.createElement('div'); var novoElemento = document.createElement('div');
// novoElemento.innerHTML = data.message; novoElemento.innerHTML = data.message;
// var fila = document.getElementById('Fila').appendChild(novoElemento); document.getElementById('Fila').appendChild(novoElemento);
let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1"); let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
if (valorAtual === 'true') { if (valorAtual === 'true') {
texto = new SpeechSynthesisUtterance(data.speak); texto = new SpeechSynthesisUtterance(data.speak);
window.speechSynthesis.speak(texto); window.speechSynthesis.speak(texto);
setTimeout(function() { // setTimeout(function() {
location.reload(); // location.reload();
}, 6000); // }, 6000);
} }
} }
else if (document.getElementById('obs-'+data.id) !== null && data.tipo === 'edit'){ else if (document.getElementById('obs-'+data.id) !== null && data.tipo === 'edit'){
const obs = document.getElementById('obs-'+data.id) const obs = document.getElementById('obs-'+data.id)
// const card = obs.parentNode; const card = obs.parentNode;
// card.style.backgroundColor = 'rgb(243, 165, 75)'; card.style.backgroundColor = 'rgb(243, 165, 75)';
// obs.innerHTML = data.message; obs.innerHTML = data.message;
let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1"); let valorAtual = document.cookie.replace(/(?:(?:^|.*;\s*)notificacao\s*\=\s*([^;]*).*$)|^.*$/, "$1");
if (valorAtual === 'true') { if (valorAtual === 'true') {
texto = new SpeechSynthesisUtterance(data.speak); texto = new SpeechSynthesisUtterance(data.speak);
window.speechSynthesis.speak(texto); window.speechSynthesis.speak(texto);
setTimeout(function() { // setTimeout(function() {
location.reload(); // location.reload();
}, 6000); // }, 6000);
} }
} }
else if (document.getElementById('m-card-'+data.id) !== null && data.tipo === 'delete'){ else if (document.getElementById('m-card-'+data.id) !== null && data.tipo === 'delete'){

View File

@@ -1,37 +1,62 @@
@keyframes girar {
from { h4{
transform: rotate(0deg); color: black;
}
to {
transform: rotate(360deg);
}
} }
@keyframes jump { .container {
0% { border-radius: 8px;
transform: scale(0.0); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
} padding: 0px;
70% { width: 100%;
transform: scale(1.2); height: 100%;
} box-sizing: border-box;
100% {
transform: scale(1);
}
} }
.loading {
align-items: center; .kanban-board {
align-content: center; display: flex;
align-self: center; gap: 10px;
margin: 0 auto; justify-content: space-between;
animation: girar 4s infinite linear;
} }
.column {
flex: 1;
border: 1px solid #535353;
border-radius: 6px;
padding: 15px;
display: flex;
flex-direction: column;
}
.cards-container {
flex-grow: 1; /* Permite que o container de cards ocupe o espaço restante */
overflow-y: auto; /* Adiciona a barra de rolagem vertical */
max-height: 85vh; /* Defina uma altura máxima para ativar o scroll */
padding-right: 5px; /* Espaçamento para não cortar a barra de rolagem */
}
.cards-container::-webkit-scrollbar {
width: 8px;
}
.cards-container::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 10px;
}
.cards-container::-webkit-scrollbar-thumb {
background: #888;
border-radius: 10px;
}
.cards-container::-webkit-scrollbar-thumb:hover {
background: #555;
}
.m-card { .m-card {
/* width: 50px; */ width: 100%;
height: 100%;
background-color: #f2f2f2; background-color: #f2f2f2;
border-radius: 10px; border-radius: 10px;
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2); box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
@@ -46,51 +71,24 @@
animation: jump 0.7s; animation: jump 0.7s;
} }
h4{
color: black;
}
@media screen and (max-width: 1028px) {
.tab { .container {
display: flex; padding: 0px;
padding-top: 15px; gap: 0px;
justify-content: space-between; min-width: 100%;
overflow: auto; min-height: 100%;
width: 100%;
border-bottom: 2px solid rgba(86, 187, 255, 0.192);
}
.tab button {
width: 24%;
background-color: #999aeb00;
padding: 10px 10px;
transition: 0.6s;
border-radius: 20px 20px 0px 0px;
align-items: center;
border-color: rgba(86, 187, 255, 0.192);
line-height: 20px;
}
.tab button.active {
border-radius: 8px 8px 0px 0px;
border-color: rgba(86, 187, 255, 0.192);
background: var(--main-gradient);
box-shadow: 0px 0px 15px rgba(86, 187, 255, 0.815);
}
.tabcontent {
display: none;
padding: 6px 12px;
} }
#list-orders{ .kanban-board {
justify-self: center; gap: 0px;
width: 30%;
} }
@media (max-width: 768px) { .column {
#list-orders{
width: 100%; padding: 0px;
} }
} }

View File

@@ -4,49 +4,49 @@ function reloadPage(){
location.reload();}, 3000); location.reload();}, 3000);
} }
function openTab(evt, etapa) { // function openTab(evt, etapa) {
var i, tabcontent, tablinks; // var i, tabcontent, tablinks;
tabcontent = document.getElementsByClassName("tabcontent"); // tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) { // for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none"; // tabcontent[i].style.display = "none";
} // }
tablinks = document.getElementsByClassName("tablinks"); // tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) { // for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", ""); // tablinks[i].className = tablinks[i].className.replace(" active", "");
} // }
document.getElementById(etapa).style.display = "block"; // document.getElementById(etapa).style.display = "block";
evt.currentTarget.className += " active"; // evt.currentTarget.className += " active";
} // }
function displayBlock(etapa) { // function displayBlock(etapa) {
document.getElementById('loading').style.display = "none"; // document.getElementById('loading').style.display = "none";
document.getElementById(etapa).style.display = "block"; // document.getElementById(etapa).style.display = "block";
} // }
tabcontent = document.getElementsByClassName("tabcontent"); // tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) { // for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none"; // tabcontent[i].style.display = "none";
} // }
tabcontent[0].style.display = "block"; // tabcontent[0].style.display = "block";
function delayTab(tab){ // function delayTab(tab){
document.getElementById('Fila').style.display = "none"; // document.getElementById('Fila').style.display = "none";
document.getElementById('Preparo').style.display = "none"; // document.getElementById('Preparo').style.display = "none";
document.getElementById('Finalizado').style.display = "none"; // document.getElementById('Finalizado').style.display = "none";
document.getElementById('Entregue').style.display = "none"; // document.getElementById('Entregue').style.display = "none";
document.getElementById('loading').style.display = "block"; // document.getElementById('loading').style.display = "block";
setTimeout(function() { // setTimeout(function() {
displayBlock(tab);}, 1000); // displayBlock(tab);}, 1000);
// reloadPage(); // // reloadPage();
} // }
displayBlock('Fila'); // displayBlock('Fila');
// function mostrarNotificacao(titulo,corpo,grupo) { // function mostrarNotificacao(titulo,corpo,grupo) {