Add task occurrence scheduling and card completion workflow
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
Duration flexible
|
||||
{% endif %}
|
||||
{% if recommendation.task.is_recurring %} · Recurring{% endif %}
|
||||
{% if recommendation.task.scheduled_time %} · {{ recommendation.task.scheduled_time|time:'H:i' }} {{ recommendation.task.time_zone }}{% endif %}
|
||||
{% if not recommendation.task.is_active %} · Paused{% endif %}
|
||||
{% if recommendation.task.weather_profile != 'none' %} · {{ recommendation.task.get_weather_profile_display }}{% endif %}
|
||||
{% if recommendation.task.weather_shifted_from %} · Moved from {{ recommendation.task.weather_shifted_from|date:'l' }} — {{ recommendation.task.weather_shift_reason }}{% endif %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<article class="task-card{% if not task.is_active %} task-card--inactive{% endif %}{% if task.is_completed %} task-card--completed{% endif %}" id="task-{{ task.pk }}">
|
||||
<div class="task-card__topline">
|
||||
<span class="priority priority--{{ task.priority }}">{{ task.get_priority_display }}</span>
|
||||
<time datetime="{{ task.scheduled_for|date:'Y-m-d' }}">{{ task.scheduled_for|date:"D, j M" }}</time>
|
||||
<time datetime="{{ task.scheduled_for|date:'Y-m-d' }}">{{ task.scheduled_for|date:"D, j M" }}{% if task.scheduled_time %} at {{ task.scheduled_time|time:'H:i' }}{% endif %}</time>
|
||||
</div>
|
||||
<h2><a href="{% url 'planner:task-detail' task.pk %}">{{ task.title }}</a></h2>
|
||||
{% if task.description %}<p class="task-card__description">{{ task.description|truncatewords:20 }}</p>{% endif %}
|
||||
@@ -18,6 +18,9 @@
|
||||
<p class="subtask-count"><span aria-hidden="true">↳</span> {{ task.subtasks.count }} subtask{{ task.subtasks.count|pluralize }}{% if task.is_completed %} unlocked{% else %} — complete this task to unlock{% endif %}</p>
|
||||
{% endif %}
|
||||
<footer class="task-card__footer">
|
||||
{% if task.is_recurring %}
|
||||
<a class="button button--compact" href="{% url 'planner:task-detail' task.pk %}">View occurrences</a>
|
||||
{% else %}
|
||||
<form method="post" action="{% url 'planner:task-toggle-completed' task.pk %}" hx-post="{% url 'planner:task-toggle-completed' task.pk %}" hx-target="#task-list" hx-swap="innerHTML">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="status" value="{{ current_filter|default:'active' }}">
|
||||
@@ -26,6 +29,7 @@
|
||||
{% if task.is_completed %}Completed — reopen{% else %}Mark complete{% endif %}
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
<form method="post" action="{% url 'planner:task-toggle-active' task.pk %}" hx-post="{% url 'planner:task-toggle-active' task.pk %}" hx-target="#task-list" hx-swap="innerHTML">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="status" value="{{ current_filter|default:'active' }}">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div>
|
||||
<p class="eyebrow">{{ task.get_priority_display }} priority{% if task.category %} · {{ task.category }}{% endif %}</p>
|
||||
<h1>{{ task.title }}</h1>
|
||||
<p class="detail-card__date">Scheduled for <time datetime="{{ task.scheduled_for|date:'Y-m-d' }}">{{ task.scheduled_for|date:"l, j F Y" }}</time></p>
|
||||
<p class="detail-card__date">Scheduled for <time datetime="{{ task.scheduled_for|date:'Y-m-d' }}">{{ task.scheduled_for|date:"l, j F Y" }}</time>{% if task.scheduled_time %} at {{ task.scheduled_time|time:'H:i' }} {{ task.time_zone }}{% endif %}</p>
|
||||
</div>
|
||||
<div class="detail-card__actions">
|
||||
<a class="button button--secondary" href="{% url 'planner:task-update' task.pk %}">Edit task</a>
|
||||
@@ -28,6 +28,49 @@
|
||||
</dl>
|
||||
</div>
|
||||
</article>
|
||||
{% if task.is_recurring %}
|
||||
<section class="subtasks-section" aria-labelledby="occurrences-heading">
|
||||
<h2 id="occurrences-heading">Upcoming occurrences</h2>
|
||||
<p class="muted">Each date keeps its own completion state. Edit task changes the series.</p>
|
||||
<ul class="subtasks-list occurrence-list">
|
||||
{% for occurrence in occurrences %}
|
||||
<li>
|
||||
<div class="occurrence-list__summary">
|
||||
<strong>{{ occurrence.scheduled_date|date:'l, j F Y' }}</strong>
|
||||
<span>{% if occurrence.scheduled_time %}{{ occurrence.scheduled_time|time:'H:i' }} · {% endif %}{{ occurrence.get_status_display }}</span>
|
||||
</div>
|
||||
<form class="occurrence-list__complete" method="post" action="{% url 'planner:task-toggle-completed' task.pk %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="selected_date" value="{{ occurrence.scheduled_date|date:'Y-m-d' }}">
|
||||
<input type="hidden" name="return_to_task_detail" value="1">
|
||||
<button class="button button--compact" type="submit">{% if occurrence.status == 'completed' %}Reopen{% else %}Complete{% endif %} {{ occurrence.scheduled_date|date:'j M' }}</button>
|
||||
</form>
|
||||
<form class="occurrence-list__form" method="post" action="{% url 'planner:task-occurrence-update' task.pk %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="scheduled_date" value="{{ occurrence.scheduled_date|date:'Y-m-d' }}">
|
||||
<label for="occurrence-time-{{ occurrence.pk }}">Time for {{ occurrence.scheduled_date|date:'j M' }}</label>
|
||||
<input id="occurrence-time-{{ occurrence.pk }}" type="time" name="scheduled_time" value="{{ occurrence.scheduled_time|time:'H:i' }}">
|
||||
<button class="button button--compact" type="submit">Save time</button>
|
||||
</form>
|
||||
<form class="occurrence-list__form occurrence-list__form--state" method="post" action="{% url 'planner:task-occurrence-update' task.pk %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="scheduled_date" value="{{ occurrence.scheduled_date|date:'Y-m-d' }}">
|
||||
<label for="occurrence-status-{{ occurrence.pk }}">State for {{ occurrence.scheduled_date|date:'j M' }}</label>
|
||||
<select id="occurrence-status-{{ occurrence.pk }}" name="status">
|
||||
<option value="pending"{% if occurrence.status == 'pending' %} selected{% endif %}>Pending</option>
|
||||
<option value="completed"{% if occurrence.status == 'completed' %} selected{% endif %}>Completed</option>
|
||||
<option value="skipped"{% if occurrence.status == 'skipped' %} selected{% endif %}>Skipped</option>
|
||||
<option value="snoozed"{% if occurrence.status == 'snoozed' %} selected{% endif %}>Snoozed</option>
|
||||
</select>
|
||||
<label for="occurrence-snooze-{{ occurrence.pk }}">Snooze until</label>
|
||||
<input id="occurrence-snooze-{{ occurrence.pk }}" type="date" name="snoozed_until" value="{{ occurrence.snoozed_until|date:'Y-m-d' }}">
|
||||
<button class="button button--compact" type="submit">Save state</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% if task.subtasks.all %}
|
||||
<section class="subtasks-section" aria-labelledby="subtasks-heading">
|
||||
<p class="eyebrow">Break it down</p>
|
||||
|
||||
Reference in New Issue
Block a user