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