diff --git a/gestaoRaul/comandas/__pycache__/urls.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/urls.cpython-310.pyc index 39c253f..a79bde7 100644 Binary files a/gestaoRaul/comandas/__pycache__/urls.cpython-310.pyc and b/gestaoRaul/comandas/__pycache__/urls.cpython-310.pyc differ diff --git a/gestaoRaul/comandas/__pycache__/views.cpython-310.pyc b/gestaoRaul/comandas/__pycache__/views.cpython-310.pyc index eaf9595..2e07121 100644 Binary files a/gestaoRaul/comandas/__pycache__/views.cpython-310.pyc and b/gestaoRaul/comandas/__pycache__/views.cpython-310.pyc differ diff --git a/gestaoRaul/comandas/templates/comandas.html b/gestaoRaul/comandas/templates/comandas.html index 97f1dd2..7abc4b3 100644 --- a/gestaoRaul/comandas/templates/comandas.html +++ b/gestaoRaul/comandas/templates/comandas.html @@ -1,12 +1,33 @@ {% extends "base.html" %} +{% load static %} {% block 'title' %} -Type Pay +Comandas{% endblock %} +{% block 'head' %} + {% endblock %} - {% block 'body' %} -Body Type Pay + +body> +
+ + {% for comanda in comandas %} + +
{{comanda.name}} + + +
+ + {% endfor %} + + +
+ + + + + {% endblock %} \ No newline at end of file diff --git a/gestaoRaul/comandas/templates/viewcomanda.html b/gestaoRaul/comandas/templates/viewcomanda.html new file mode 100644 index 0000000..e202a90 --- /dev/null +++ b/gestaoRaul/comandas/templates/viewcomanda.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} +{% load static %} + + + + +{% block 'title' %} +Comandas{% endblock %} +{% block 'head' %} + +{% endblock %} +{% block 'body' %} + +body> +
+

{{comanda.id}}

+

{{comanda.name}}

+

{{comanda.mesa}}

+

{{comanda.dt_open}}

+ + + +
+ + + + + +{% endblock %} \ No newline at end of file diff --git a/gestaoRaul/comandas/urls.py b/gestaoRaul/comandas/urls.py index c739f6d..4b9539a 100644 --- a/gestaoRaul/comandas/urls.py +++ b/gestaoRaul/comandas/urls.py @@ -4,6 +4,7 @@ from . import views urlpatterns = [ path('', views.comandas, name='comandas'), + path('viewcomanda/', views.viewComanda, name='viewcomanda'), diff --git a/gestaoRaul/comandas/views.py b/gestaoRaul/comandas/views.py index e60abb5..8f5c437 100644 --- a/gestaoRaul/comandas/views.py +++ b/gestaoRaul/comandas/views.py @@ -1,6 +1,19 @@ -from django.shortcuts import render +from django.shortcuts import render, redirect + +from comandas.models import Comanda # Create your views here. def comandas(request): - return render(request, 'comandas.html') \ No newline at end of file + comandas = Comanda.objects.all() + return render(request, 'comandas.html', {'comandas': comandas}) + + + + +def viewComanda(request): + id = request.GET.get('parametro') + comanda_id = int(id) + comanda = Comanda.objects.get(id=comanda_id) + + return render(request, 'viewcomanda.html', {'comanda': comanda}) \ No newline at end of file diff --git a/gestaoRaul/db.sqlite3 b/gestaoRaul/db.sqlite3 index 71dc958..7e27881 100644 Binary files a/gestaoRaul/db.sqlite3 and b/gestaoRaul/db.sqlite3 differ diff --git a/gestaoRaul/mesas/__pycache__/models.cpython-310.pyc b/gestaoRaul/mesas/__pycache__/models.cpython-310.pyc index ff8112c..fced26a 100644 Binary files a/gestaoRaul/mesas/__pycache__/models.cpython-310.pyc and b/gestaoRaul/mesas/__pycache__/models.cpython-310.pyc differ diff --git a/gestaoRaul/mesas/__pycache__/urls.cpython-310.pyc b/gestaoRaul/mesas/__pycache__/urls.cpython-310.pyc index 9b9e2f6..2d248ea 100644 Binary files a/gestaoRaul/mesas/__pycache__/urls.cpython-310.pyc and b/gestaoRaul/mesas/__pycache__/urls.cpython-310.pyc differ diff --git a/gestaoRaul/mesas/__pycache__/views.cpython-310.pyc b/gestaoRaul/mesas/__pycache__/views.cpython-310.pyc index f5a2ffb..1eb4a2c 100644 Binary files a/gestaoRaul/mesas/__pycache__/views.cpython-310.pyc and b/gestaoRaul/mesas/__pycache__/views.cpython-310.pyc differ diff --git a/gestaoRaul/mesas/models.py b/gestaoRaul/mesas/models.py index 82e7191..1326f82 100644 --- a/gestaoRaul/mesas/models.py +++ b/gestaoRaul/mesas/models.py @@ -9,5 +9,8 @@ class Mesa(models.Model): 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') \ No newline at end of file diff --git a/gestaoRaul/mesas/templates/mesas.html b/gestaoRaul/mesas/templates/mesas.html index 8d6631d..97b05b3 100644 --- a/gestaoRaul/mesas/templates/mesas.html +++ b/gestaoRaul/mesas/templates/mesas.html @@ -18,7 +18,21 @@ RRB&C - Mesas {% for mesa in mesas %} -
{{mesa.name}}
+
{{mesa.name}} + + +
+ {% csrf_token %} + + +
+ + +
{% endfor %} diff --git a/gestaoRaul/mesas/urls.py b/gestaoRaul/mesas/urls.py index 5b3cfff..d3dfc51 100644 --- a/gestaoRaul/mesas/urls.py +++ b/gestaoRaul/mesas/urls.py @@ -4,6 +4,8 @@ from . import views urlpatterns = [ path('', views.mesas, name='mesas'), + path('onOffmesa/', views.onOffmesa, name='onOffmesa'), + diff --git a/gestaoRaul/mesas/views.py b/gestaoRaul/mesas/views.py index f5b7780..fc6e1cc 100644 --- a/gestaoRaul/mesas/views.py +++ b/gestaoRaul/mesas/views.py @@ -1,4 +1,4 @@ -from django.shortcuts import render +from django.shortcuts import render,redirect from mesas.models import Mesa @@ -6,4 +6,14 @@ from mesas.models import Mesa def mesas(request): mesas = Mesa.objects.all() - return render(request, 'mesas.html', {'mesas': mesas}) \ No newline at end of file + return render(request, 'mesas.html', {'mesas': mesas}) + + + +def onOffmesa(request): + id = request.POST.get('id-mesa') + mesa_id = int(id) + mesa = Mesa.objects.get(id=mesa_id) + mesa.active = not mesa.active + mesa.save() + return redirect('mesas') \ No newline at end of file diff --git a/gestaoRaul/products/__pycache__/views.cpython-310.pyc b/gestaoRaul/products/__pycache__/views.cpython-310.pyc index 309fb18..5a72202 100644 Binary files a/gestaoRaul/products/__pycache__/views.cpython-310.pyc and b/gestaoRaul/products/__pycache__/views.cpython-310.pyc differ diff --git a/gestaoRaul/templates/base.html b/gestaoRaul/templates/base.html index 7cc6df3..86972ac 100644 --- a/gestaoRaul/templates/base.html +++ b/gestaoRaul/templates/base.html @@ -22,7 +22,7 @@