home · contact · privacy
Improve accounting scripts.
[misc] / todo_templates / day_todos.html
diff --git a/todo_templates/day_todos.html b/todo_templates/day_todos.html
new file mode 100644 (file)
index 0000000..8cf87fb
--- /dev/null
@@ -0,0 +1,240 @@
+{% extends 'base.html' %}
+
+
+
+{% block css %}
+td.checkbox { text-align: center; }
+td { vertical-align: middle; }
+td button { padding: 0em; }
+th.centered { text-align: center; }
+ul { padding-left: 1.5em; margin: 0; }
+details > summary.todo {
+    list-style-type: '    ';
+}
+details > summary.has_dependers {
+    list-style-type: '[+]:';
+}
+details[open] > summary.has_dependers {
+    list-style-type: '[▼]:';
+}
+details > summary.has_deps::after {
+    content: ':[+]';
+}
+details[open] > summary.has_deps::after {
+    content: ':[▼]';
+}
+table.undone_todos tr.deps_undone {
+    background-color: #cccccc;
+}
+details.adoptables {
+    margin-bottom: 1em;
+}
+details.adoptables summary span {
+    background-color: #cccccc; 
+}
+table.undone_todos tr td {
+    border-bottom: 1px dotted black;
+}
+td.left { text-align: left; }
+td.unbreakable { white-space: nowrap; }
+{% endblock %}
+
+
+
+{% macro todo_title_expandable(todo, show_deps_doneness, ignore=0) %}
+{% if todo.has_dependers or todo.has_deps %}
+<details>
+<summary class="todo {% if todo.has_dependers %}has_dependers{% endif %} {% if todo.has_deps %}has_deps{% endif %}">
+{% else %}
+&nbsp;&nbsp;&nbsp;&nbsp;
+{% endif %}
+<a href="todo?id={{todo.id_}}&return_to=day_todos">{{todo.title|e}}</a>
+{% if todo.has_dependers or todo.has_deps %}
+</summary>
+{% if todo.has_dependers %}
+dependers:
+<ul>
+{% for path in todo.depender_paths %}
+<li>{% for depender_todo in path %}<a href="todo?id={{depender_todo.id_}}&return_to=day_todos">{{ depender_todo.title|e }}</a>{% if not loop.last %}:{% endif %}{% endfor %}
+{% endfor %}
+</ul>
+{% endif %}
+{% if todo.has_deps %}
+depends on:
+<ul>
+{% for dep_todo in todo.deps %}
+<li>
+{% if show_deps_doneness == true %}{{ macros.doneness_string(dep_todo) }}{% endif %}
+<a href="todo?id={{dep_todo.id_}}&return_to=day_todos">{{ dep_todo.title|e }}</a>{% if dep_todo.has_deps %}:+{% endif %}
+{% endfor %}
+</ul>
+{% endif %}
+</details>
+{% endif %}
+{% endmacro %}
+
+
+
+{% macro todo_title_as_tree_node(todo, indent) %}
+{% for i in range(indent-1) %}&nbsp; &nbsp;{% endfor %}
+{% if indent>0 %}&nbsp;+{% endif %}
+{% if todo.been_observed %}({% endif %}<a href="todo?id={{todo.id_}}&return_to=day_todos">{{todo.title}}</a>{% if todo.been_observed %}){% endif %}
+{% endmacro %}
+
+
+
+{% macro draw_undone_todo_row(todo, title_drawer, indent_or_doneness) %}
+<tr {% if todo.deps_done == false %}class="deps_undone"{% endif %}>
+{% if todo.already_listed %}
+<td class="checkbox"><input type="checkbox" disabled /></td>
+<td class="number left"><input type="number" value="{{todo.day_effort}}" size=7 disabled /></td>
+<td class="number"><input type="number" value="{{todo.importance}}" size=7 disabled /></td>
+<td>
+{{ title_drawer(todo, indent_or_doneness ) }}
+</td>
+<td><input value="{{todo.comment|e}}" size=100 disabled /></td>
+{% else %}
+<input name="todo_id" value="{{todo.id_}}" type="hidden" >
+<td class="checkbox">
+<input name="done" type="checkbox" value="{{todo.id_}}" {% if todo.done %}checked{% endif %} {% if todo.deps_done == false %}disabled{% endif %}>
+</td>
+<td class="number unbreakable">
+<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)}} >
+</td>
+<td class="number">
+<input name="importance" type="number" step=0.1 size=7 value={{todo.importance}} } >
+</td>
+<td>
+{{ title_drawer(todo, indent_or_doneness) }}
+</td>
+<td>
+<input name="effort_comment" type="text" size=100 value="{{todo.comment|e}}" />
+</td>
+{% endif %}
+</tr>
+{% endmacro %}
+
+
+
+{% macro draw_done_todo_row(todo, title_drawer, indent) %}
+<tr>
+<td class="number">{{ '{:4.1f}'.format(todo.effort_at_selected_date) }}</td>
+<td class="number">{{ '{:4.1f}'.format(todo.effort_at_selected_date + todo.dep_efforts) }}</td>
+<td>
+{{ title_drawer(todo, indent) }}
+</td>
+</td>
+</td>
+<td>{{ todo.comment }}</td>
+</tr>
+{% endmacro %}
+
+
+
+{% macro draw_todo_rows(todos, is_tree_shaped, todo_row_drawer, indent, show_deps_doneness=false) %}
+{% for todo in todos %}
+{% if is_tree_shaped %}
+{{ todo_row_drawer(todo, todo_title_as_tree_node, indent) }}
+{% if not todo.been_observed and todo.deps %}
+{{ draw_todo_rows(todo.deps, is_tree_shaped, todo_row_drawer, indent+1) }}
+{% endif %}
+{% else %}
+{{ todo_row_drawer(todo, todo_title_expandable, show_deps_doneness) }}
+{% endif %}
+{{ todo.observe() }}
+{% endfor %}
+{% endmacro %}
+
+
+
+{% block content %}
+<h3>day todos</h3>
+
+<form id="form_to_watch" action="day_todos" method="POST">
+{% include 'tagfilters.html' %}
+<br />
+<input id="filter_button" type="submit" name="filter" value="filter" />
+<p>
+| <a href="day_todos?date={{prev_date}}">prev</a> | {{day.date}} | <a href="day_todos?date={{next_date}}">next</a> | 
+comment: <input name="day_comment" value="{{day.comment|e}}">
+<input class="update" type="submit" name="update" value="update">
+<input type="hidden" name="date" value="{{day.date}}" />
+| show as {% if is_tree_shaped %}<a href="?tree=0">flat</a>|<b>tree</b>{% else %}<b>flat</b>|<a href="?tree=1">tree</a>{% endif %}
+</p>
+
+<h3>undone</h3>
+<p>
+task quick-add: <input name="choose_task" size=50 list="tasks" autocomplete="off">
+don't adopt, make new: <input type="checkbox" name="dont_adopt" />
+</p>
+{{ macros.datalist_tasks(all_tasks, with_weight=true) }}
+
+{% if adoptable_past_todos %}
+<details class="adoptables">
+<summary><span>there are adoptable/unfinished past todos ({{adoptable_past_todos|count}})</span></summary>
+<table class="alternating">
+<tr>
+<th>adopt?</th><th>date</th><th>title</th><th>comment</th>
+</tr
+{% for todo in adoptable_past_todos %}
+<tr>
+<td class="checkbox"><input name="choose_todo" type="checkbox" value="{{todo.id_}}"></td>
+<td>{{todo.earliest_date}}</td>
+<td><a href="todo?id={{todo.id_}}">{{todo.title|e}}</a></td>
+<td>{{todo.comment|e}}</td>
+</tr>
+{% endfor %}
+</table>
+</details>
+{% endif %}
+
+{% if undone_todos %} 
+<table class="undone_todos">
+<tr>
+{{ macros.sort_head(undone_sort, "sort_done", "done", "undone_sort") }}
+{{ macros.sort_head(undone_sort, "default_effort", "effort", "undone_sort") }}
+{{ macros.sort_head(undone_sort, "importance", "importance", "undone_sort") }}
+{{ macros.sort_head(undone_sort, "title", "todo", "undone_sort") }}
+<th>comment</th>
+</tr>
+{{ draw_todo_rows(undone_todos, is_tree_shaped, draw_undone_todo_row, 0, show_deps_doneness=true) }}
+{% endif %}
+
+</table>
+<input id="update_button" class="update" type="submit" name="update" value="update">
+</form>
+
+{% if done_todos %}
+<h3>done</h3>
+<table class="alternating">
+<tr>
+{{ macros.sort_head(done_sort, "effort_at_selected_date", "single<br />effort", "done_sort") }}
+{{ macros.sort_head(done_sort, "family_effort", "family<br />effort", "done_sort") }}
+{{ macros.sort_head(done_sort, "title", "todo", "done_sort") }}
+<th>comment</th>
+</tr>
+{{ draw_todo_rows(done_todos, is_tree_shaped, draw_done_todo_row, 0) }}
+</table>
+{% endif %}
+
+{% 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);
+        changes_to_commit = true; 
+    };
+    input.insertAdjacentElement('afterend', button);
+}
+</script>
+{% endblock %}