feat: arrastar mesas tambem para depósito

This commit is contained in:
2025-01-03 15:58:44 -03:00
parent 42f3e02b0d
commit a2d751e88f
4 changed files with 27 additions and 5 deletions

Binary file not shown.

View File

@@ -40,16 +40,19 @@ RRB&C - Mapa de Mesas
{% endfor %}
</div>
<h2>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" style=" position: absolute; background-color: indianred;" >{{mesa.name}} <input type="text" hidden value="{{mesa.location}}"> </div>
<div id="{{mesa.id}}" class="m-card" ondragend="saveLocal()" draggable="true" style=" background-color: indianred;" >{{mesa.name}} <input type="text" hidden value="{{mesa.location}}"> </div>
{% else %}
<div id="{{mesa.id}}" class="m-card" ondragend="saveLocal()" draggable="true" >{{mesa.name}} <input type="text" hidden value="{{mesa.location}}"></div>
{% endif %}
{% endfor %}
</div>
{% endblock %}

View File

@@ -55,3 +55,14 @@
border: 0.3px solid #cccccc56;
padding: 0px;
}
#drop {
display: flex;
background-color: rgb(75, 75, 75);
border-radius: 15px;
padding: 15px;
margin: 15px;
min-height: 300px;
max-width: 1370px;
}

View File

@@ -44,8 +44,13 @@ function saveLocal() {
const mesaElement = event.target;
const targetElement = event.target.parentNode;
const mesaId = mesaElement.id
const targetId = targetElement.id;
const parentNodeClass = targetElement.classList.value
console.log(parentNodeClass)
if (parentNodeClass == 'espaco' || targetId == 'drop'){
const url = `/mesas/locationMesa/${mesaId}/${targetId}/`;
var resposta = fetch(url, {method: 'POST',
headers: {'Content-Type': 'application/json',
@@ -61,6 +66,9 @@ var resposta = fetch(url, {method: 'POST',
console.log(document.cookie)
console.error('Erro ao salvar local:', error);
});
}else{
alert('Aqui não pode!!!')
}
}