{% extends 'base.html.twig' %}
{% block title %}
	{{parent()}}Liste des utilisateurs
{% endblock %}
{% block body %}
	<div class="container-fluid">
		<h1 class="text-center text-primary mt-4 pt-4 display-1 fw-bold">
			Liste des utilisateurs</h1>
		<div class="row justify-content-center">
			<div class="col-12 col-md-8 bg-white p-4 m-0 text-primary">
				<div class="table-responsive">
					<table class="table table-hover">
						<thead>
							<tr class="fw-bold text-primary">
								<th scope="col">Email</th>
								<th scope="col">Date d'inscription</th>
								<th scope="col">Rôle</th>
							</tr>
						</thead>
						<tbody>
							{% for user in users |sort((a, b) =>
b.email <=> a.email) %}
								<tr class="{{ cycle(['table-primary', 'table-secondary'], loop.index0) }}">
									<td>{{ user.email}}</td>
									<td>{{ user.inscriptionDate |
date("d-m-Y à H:i:s") }}</td>
									{% if 'ROLE_ADMIN' in user.roles %}

										<td>Administrateur</td>
									{% elseif 'ROLE_MOD' in user.roles %}
										<td>Moderateur</td>
									{% else %}
										<td>Utilisateur</td>
									{% endif %}
								</tr>
							{% endfor %}
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
{% endblock %}
