mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
chore: Delete numerous application modules, templates, static assets, documentation, and build files.
This commit is contained in:
0
mesas/__init__.py
Normal file
0
mesas/__init__.py
Normal file
7
mesas/admin.py
Normal file
7
mesas/admin.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from mesas.models import Mesa
|
||||
|
||||
|
||||
admin.site.register(Mesa)
|
||||
|
||||
8
mesas/api_views.py
Normal file
8
mesas/api_views.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from rest_framework import viewsets, permissions
|
||||
from .models import Mesa
|
||||
from .serializers import MesaSerializer
|
||||
|
||||
class MesaViewSet(viewsets.ModelViewSet):
|
||||
queryset = Mesa.objects.all()
|
||||
serializer_class = MesaSerializer
|
||||
permission_classes = [permissions.IsAuthenticated]
|
||||
6
mesas/apps.py
Normal file
6
mesas/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class MesasConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'mesas'
|
||||
23
mesas/migrations/0001_initial.py
Normal file
23
mesas/migrations/0001_initial.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.1.4 on 2024-12-10 00:52
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Mesa',
|
||||
fields=[
|
||||
('id', models.AutoField(primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=100)),
|
||||
('location', models.CharField(blank=True, max_length=255, null=True)),
|
||||
('active', models.BooleanField(default=False)),
|
||||
],
|
||||
),
|
||||
]
|
||||
0
mesas/migrations/__init__.py
Normal file
0
mesas/migrations/__init__.py
Normal file
15
mesas/models.py
Normal file
15
mesas/models.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
|
||||
class Mesa(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
name = models.CharField(max_length=100)
|
||||
location = models.CharField(max_length=255, null=True, blank=True)
|
||||
active = models.BooleanField(default=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
# Foreign Key to Comandas model (assuming it exists)
|
||||
# comanda = models.ForeignKey('Comandas', on_delete=models.DO_NOTHING, db_column='id_mesa')
|
||||
7
mesas/serializers.py
Normal file
7
mesas/serializers.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from rest_framework import serializers
|
||||
from .models import Mesa
|
||||
|
||||
class MesaSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Mesa
|
||||
fields = '__all__'
|
||||
36
mesas/templates/mesas.html
Normal file
36
mesas/templates/mesas.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
|
||||
|
||||
|
||||
{% block 'head' %}
|
||||
<link rel="stylesheet" href="{% static 'mesas/css/mesas.css' %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block 'title' %}
|
||||
RRB&C - Mesas
|
||||
{% endblock %}
|
||||
|
||||
{% block 'body' %}
|
||||
|
||||
<body>
|
||||
<div class="grid-container">
|
||||
|
||||
{% for mesa in mesas %}
|
||||
|
||||
<div class="card"
|
||||
{% if mesa.active == True %}
|
||||
style="background-color: indianred;"
|
||||
{% endif %}
|
||||
>{{mesa.name}}
|
||||
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
100
mesas/templates/mesas_map.html
Normal file
100
mesas/templates/mesas_map.html
Normal file
@@ -0,0 +1,100 @@
|
||||
{% extends "base.html" %}
|
||||
{% load static %}
|
||||
{% load custom_filter_tag %}
|
||||
|
||||
|
||||
{% block 'head' %}
|
||||
<link rel="stylesheet" href="{% static 'mesas/css/mesas_map.css' %}">
|
||||
<script src="{% static 'mesas/js/mesas_map.js' %}"></script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block 'title' %}
|
||||
RRB&C - Mapa de Mesas
|
||||
{% endblock %}
|
||||
|
||||
{% block 'body' %}
|
||||
{% csrf_token %}
|
||||
|
||||
<style>
|
||||
#mapa {
|
||||
justify-self: center;
|
||||
width: 1400px;
|
||||
height: 800px;
|
||||
border-radius: 15px;
|
||||
margin-bottom: 20px;
|
||||
background-image: url("{% static 'midia/mapMesa.webp' %}" );
|
||||
background-size: cover;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Mapa de Mesas</h1>
|
||||
<div id="scroll">
|
||||
<div id="mapa" >
|
||||
|
||||
{% for eixo in eixosXY %}
|
||||
<div
|
||||
id="{{eixo.x}}-{{eixo.y}}"
|
||||
class="espaco"
|
||||
style="
|
||||
left: {{eixo.y}}px;
|
||||
top: {{eixo.x}}px;
|
||||
">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<h2 style="justify-self: center;" >Depósito</h2>
|
||||
<div id="drop" >
|
||||
{% for mesa in mesas %}
|
||||
|
||||
{% if mesa.active == True %}
|
||||
|
||||
<div
|
||||
id="{{mesa.id}}"
|
||||
class="m-card"
|
||||
|
||||
ondragend="saveLocal()"
|
||||
draggable="true">
|
||||
<button
|
||||
class="button-popover"
|
||||
popovertarget="my-pop-{{mesa.id}}">
|
||||
{{mesa.name}}
|
||||
</button>
|
||||
<input type="text" hidden value="{{mesa.location}}">
|
||||
</div>
|
||||
|
||||
<div id="my-pop-{{mesa.id}}" popover class="popover">
|
||||
<h4>{{mesa.name}}</h4>
|
||||
{% for comanda in comandas %}
|
||||
{% if comanda.mesa.id == mesa.id %}
|
||||
<div >
|
||||
<a href="{% url 'viewcomanda' %}?parametro={{ comanda.id }}">
|
||||
{{comanda.name}}🔗
|
||||
</a>
|
||||
{{ comanda.id | total }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<div
|
||||
style="background-color: rgb(148, 255, 127);"
|
||||
id="{{mesa.id}}"
|
||||
class="m-card"
|
||||
ondragend="saveLocal()"
|
||||
draggable="true" >
|
||||
{{mesa.name}}
|
||||
<input type="text" hidden value="{{mesa.location}}">
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
3
mesas/tests.py
Normal file
3
mesas/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
11
mesas/urls.py
Normal file
11
mesas/urls.py
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.mesas, name='mesas'),
|
||||
path('mapMesas/', views.mapMesas, name='mapMesas'),
|
||||
path('locationMesa/<int:mesaId>/<str:location>/', views.locationMesa, name='locationMesa'),
|
||||
|
||||
|
||||
]
|
||||
39
mesas/views.py
Normal file
39
mesas/views.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from django.shortcuts import render
|
||||
from django.http import JsonResponse
|
||||
|
||||
from comandas.models import Comanda
|
||||
from mesas.models import Mesa
|
||||
from gestaoRaul.decorators import group_required
|
||||
|
||||
|
||||
def mesas(request):
|
||||
mesas = Mesa.objects.all()
|
||||
return render(request, 'mesas.html', {'mesas': mesas, })
|
||||
|
||||
|
||||
@group_required(groupName='Garçom')
|
||||
def mapMesas(request):
|
||||
eixosXY = []
|
||||
for i in range(0,27):
|
||||
for j in range(0,16):
|
||||
item = {'x':j*50, 'y':i*50}
|
||||
eixosXY.append(item)
|
||||
|
||||
mesas = Mesa.objects.all()
|
||||
comandas = Comanda.objects.filter(status__in=["OPEN", "PAYING"])
|
||||
for mesa in mesas:
|
||||
for comanda in comandas:
|
||||
if mesa.id == comanda.mesa.id:
|
||||
mesa.active = True
|
||||
break
|
||||
for mesa in mesas:
|
||||
print(mesa.active)
|
||||
|
||||
return render(request, 'mesas_map.html', {'comandas': comandas,'mesas': mesas, 'eixosXY': eixosXY})
|
||||
|
||||
def locationMesa(request, mesaId, location):
|
||||
print('inicioul')
|
||||
mesa = Mesa.objects.get(id=mesaId)
|
||||
mesa.location = location
|
||||
mesa.save()
|
||||
return JsonResponse({'status': 'ok'})
|
||||
Reference in New Issue
Block a user