Dev #71
@@ -508,10 +508,11 @@ function onBoardSelectChange(bId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. Data van specifiek bord inladen
|
// 2. Data van specifiek bord inladen
|
||||||
async function loadBoardData(boardId) {
|
async function loadBoardData(boardId, showLoader = true) {
|
||||||
currentBoardId = boardId;
|
currentBoardId = boardId;
|
||||||
document.getElementById('linkToTimeline')?.setAttribute('href', `/timeline.php?board_id=${boardId}`);
|
document.getElementById('linkToTimeline')?.setAttribute('href', `/timeline.php?board_id=${boardId}`);
|
||||||
const container = document.getElementById('boardLanesContainer');
|
const container = document.getElementById('boardLanesContainer');
|
||||||
|
if (showLoader) {
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<div class="flex items-center justify-center w-full py-20 text-slate-400 text-sm">
|
<div class="flex items-center justify-center w-full py-20 text-slate-400 text-sm">
|
||||||
<i data-lucide="loader-2" class="w-5 h-5 animate-spin mr-2"></i>
|
<i data-lucide="loader-2" class="w-5 h-5 animate-spin mr-2"></i>
|
||||||
@@ -519,6 +520,7 @@ async function loadBoardData(boardId) {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
if (typeof lucide !== 'undefined') lucide.createIcons();
|
if (typeof lucide !== 'undefined') lucide.createIcons();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/api/board.php?action=get_board_data&board_id=${boardId}`);
|
const res = await fetch(`/api/board.php?action=get_board_data&board_id=${boardId}`);
|
||||||
@@ -567,9 +569,13 @@ function onCardDragStart(e, cardId) {
|
|||||||
function onCardDragEnd(e) {
|
function onCardDragEnd(e) {
|
||||||
if (draggedCardId) {
|
if (draggedCardId) {
|
||||||
const el = document.getElementById(`card-${draggedCardId}`);
|
const el = document.getElementById(`card-${draggedCardId}`);
|
||||||
if (el) el.classList.remove('opacity-40');
|
if (el) el.classList.remove('opacity-40', 'pointer-events-none');
|
||||||
draggedCardId = null;
|
draggedCardId = null;
|
||||||
}
|
}
|
||||||
|
// Verwijder eventuele achtergebleven opacity op alle kaarten
|
||||||
|
document.querySelectorAll('[id^="card-"].opacity-40').forEach(el => {
|
||||||
|
el.classList.remove('opacity-40', 'pointer-events-none');
|
||||||
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
isDraggingCard = false;
|
isDraggingCard = false;
|
||||||
}, 150);
|
}, 150);
|
||||||
@@ -599,6 +605,23 @@ async function onLaneDrop(e, targetLaneId) {
|
|||||||
|
|
||||||
const rawId = draggedCardId || e.dataTransfer.getData('text/plain');
|
const rawId = draggedCardId || e.dataTransfer.getData('text/plain');
|
||||||
const cardId = parseInt(rawId, 10);
|
const cardId = parseInt(rawId, 10);
|
||||||
|
|
||||||
|
// Direct re-activeren van het gesleepte element
|
||||||
|
const activeEl = cardId ? document.getElementById(`card-${cardId}`) : null;
|
||||||
|
if (activeEl) {
|
||||||
|
activeEl.classList.remove('opacity-40', 'pointer-events-none');
|
||||||
|
// Optimistic DOM append als dropZone en element bestaan
|
||||||
|
const emptyNotice = dropZone.querySelector('.pointer-events-none');
|
||||||
|
if (emptyNotice && emptyNotice.innerText.includes('Geen taken')) {
|
||||||
|
emptyNotice.remove();
|
||||||
|
}
|
||||||
|
dropZone.appendChild(activeEl);
|
||||||
|
}
|
||||||
|
draggedCardId = null;
|
||||||
|
setTimeout(() => {
|
||||||
|
isDraggingCard = false;
|
||||||
|
}, 150);
|
||||||
|
|
||||||
if (!cardId) return;
|
if (!cardId) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -611,7 +634,7 @@ async function onLaneDrop(e, targetLaneId) {
|
|||||||
target_position: 999
|
target_position: 999
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
await loadBoardData(currentBoardId);
|
await loadBoardData(currentBoardId, false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Fout bij verplaatsen taak:', err);
|
console.error('Fout bij verplaatsen taak:', err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -628,6 +628,10 @@ async function handleCanvasLaneDrop(e, targetCategory) {
|
|||||||
const cardEl = document.getElementById(`card-${cardId}`);
|
const cardEl = document.getElementById(`card-${cardId}`);
|
||||||
if (!cardEl) return;
|
if (!cardEl) return;
|
||||||
|
|
||||||
|
// Directe reactivatie van de kaart
|
||||||
|
cardEl.classList.remove('opacity-40', 'scale-[0.98]', 'pointer-events-none');
|
||||||
|
document.querySelectorAll('.opacity-40.scale-\\[0\\.98\\]').forEach(el => el.classList.remove('opacity-40', 'scale-[0.98]', 'pointer-events-none'));
|
||||||
|
|
||||||
const sourceLane = cardEl.closest('.brainstorm-lane');
|
const sourceLane = cardEl.closest('.brainstorm-lane');
|
||||||
const sourceCategory = sourceLane ? sourceLane.getAttribute('data-category') : null;
|
const sourceCategory = sourceLane ? sourceLane.getAttribute('data-category') : null;
|
||||||
|
|
||||||
|
|||||||
@@ -405,6 +405,14 @@ async function handleRoadmapQuarterDrop(e, targetQuarter) {
|
|||||||
const itemId = draggedRoadmapItemId || parseInt(e.dataTransfer.getData('text/plain'), 10);
|
const itemId = draggedRoadmapItemId || parseInt(e.dataTransfer.getData('text/plain'), 10);
|
||||||
draggedRoadmapItemId = null;
|
draggedRoadmapItemId = null;
|
||||||
|
|
||||||
|
if (itemId) {
|
||||||
|
const el = document.getElementById(`roadmap-item-${itemId}`);
|
||||||
|
if (el) el.classList.remove('opacity-40', 'scale-[0.99]', 'pointer-events-none');
|
||||||
|
}
|
||||||
|
document.querySelectorAll('[id^="roadmap-item-"].opacity-40').forEach(el => {
|
||||||
|
el.classList.remove('opacity-40', 'scale-[0.99]', 'pointer-events-none');
|
||||||
|
});
|
||||||
|
|
||||||
if (!itemId || !targetQuarter) return;
|
if (!itemId || !targetQuarter) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -573,6 +573,13 @@ function renderTimelineLaneDropBar() {
|
|||||||
dropBadge.classList.remove('ring-2', 'ring-indigo-500', 'bg-indigo-100', 'dark:bg-indigo-900/60');
|
dropBadge.classList.remove('ring-2', 'ring-indigo-500', 'bg-indigo-100', 'dark:bg-indigo-900/60');
|
||||||
const cardIdStr = e.dataTransfer.getData('text/plain');
|
const cardIdStr = e.dataTransfer.getData('text/plain');
|
||||||
const cardId = parseInt(cardIdStr, 10);
|
const cardId = parseInt(cardIdStr, 10);
|
||||||
|
if (cardId) {
|
||||||
|
const el = document.querySelector(`.timeline-row[data-card-id="${cardId}"]`);
|
||||||
|
if (el) el.classList.remove('opacity-50', 'bg-indigo-50/50', 'dark:bg-indigo-950/30', 'pointer-events-none');
|
||||||
|
}
|
||||||
|
document.querySelectorAll('.timeline-row.opacity-50').forEach(el => {
|
||||||
|
el.classList.remove('opacity-50', 'bg-indigo-50/50', 'dark:bg-indigo-950/30', 'pointer-events-none');
|
||||||
|
});
|
||||||
if (cardId && lane.id) {
|
if (cardId && lane.id) {
|
||||||
await moveTimelineCardToLane(cardId, lane.id);
|
await moveTimelineCardToLane(cardId, lane.id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user