369 lines
20 KiB
PHP
369 lines
20 KiB
PHP
<?php
|
|
// includes/layout/footer.php
|
|
?>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add Patient Modal -->
|
|
<div class="modal fade" id="addPatientModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST">
|
|
<input type="hidden" name="action" value="add_patient">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title fw-bold"><?php echo __('add_patient'); ?></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('name'); ?></label>
|
|
<input type="text" name="name" class="form-control" required>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('phone'); ?></label>
|
|
<input type="text" name="phone" class="form-control" required>
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('dob'); ?></label>
|
|
<input type="date" name="dob" class="form-control">
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('gender'); ?></label>
|
|
<select name="gender" class="form-select">
|
|
<option value="Male"><?php echo __('male'); ?></option>
|
|
<option value="Female"><?php echo __('female'); ?></option>
|
|
<option value="Other"><?php echo __('other'); ?></option>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('blood_group'); ?></label>
|
|
<input type="text" name="blood_group" class="form-control" placeholder="O+, A-, etc.">
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<h6 class="fw-bold mb-3"><?php echo __('insurance'); ?> (<?php echo __('optional'); ?>)</h6>
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('insurance_company'); ?></label>
|
|
<select name="insurance_company_id" class="form-select">
|
|
<option value=""><?php echo __('not_insured'); ?></option>
|
|
<?php foreach ($all_insurance as $i): ?>
|
|
<option value="<?php echo $i['id']; ?>"><?php echo htmlspecialchars($i['name']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('policy_number'); ?></label>
|
|
<input type="text" name="policy_number" class="form-control">
|
|
</div>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('address'); ?></label>
|
|
<textarea name="address" class="form-control" rows="2"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo __('cancel'); ?></button>
|
|
<button type="submit" class="btn btn-primary px-4"><?php echo __('save'); ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add Insurance Modal -->
|
|
<div class="modal fade" id="addInsuranceModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=insurance" method="POST">
|
|
<input type="hidden" name="action" value="add_insurance">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title fw-bold"><?php echo __('add_insurance'); ?></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('name'); ?> (EN)</label>
|
|
<input type="text" name="name_en" class="form-control" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('name'); ?> (AR)</label>
|
|
<input type="text" name="name_ar" class="form-control" dir="rtl" required>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('email'); ?></label>
|
|
<input type="email" name="email" class="form-control">
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('phone'); ?></label>
|
|
<input type="text" name="phone" class="form-control">
|
|
</div>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('contact_info'); ?></label>
|
|
<textarea name="contact_info" class="form-control" rows="2"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo __('cancel'); ?></button>
|
|
<button type="submit" class="btn btn-primary px-4"><?php echo __('save'); ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Book Appointment Modal -->
|
|
<div class="modal fade" id="bookAppointmentModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST">
|
|
<input type="hidden" name="action" value="book_appointment">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title fw-bold"><?php echo __('book_appointment'); ?></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('patient'); ?></label>
|
|
<select name="patient_id" class="form-select" required>
|
|
<option value=""><?php echo __('search'); ?>...</option>
|
|
<?php foreach ($all_patients as $p): ?>
|
|
<option value="<?php echo $p['id']; ?>"><?php echo htmlspecialchars($p['name']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('doctor'); ?></label>
|
|
<select name="doctor_id" class="form-select" required>
|
|
<option value=""><?php echo __('search'); ?>...</option>
|
|
<?php foreach ($all_doctors as $d): ?>
|
|
<option value="<?php echo $d['id']; ?>"><?php echo htmlspecialchars($d['name']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('date'); ?></label>
|
|
<input type="datetime-local" name="date" class="form-control" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('reason'); ?></label>
|
|
<textarea name="reason" class="form-control" rows="2"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo __('cancel'); ?></button>
|
|
<button type="submit" class="btn btn-success px-4"><?php echo __('book_appointment'); ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Record Visit Modal -->
|
|
<div class="modal fade" id="recordVisitModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg">
|
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST">
|
|
<input type="hidden" name="action" value="record_visit">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title fw-bold"><?php echo __('add_visit'); ?></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col-md-12 mb-3">
|
|
<label class="form-label"><?php echo __('appointment'); ?> (<?php echo __('optional'); ?>)</label>
|
|
<select name="appointment_id" class="form-select" id="visit_appointment_select" onchange="updateVisitFields()">
|
|
<option value=""><?php echo __('search'); ?>...</option>
|
|
<?php foreach ($scheduled_appointments as $sa): ?>
|
|
<option value="<?php echo $sa['id']; ?>" data-patient="<?php echo $sa['patient_id']; ?>" data-doctor="<?php echo $sa['doctor_id']; ?>">
|
|
<?php echo htmlspecialchars($sa['patient_name']); ?> - <?php echo $sa['appointment_date']; ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('patient'); ?></label>
|
|
<select name="patient_id" id="visit_patient_id" class="form-select" required>
|
|
<option value=""><?php echo __('search'); ?>...</option>
|
|
<?php foreach ($all_patients as $p): ?>
|
|
<option value="<?php echo $p['id']; ?>"><?php echo htmlspecialchars($p['name']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<div class="col-md-6 mb-3">
|
|
<label class="form-label"><?php echo __('doctor'); ?></label>
|
|
<select name="doctor_id" id="visit_doctor_id" class="form-select" required>
|
|
<option value=""><?php echo __('search'); ?>...</option>
|
|
<?php foreach ($all_doctors as $d): ?>
|
|
<option value="<?php echo $d['id']; ?>"><?php echo htmlspecialchars($d['name']); ?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<h6 class="fw-bold mb-3"><?php echo __('vitals'); ?></h6>
|
|
<div class="row">
|
|
<div class="col-md-3 mb-3">
|
|
<label class="form-label"><?php echo __('weight'); ?></label>
|
|
<input type="text" name="weight" class="form-control">
|
|
</div>
|
|
<div class="col-md-3 mb-3">
|
|
<label class="form-label"><?php echo __('blood_pressure'); ?></label>
|
|
<input type="text" name="blood_pressure" class="form-control" placeholder="120/80">
|
|
</div>
|
|
<div class="col-md-3 mb-3">
|
|
<label class="form-label"><?php echo __('heart_rate'); ?></label>
|
|
<input type="text" name="heart_rate" class="form-control">
|
|
</div>
|
|
<div class="col-md-3 mb-3">
|
|
<label class="form-label"><?php echo __('temperature'); ?></label>
|
|
<input type="text" name="temperature" class="form-control">
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('symptoms'); ?></label>
|
|
<textarea name="symptoms" class="form-control" rows="2"></textarea>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('diagnosis'); ?></label>
|
|
<textarea name="diagnosis" class="form-control" rows="2"></textarea>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('treatment_plan'); ?></label>
|
|
<textarea name="treatment_plan" class="form-control" rows="2"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo __('cancel'); ?></button>
|
|
<button type="submit" class="btn btn-info text-white px-4"><?php echo __('save'); ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Create Bill Modal -->
|
|
<div class="modal fade" id="createBillModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=billing" method="POST">
|
|
<input type="hidden" name="action" value="create_bill">
|
|
<input type="hidden" name="visit_id" id="bill_visit_id">
|
|
<input type="hidden" name="patient_id" id="bill_patient_id">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title fw-bold"><?php echo __('create_bill'); ?></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p class="mb-3"><?php echo __('patient'); ?>: <strong id="bill_patient_name"></strong></p>
|
|
<div class="alert alert-info py-2 small">
|
|
<i class="bi bi-info-circle me-1"></i> If patient has insurance, 80% coverage will be applied automatically.
|
|
</div>
|
|
<div id="bill_items_container">
|
|
<div class="row g-2 mb-2 align-items-end item-row">
|
|
<div class="col-8">
|
|
<label class="form-label small mb-1"><?php echo __('description'); ?></label>
|
|
<input type="text" name="items[]" class="form-control" required value="<?php echo __('consultation_fee'); ?>">
|
|
</div>
|
|
<div class="col-4">
|
|
<label class="form-label small mb-1"><?php echo __('amount'); ?></label>
|
|
<input type="number" step="0.01" name="amounts[]" class="form-control" required placeholder="0.00">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<button type="button" class="btn btn-link btn-sm p-0 mt-2" onclick="addBillItem()">+ <?php echo __('add_item'); ?></button>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo __('cancel'); ?></button>
|
|
<button type="submit" class="btn btn-success px-4"><?php echo __('save'); ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Provisional Report Modal -->
|
|
<div class="modal fade" id="reportModal" tabindex="-1" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST">
|
|
<input type="hidden" name="action" value="create_report">
|
|
<input type="hidden" name="visit_id" id="report_visit_id">
|
|
<div class="modal-content border-0 shadow">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title fw-bold"><?php echo __('new_report'); ?></h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('report_type'); ?></label>
|
|
<input type="text" name="report_type" class="form-control" required placeholder="General, Lab, X-Ray, etc.">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('findings'); ?></label>
|
|
<textarea name="findings" class="form-control" rows="3"></textarea>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label"><?php echo __('recommendations'); ?></label>
|
|
<textarea name="recommendations" class="form-control" rows="3"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer bg-light">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo __('cancel'); ?></button>
|
|
<button type="submit" class="btn btn-primary px-4"><?php echo __('save'); ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Bootstrap 5 Bundle JS -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
function updateVisitFields() {
|
|
const select = document.getElementById('visit_appointment_select');
|
|
const option = select.options[select.selectedIndex];
|
|
if (option.value) {
|
|
document.getElementById('visit_patient_id').value = option.dataset.patient;
|
|
document.getElementById('visit_doctor_id').value = option.dataset.doctor;
|
|
}
|
|
}
|
|
|
|
function showReportModal(visitId) {
|
|
document.getElementById('report_visit_id').value = visitId;
|
|
new bootstrap.Modal(document.getElementById('reportModal')).show();
|
|
}
|
|
|
|
function showBillModal(visitId, patientId, patientName) {
|
|
document.getElementById('bill_visit_id').value = visitId;
|
|
document.getElementById('bill_patient_id').value = patientId;
|
|
document.getElementById('bill_patient_name').innerText = patientName;
|
|
new bootstrap.Modal(document.getElementById('createBillModal')).show();
|
|
}
|
|
|
|
function addBillItem() {
|
|
const container = document.getElementById('bill_items_container');
|
|
const row = document.createElement('div');
|
|
row.className = 'row g-2 mb-2 align-items-end item-row';
|
|
row.innerHTML = `
|
|
<div class="col-8">
|
|
<input type="text" name="items[]" class="form-control" required>
|
|
</div>
|
|
<div class="col-4">
|
|
<input type="number" step="0.01" name="amounts[]" class="form-control" required placeholder="0.00">
|
|
</div>
|
|
`;
|
|
container.appendChild(row);
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|