65 lines
3.1 KiB
PHP
65 lines
3.1 KiB
PHP
<section class="page-header">
|
|
<div>
|
|
<p class="eyebrow">Administration</p>
|
|
<h1 class="page-title">Comptes utilisateurs</h1>
|
|
<p class="lead-text">Activez, désactivez ou supprimez les comptes.</p>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="table-panel">
|
|
<table class="table app-table align-middle mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>Identifiant</th>
|
|
<th>E-mail</th>
|
|
<th>Rôle</th>
|
|
<th>Statut</th>
|
|
<th>Créé le</th>
|
|
<th class="text-end">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($utilisateurs as $compte): ?>
|
|
<tr>
|
|
<td>
|
|
<strong><?php print Helpers::echapper($compte["identifiant"]); ?></strong>
|
|
<?php if ($compte["id"] === $utilisateur["id"]): ?>
|
|
<span class="badge-etat etat-possede">vous</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td><?php print Helpers::echapper($compte["email"] ?? ""); ?></td>
|
|
<td><?php print Helpers::echapper($compte["role"]); ?></td>
|
|
<td>
|
|
<?php if ($compte["actif"]): ?>
|
|
<span class="badge-etat etat-possede">Actif</span>
|
|
<?php else: ?>
|
|
<span class="badge-etat etat-vendu">Inactif</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td><?php print Helpers::echapper(substr((string) ($compte["createdAt"] ?? ""), 0, 10)); ?></td>
|
|
<td class="text-end">
|
|
<div class="d-inline-flex gap-2">
|
|
<?php if ($compte["id"] !== $utilisateur["id"]): ?>
|
|
<form method="post" action="/admin/utilisateurs/<?php print Helpers::echapper($compte["id"]); ?>/basculer">
|
|
<?php print Csrf::champCache(); ?>
|
|
<button type="submit" class="btn btn-sm btn-outline-neon">
|
|
<?php print $compte["actif"] ? "Désactiver" : "Activer"; ?>
|
|
</button>
|
|
</form>
|
|
<form method="post" action="/admin/utilisateurs/<?php print Helpers::echapper($compte["id"]); ?>/supprimer" onsubmit="return confirm('Supprimer définitivement ce compte ?');">
|
|
<?php print Csrf::champCache(); ?>
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">
|
|
Supprimer
|
|
</button>
|
|
</form>
|
|
<?php else: ?>
|
|
<span class="text-muted">—</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|