home · contact · privacy
ea1b324c3c76af56642842a5b3adaa6b819a3d2b
[misc] / todo_templates / pick_tasks.html
1 {% extends 'base.html' %}
2 {% block css %}
3 td.number { text-align: right; }
4 table.alternating tr:nth-child(even) {
5     background-color: #cccccc;
6 }
7 table.alternating tr:nth-child(odd) {
8     background-color: #ffffff;
9 }
10 th { text-align: left; background-color: white; border: 1px solid black; }
11 th.desc { background: linear-gradient(to bottom, white, grey); }
12 {% endblock %}
13 {% block content %}
14 <form action="pick_tasks" method="POST">
15 {% include 'tagfilters.html' %}
16 <br />
17 <input name="hide_chosen_tasks" type="checkbox" {% if hide_chosen_tasks %}checked{% endif %} /> hide chosen tasks<br />
18 search: <input name="search" value="{{search|e}}" />
19 <input type="submit" name="filter" value="filter" />
20 </form>
21
22 <h3>pick todos for day</h3>
23 <p><a href="pick_tasks?date={{prev_date}}">prev</a> | {{day.date}} | <a href="pick_tasks?date={{next_date}}">next</a> | {{day.comment}}</p>
24 <form id="form_to_watch" action="{{action|e}}" method="POST">
25 <input type="hidden" name="date" value="{{day.date}}" />
26 <input id="pick_upper" type="submit" value="pick" />
27 <table class="alternating">
28 <tr>
29 <th>do</th>
30 <th {% if sort=='effort' %}class="desc"{% endif %}><a href="?sort=effort">effort</a></th>
31 <th {% if sort=='title' %}class="desc"{% endif %}><a href="?sort=title">what</a></th>
32 <th>comment</th>
33 </tr>
34 {% for todo in chosen_todos %}
35 <tr>
36 <td class="checkbox">
37 <input name="chosen_todo" {% if todo.done or todo.day_effort %}class="protected"{% endif %} type="checkbox" value="{{todo.id_}}" checked>
38 </td>
39 <td class="number">
40 {% if todo.day_effort %}{{todo.day_effort}}&nbsp;{% else %}({{todo.default_effort}}){% endif %}{% if todo.done and not "cancelled" in todo.contemporary_tags%}✓{% else %}&nbsp;{% endif %}</td>
41 <td><a href="todo?id={{todo.id_}}">{% if "cancelled" in todo.contemporary_tags %}<s>{% endif %}{% if "deadline" in todo.contemporary_tags %}DEADLINE: {% endif %}<a href="todo?id={{todo.id_}}&return_to=pick_tasks" />{{todo.path|e}}{{todo.title|e}}</a>{%if "cancelled" in todo.contemporary_tags%}</s>{% endif %}</a></td>
42 <td>{{todo.comment|e}}</td>
43 </tr>
44 {% endfor %}
45 <tr>
46 <th colspan=4>earlier todos to continue</th>
47 </tr>
48 {% for todo in relevant_todos %}
49 <tr>
50 <td class="checkbox">
51 <input name="choose_todo" type="checkbox" value="{{todo.id_}}">
52 </td>
53 <td class="number">{{todo.all_days_effort}}/{{todo.default_effort}}</td>
54 <td><a href="todo?id={{todo.id_}}">{{todo.day.date}} {{todo.task.title.then|e}}</a></td>
55 <td>{{todo.comment|e}}</td>
56 </tr>
57 {% endfor %}
58 <th colspan=4>tasks</th>
59 {% for task in tasks %}
60 <tr>
61 <td class="checkbox">
62 <input name="choose_task" type="checkbox" value="{{task.id_}}">
63 </td>
64 <td class="number">({{task.default_effort.then}})&nbsp;</td>
65 <td><a href="task?id={{ task.id_ }}&return_to=pick_tasks" />{{ task.title.then|e }}</a></td>
66 <td>{{task.comment|e}}</td>
67 </tr>
68 {% endfor %}
69 </table>
70 <input type="hidden" name="search" value="{{search|e}}" />
71 <input id="pick_lower" type="submit" value="pick" />
72 </form>
73 {% include 'watch_form.html' %}
74 <script>
75 function make_selectables_toggler(neighbor_id, input_name) {
76     var neighbor = document.getElementById(neighbor_id);
77     var button = document.createElement('button');
78     button.textContent = 'toggle selectables';
79     button.onclick = function(event) {
80         event.preventDefault();
81         let checkboxes = document.getElementsByName(input_name);
82         for (let i = 0; i < checkboxes.length; i++) {
83             if (checkboxes[i].classList.contains('protected')) { 
84                 continue;       
85         }
86             checkboxes[i].click();
87             formHasChanged = true;
88         }
89     }
90     neighbor.insertAdjacentElement('afterend', button);
91 }
92 make_selectables_toggler('pick_upper', 'chosen_todo');
93 make_selectables_toggler('pick_lower', 'choose_task');
94 </script>
95 {% endblock %}
96