subcategories and editing for tasks

This commit is contained in:
2026-02-10 19:31:57 +01:00
parent b2f26b66bb
commit 6902ff3373
7 changed files with 389 additions and 81 deletions

View File

@@ -3,11 +3,16 @@
<div class="card" style="border-left: 5px solid {{ entry.activity.color }};">
<div style="display: flex; justify-content: space-between; align-items: start;">
<div>
<h2>{{ entry.activity.name }}</h2>
<h2>
{{ entry.activity.name }}
{% if entry.subcategory %}
<span style="font-size: 0.8rem; background: #eee; padding: 2px 8px; border-radius: 10px; color: #555; vertical-align: middle;">
{{ entry.subcategory }}
</span>
{% endif %}
</h2>
<p style="color: #666;">
{{ entry.start_time.strftime('%A, %d. %B %Y') }}<br>
{{ entry.start_time.strftime('%H:%M') }}
{% if entry.end_time %} - {{ entry.end_time.strftime('%H:%M') }} {% endif %}
{{ entry.start_time.strftime('%A, %d. %B %Y') }}
</p>
</div>
<div style="text-align: right;">
@@ -18,13 +23,36 @@
</div>
<div class="card">
<h3>Session Notes</h3>
<h3>Edit Entry</h3>
<form method="POST">
<textarea name="note" rows="4" style="width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-family: inherit;">{{ entry.note }}</textarea>
<div style="margin-top: 10px; text-align: right;">
<button type="submit" class="btn">Update Note</button>
<input type="hidden" name="action" value="update">
<div style="display: flex; gap: 1rem; margin-bottom: 1rem;">
<div style="flex: 1;">
<label>Start Time</label>
<input type="datetime-local" name="start_time" value="{{ entry.start_time.strftime('%Y-%m-%dT%H:%M') }}" required>
</div>
<div style="flex: 1;">
<label>End Time</label>
<!-- If currently running (end_time is None), prevent editing end time or handle appropriately. Usually logbook is for past entries. -->
<input type="datetime-local" name="end_time" value="{{ entry.end_time.strftime('%Y-%m-%dT%H:%M') if entry.end_time else '' }}">
</div>
</div>
<label>Note</label>
<textarea name="note" rows="3" style="width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-family: inherit;">{{ entry.note }}</textarea>
<div style="margin-top: 10px; display: flex; justify-content: space-between;">
<button type="submit" class="btn">Save Changes</button>
</div>
</form>
<div style="border-top: 1px solid #eee; margin-top: 2rem; padding-top: 1rem;">
<form method="POST" onsubmit="return confirm('Are you sure you want to delete this entry? This action cannot be undone.');">
<input type="hidden" name="action" value="delete">
<button type="submit" class="btn btn-danger">Delete Entry</button>
</form>
</div>
</div>
<div class="card">
@@ -36,7 +64,7 @@
{% for task in tasks %}
<li style="border-bottom: 1px solid #eee; padding: 15px 0; display: flex; align-items: center;">
<span style="margin-right: 15px; font-size: 1.2rem;">
{% if task.status == 'completed' %}{% else %}{% endif %}
{% if task.status == 'completed' %}Done{% else %}Open{% endif %}
</span>
<div style="flex-grow: 1;">
<a href="{{ url_for('task_detail', task_id=task._id) }}" style="font-weight: bold; display: block; font-size: 1.1rem;">{{ task.name }}</a>