ID: ${todo.id}
Created: ${todo.creationDate}
Next: ${todo.nextDate || ''}
Due: ${todo.dueDate || ''}
Status: ${todo.status || ''}
Urgent: ${todo.urgent}
Importance: ${todo.importance}
Prio: ${todo.prio}
Est.: ${todo.timeEstimation}m
Spent: ${todo.actualTime}m
Category: ${todo.category || ''}
Task: ${todo.task}
Coms: ${todo.coms ? `
Link` : ''}
Link: ${todo.link ? `
Link` : ''}
Comments: ${todo.comments || ''}
Linked: ${todo.linkedTasks || ''}
`).join('');
}
function addTodo(e) {
e.preventDefault();
const task = document.getElementById('task').value.trim();
const creationDate = document.getElementById('creation-date').value || new Date().toISOString().slice(0,10);
const nextDate = document.getElementById('next-date').value;
const dueDate = document.getElementById('due-date').value;
const status = document.getElementById('status').value;
const urgent = parseInt(document.getElementById('urgent').value) || 1;
const importance = parseInt(document.getElementById('importance').value) || 1;
const prio = urgent * importance;
const timeEstimation = parseInt(document.getElementById('time-estimation').value) || 0;
const actualTime = parseInt(document.getElementById('actual-time').value) || 0;
let category = document.getElementById('category').value.trim();
if (category && !categories.includes(category)) {
categories.push(category);
}
const coms = document.getElementById('coms').value.trim();
const link = document.getElementById('link').value.trim();
const comments = document.getElementById('comments').value.trim();
const linkedTasks = document.getElementById('linked-tasks').value.trim();
const todo = {
id: getNextId(),
creationDate,
nextDate,
dueDate,
status,
urgent,
importance,
prio,
timeEstimation,
actualTime,
category,
task,
coms,
link,
comments,
linkedTasks
};
todos.push(todo);
saveTodos();
renderForm();
renderTodos();
document.getElementById('todo-form').reset();
}
function init() {
loadTodos();
renderForm();
renderTodos();
document.getElementById('todo-form').addEventListener('submit', addTodo);
}
document.addEventListener('DOMContentLoaded', init);
// Password protection placeholder (to be implemented if needed)
// If you want to enable password, set a flag in localStorage and show/hide #password-section accordingly.