40 lines
1.3 KiB
Cheetah
40 lines
1.3 KiB
Cheetah
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>{{ .title }}</title>
|
|
{{template "head" .}}
|
|
</head>
|
|
<body>
|
|
{{template "navbar" .}}
|
|
|
|
<div class="position-absolute top-50 start-50 translate-middle">
|
|
<div class="fs-3">{{ .title }}</div>
|
|
<hr>
|
|
<div id="tasks"></div>
|
|
</div>
|
|
|
|
{{template "scripts" .}}
|
|
<script>
|
|
userLoggedIn().then((loggedIn) => !loggedIn ? redirect("/view/login") : getAllTasks());
|
|
const tasksEl = document.getElementById("tasks");
|
|
|
|
function getAllTasks() {
|
|
axios.get("/tasks", axiosConfig).then((response) => {
|
|
const tasks = response.data.tasks;
|
|
[...tasks]
|
|
.forEach((task) => {
|
|
const newTask = document.createElement('div');
|
|
newTask.classList.add('row', 'g-0', 'align-items-center', 'mb-1');
|
|
newTask.innerHTML = `
|
|
<div class="col-2 overflow-ellipsis text-end pe-4">${task.ID}</div>
|
|
<div class="col-6 overflow-ellipsis">${task.Description}</div>
|
|
<div class="col-2 overflow-ellipsis text-end">${task.Done}</div>
|
|
`;
|
|
tasksEl.appendChild(newTask);
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|