Added Task crud

This commit is contained in:
Joren de Graaf
2026-08-07 21:37:38 +02:00
parent 5026d1cedb
commit cb1c9acefc
15 changed files with 665 additions and 5 deletions
+4
View File
@@ -0,0 +1,4 @@
<form method="post" action="{{ path('app_task_delete', {'id': task.id}) }}" onsubmit="return confirm('Are you sure you want to delete this item?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ task.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 Task{% endblock %}
{% block body %}
<h1>Edit Task</h1>
{{ include('task/_form.html.twig', {'button_label': 'Update'}) }}
<a href="{{ path('app_task_index') }}">back to list</a>
{{ include('task/_delete_form.html.twig') }}
{% endblock %}
+51
View File
@@ -0,0 +1,51 @@
{% extends 'base.html.twig' %}
{% block title %}Task index{% endblock %}
{% block body %}
<h1>Task index</h1>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Description</th>
<th>EstimatedDurationMinutes</th>
<th>Priority</th>
<th>Category</th>
<th>IsRecurring</th>
<th>IsActive</th>
<th>CreatedAt</th>
<th>UpdatedAt</th>
<th>actions</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}
<tr>
<td>{{ task.id }}</td>
<td>{{ task.title }}</td>
<td>{{ task.description }}</td>
<td>{{ task.estimatedDurationMinutes }}</td>
<td>{{ task.priority }}</td>
<td>{{ task.category }}</td>
<td>{{ task.isRecurring ? 'Yes' : 'No' }}</td>
<td>{{ task.isActive ? 'Yes' : 'No' }}</td>
<td>{{ task.createdAt ? task.createdAt|date('Y-m-d H:i:s') : '' }}</td>
<td>{{ task.updatedAt ? task.updatedAt|date('Y-m-d H:i:s') : '' }}</td>
<td>
<a href="{{ path('app_task_show', {'id': task.id}) }}">show</a>
<a href="{{ path('app_task_edit', {'id': task.id}) }}">edit</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="11">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
<a href="{{ path('app_task_new') }}">Create new</a>
{% endblock %}
+11
View File
@@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block title %}New Task{% endblock %}
{% block body %}
<h1>Create new Task</h1>
{{ include('task/_form.html.twig') }}
<a href="{{ path('app_task_index') }}">back to list</a>
{% endblock %}
+58
View File
@@ -0,0 +1,58 @@
{% extends 'base.html.twig' %}
{% block title %}Task{% endblock %}
{% block body %}
<h1>Task</h1>
<table class="table">
<tbody>
<tr>
<th>Id</th>
<td>{{ task.id }}</td>
</tr>
<tr>
<th>Title</th>
<td>{{ task.title }}</td>
</tr>
<tr>
<th>Description</th>
<td>{{ task.description }}</td>
</tr>
<tr>
<th>EstimatedDurationMinutes</th>
<td>{{ task.estimatedDurationMinutes }}</td>
</tr>
<tr>
<th>Priority</th>
<td>{{ task.priority }}</td>
</tr>
<tr>
<th>Category</th>
<td>{{ task.category }}</td>
</tr>
<tr>
<th>IsRecurring</th>
<td>{{ task.isRecurring ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<th>IsActive</th>
<td>{{ task.isActive ? 'Yes' : 'No' }}</td>
</tr>
<tr>
<th>CreatedAt</th>
<td>{{ task.createdAt ? task.createdAt|date('Y-m-d H:i:s') : '' }}</td>
</tr>
<tr>
<th>UpdatedAt</th>
<td>{{ task.updatedAt ? task.updatedAt|date('Y-m-d H:i:s') : '' }}</td>
</tr>
</tbody>
</table>
<a href="{{ path('app_task_index') }}">back to list</a>
<a href="{{ path('app_task_edit', {'id': task.id}) }}">edit</a>
{{ include('task/_delete_form.html.twig') }}
{% endblock %}