{% extends 'base.html.twig' %}
{% block body %}
<div class="d-flex align-items-center justify-content-between mb-2">
<h1 class="mt-4 mb-3">Sessions</h1>
<a class="btn btn-primary mt-3" href="{{ path('app_session_new') }}"> Start new session</a>
</div>
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Recipes</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for session in sessions %}
<tr>
<td>{{ session.date.format('d/m/Y') }}</td>
<td>
{% for recipe in session.recipes %}
{{ recipe.name }}
{%- if recipe == session.recipes|last -%}
{{ '.' }}
{%- else -%}
{{ ' / ' }}
{% endif %}
{% endfor %}
</td>
<td>{{ include('session/_delete_form.html.twig') }}</td>
<td> <a class="btn btn-primary" href="{{ path('app_session_show', {'id': session.id}) }}" role="button">Go</a></td>
</tr>
{% else %}
<tr>
<td colspan="4">no records found</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}