Added 'add task' functionality
This commit is contained in:
@@ -60,4 +60,8 @@ pre {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
background: white;
|
background: white;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#taskCard {
|
||||||
|
margin-top: 45%;
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="historyContent"></div>
|
<div id="historyContent"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="addTask" class="screen" style="display: none;">Add Task</div>
|
<div id="addTask" class="screen" style="display: none;">
|
||||||
|
<article class="card" id="taskCard">
|
||||||
|
<header>
|
||||||
|
<h1>New task</h1> <br>
|
||||||
|
<label for="newTaskName">Task name</label>
|
||||||
|
<input type="text" id="newTaskName"> <br>
|
||||||
|
<label for="newTaskPoints">Task points</label>
|
||||||
|
<input type="number" id="newTaskPoints" min="1" max="5"> <br>
|
||||||
|
<input onclick="newTask()" value="Create" type="submit"> <br>
|
||||||
|
</header>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="menu" class="flex three demo">
|
<div id="menu" class="flex three demo">
|
||||||
<div class="third" id="taskButton">
|
<div class="third" id="taskButton">
|
||||||
@@ -50,8 +61,8 @@
|
|||||||
<span class="button" onclick="switchScreen('history')">History</span>
|
<span class="button" onclick="switchScreen('history')">History</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="third" id="addButton">
|
<div class="third" id="addButton">
|
||||||
<!-- <span class="button tooltip-top" onclick="switchScreen('add')" disabled data-tooltip="In construction">+ Task</span>-->
|
<span class="button tooltip-top" onclick="switchScreen('add')" >+ Task</span>
|
||||||
<span class="button tooltip-top" disabled data-tooltip="In construction">+ Task</span>
|
<!-- <span class="button tooltip-top" disabled data-tooltip="In construction">+ Task</span>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -155,4 +155,20 @@ async function switchScreen(button) {
|
|||||||
} else if (button === "add") {
|
} else if (button === "add") {
|
||||||
document.getElementById("addTask").setAttribute("style", "");
|
document.getElementById("addTask").setAttribute("style", "");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function newTask() {
|
||||||
|
let points = document.getElementById(`newTaskPoints`).value;
|
||||||
|
let name = document.getElementById(`newTaskName`).value;
|
||||||
|
await fetch("/addTask", {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
tid: 0,
|
||||||
|
name: name,
|
||||||
|
points: Number(points),
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user