40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
require_once 'header.php';
|
|
|
|
$pdo = db();
|
|
$stmt = $pdo->query("SELECT users.id, users.email, users.is_superadmin, companies.name AS company_name FROM users LEFT JOIN companies ON users.company_id = companies.id ORDER BY users.id");
|
|
$users = $stmt->fetchAll();
|
|
|
|
?>
|
|
|
|
<h2>Manage Users</h2>
|
|
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Email</th>
|
|
<th>Company</th>
|
|
<th>Super Admin?</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($users as $user): ?>
|
|
<tr>
|
|
<td><?php echo htmlspecialchars($user['id']); ?></td>
|
|
<td><?php echo htmlspecialchars($user['email']); ?></td>
|
|
<td><?php echo htmlspecialchars($user['company_name'] ?? 'N/A'); ?></td>
|
|
<td><?php echo $user['is_superadmin'] ? 'Yes' : 'No'; ?></td>
|
|
<td>
|
|
<a href="#" class="btn btn-primary btn-sm">Edit</a>
|
|
<a href="#" class="btn btn-danger btn-sm">Delete</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<?php
|
|
require_once 'footer.php';
|
|
?>
|