mise en avant du super admin

This commit is contained in:
Esenjin 2024-12-30 23:05:59 +01:00
parent adabbf47ab
commit 4d96a08cd3
2 changed files with 42 additions and 4 deletions

View File

@ -220,6 +220,32 @@ body {
gap: 0.5rem; gap: 0.5rem;
} }
.admin-table tr.main-admin {
background-color: rgba(33, 150, 243, 0.1);
}
.admin-table tr.main-admin:hover {
background-color: rgba(33, 150, 243, 0.15);
}
.admin-badge {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.25rem 0.5rem;
border-radius: 1rem;
font-size: 0.8rem;
font-weight: 500;
background-color: #2196f3;
color: white;
margin-left: 0.5rem;
}
.admin-badge .icon {
width: 12px;
height: 12px;
}
/* Formulaires */ /* Formulaires */
.form-group { .form-group {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;

View File

@ -195,10 +195,22 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($users as $user): ?> <?php foreach ($users as $user):
<tr> $isMainAdmin = $user['id'] === $users[0]['id'];
?>
<tr class="<?php echo $isMainAdmin ? 'main-admin' : ''; ?>">
<td><?php echo htmlspecialchars($user['id']); ?></td> <td><?php echo htmlspecialchars($user['id']); ?></td>
<td><?php echo htmlspecialchars($user['username']); ?></td> <td>
<?php echo htmlspecialchars($user['username']); ?>
<?php if ($isMainAdmin): ?>
<span class="admin-badge">
<svg class="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 2l3 7h7l-6 4 3 7-7-4-7 4 3-7-6-4h7z"/>
</svg>
Admin principal
</span>
<?php endif; ?>
</td>
<td><?php echo htmlspecialchars($user['created_at']); ?></td> <td><?php echo htmlspecialchars($user['created_at']); ?></td>
<td class="table-actions"> <td class="table-actions">
<button onclick="editUser(<?php <button onclick="editUser(<?php
@ -207,7 +219,7 @@ while ($row = $result->fetchArray(SQLITE3_ASSOC)) {
class="tree-button"> class="tree-button">
✏️ ✏️
</button> </button>
<?php if ($user['id'] !== $users[0]['id']): ?> <?php if (!$isMainAdmin): ?>
<button onclick="deleteUser(<?php echo htmlspecialchars($user['id']); ?>)" <button onclick="deleteUser(<?php echo htmlspecialchars($user['id']); ?>)"
class="tree-button tree-button-danger"> class="tree-button tree-button-danger">
🗑️ 🗑️