65 lines
2.8 KiB
PHP
65 lines
2.8 KiB
PHP
<?php
|
|
require_once __DIR__ . '/layout_header.php';
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
$patients = [];
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query("SELECT id, name, mobile, created_at FROM patients WHERE clinic_id = 1 ORDER BY created_at DESC");
|
|
$patients = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
} catch (PDOException $e) {
|
|
// In a real app, log this error and show a user-friendly message.
|
|
error_log("DB Error: " . $e->getMessage());
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="container-fluid p-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1 class="h3">قائمة المرضى</h1>
|
|
<a href="#" class="btn btn-primary">
|
|
<i class="bi bi-plus-circle-fill me-2"></i> إضافة مريض جديد
|
|
</a>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th scope="col">#</th>
|
|
<th scope="col">الاسم</th>
|
|
<th scope="col">رقم الموبايل</th>
|
|
<th scope="col">تاريخ التسجيل</th>
|
|
<th scope="col">إجراءات</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (empty($patients)): ?>
|
|
<tr>
|
|
<td colspan="5" class="text-center">لا يوجد مرضى لعرضهم.</td>
|
|
</tr>
|
|
<?php else: ?>
|
|
<?php foreach ($patients as $patient): ?>
|
|
<tr>
|
|
<th scope="row"><?php echo htmlspecialchars($patient['id']); ?></th>
|
|
<td><?php echo htmlspecialchars($patient['name']); ?></td>
|
|
<td><?php echo htmlspecialchars($patient['mobile']); ?></td>
|
|
<td><?php echo (new DateTime($patient['created_at']))->format('Y-m-d'); ?></td>
|
|
<td>
|
|
<a href="#" class="btn btn-sm btn-outline-primary"><i class="bi bi-eye-fill"></i></a>
|
|
<a href="#" class="btn btn-sm btn-outline-secondary"><i class="bi bi-pencil-fill"></i></a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php require_once __DIR__ . '/layout_footer.php'; ?>
|