{% extends "base.html" %}
{% block entete %}Gestion des utilisateurs{% endblock %}
{% block navbar %}
<ul>
	<li><a href="#first">Liste des utilisateurs</a></li>
</ul>
{% endblock %}
{% block content %}
<section id="first" class="main">
	<header class="major">
		<h2>Liste des utilisateurs</h2>
	</header>
	<a class="button" href="{% url 'users:createUser' %}"><i class="fa fa-user-plus"></i> Créer un utilisateur</a><br><br>
	<div class="table-wrapper">
		<table>
			<thead>
				<tr>
					<th>Utilisateur</th>
					<th>Profil</th>
					{% if perms.auth.change_user %}
					<th>Activer / Désactiver</th>
					{% endif %}
				</tr>
			</thead>
			<tbody>
				{% for user in users %}
				<tr>
					<td><a href="{% url 'users:profile' user.pk %}">{{user}}</a></td>
					<td><a class="button small" href="{% url 'users:profile' user.pk %}"><i class="fa fa-user"></i> Profil</a></td>
					{% if perms.auth.change_user %}
					<td><a class="button small" href="{% url 'users:switchActivateUser' user.pk %}">{% if user.is_active %}<i class="fa fa-times-circle"></i> Désactiver{% else %}<i class="fa fa-check-circle"></i> Activer{% endif %}</a></td>
					{% endif %}
				</tr>
				{% endfor %}
			</tbody>
		</table>
	</div>
</section>
{% endblock %}