101 lines
3.7 KiB
PHP
101 lines
3.7 KiB
PHP
<?php
|
|
require_once 'db/config.php';
|
|
|
|
// Fetch users from the database
|
|
$pdoconn = db();
|
|
$stmt = $pdoconn->query("SELECT user_id, username, role, org_id FROM Users");
|
|
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>User Management</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
background-color: #F7F7F7;
|
|
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
|
|
}
|
|
.sidebar {
|
|
background-color: #2a3f54;
|
|
color: white;
|
|
height: 100vh;
|
|
padding-top: 20px;
|
|
}
|
|
.sidebar a {
|
|
color: #dcdcdc;
|
|
text-decoration: none;
|
|
display: block;
|
|
padding: 10px 15px;
|
|
transition: background-color 0.3s;
|
|
}
|
|
.sidebar a:hover, .sidebar a.active {
|
|
background-color: #1ABB9C;
|
|
color: white;
|
|
}
|
|
.main-content {
|
|
padding: 20px;
|
|
}
|
|
.table-custom {
|
|
background-color: white;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-2 sidebar">
|
|
<h3 class="text-center">AI Chem Lab</h3>
|
|
<hr>
|
|
<a href="index.php"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
|
|
<a href="users.php" class="active"><i class="fas fa-users"></i> User Management</a>
|
|
</div>
|
|
<div class="col-md-10 main-content">
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<h1>User Management</h1>
|
|
<a href="create_user.php" class="btn btn-primary">Create New User</a>
|
|
</div>
|
|
<hr>
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-bordered table-custom">
|
|
<thead class="table-dark">
|
|
<tr>
|
|
<th>User ID</th>
|
|
<th>Username</th>
|
|
<th>Role</th>
|
|
<th>Organization ID</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (empty($users)): ?>
|
|
<tr>
|
|
<td colspan="5" class="text-center">No users found.</td>
|
|
</tr>
|
|
<?php else: ?>
|
|
<?php foreach ($users as $user): ?>
|
|
<tr>
|
|
<td><?= htmlspecialchars($user['user_id']) ?></td>
|
|
<td><?= htmlspecialchars($user['username']) ?></td>
|
|
<td><?= htmlspecialchars($user['role']) ?></td>
|
|
<td><?= htmlspecialchars($user['org_id']) ?></td>
|
|
<td>
|
|
<button class="btn btn-sm btn-info" disabled>Edit</button>
|
|
<button class="btn btn-sm btn-danger" disabled>Delete</button>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|