30-06-24
15
// InÃcio do script
const todoColumn = document.getElementById('todoColumn');
const inProgressColumn = document.getElementById('inProgressColumn');
const reviewColumn = document.getElementById('reviewColumn');
const doneColumn = document.getElementById('doneColumn');
let orderNumber = 1;
const dragStart = (event) => {
event.target.classList.add('dragging');
};
const dragEnd = (event) => {
event.target.classList.remove('dragging');
saveToLocalStorage(); // Salva após mover o card
};
const dragOver = (event) => {
event.preventDefault();
};
const dragEnter = (event) => {
event.preventDefault();
const currentColumn = event.target.closest('.column__cards');
if (currentColumn) {
currentColumn.classList.add('column--highlight');
}
};
const dragLeave = (event) => {
const currentColumn = event.target.closest('.column__cards');
if (currentColumn) {
currentColumn.classList.remove('column--highlight');
}
};
const drop = (event) => {
event.preventDefault();
const currentColumn = event.target.closest('.column__cards');
const draggedCard = document.querySelector('.card.dragging');
if (currentColumn && draggedCard) {
currentColumn.appendChild(draggedCard);
currentColumn.classList.remove('column--highlight');
updateCardBackground(draggedCard, currentColumn);
updateOrderCount();
saveToLocalStorage(); // Salva após o drop
}
};
const createCard = (order) => {
const card = document.createElement('section');
card.className = 'card';
card.draggable = true;
const circleColor = getCircleColor(order.priority);
card.innerHTML = `
Ordem #${order.number} - ${order.tipo}
${order.description}
Manutentor: ${order.manut
1
34
Comment