home · contact · privacy
Improve accounting scripts.
[misc] / todo_templates / do_todos.html
diff --git a/todo_templates/do_todos.html b/todo_templates/do_todos.html
new file mode 100644 (file)
index 0000000..7a8ae82
--- /dev/null
@@ -0,0 +1,85 @@
+{% extends 'base.html' %}
+{% block css %}
+table.alternating tr:nth-child(even) {
+    background-color: #cccccc;
+}
+table.alternating tr:nth-child(odd) {
+    background-color: #ffffff;
+}
+th, td { text-align: left}
+th.desc { background: linear-gradient(to bottom, white, grey); }
+th.center { text-align: center; }
+td.checkbox, td.number { height: 0.1em; padding: 0em; text-align: center; }
+td.checkbox { width: 0.1em; text-align: center; }
+td button { height: 1.5em; padding: 0em; margin: 0em }
+input[type="number"] { text-align: right; }
+th.desc { background: linear-gradient(to bottom, white, grey); }
+{% endblock %}
+{% block content %}
+<form action="do_todos" method="POST">
+{% include 'tagfilters.html' %}
+<br />
+<input name="hide_done" type="checkbox" {% if hide_done %}checked{% endif %} /> hide done
+<input type="submit" name="filter" value="filter" />
+</form>
+<h3>do day</h3>
+<form id="form_to_watch" action="do_todos" method="POST">
+<p>
+| <a href="do_todos?date={{prev_date}}">prev</a> | {{day.date}} | <a href="do_todos?date={{next_date}}">next</a> | 
+comment: <input name="day_comment" value="{{day.comment|e}}">
+<input type="submit" value="update">
+<input type="hidden" name="date" value="{{day.date}}" />
+</p>
+<table class="alternating">
+<tr>
+<th {% if sort=='done' %}class="desc"{% endif %}><a href="?sort=done">done</a></th>
+<th class="center{% if sort=='default_effort' %} desc{% endif %}"><a href="?sort=default_effort">effort</a></th>
+<th {% if sort=='importance' %}class ="desc"{% endif %}><a href="?sort=importance">importance</a></th>
+<th {% if sort=='title' %}class="desc"{% endif %}><a href="?sort=title">todo</a></th>
+<th>comment</th>
+{% for todo in todos %}
+<tr>
+<input name="todo_id" value="{{todo.id_}}" type="hidden" >
+<td class="checkbox">
+{% if todo.children %}
+{% if todo.done %}✓{% else %}&nbsp;&nbsp;{% endif %}
+{% else %}
+<input name="done" type="checkbox" value="{{todo.id_}}" {% if todo.done %}checked{% endif %}>
+{% endif %}
+</td>
+<td class="number">
+{% if todo.children %}
+<input type="hidden" name="effort" value="0" />
+{% else %}
+<input class="effort_input" name="effort" type="number" step=0.1 size=7 value="{% if todo.day_effort is not none %}{{todo.day_effort}}{% endif %}" placeholder={{"%.1f"|format(todo.task.default_effort.then)}} >
+{% endif %}
+</td>
+<td class="number"><input name="importance" type="number" step=0.1 size=7 value={{todo.importance}} } ></td>
+<td><a href="todo?id={{todo.id_}}">{{todo.path}}{{todo.title}}</a></td>
+<td><input name="effort_comment" type="text" size=100 value="{{todo.comment|e}}" /></td>
+</tr>
+{% endfor %}
+</table>
+<input type="submit" value="update">
+</form>
+{% include 'watch_form.html' %}
+<script>
+var effort_inputs = document.getElementsByClassName("effort_input");
+for (let i = 0; i < effort_inputs.length; i++) {
+    let input = effort_inputs[i];
+    let button = document.createElement('button');
+    button.innerHTML = '+' + parseFloat(input.placeholder).toFixed(1);
+    button.onclick = function(event) {
+        event.preventDefault();
+        if (input.value) {
+            input.value = parseFloat(input.value) + parseFloat(input.placeholder);
+        } else {
+            input.value = parseFloat(input.placeholder);
+        }
+        input.value = parseFloat(input.value).toFixed(1);
+        formHasChanged = true; 
+    };
+    input.insertAdjacentElement('afterend', button);
+}
+</script>
+{% endblock %}