mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
matriz do mapa de mesas
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,6 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Mesa(models.Model):
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
{% load static %}
|
||||
|
||||
|
||||
|
||||
{% block 'head' %}
|
||||
<link rel="stylesheet" href="{% static 'mesas/css/mesas.css' %}">
|
||||
{% endblock %}
|
||||
@@ -15,21 +14,76 @@ RRB&C - Mapa de Mesas
|
||||
|
||||
|
||||
|
||||
<!-- <div class="card"
|
||||
{% if mesa.active == True %}
|
||||
style="background-color: indianred;"
|
||||
{% endif %}
|
||||
>{{mesa.name}}
|
||||
</div> -->
|
||||
<style>
|
||||
.container {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.column {
|
||||
border: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.task {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
background: #f0f0f0;
|
||||
padding: 10px;
|
||||
cursor: move;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function eventEnter(event) {
|
||||
console.log(event)
|
||||
}
|
||||
|
||||
const columns = document.querySelectorAll('.column');
|
||||
|
||||
columns.forEach(column => {
|
||||
column.addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
column.addEventListener('drop', (e) => {
|
||||
const task = document.querySelector('.dragging');
|
||||
column.appendChild(task);
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('dragstart', (e) => {
|
||||
e.target.classList.remove('dragging');
|
||||
});
|
||||
|
||||
document.addEventListener('dragend', (e) => {
|
||||
e.target.classList.add('dragging');
|
||||
});
|
||||
|
||||
</script>
|
||||
<div id="mapa">
|
||||
|
||||
{% for eixo in eixosXY %}
|
||||
<div
|
||||
id="{{eixo.y}}-{{eixo.y}}"
|
||||
class="column"
|
||||
ondragenter="eventEnter(event)"
|
||||
style="background-color: rgba(0, 0, 255, 0.103);
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
left: {{eixo.y}}px;
|
||||
top: {{eixo.x}}px;position: absolute"></div>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% for mesa in mesas %}
|
||||
|
||||
|
||||
{% if mesa.active == True %}
|
||||
<div class="m-card" style= " {{ mesa.location }} background-color: indianred;" >{{mesa.name}}</div>
|
||||
<div class="m-card" ondragend="eventEnter(event)" draggable="true" style=" background-color: indianred;" >{{mesa.name}}</div>
|
||||
{% else %}
|
||||
<div class="m-card" style= " {{ mesa.location }} " >{{mesa.name}}</div>
|
||||
<div class="m-card" ondragend="eventEnter(event)" draggable="true" >{{mesa.name}}</div>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
@@ -38,26 +92,4 @@ style="background-color: indianred;"
|
||||
|
||||
|
||||
|
||||
<!-- <body>
|
||||
<div class="grid-container">
|
||||
|
||||
{% for mesa in mesas %}
|
||||
|
||||
<div class="card" style="right: 20px; bottom: 30px;">Elemento 2</div>
|
||||
|
||||
<div class="card"
|
||||
{% if mesa.active == True %}
|
||||
style="background-color: indianred;"
|
||||
{% endif %}
|
||||
>{{mesa.name}}
|
||||
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
|
||||
</div>
|
||||
</body> -->
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -10,8 +10,14 @@ def mesas(request):
|
||||
|
||||
|
||||
def mapMesas(request):
|
||||
eixosXY = []
|
||||
for i in range(0,25):
|
||||
for j in range(0,15):
|
||||
item = {'x':j*50, 'y':i*50}
|
||||
eixosXY.append(item)
|
||||
|
||||
mesas = Mesa.objects.all()
|
||||
return render(request, 'mesas_map.html', {'mesas': mesas})
|
||||
return render(request, 'mesas_map.html', {'mesas': mesas, 'eixosXY': eixosXY})
|
||||
|
||||
# def onOffmesa(request):
|
||||
# id = request.POST.get('id-mesa')
|
||||
|
||||
Reference in New Issue
Block a user