68 lines
3.2 KiB
Twig
68 lines
3.2 KiB
Twig
<li class="task-list__item{{ not task.isActive ? ' task-list__item--completed' : '' }}">
|
|
<form class="task-list__completion-form">
|
|
<input type="hidden" name="date" value="{{ selected_date|default('now')|date('Y-m-d') }}">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('completion' ~ task.id) }}">
|
|
<input
|
|
id="task-completion-{{ task.id }}"
|
|
class="task-list__checkbox"
|
|
type="checkbox"
|
|
name="completed"
|
|
value="1"
|
|
{{ not task.isActive ? 'checked' : '' }}
|
|
aria-label="Mark {{ task.title }} as {{ task.isActive ? 'completed' : 'active' }}"
|
|
hx-post="{{ path('app_task_toggle_completion', {'id': task.id}) }}"
|
|
hx-include="closest form"
|
|
hx-target="closest .task-list"
|
|
hx-swap="outerHTML"
|
|
>
|
|
<label class="task-list__toggle" for="task-completion-{{ task.id }}" title="Mark {{ task.title }} as {{ task.isActive ? 'completed' : 'active' }}">
|
|
<span class="material-symbols-outlined task-list__toggle-icon task-list__toggle-icon--unchecked" aria-hidden="true">circle</span>
|
|
<span class="material-symbols-outlined task-list__toggle-icon task-list__toggle-icon--checked" aria-hidden="true">check_circle</span>
|
|
<span class="visually-hidden">Mark {{ task.title }} as {{ task.isActive ? 'completed' : 'active' }}</span>
|
|
</label>
|
|
<a class="task-list__title" href="{{ path('app_task_edit', {'id': task.id}) }}">{{ task.title }}</a>
|
|
{% if task.isRecurring %}
|
|
<span class="task-list__recurrence">Every {{ task.recurrenceInterval }} {{ task.recurrenceUnit }}{{ task.recurrenceInterval != 1 ? 's' : '' }}</span>
|
|
{% endif %}
|
|
</form>
|
|
|
|
{% if task.isActive %}
|
|
<form
|
|
class="task-list__snooze-form"
|
|
hx-post="{{ path('app_task_snooze', {'id': task.id}) }}"
|
|
hx-target="closest .task-list"
|
|
hx-swap="outerHTML"
|
|
>
|
|
<input type="hidden" name="date" value="{{ selected_date|default('now')|date('Y-m-d') }}">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('snooze' ~ task.id) }}">
|
|
<label class="visually-hidden" for="task-snooze-{{ task.id }}">Snooze {{ task.title }}</label>
|
|
<select id="task-snooze-{{ task.id }}" name="snooze">
|
|
<option value="tomorrow">Tomorrow</option>
|
|
<option value="two_days">2 days</option>
|
|
<option value="week">1 week</option>
|
|
<option value="custom">Custom date</option>
|
|
</select>
|
|
<label class="visually-hidden" for="task-snooze-date-{{ task.id }}">Custom snooze date</label>
|
|
<input id="task-snooze-date-{{ task.id }}" type="date" name="custom_date" min="{{ selected_date|default('now')|date_modify('+1 day')|date('Y-m-d') }}">
|
|
<button type="submit">Snooze</button>
|
|
</form>
|
|
{% endif %}
|
|
|
|
<form
|
|
class="task-list__remove-form"
|
|
hx-post="{{ path('app_task_delete', {'id': task.id}) }}"
|
|
hx-target="closest .task-list__item"
|
|
hx-swap="delete"
|
|
hx-confirm="Remove {{ task.title }}?"
|
|
>
|
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ task.id) }}">
|
|
<button class="task-list__remove" type="submit" aria-label="Remove {{ task.title }}" title="Remove {{ task.title }}">
|
|
<span class="material-symbols-outlined" aria-hidden="true">delete</span>
|
|
</button>
|
|
</form>
|
|
<a class="task-list__title" href="{{ path('app_task_edit', {'id': task.id}) }}">
|
|
<span class="material-symbols-outlined" aria-hidden="true">edit</span>
|
|
</a>
|
|
|
|
</li>
|