home · contact · privacy
Improve accounting scripts.
[misc] / todo_templates / day.html
1 {% extends 'base.html' %}
2 {% block css %}
3 table.alternating tr:nth-child(even) {
4     background-color: #cccccc;
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 <h3>edit day</h3>
26 <form id="form_to_watch" action="{{action|e}}" method="POST">
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 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 <details>
34 <summary>done: {{ db.selected_day.todos_sum|round(2) }} ({{ db.selected_day.todos_sum2|round(2)}})</summary>
35 <table class="alternating">
36 {% for todo in done_tasks %}
37 <tr>
38 <td>{{todo.task.current_title|e}}</td>
39 <td>{{todo.effort}}</td>
40 <td>{{todo.comment}}</td>
41 </tr>
42 {% endfor %}
43 </table>
44 </details>
45 <table class="alternating">
46 <tr>
47 <th {% if sort=='title' %}class="desc"{% endif %}><a href="?sort=title">task</a></th>
48 <th {% if sort=='chosen' %}class="desc"{% endif %}><a href="?sort=chosen">todo</a></th>
49 <th {% if sort=='done' %}class="desc"{% endif %}><a href="?sort=done">done</a></th>
50 <th {% if sort=='default_effort' %}class="desc"{% endif %}><a href="?sort=default_effort">effort</a></th>
51 <th {% if sort=='importance' %}class="desc"{% endif %}><a href="?sort=importance">importance</a></th>
52 <th>edit?</th><th>day tags</th>
53 <th {% if sort=='comment' %}class="desc"{% endif %}><a href="?sort=comment">comment</a></th></tr>
54 {% for row in task_rows %}
55 <tr>
56 <input name="t_uuid" value="{{ row.uuid }}" type="hidden" >
57 <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>
58 {% if row.todo %}
59 <td class="checkbox"><input name="choose" type="checkbox" value="{{ row.uuid }}" checked></td>
60 <td class="checkbox"><input name="done" type="checkbox" value="{{ row.uuid }}" {% if row.todo.done %}checked{% endif %}></td>
61 <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>
62 <td class="number"><input name="importance" type="number" step=0.1 size=8 value="{{row.todo.importance}}" ></td>
63 <td><a href="{{db.prefix}}/todo?task={{row.uuid}}&date={{db.selected_date}}&referer=day">edit</a></td>
64 <td>{% for tag in row.todo.day_tags | sort %}<a href="{{db.prefix}}/tags?t_and={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
65 <td>{{ row.todo.comment|e }}</td>
66 {% else %}
67 <td class="checkbox"><input name="choose" type="checkbox" value="{{ row.uuid }}"</td>
68 <td class="checkbox"><input name="done" type="checkbox" value="{{ row.uuid }}"></td>
69 <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>
70 <td class="number"><input name="importance" type="number" step=0.1 size=8 value="1.0" ></td>
71 <td><a href="{{db.prefix}}/todo?task={{row.uuid}}&date={{db.selected_date}}&referer=day">edit</a></td>
72 <td></td>
73 <td></td>
74 <td></td>
75 {% endif %}
76 </tr>
77 {% endfor %}
78 </table>
79 <input type="submit" value="update">
80 </form>
81 {% include 'watch_form.html' %}
82 <script>
83 var day_effort_inputs = document.getElementsByClassName("day_effort_input");
84 for (let i = 0; i < day_effort_inputs.length; i++) {
85     let input = day_effort_inputs[i];
86     let button = document.createElement('button');
87     button.innerHTML = '+' + input.placeholder;
88     button.onclick = function(event) {
89         event.preventDefault();
90         if (input.value) {
91             input.value = parseFloat(input.value) + parseFloat(input.placeholder);
92         } else {
93             input.value = parseFloat(input.placeholder);
94         }
95         input.value = parseFloat(input.value).toFixed(1);
96         formHasChanged = true; 
97     };
98     input.insertAdjacentElement('afterend', button);
99 }
100 </script>
101 {% endblock %}