first version of defer/sick mode

This commit is contained in:
Joren de Graaf
2026-09-07 17:34:23 +02:00
parent e5e8c4e339
commit 39130cce8d
28 changed files with 914 additions and 73 deletions
+7 -1
View File
@@ -20,7 +20,13 @@
{% endif %}
</head>
<body>
<header><img src="{{ asset('build/images/logo.png') }}" class="logo" alt="Logo">TaskNest <img src="{{ asset('build/images/TaskNestMascots.png') }}" class="mascots" alt="Mascots"></header>
<header>
<img src="{{ asset('build/images/logo.png') }}" class="logo" alt="Logo">TaskNest
{% if app.user %}
<a class="settings-link" href="{{ path('app_settings') }}">Settings</a>
{% endif %}
<img src="{{ asset('build/images/TaskNestMascots.png') }}" class="mascots" alt="Mascots">
</header>
{% block body %}{% endblock %}
</body>
</html>
+35
View File
@@ -0,0 +1,35 @@
{% extends 'base.html.twig' %}
{% block title %}Settings{% endblock %}
{% block body %}
<main class="container container-flex--narrow">
<p><a href="{{ path('app_task_index') }}">← Back to tasks</a></p>
<section class="settings-page" aria-labelledby="settings-title">
<h1 id="settings-title">Settings</h1>
<section class="settings-page__section" aria-labelledby="sick-day-title">
<h2 id="sick-day-title">Sick Day Mode</h2>
<p>Non-essential tasks are deferred until recovery. Tasks marked “Required on sick days” remain available.</p>
{{ form_start(form) }}
{{ form_row(form.sickModeEnabled) }}
{{ form_row(form.sickUntil) }}
<button class="btn btn-primary" type="submit">Save settings</button>
{{ form_end(form) }}
{% if settings.isSickOn(today) %}
<p class="settings-page__status">Sick Day Mode is active{% if settings.sickUntil %} through {{ settings.sickUntil|date('j F') }}{% endif %}.</p>
{% elseif settings.sickModeEnabled and settings.sickUntil %}
<p class="settings-page__status">The saved recovery date has passed, so Sick Day Mode is no longer affecting tasks.</p>
{% endif %}
</section>
<section class="settings-page__section" aria-labelledby="weather-settings-title">
<h2 id="weather-settings-title">Weather location</h2>
<p>{{ settings.hasLocation ? 'Your saved location is used for weather-aware task suggestions.' : 'Set your weather location from the Tasks page.' }}</p>
</section>
</section>
</main>
{% endblock %}
+2
View File
@@ -24,6 +24,8 @@
<div>{{ form_row(form.estimatedDurationMinutes) }}</div>
<div>{{ form_row(form.priority) }}</div>
<div>{{ form_row(form.category) }}</div>
<div>{{ form_row(form.requiredOnSickDay) }}</div>
<div>{{ form_row(form.deferDays) }}</div>
</div>
<div class="task-composer__row">
<div>{{ form_row(form.scheduledFor) }}</div>
+23
View File
@@ -25,6 +25,29 @@
<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}) }}"
+3
View File
@@ -4,6 +4,9 @@
{% endblock %}
{% block body %}
<a class="user" href="{{ path('app_user_index') }}">
{% if user.username != "" %} {{ user.username|first }}{% endif %}
</a>
<div class="container">
<div class="task-list-header">
<button class="weather-location" type="button" data-weather-location data-location-url="{{ path('app_task_location') }}" data-location-token="{{ csrf_token('weather_location') }}">
+4
View File
@@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_user_delete', {'id': user.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ user.id) }}">
<button class="btn">Delete</button>
</form>
+4
View File
@@ -0,0 +1,4 @@
{{ form_start(form) }}
{{ form_widget(form) }}
<button class="btn">{{ button_label|default('Save') }}</button>
{{ form_end(form) }}
+13
View File
@@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}
{% block title %}Edit User{% endblock %}
{% block body %}
<h1>Edit User</h1>
{{ include('user/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_user_index') }}">back to list</a>
{{ include('user/_delete_form.html.twig') }}
{% endblock %}
+41
View File
@@ -0,0 +1,41 @@
{% extends 'base.html.twig' %}
{% block title %}User index{% endblock %}
{% block body %}
<h1>User index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Email</th>
<th>Roles</th>
<th>Password</th>
<th>Username</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td>{{ user.email }}</td>
<td>{{ user.roles ? user.roles|json_encode : '' }}</td>
<td>{{ user.password }}</td>
<td>{{ user.username }}</td>
<td>
<a href="{{ path('app_user_show', {'id': user.id}) }}">show</a>
<a href="{{ path('app_user_edit', {'id': user.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="6">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_user_new') }}">Create new</a>
{% endblock %}
+11
View File
@@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New User{% endblock %}
{% block body %}
<h1>Create new User</h1>
{{ include('user/_form.html.twig') }}
<a href="{{ path('app_user_index') }}">back to list</a>
{% endblock %}
+38
View File
@@ -0,0 +1,38 @@
{% extends 'base.html.twig' %}
{% block title %}User{% endblock %}
{% block body %}
<h1>User</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ user.id }}</td>
</tr>
<tr>
<th>Email</th>
<td>{{ user.email }}</td>
</tr>
<tr>
<th>Roles</th>
<td>{{ user.roles ? user.roles|json_encode : '' }}</td>
</tr>
<tr>
<th>Password</th>
<td>{{ user.password }}</td>
</tr>
<tr>
<th>Username</th>
<td>{{ user.username }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_user_index') }}">back to list</a>
<a href="{{ path('app_user_edit', {'id': user.id}) }}">edit</a>
{{ include('user/_delete_form.html.twig') }}
{% endblock %}