update visits list
This commit is contained in:
parent
0a3eff3c92
commit
5f78c2abad
@ -14,6 +14,9 @@ $all_tests = $db->query("SELECT id, name_$lang as name, price, normal_range FROM
|
|||||||
$all_xray_groups = $db->query("SELECT id, name_$lang as name FROM xray_groups")->fetchAll();
|
$all_xray_groups = $db->query("SELECT id, name_$lang as name FROM xray_groups")->fetchAll();
|
||||||
$all_xrays = $db->query("SELECT id, name_$lang as name, price FROM xray_tests")->fetchAll();
|
$all_xrays = $db->query("SELECT id, name_$lang as name, price FROM xray_tests")->fetchAll();
|
||||||
|
|
||||||
|
// Drugs Data
|
||||||
|
$all_drugs = $db->query("SELECT id, name_$lang as name, default_dosage, default_instructions FROM drugs")->fetchAll();
|
||||||
|
|
||||||
$scheduled_appointments = $db->query("
|
$scheduled_appointments = $db->query("
|
||||||
SELECT a.id, p.name as patient_name, a.start_time, a.patient_id, a.doctor_id
|
SELECT a.id, p.name as patient_name, a.start_time, a.patient_id, a.doctor_id
|
||||||
FROM appointments a
|
FROM appointments a
|
||||||
|
|||||||
@ -872,11 +872,382 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Record/Edit Visit Modal -->
|
||||||
|
<div class="modal fade" id="recordVisitModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-xl">
|
||||||
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=visits" method="POST" id="visitForm">
|
||||||
|
<input type="hidden" name="action" value="record_visit" id="visitAction">
|
||||||
|
<input type="hidden" name="id" id="visitId">
|
||||||
|
<div class="modal-content border-0 shadow">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title fw-bold text-white" id="visitModalTitle"><?php echo __('add_visit'); ?></h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<!-- Tabs -->
|
||||||
|
<ul class="nav nav-tabs mb-3" id="visitTabs" role="tablist">
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link active" id="details-tab" data-bs-toggle="tab" data-bs-target="#visit-details" type="button" role="tab"><?php echo __('details'); ?></button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="vitals-tab" data-bs-toggle="tab" data-bs-target="#visit-vitals" type="button" role="tab"><?php echo __('vitals'); ?></button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="diagnosis-tab" data-bs-toggle="tab" data-bs-target="#visit-diagnosis" type="button" role="tab"><?php echo __('symptoms_diagnosis'); ?></button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="treatments-tab" data-bs-toggle="tab" data-bs-target="#visit-treatments" type="button" role="tab"><?php echo __('treatment_plan'); ?></button>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="prescriptions-tab" data-bs-toggle="tab" data-bs-target="#visit-prescriptions" type="button" role="tab"><?php echo __('prescriptions'); ?></button>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" id="visitTabsContent">
|
||||||
|
<!-- Details Tab -->
|
||||||
|
<div class="tab-pane fade show active" id="visit-details" role="tabpanel">
|
||||||
|
<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 select2-modal" required>
|
||||||
|
<option value=""><?php echo __('select'); ?>...</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 select2-modal" required>
|
||||||
|
<option value=""><?php echo __('select'); ?>...</option>
|
||||||
|
<?php foreach ($all_doctors as $d): ?>
|
||||||
|
<option value="<?php echo $d['id']; ?>"><?php echo htmlspecialchars($d['name']); ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Vitals Tab -->
|
||||||
|
<div class="tab-pane fade" id="visit-vitals" role="tabpanel">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('weight'); ?> (kg)</label>
|
||||||
|
<input type="number" step="0.1" name="weight" id="visit_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" id="visit_blood_pressure" class="form-control" placeholder="120/80">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('heart_rate'); ?> (bpm)</label>
|
||||||
|
<input type="number" name="heart_rate" id="visit_heart_rate" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('temperature'); ?> (°C)</label>
|
||||||
|
<input type="number" step="0.1" name="temperature" id="visit_temperature" class="form-control">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Symptoms & Diagnosis Tab -->
|
||||||
|
<div class="tab-pane fade" id="visit-diagnosis" role="tabpanel">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label"><?php echo __('symptoms'); ?></label>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-info float-end" onclick="generateAISuggestion(this)" data-target="symptoms">
|
||||||
|
<i class="bi bi-magic"></i> AI Suggestion
|
||||||
|
</button>
|
||||||
|
<textarea name="symptoms" id="visit_symptoms" class="form-control summernote" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label"><?php echo __('diagnosis'); ?></label>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-info float-end" onclick="generateAISuggestion(this)" data-target="diagnosis">
|
||||||
|
<i class="bi bi-magic"></i> AI Suggestion
|
||||||
|
</button>
|
||||||
|
<textarea name="diagnosis" id="visit_diagnosis" class="form-control summernote" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Treatments Tab -->
|
||||||
|
<div class="tab-pane fade" id="visit-treatments" role="tabpanel">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label"><?php echo __('treatment_plan'); ?></label>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-info float-end" onclick="generateAISuggestion(this)" data-target="treatment_plan">
|
||||||
|
<i class="bi bi-magic"></i> AI Suggestion
|
||||||
|
</button>
|
||||||
|
<textarea name="treatment_plan" id="visit_treatment_plan" class="form-control summernote" rows="3" data-height="300"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Prescriptions Tab -->
|
||||||
|
<div class="tab-pane fade" id="visit-prescriptions" role="tabpanel">
|
||||||
|
<label class="form-label fw-bold"><?php echo __('prescriptions'); ?></label>
|
||||||
|
<div class="table-responsive mb-2">
|
||||||
|
<table class="table table-bordered table-sm" id="prescriptionTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo __('drug_name'); ?></th>
|
||||||
|
<th style="width: 150px;"><?php echo __('dosage'); ?></th>
|
||||||
|
<th><?php echo __('instructions'); ?></th>
|
||||||
|
<th style="width: 50px;"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<!-- Rows added dynamically -->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-primary" onclick="addPrescriptionRow()">
|
||||||
|
<i class="bi bi-plus-lg"></i> <?php echo __('add_drug'); ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</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 Inquiry Modal -->
|
||||||
|
<div class="modal fade" id="addInquiryModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=laboratory_inquiries" method="POST" enctype="multipart/form-data">
|
||||||
|
<input type="hidden" name="action" value="add_inquiry">
|
||||||
|
<input type="hidden" name="visit_id" id="inquiry_visit_id">
|
||||||
|
<input type="hidden" name="patient_id" id="inquiry_patient_id">
|
||||||
|
<div class="modal-content border-0 shadow">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title fw-bold text-white"><?php echo __('add_inquiry'); ?></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_name'); ?></label>
|
||||||
|
<input type="text" name="patient_name" id="inquiry_patient_name" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('inquiry_date'); ?></label>
|
||||||
|
<input type="datetime-local" name="inquiry_date" class="form-control" value="<?php echo date('Y-m-d\TH:i'); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('status'); ?></label>
|
||||||
|
<select name="status" class="form-select">
|
||||||
|
<option value="Pending"><?php echo __('Pending'); ?></option>
|
||||||
|
<option value="Completed"><?php echo __('Completed'); ?></option>
|
||||||
|
<option value="Cancelled"><?php echo __('Cancelled'); ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label class="form-label fw-bold"><?php echo __('tests'); ?></label>
|
||||||
|
<div class="table-responsive mb-2">
|
||||||
|
<table class="table table-bordered table-sm" id="inquiryTestsTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo __('test'); ?></th>
|
||||||
|
<th><?php echo __('result'); ?></th>
|
||||||
|
<th><?php echo __('attachment'); ?></th>
|
||||||
|
<th style="width: 50px;"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-primary" onclick="addInquiryTestRow()">
|
||||||
|
<i class="bi bi-plus-lg"></i> <?php echo __('add_test'); ?>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
<label class="form-label"><?php echo __('notes'); ?></label>
|
||||||
|
<textarea name="notes" class="form-control summernote" 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 X-Ray Inquiry Modal -->
|
||||||
|
<div class="modal fade" id="addXrayInquiryModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=xray_inquiries" method="POST" enctype="multipart/form-data">
|
||||||
|
<input type="hidden" name="action" value="add_xray_inquiry">
|
||||||
|
<input type="hidden" name="visit_id" id="xray_inquiry_visit_id">
|
||||||
|
<input type="hidden" name="patient_id" id="xray_inquiry_patient_id">
|
||||||
|
<div class="modal-content border-0 shadow">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title fw-bold text-white"><?php echo __('add_xray_inquiry'); ?></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_name'); ?></label>
|
||||||
|
<input type="text" name="patient_name" id="xray_inquiry_patient_name" class="form-control" required>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('inquiry_date'); ?></label>
|
||||||
|
<input type="datetime-local" name="inquiry_date" class="form-control" value="<?php echo date('Y-m-d\TH:i'); ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6 mb-3">
|
||||||
|
<label class="form-label"><?php echo __('status'); ?></label>
|
||||||
|
<select name="status" class="form-select">
|
||||||
|
<option value="Pending"><?php echo __('Pending'); ?></option>
|
||||||
|
<option value="Completed"><?php echo __('Completed'); ?></option>
|
||||||
|
<option value="Cancelled"><?php echo __('Cancelled'); ?></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<label class="form-label fw-bold"><?php echo __('xray_tests'); ?></label>
|
||||||
|
<div class="table-responsive mb-2">
|
||||||
|
<table class="table table-bordered table-sm" id="xrayInquiryTestsTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo __('test'); ?></th>
|
||||||
|
<th><?php echo __('result'); ?></th>
|
||||||
|
<th><?php echo __('attachment'); ?></th>
|
||||||
|
<th style="width: 50px;"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-primary" onclick="addXrayInquiryTestRow()">
|
||||||
|
<i class="bi bi-plus-lg"></i> <?php echo __('add_test'); ?>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
<label class="form-label"><?php echo __('notes'); ?></label>
|
||||||
|
<textarea name="notes" class="form-control summernote" 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>
|
||||||
|
|
||||||
|
<!-- 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=visits" 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 text-white"><?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>
|
||||||
|
<select name="report_type" class="form-select" required>
|
||||||
|
<option value="Medical Report">Medical Report</option>
|
||||||
|
<option value="Referral">Referral</option>
|
||||||
|
<option value="Sick Leave">Sick Leave</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label"><?php echo __('findings'); ?></label>
|
||||||
|
<textarea name="findings" class="form-control summernote" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label"><?php echo __('recommendations'); ?></label>
|
||||||
|
<textarea name="recommendations" class="form-control summernote" 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>
|
||||||
|
|
||||||
|
<!-- Bill Modal -->
|
||||||
|
<div class="modal fade" id="billModal" 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="create_bill">
|
||||||
|
<input type="hidden" name="patient_id" id="bill_patient_id">
|
||||||
|
<input type="hidden" name="visit_id" id="bill_visit_id">
|
||||||
|
<div class="modal-content border-0 shadow">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title fw-bold text-white"><?php echo __('create_bill'); ?>: <span id="bill_patient_name"></span></h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="table-responsive mb-2">
|
||||||
|
<table class="table table-bordered" id="billTable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><?php echo __('description'); ?></th>
|
||||||
|
<th style="width: 150px;"><?php echo __('amount'); ?></th>
|
||||||
|
<th style="width: 50px;"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><input type="text" name="items[]" class="form-control" placeholder="Consultation Fee" required></td>
|
||||||
|
<td><input type="number" step="0.01" name="amounts[]" class="form-control" required></td>
|
||||||
|
<td><button type="button" class="btn btn-sm btn-danger" onclick="removeBillItemRow(this)"><i class="bi bi-x-lg"></i></button></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-primary" onclick="addBillItemRow()">
|
||||||
|
<i class="bi bi-plus-lg"></i> <?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 __('create_bill'); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Visit Results Modal (Read-only view) -->
|
||||||
|
<div class="modal fade" id="visitResultsModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content border-0 shadow">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title fw-bold text-white"><?php echo __('visit_details'); ?></h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" id="visitResultsContent">
|
||||||
|
<!-- Populated via JS -->
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer bg-light">
|
||||||
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo __('close'); ?></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/5.0.7/jquery.inputmask.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/5.0.7/jquery.inputmask.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.18/dist/summernote-lite.min.js"></script>
|
||||||
|
<script src="assets/js/ai_helper.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
// --- Patient Modals ---
|
||||||
function showEditPatientModal(data) {
|
function showEditPatientModal(data) {
|
||||||
document.getElementById('edit_patient_id').value = data.id;
|
document.getElementById('edit_patient_id').value = data.id;
|
||||||
document.getElementById('edit_patient_name').value = data.name;
|
document.getElementById('edit_patient_name').value = data.name;
|
||||||
@ -903,6 +1274,258 @@ function showDeletePatientModal(id, name) {
|
|||||||
modal.show();
|
modal.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --- Visit Modals ---
|
||||||
|
function showRecordVisitModal(patientId = null) {
|
||||||
|
document.getElementById('visitForm').reset();
|
||||||
|
document.getElementById('visitAction').value = 'record_visit';
|
||||||
|
document.getElementById('visitId').value = '';
|
||||||
|
document.getElementById('visitModalTitle').innerText = '<?php echo __('add_visit'); ?>';
|
||||||
|
|
||||||
|
// Reset Summernote fields
|
||||||
|
$('#visit_symptoms').summernote('code', '');
|
||||||
|
$('#visit_diagnosis').summernote('code', '');
|
||||||
|
$('#visit_treatment_plan').summernote('code', '');
|
||||||
|
|
||||||
|
// Clear dynamic rows
|
||||||
|
document.querySelector('#prescriptionTable tbody').innerHTML = '';
|
||||||
|
addPrescriptionRow(); // Add one empty row
|
||||||
|
|
||||||
|
if (patientId) {
|
||||||
|
$('#visit_patient_id').val(patientId).trigger('change');
|
||||||
|
} else {
|
||||||
|
$('#visit_patient_id').val('').trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset other selects
|
||||||
|
$('#visit_doctor_id').val('').trigger('change');
|
||||||
|
|
||||||
|
var modal = new bootstrap.Modal(document.getElementById('recordVisitModal'));
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditVisitModal(data) {
|
||||||
|
document.getElementById('visitForm').reset();
|
||||||
|
document.getElementById('visitAction').value = 'edit_visit';
|
||||||
|
document.getElementById('visitId').value = data.id;
|
||||||
|
document.getElementById('visitModalTitle').innerText = '<?php echo __('edit_visit'); ?>';
|
||||||
|
|
||||||
|
// Populate fields
|
||||||
|
$('#visit_patient_id').val(data.patient_id).trigger('change');
|
||||||
|
$('#visit_doctor_id').val(data.doctor_id).trigger('change');
|
||||||
|
document.getElementById('visit_weight').value = data.weight || '';
|
||||||
|
document.getElementById('visit_blood_pressure').value = data.blood_pressure || '';
|
||||||
|
document.getElementById('visit_heart_rate').value = data.heart_rate || '';
|
||||||
|
document.getElementById('visit_temperature').value = data.temperature || '';
|
||||||
|
|
||||||
|
// Populate Summernote fields
|
||||||
|
$('#visit_symptoms').summernote('code', data.symptoms || '');
|
||||||
|
$('#visit_diagnosis').summernote('code', data.diagnosis || '');
|
||||||
|
$('#visit_treatment_plan').summernote('code', data.treatment_plan || '');
|
||||||
|
|
||||||
|
// Populate prescriptions
|
||||||
|
const tbody = document.querySelector('#prescriptionTable tbody');
|
||||||
|
tbody.innerHTML = '';
|
||||||
|
|
||||||
|
if (data.prescriptions && data.prescriptions.length > 0) {
|
||||||
|
data.prescriptions.forEach(p => {
|
||||||
|
addPrescriptionRow(p.drug_name, p.dosage, p.instructions);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addPrescriptionRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
var modal = new bootstrap.Modal(document.getElementById('recordVisitModal'));
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showVisitResultsModal(data) {
|
||||||
|
const content = `
|
||||||
|
<dl class="row">
|
||||||
|
<dt class="col-sm-3"><?php echo __('date'); ?></dt>
|
||||||
|
<dd class="col-sm-9">${data.visit_date}</dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-3"><?php echo __('patient'); ?></dt>
|
||||||
|
<dd class="col-sm-9">${data.patient_name || '-'}</dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-3"><?php echo __('doctor'); ?></dt>
|
||||||
|
<dd class="col-sm-9">${data.doctor_name || '-'}</dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-3"><?php echo __('diagnosis'); ?></dt>
|
||||||
|
<dd class="col-sm-9">${data.diagnosis || '-'}</dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-3"><?php echo __('treatment'); ?></dt>
|
||||||
|
<dd class="col-sm-9">${data.treatment_plan || '-'}</dd>
|
||||||
|
|
||||||
|
<dt class="col-sm-3"><?php echo __('vitals'); ?></dt>
|
||||||
|
<dd class="col-sm-9">
|
||||||
|
BP: ${data.blood_pressure || '-'},
|
||||||
|
Weight: ${data.weight || '-'} kg,
|
||||||
|
Temp: ${data.temperature || '-'}°C
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
`;
|
||||||
|
document.getElementById('visitResultsContent').innerHTML = content;
|
||||||
|
var modal = new bootstrap.Modal(document.getElementById('visitResultsModal'));
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showLabInquiryModalFromVisit(visitId, patientId, patientName) {
|
||||||
|
document.getElementById('inquiry_visit_id').value = visitId;
|
||||||
|
document.getElementById('inquiry_patient_id').value = patientId;
|
||||||
|
document.getElementById('inquiry_patient_name').value = patientName || '';
|
||||||
|
// if patient name is present, make it readonly maybe?
|
||||||
|
|
||||||
|
// Clear tests
|
||||||
|
document.querySelector('#inquiryTestsTable tbody').innerHTML = '';
|
||||||
|
addInquiryTestRow();
|
||||||
|
|
||||||
|
var modal = new bootstrap.Modal(document.getElementById('addInquiryModal'));
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showXrayInquiryModalFromVisit(visitId, patientId, patientName) {
|
||||||
|
document.getElementById('xray_inquiry_visit_id').value = visitId;
|
||||||
|
document.getElementById('xray_inquiry_patient_id').value = patientId;
|
||||||
|
document.getElementById('xray_inquiry_patient_name').value = patientName || '';
|
||||||
|
|
||||||
|
// Clear tests
|
||||||
|
document.querySelector('#xrayInquiryTestsTable tbody').innerHTML = '';
|
||||||
|
addXrayInquiryTestRow();
|
||||||
|
|
||||||
|
var modal = new bootstrap.Modal(document.getElementById('addXrayInquiryModal'));
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showReportModal(visitId) {
|
||||||
|
document.getElementById('report_visit_id').value = visitId;
|
||||||
|
var modal = new bootstrap.Modal(document.getElementById('reportModal'));
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Bill Modal ---
|
||||||
|
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 || '';
|
||||||
|
|
||||||
|
// Reset table
|
||||||
|
const tbody = document.querySelector('#billTable tbody');
|
||||||
|
tbody.innerHTML = `
|
||||||
|
<tr>
|
||||||
|
<td><input type="text" name="items[]" class="form-control" placeholder="Consultation Fee" required></td>
|
||||||
|
<td><input type="number" step="0.01" name="amounts[]" class="form-control" required></td>
|
||||||
|
<td><button type="button" class="btn btn-sm btn-danger" onclick="removeBillItemRow(this)"><i class="bi bi-x-lg"></i></button></td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
|
||||||
|
var modal = new bootstrap.Modal(document.getElementById('billModal'));
|
||||||
|
modal.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Helper Functions ---
|
||||||
|
function addPrescriptionRow(drugName = '', dosage = '', instructions = '') {
|
||||||
|
const tbody = document.querySelector('#prescriptionTable tbody');
|
||||||
|
const tr = document.createElement('tr');
|
||||||
|
|
||||||
|
// Build options for drug select
|
||||||
|
let drugOptions = '<option value="">Select Drug...</option>';
|
||||||
|
<?php foreach ($all_drugs as $drug): ?>
|
||||||
|
drugOptions += `<option value="<?php echo htmlspecialchars($drug['name']); ?>" data-dosage="<?php echo htmlspecialchars($drug['default_dosage']); ?>" data-instructions="<?php echo htmlspecialchars($drug['default_instructions']); ?>"><?php echo htmlspecialchars($drug['name']); ?></option>`;
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
tr.innerHTML = `
|
||||||
|
<td>
|
||||||
|
<div class="input-group">
|
||||||
|
<select name="prescriptions[drug_name][]" class="form-select drug-select" onchange="updateDrugDetails(this)">
|
||||||
|
${drugOptions}
|
||||||
|
</select>
|
||||||
|
<input type="text" name="prescriptions[custom_drug_name][]" class="form-control d-none" placeholder="Or type custom name">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td><input type="text" name="prescriptions[dosage][]" class="form-control" value="${dosage}"></td>
|
||||||
|
<td><input type="text" name="prescriptions[instructions][]" class="form-control" value="${instructions}"></td>
|
||||||
|
<td><button type="button" class="btn btn-sm btn-danger" onclick="removePrescriptionRow(this)"><i class="bi bi-x-lg"></i></button></td>
|
||||||
|
`;
|
||||||
|
tbody.appendChild(tr);
|
||||||
|
|
||||||
|
// Set value if provided
|
||||||
|
if (drugName) {
|
||||||
|
// Try to set select value
|
||||||
|
const select = tr.querySelector('select');
|
||||||
|
select.value = drugName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateDrugDetails(select) {
|
||||||
|
const option = select.options[select.selectedIndex];
|
||||||
|
const row = select.closest('tr');
|
||||||
|
if (option.value) {
|
||||||
|
row.querySelector('input[name="prescriptions[dosage][]"]').value = option.getAttribute('data-dosage') || '';
|
||||||
|
row.querySelector('input[name="prescriptions[instructions][]"]').value = option.getAttribute('data-instructions') || '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function removePrescriptionRow(btn) {
|
||||||
|
btn.closest('tr').remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
function addBillItemRow() {
|
||||||
|
const tbody = document.querySelector('#billTable tbody');
|
||||||
|
const tr = document.createElement('tr');
|
||||||
|
tr.innerHTML = `
|
||||||
|
<td><input type="text" name="items[]" class="form-control" required></td>
|
||||||
|
<td><input type="number" step="0.01" name="amounts[]" class="form-control" required></td>
|
||||||
|
<td><button type="button" class="btn btn-sm btn-danger" onclick="removeBillItemRow(this)"><i class="bi bi-x-lg"></i></button></td>
|
||||||
|
`;
|
||||||
|
tbody.appendChild(tr);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeBillItemRow(btn) {
|
||||||
|
const tbody = document.querySelector('#billTable tbody');
|
||||||
|
if (tbody.children.length > 1) {
|
||||||
|
btn.closest('tr').remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addInquiryTestRow() {
|
||||||
|
const tbody = document.querySelector('#inquiryTestsTable tbody');
|
||||||
|
const tr = document.createElement('tr');
|
||||||
|
|
||||||
|
let options = '<option value="">Select Test...</option>';
|
||||||
|
<?php foreach ($all_tests as $t): ?>
|
||||||
|
options += `<option value="<?php echo $t['id']; ?>"><?php echo htmlspecialchars($t['name']); ?> ($<?php echo $t['price']; ?>)</option>`;
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
tr.innerHTML = `
|
||||||
|
<td><select name="test_ids[]" class="form-select select2-modal">${options}</select></td>
|
||||||
|
<td><input type="text" name="results[]" class="form-control"></td>
|
||||||
|
<td><input type="file" name="attachments[]" class="form-control"></td>
|
||||||
|
<td><button type="button" class="btn btn-sm btn-danger" onclick="this.closest('tr').remove()"><i class="bi bi-x-lg"></i></button></td>
|
||||||
|
`;
|
||||||
|
tbody.appendChild(tr);
|
||||||
|
$(tr).find('.select2-modal').select2({ dropdownParent: $(tr).closest('.modal'), width: '100%' });
|
||||||
|
}
|
||||||
|
|
||||||
|
function addXrayInquiryTestRow() {
|
||||||
|
const tbody = document.querySelector('#xrayInquiryTestsTable tbody');
|
||||||
|
const tr = document.createElement('tr');
|
||||||
|
|
||||||
|
let options = '<option value="">Select X-Ray...</option>';
|
||||||
|
<?php foreach ($all_xrays as $x): ?>
|
||||||
|
options += `<option value="<?php echo $x['id']; ?>"><?php echo htmlspecialchars($x['name']); ?> ($<?php echo $x['price']; ?>)</option>`;
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
tr.innerHTML = `
|
||||||
|
<td><select name="xray_ids[]" class="form-select select2-modal">${options}</select></td>
|
||||||
|
<td><input type="text" name="results[]" class="form-control"></td>
|
||||||
|
<td><input type="file" name="attachments[]" class="form-control"></td>
|
||||||
|
<td><button type="button" class="btn btn-sm btn-danger" onclick="this.closest('tr').remove()"><i class="bi bi-x-lg"></i></button></td>
|
||||||
|
`;
|
||||||
|
tbody.appendChild(tr);
|
||||||
|
$(tr).find('.select2-modal').select2({ dropdownParent: $(tr).closest('.modal'), width: '100%' });
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Other Modals (Doctor, Nurse, etc.) ---
|
||||||
function showEditDoctorModal(data) {
|
function showEditDoctorModal(data) {
|
||||||
document.getElementById('edit_doctor_id').value = data.id;
|
document.getElementById('edit_doctor_id').value = data.id;
|
||||||
document.getElementById('edit_doctor_name_en').value = data.name_en;
|
document.getElementById('edit_doctor_name_en').value = data.name_en;
|
||||||
@ -1039,16 +1662,36 @@ document.getElementById('quickAddCityForm').addEventListener('submit', function(
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Initialize Select2 for modals
|
// Initialize Select2 for modals
|
||||||
$('.select2-modal').select2({
|
$('.select2-modal').each(function() {
|
||||||
dropdownParent: $('.modal'),
|
$(this).select2({
|
||||||
width: '100%'
|
dropdownParent: $(this).closest('.modal'),
|
||||||
|
width: '100%'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize Inputmask
|
// Initialize Inputmask
|
||||||
if (typeof Inputmask !== 'undefined') {
|
if (typeof Inputmask !== 'undefined') {
|
||||||
Inputmask().mask(document.querySelectorAll("input"));
|
Inputmask().mask(document.querySelectorAll("input"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize Summernote
|
||||||
|
$('.summernote').each(function() {
|
||||||
|
$(this).summernote({
|
||||||
|
placeholder: 'Type here...',
|
||||||
|
tabsize: 2,
|
||||||
|
height: $(this).data('height') || 100,
|
||||||
|
toolbar: [
|
||||||
|
['style', ['style']],
|
||||||
|
['font', ['bold', 'underline', 'clear']],
|
||||||
|
['color', ['color']],
|
||||||
|
['para', ['ul', 'ol', 'paragraph']],
|
||||||
|
['table', ['table']],
|
||||||
|
['insert', ['link', 'picture', 'video']],
|
||||||
|
['view', ['fullscreen', 'codeview', 'help']]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
8
lang.php
8
lang.php
@ -48,6 +48,7 @@ $translations = [
|
|||||||
'specialization' => 'Specialization',
|
'specialization' => 'Specialization',
|
||||||
'visits' => 'Visits',
|
'visits' => 'Visits',
|
||||||
'new_visit' => 'New Visit',
|
'new_visit' => 'New Visit',
|
||||||
|
'details' => 'Details',
|
||||||
'vitals' => 'Vitals',
|
'vitals' => 'Vitals',
|
||||||
'weight' => 'Weight (kg)',
|
'weight' => 'Weight (kg)',
|
||||||
'blood_pressure' => 'Blood Pressure',
|
'blood_pressure' => 'Blood Pressure',
|
||||||
@ -55,7 +56,9 @@ $translations = [
|
|||||||
'temperature' => 'Temperature (°C)',
|
'temperature' => 'Temperature (°C)',
|
||||||
'symptoms' => 'Symptoms',
|
'symptoms' => 'Symptoms',
|
||||||
'diagnosis' => 'Diagnosis',
|
'diagnosis' => 'Diagnosis',
|
||||||
|
'symptoms_diagnosis' => 'Symptoms & Diagnosis',
|
||||||
'treatment_plan' => 'Treatment Plan',
|
'treatment_plan' => 'Treatment Plan',
|
||||||
|
'treatment_prescription' => 'Treatment & Prescription',
|
||||||
'provisional_reports' => 'Provisional Reports',
|
'provisional_reports' => 'Provisional Reports',
|
||||||
'new_report' => 'New Report',
|
'new_report' => 'New Report',
|
||||||
'report_type' => 'Report Type',
|
'report_type' => 'Report Type',
|
||||||
@ -328,6 +331,7 @@ $translations = [
|
|||||||
'specialization' => 'التخصص',
|
'specialization' => 'التخصص',
|
||||||
'visits' => 'الزيارات',
|
'visits' => 'الزيارات',
|
||||||
'new_visit' => 'زيارة جديدة',
|
'new_visit' => 'زيارة جديدة',
|
||||||
|
'details' => 'التفاصيل',
|
||||||
'vitals' => 'العلامات الحيوية',
|
'vitals' => 'العلامات الحيوية',
|
||||||
'weight' => 'الوزن (كجم)',
|
'weight' => 'الوزن (كجم)',
|
||||||
'blood_pressure' => 'ضغط الدم',
|
'blood_pressure' => 'ضغط الدم',
|
||||||
@ -335,7 +339,9 @@ $translations = [
|
|||||||
'temperature' => 'درجة الحرارة',
|
'temperature' => 'درجة الحرارة',
|
||||||
'symptoms' => 'الأعراض',
|
'symptoms' => 'الأعراض',
|
||||||
'diagnosis' => 'التشخيص',
|
'diagnosis' => 'التشخيص',
|
||||||
|
'symptoms_diagnosis' => 'الأعراض والتشخيص',
|
||||||
'treatment_plan' => 'خطة العلاج',
|
'treatment_plan' => 'خطة العلاج',
|
||||||
|
'treatment_prescription' => 'العلاج والوصفة الطبية',
|
||||||
'provisional_reports' => 'التقارير المؤقتة',
|
'provisional_reports' => 'التقارير المؤقتة',
|
||||||
'new_report' => 'تقرير جديد',
|
'new_report' => 'تقرير جديد',
|
||||||
'report_type' => 'نوع التقرير',
|
'report_type' => 'نوع التقرير',
|
||||||
@ -538,4 +544,4 @@ $translations = [
|
|||||||
'inactive' => 'غير نشط',
|
'inactive' => 'غير نشط',
|
||||||
'are_you_sure_delete_service' => 'هل أنت متأكد أنك تريد حذف هذه الخدمة؟',
|
'are_you_sure_delete_service' => 'هل أنت متأكد أنك تريد حذف هذه الخدمة؟',
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user