Mini Kabibi Habibi
| Current Path : C:/xampp/htdocs/clinic/ |
|
|
| Current File : C:/xampp/htdocs/clinic/initial_assessment.php |
<?php
session_start();
include 'includes/db.php';
// Ensure admin logged in
if (!isset($_SESSION['user_id']) || $_SESSION['role'] !== 'admin') {
header("Location: login.php");
exit();
}
$page_title = "Initial Assessment";
$today = date('Y-m-d');
// Fetch pending patients for today
$stmt = $pdo->prepare("
SELECT l.id, l.patient_name, l.school, l.age
FROM logs l
WHERE l.log_date = :today
AND l.id NOT IN (SELECT log_id FROM health_records)
ORDER BY l.id DESC
");
$stmt->execute([':today' => $today]);
$pending_patients = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title><?= $page_title ?></title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" />
<style>
body {
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: #f8f9fa;
}
.sidebar {
width: 250px;
background-color: #2c3e50;
color: white;
position: fixed;
top: 0;
bottom: 0;
left: 0;
}
.sidebar a {
color: #ccc;
text-decoration: none;
padding: 15px;
display: block;
transition: 0.3s;
}
.sidebar a:hover {
background-color: #34495e;
color: #fff;
}
.sidebar .collapse a {
font-size: 0.95rem;
padding-left: 30px;
}
.main-content {
margin-left: 250px;
padding: 40px;
flex: 1;
}
.form-card {
background-color: #fff;
border-radius: 10px;
padding: 30px;
box-shadow: 0 0 15px rgba(0,0,0,0.05);
}
h2.page-title {
font-weight: 600;
margin-bottom: 30px;
}
</style>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
</head>
<body>
<!-- Sidebar -->
<?php include 'sidebar.php'; ?>
<!-- Main Content -->
<div class="main-content">
<h2><?= $page_title ?></h2>
<?php if (count($pending_patients) > 0): ?>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>School</th>
<th>Age/Sex</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($pending_patients as $patient): ?>
<tr>
<td><?= htmlspecialchars($patient['patient_name']) ?></td>
<td><?= htmlspecialchars($patient['school']) ?></td>
<td><?= htmlspecialchars($patient['age']) ?></td>
<td>
<a href="view_patient.php?id=<?= $patient['id'] ?>" class="btn btn-sm btn-success">View</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="alert alert-info">No pending records found for today.</div>
<?php endif; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>