feat: save location mesa_map

This commit is contained in:
2025-01-02 15:17:06 -03:00
parent 79409843d0
commit f8d1373454
8 changed files with 96 additions and 64 deletions

View File

@@ -1,4 +1,6 @@
from django.shortcuts import render,redirect
from django.shortcuts import render,redirect, HttpResponse
from django.http import JsonResponse
from mesas.models import Mesa
@@ -19,6 +21,11 @@ def mapMesas(request):
mesas = Mesa.objects.all()
return render(request, 'mesas_map.html', {'mesas': mesas, 'eixosXY': eixosXY})
def locationMesa(request, mesaId, location):
mesa = Mesa.objects.get(id=mesaId)
mesa.location = location
mesa.save()
return JsonResponse({'status': 'ok'})
# def onOffmesa(request):
# id = request.POST.get('id-mesa')
# mesa_id = int(id)