Marwan Alwali 43901b5bda update
2025-09-09 01:15:48 +03:00

252 lines
11 KiB
HTML

<div class="table-responsive">
<table class="table table-hover">
<thead class="table-light">
<tr>
<th>Patient</th>
<th>Demographics</th>
<th>Contact</th>
<th>Insurance</th>
<th>Status</th>
<th>Last Visit</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for patient in patients %}
<tr>
<td>
<div class="d-flex align-items-center">
{% if patient.photo %}
<img src="{{ patient.photo.url }}"
alt="{{ patient.get_display_name }}"
class="rounded-circle me-2"
width="32" height="32">
{% else %}
<div class="bg-primary text-white rounded-circle d-flex align-items-center justify-content-center me-2"
style="width: 32px; height: 32px; font-size: 14px;">
{{ patient.first_name|first|upper }}{{ patient.last_name|first|upper }}
</div>
{% endif %}
<div>
<div class="fw-bold">{{ patient.get_display_name }}</div>
<small class="text-muted">MRN: {{ patient.mrn }}</small>
{% if patient.is_vip %}
<br><span class="badge bg-warning text-dark">VIP</span>
{% endif %}
{% if patient.confidential_patient %}
<span class="badge bg-danger">Confidential</span>
{% endif %}
</div>
</div>
</td>
<td>
<div>
<strong>{{ patient.age }} years old</strong>
</div>
<div>{{ patient.get_gender_display }}</div>
<div>DOB: {{ patient.date_of_birth|date:"M d, Y" }}</div>
</td>
<td>
{% if patient.email %}
<div>
<i class="fas fa-envelope"></i> {{ patient.email }}
</div>
{% endif %}
{% if patient.phone_number %}
<div>
<i class="fas fa-phone"></i> {{ patient.phone_number }}
</div>
{% endif %}
{% if patient.full_address %}
<div>
<i class="fas fa-map-marker-alt"></i>
<small class="text-muted">{{ patient.city }}, {{ patient.state }}</small>
</div>
{% endif %}
</td>
<td>
{% with patient.insurance_info.first as primary_insurance %}
{% if primary_insurance %}
<div>{{ primary_insurance.insurance_company }}</div>
<small class="text-muted">{{ primary_insurance.plan_name }}</small>
{% if primary_insurance.is_verified %}
<br><span class="badge bg-success fs-9px">Verified</span>
{% else %}
<br><span class="badge bg-warning fs-9px">Unverified</span>
{% endif %}
{% else %}
<span class="text-muted">No insurance</span>
{% endif %}
{% endwith %}
</td>
<td>
<div>
{% if patient.is_deceased %}
<span class="badge bg-dark fs-9px">Deceased</span>
{% elif patient.is_active %}
<span class="badge bg-success fs-9px">Active</span>
{% else %}
<span class="badge bg-secondary fs-9px">Inactive</span>
{% endif %}
</div>
{% if patient.allergies %}
<div class="mt-1">
<span class="badge bg-danger fs-9px" title="Has allergies">
<i class="fas fa-exclamation-triangle"></i> Allergies
</span>
</div>
{% endif %}
{% if patient.medical_alerts %}
<div class="mt-1">
<span class="badge bg-warning text-dark fs-9px" title="Medical alerts">
<i class="fas fa-bell"></i> Alerts
</span>
</div>
{% endif %}
</td>
<td>
{% if patient.last_visit_date %}
{{ patient.last_visit_date|timesince }} ago
{% else %}
<span class="text-muted">No visits</span>
{% endif %}
</td>
<td>
<div class="btn-group btn-group-sm" role="group">
<a href="{% url 'patients:patient_detail' patient.pk %}"
class="btn btn-outline-primary"
title="View Details">
<i class="fas fa-eye"></i>
</a>
<button type="button"
class="btn btn-outline-secondary"
title="Edit Patient">
<i class="fas fa-edit"></i>
</button>
<button type="button"
class="btn btn-outline-info"
title="View Insurance"
hx-get="{% url 'patients:insurance_info_list' patient.pk %}"
hx-target="#insurance-modal-body"
hx-swap="innerHTML"
hx-trigger="click"
data-bs-toggle="modal"
data-bs-target="#insuranceModal">
<i class="fas fa-shield-alt"></i>
</button>
<button type="button"
class="btn btn-outline-success"
title="View Consents"
hx-get="{% url 'patients:consent_forms_list' patient.pk %}"
hx-target="#consent-modal-body"
hx-swap="innerHTML"
hx-trigger="click"
data-bs-toggle="modal"
data-bs-target="#consentModal">
<i class="fas fa-file-signature"></i>
</button>
<button type="button"
class="btn btn-outline-warning"
data-bs-toggle="modal"
data-bs-target="#quickActionsModal"></button>
</div>
</td>
</tr>
{% empty %}
<tr>
<td colspan="7" class="text-center text-muted py-4">
<i class="fas fa-users fa-2x mb-2"></i>
<br>No patients found.
</td>
</tr>
{% endfor %}
</tbody>
</table>
<!-- prevents close & backdrop churn -->
<!-- Insurance Modal -->
<div class="modal " id="insuranceModal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="insuranceModalLabel">
<i class="fas fa-shield-alt"></i> Insurance Information
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="insurance-modal-body">
<!-- Insurance content will be loaded here -->
</div>
</div>
</div>
</div>
<!-- Consent Modal -->
<div class="modal " id="consentModal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="consentModalLabel">
<i class="fas fa-file-signature"></i> Consent Forms
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="consent-modal-body">
<!-- Consent content will be loaded here -->
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="quickActionsModal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">
<i class="fas fa-bolt me-2"></i>Quick Actions
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6 mb-3">
<a href="{% url 'patients:patient_registration' %}" class="btn btn-outline-primary w-100 text-start">
<i class="fas fa-user-plus me-3"></i>Register New Patient
</a>
</div>
<div class="col-md-6 mb-3">
<a href="{% url 'appointments:appointment_create' %}" class="btn btn-outline-success w-100 text-start">
<i class="fas fa-calendar-plus me-3"></i>Schedule Appointment
</a>
</div>
<div class="col-md-6 mb-3">
<a href="" class="btn btn-outline-info w-100 text-start">
<i class="fas fa-notes-medical me-3"></i>Create Medical Record
</a>
</div>
<div class="col-md-6 mb-3">
<a href="{% url 'laboratory:lab_order_create' %}" class="btn btn-outline-warning w-100 text-start">
<i class="fas fa-vial me-3"></i>Order Laboratory Test
</a>
</div>
<div class="col-md-6 mb-3">
<a href="{% url 'billing:bill_create' %}" class="btn btn-outline-danger w-100 text-start">
<i class="fas fa-file-invoice-dollar me-3"></i>Create New Bill
</a>
</div>
<div class="col-md-6 mb-3">
<a href="" class="btn btn-outline-secondary w-100 text-start">
<i class="fas fa-prescription-bottle-alt me-3"></i>Write Prescription
</a>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>