cc34/templates/atelier/index.html.twig

63 lines
2.7 KiB
Twig

{% extends 'base.html.twig' %}
{% block title %}Atelier index{% endblock %}
{% block body %}
<div class="card mb-4">
<div class="card-header">
<h1 class="card-title">Liste des Ateliers</h1>
</div>
{% if (ateliers | length) > 0 %}
<div class="card-body table-responsive">
<table class="table align-middle">
<thead>
<tr>
<th scope="col">NOM</th>
<th scope="col">DESCRIPTION</th>
<th scope="col">ACTIONS</th>
</tr>
</thead>
<tbody>
{% for atelier in ateliers %}
<tr>
<td>{{ atelier.nom }}</td>
<td>{{ atelier.description | raw }}</td>
<td>
<div class="d-flex flex-row align-content-end">
<a class="btn btn-outline-primary m-1"
href="{{ path('app_atelier_show', {'id': atelier.id}) }}">Afficher</a>
{% if app.user and app.user == atelier.instructeur %}
<a class="btn btn-outline-primary m-1"
href="{{ path('app_atelier_edit', {'id': atelier.id}) }}">Modifier</a>
{% else %}
<button class="btn btn-outline-secondary m-1"
href="{{ path('app_atelier_edit', {'id': atelier.id}) }}" disabled>Modifier
</button>
{% endif %}
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if is_granted('ROLE_INSTRUCTEUR') %}
<div class="card-footer d-flex justify-content-center">
<a class="btn btn-primary" href="{{ path('app_atelier_new') }}">Créer atelier</a>
</div>
{% endif %}
{% else %}
{% if is_granted('ROLE_INSTRUCTEUR') %}
<div class="alert alert-info" role="alert">
Il n'y a pas encore d'ateliers. Vous pouvez commencer par <a class="alert-link"
href="{{ path('app_atelier_new') }}">en
créer
un !</a>
</div>
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}