{% extends 'base.html.twig' %}
{% block title %}
	{{parent()}}Liste des catégories (A-Z)
{% endblock %}
{% block body %}
	<div class="container-fluid">
		<h1 class="text-center text-primary mt-4 pt-4 display-1 fw-bold">
			Liste des catégories</h1>
		<div class="row justify-content-center">
			<div class="col-12 col-md-8 bg-white p-4 m-0 text-primary text-center">
				<div class="table-responsive">
					{{ form_start(form) }}
					<table class="table table-hover">
						<thead>
							<tr class="fw-bold text-primary">
								<th scope="col">Libellé</th>
								<th scope="col"></th>
								<th scope="col"></th>
								<th scope="col"></th>
							</tr>
						</thead>
						<tbody>
							{% for categorie in categories |sort((a, b) =>
a.libelle <=> b.libelle) %}
								<tr class="{{ cycle(['table-primary', 'table-secondary'], loop.index0) }}">
									<td class="textstart">{{ categorie.libelle | capitalize }}</td>
									<td>
										<a href="{{path("app_modifier_categorie",{'id':categorie.id})}}">
											<i class="bi bi-pen-fill text-dark"></i>
										</a>
									</td>
									<td>
										<a href="{{path("app_supprimer_categorie",{'id':categorie.id})}}">
											<i class="bi bi-trash-fill text-dark"></i>
										</a>
									</td>
									<td>{{ form_widget(form.categories[categorie.id]) }}</td>
								</tr>
							{% endfor %}
						</tbody>
					</table>
					{{ form_widget(form.supprimer) }}
					{{ form_end(form) }}
				</div>
			</div>
		</div>
	</div>
{% endblock %}
