`).join('');
// Add Drag and Drop listeners
boardView.querySelectorAll('.atl-task-card').forEach(card => {
card.addEventListener('dragstart', e => e.dataTransfer.setData('text/plain', e.target.dataset.issueId));
});
boardView.querySelectorAll('.atl-board-column').forEach(col => {
col.addEventListener('dragover', e => e.preventDefault());
col.addEventListener('drop', e => {
e.preventDefault();
const issueId = e.dataTransfer.getData('text/plain');
const newStatus = e.currentTarget.dataset.status;
const issue = issuesData.find(i => i.ID === issueId);
if (issue) {
issue.Status = newStatus;
renderAll();
}
});
});
}
// --- TABLE RENDERING ---
function renderIssuesTable() {
const table = document.getElementById('issues-table');
const headers = ['ID', 'Summary', 'Assignee', 'Status', 'Priority', 'Story Points', 'Actions'];
table.innerHTML = `
${headers.map(h => `| ${h} | `).join('')}
${issuesData.map(issue => `
| ${issue.ID} |
|
|
|
|
|
|
`).join('')}
`;
}
// --- DATA MANIPULATION (CRUD) ---
window.atl_updateIssue = (id, key, value) => {
const issue = issuesData.find(i => i.ID === id);
if (issue) issue[key] = value;
renderAll();
};
window.atl_addIssue = () => {
const newId = `PROJ-${Math.max(0, ...issuesData.map(i => parseInt(i.ID.split('-')[1]))) + 1}`;
issuesData.unshift({
ID: newId, Summary: 'New issue summary', Assignee: ASSIGNEES[0], Status: 'To Do',
Priority: 'Medium', 'Story Points': 1
});
renderAll();
};
window.atl_removeIssue = (id) => {
issuesData = issuesData.filter(i => i.ID !== id);
renderAll();
};
// --- INITIALIZATION ---
function initialize() {
issuesData = [
{ ID: 'PROJ-101', Summary: 'Set up user authentication flow', Assignee: 'Alex', Status: 'Done', Priority: 'High', 'Story Points': 5 },
{ ID: 'PROJ-102', Summary: 'Design the main dashboard UI', Assignee: 'Brenda', Status: 'In Review', Priority: 'High', 'Story Points': 8 },
{ ID: 'PROJ-103', Summary: 'Develop the API for user profiles', Assignee: 'Charlie', Status: 'In Progress', Priority: 'Medium', 'Story Points': 5 },
{ ID: 'PROJ-104', Summary: 'Fix login button bug on mobile', Assignee: 'Alex', Status: 'In Progress', Priority: 'High', 'Story Points': 2 },
{ ID: 'PROJ-105', Summary: 'Write documentation for the API', Assignee: 'Dana', Status: 'To Do', Priority: 'Low', 'Story Points': 3 },
{ ID: 'PROJ-106', Summary: 'Set up CI/CD pipeline', Assignee: 'Charlie', Status: 'Done', Priority: 'Medium', 'Story Points': 8 },
{ ID: 'PROJ-107', Summary: 'Research new charting libraries', Assignee: 'Brenda', Status: 'To Do', Priority: 'Low', 'Story Points': 2 },
];
renderAll();
}
initialize();
});