From 68c1920bef5ac759e029027ea532b847ca95e450 Mon Sep 17 00:00:00 2001 From: mrafeie Date: Wed, 16 Sep 2026 14:00:23 +0100 Subject: [PATCH 1/4] Add date input and delete button to todo list --- Sprint-3/todo-list/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sprint-3/todo-list/index.html b/Sprint-3/todo-list/index.html index 4d12c4654..e372757ba 100644 --- a/Sprint-3/todo-list/index.html +++ b/Sprint-3/todo-list/index.html @@ -15,9 +15,10 @@

My ToDo List

+
- + From 567be66c17dd462789baa8245f93da72498d32b4 Mon Sep 17 00:00:00 2001 From: mrafeie Date: Wed, 16 Sep 2026 14:01:10 +0100 Subject: [PATCH 2/4] Enhance todo list with deadline and delete feature Added deadline functionality to tasks and implemented delete completed tasks feature. --- Sprint-3/todo-list/script.mjs | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Sprint-3/todo-list/script.mjs b/Sprint-3/todo-list/script.mjs index ba0b2ceae..94ad91aad 100644 --- a/Sprint-3/todo-list/script.mjs +++ b/Sprint-3/todo-list/script.mjs @@ -7,7 +7,9 @@ const todos = []; // Set up tasks to be performed once on page load window.addEventListener("load", () => { document.getElementById("add-task-btn").addEventListener("click", addNewTodo); - + document + .getElementById("delete-completed-btn") + .addEventListener("click", deleteCompletedTodos); // Populate sample data Todos.addTask(todos, "Wash the dishes", false); Todos.addTask(todos, "Do the shopping", true); @@ -15,20 +17,25 @@ window.addEventListener("load", () => { render(); }); - +function deleteCompletedTodos() { + Todos.deleteCompleted(todos); + render(); +} // A callback that reads the task description from an input field and // append a new task to the todo list. function addNewTodo() { const taskInput = document.getElementById("new-task-input"); + const deadlineInput = document.getElementById("deadline-input"); const task = taskInput.value.trim(); + const deadline = deadlineInput.value; if (task) { - Todos.addTask(todos, task, false); + Todos.addTask(todos, task, false, deadline); + console.log(todos); render(); } - taskInput.value = ""; + deadlineInput.value = ""; } - // Note: // - Store the reference to the