home · contact · privacy
Imporove todo accounting.
[misc] / todo_templates / day.html
1 {% extends 'base.html' %}
2 {% block css %}
3 table.alternating tr:nth-child(even) {
4     background-color: #f2f2f2;
5 }
6 table.alternating tr:nth-child(odd) {
7     background-color: #ffffff;
8 }
9 td.checkbox, td.number { height: 0.1em; padding: 0em; text-align: center; }
10 td.checkbox { width: 0.1em }
11 td button { height: 1.5em; padding: 0em; margin: 0em }
12 td details { display: inline }
13 input[type="number"] { text-align: right; }
14 {% endblock %}
15 {% block content %}
16 <form action="{{action|e}}" method="POST">
17 {% include 'tagfilters.html' %}
18 <p>
19 <input name="expect_unchosen_done" type="hidden" value="1"/>
20 <input name="hide_unchosen" type="checkbox" {% if db.hide_unchosen %}checked{% endif %} /> hide unchosen <input name="hide_done" type="checkbox" {% if db.hide_done %}checked{% endif %} /> hide done
21 </p>
22 </form>
23
24 <form id="form_to_watch" action="{{action|e}}" method="POST">
25 <h3>edit day</h3>
26 <p>
27 <a href="{{db.prefix}}/day?selected_date={{prev_date}}">prev</a> | {{db.selected_date}} | <a href="{{db.prefix}}/day?selected_date={{next_date}}">next</a> | 
28 {{ db.selected_day.todos_sum|round(2) }} ({{ db.selected_day.todos_sum2|round(2)}}) |
29 comment: <input name="day_comment" value="{{ db.selected_day.comment|e }}">
30 <input type="submit" value="update">
31 <input type="hidden" name="selected_date" value="{{ db.selected_date }}" />
32 </p>
33 <table class="alternating">
34 <tr><th><a href="?sort=title">task</a></th><th><a href="?sort=chosen">choose?</a></th><th><a href="?sort=done">done?</a></th><th><a href="?sort=default_effort">effort</a></th><th><a href="?sort=importance">importance</a></th><th>edit?</th><th>day tags</th><th><a href="?sort=comment">comment</a></th></tr>
35 {% for row in task_rows %}
36 <tr>
37 <input name="t_uuid" value="{{ row.uuid }}" type="hidden" >
38 <td><details><summary>] <a href="{{db.prefix}}/task?id={{ row.uuid }}" />{{ row.task.current_title|e }}</a></summary>tags: {% for tag in row.task.tags | sort %}<a href="{{db.prefix}}/day?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</details></td>
39 {% if row.todo %}
40 <td class="checkbox"><input name="choose" type="checkbox" value="{{ row.uuid }}" checked></td>
41 <td class="checkbox"><input name="done" type="checkbox" value="{{ row.uuid }}" {% if row.todo.done %}checked{% endif %}></td>
42 <td class="number"><input class="day_effort_input" name="day_effort" type="number" step=0.1 size=8 value="{% if row.todo.day_effort is not none %}{{ row.todo.day_effort }}{% endif %}" placeholder={{ row.task.current_default_effort }} ></td>
43 <td class="number"><input name="importance" type="number" step=0.1 size=8 value="{{row.todo.importance}}" ></td>
44 <td><a href="{{db.prefix}}/todo?task={{row.uuid}}&date={{db.selected_date}}">edit</a></td>
45 <td>{% for tag in row.todo.day_tags | sort %}<a href="{{db.prefix}}/tags?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
46 <td>{{ row.todo.comment|e }}</td>
47 {% else %}
48 <td class="checkbox"><input name="choose" type="checkbox" value="{{ row.uuid }}"</td>
49 <td class="checkbox"><input name="done" type="checkbox" value="{{ row.uuid }}"></td>
50 <td class="number"><input class="day_effort_input" name="day_effort" type="number" step=0.1 size=8 placeholder={{ row.task.current_default_effort }} ></td>
51 <td class="number"><input name="importance" type="number" step=0.1 size=8 value="1.0" ></td>
52 <td><a href="{{db.prefix}}/todo?task={{row.uuid}}&date={{db.selected_date}}">edit</a></td>
53 <td></td>
54 <td></td>
55 <td></td>
56 {% endif %}
57 </tr>
58 {% endfor %}
59 </table>
60 <input type="submit" value="update">
61 </form>
62 {% include 'watch_form.html' %}
63 <script>
64 var day_effort_inputs = document.getElementsByClassName("day_effort_input");
65 for (let i = 0; i < day_effort_inputs.length; i++) {
66     let input = day_effort_inputs[i];
67     let button = document.createElement('button');
68     button.innerHTML = '+' + input.placeholder;
69     button.onclick = function(event) {
70         event.preventDefault();
71         if (input.value) {
72             input.value = parseFloat(input.value) + parseFloat(input.placeholder);
73         } else {
74             input.value = parseFloat(input.placeholder);
75         }
76         input.value = parseFloat(input.value).toFixed(1);
77         formHasChanged = true; 
78     };
79     input.insertAdjacentElement('afterend', button);
80 }
81 </script>
82 {% endblock %}