47 lines
2.2 KiB
PHP
47 lines
2.2 KiB
PHP
<?php
|
|
$patients_sql = "
|
|
SELECT p.*, ic.name_$lang as insurance_name
|
|
FROM patients p
|
|
LEFT JOIN insurance_companies ic ON p.insurance_company_id = ic.id
|
|
ORDER BY p.id DESC";
|
|
$patients = $db->query($patients_sql)->fetchAll();
|
|
?>
|
|
<div class="card shadow-sm">
|
|
<div class="card-header py-3 d-flex justify-content-between align-items-center">
|
|
<h5 class="mb-0 fw-bold"><i class="bi bi-people-fill me-2 text-primary"></i> <?php echo __('patients'); ?></h5>
|
|
<button class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#addPatientModal">
|
|
<i class="bi bi-plus-lg"></i> <?php echo __('add_patient'); ?>
|
|
</button>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th><?php echo __('name'); ?></th>
|
|
<th><?php echo __('age'); ?></th>
|
|
<th><?php echo __('phone'); ?></th>
|
|
<th><?php echo __('dob'); ?></th>
|
|
<th><?php echo __('insurance'); ?></th>
|
|
<th><?php echo __('policy_number'); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($patients as $p): ?>
|
|
<tr>
|
|
<td><?php echo htmlspecialchars($p['name']); ?></td>
|
|
<td><?php echo calculate_age($p['dob']); ?></td>
|
|
<td><?php echo htmlspecialchars($p['phone']); ?></td>
|
|
<td><?php echo $p['dob']; ?></td>
|
|
<td><span class="badge <?php echo $p['insurance_name'] ? 'bg-primary' : 'bg-secondary'; ?>"><?php echo $p['insurance_name'] ?: __('not_insured'); ?></span></td>
|
|
<td><?php echo htmlspecialchars($p['policy_number'] ?: '-'); ?></td>
|
|
</tr>
|
|
<?php endforeach; if (empty($patients)): ?>
|
|
<tr><td colspan="6" class="text-center py-4 text-muted">No patients found.</td></tr>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|