{% extends "basefront.html.twig" %}
{% block body %}
<table class="table table-striped" aria-describedby="Table des playlists">
<thead>
<tr>
<th class="text-left align-top" scope="col">
playlist<br />
<a href="{{ path('playlists.sort', {champ:'name', ordre:'ASC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true"><</a>
<a href="{{ path('playlists.sort', {champ:'name', ordre:'DESC'}) }}" class="btn btn-info btn-sm active" role="button" aria-pressed="true">></a>
<form class="form-inline mt-1" method="POST" action="{{ path('playlists.findallcontain', {champ:'name'}) }}">
<div class="form-group mr-1 mb-2">
<input type="text" class="sm" name="recherche"
value="{% if valeur|default and not table|default %}{{ valeur }}{% endif %}">
<input type="hidden" name="_token" value="{{ csrf_token('filtre_name') }}">
<button type="submit" class="btn btn-info mb-2 btn-sm">filtrer</button>
</div>
</form>
</th>
<th class="text-left align-top" scope="col">
catégories
<form class="form-inline mt-1" method="POST" action="{{ path('playlists.findallcontain', {champ:'id', table:'categories'}) }}">
<select class="form-select form-select-sm" name="recherche" id="recherche" onchange="this.form.submit()">
<option value=""></option>
{% for categorie in categories %}
<option
{% if valeur|default and valeur==categorie.id %}
selected
{% endif %}
value="{{ categorie.id }}">{{ categorie.name }}
</option>
{% endfor %}
</select>
</form>
</th>
<th class="text-center align-top" scope="col">
Nombre de formations
<div class="col">
<a href="{{ path('playlists.sort', {champ:'nbformations', ordre:'ASC'}) }}"
class="btn btn-info btn-sm active" role="button" aria-pressed="true"><</a>
<a href="{{ path('playlists.sort', {champ:'nbformations', ordre:'DESC'}) }}"
class="btn btn-info btn-sm active" role="button" aria-pressed="true">></a>
</div>
</th>
<th class="text-center align-top" scope="col">
</th>
</tr>
</thead>
<tbody>
<!-- boucle sur les playlists -->
{% if playlists|length > 0 %}
{% for playlist in playlists %}
<tr class="align-middle">
<td>
<h5 class="text-info">
{{ playlist.name }}
</h5>
</td>
<td class="text-left">
{% for categorie in playlist.categoriesplaylist %}
{{ categorie }}
{% endfor %}
</td>
<td class="text-center">
{{ playlist.formations|length }}
</td>
<td class="text-center">
<a href="{{ path('playlists.showone', {id:playlist.id}) }}" class="btn btn-secondary">Voir détail</a>
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
{% endblock %}