Autosave: 20260305-095147
This commit is contained in:
parent
defcfeb7da
commit
e15aadbaf9
@ -1214,6 +1214,26 @@
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="nav nav-tabs mb-3" id="recordVisitTabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="rv-patient-tab" data-bs-toggle="tab" data-bs-target="#rv-patient" type="button" role="tab" aria-controls="rv-patient" aria-selected="true"><?php echo __('patient'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="rv-vital-tab" data-bs-toggle="tab" data-bs-target="#rv-vital" type="button" role="tab" aria-controls="rv-vital" aria-selected="false"><?php echo __('vitals'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="rv-symptoms-tab" data-bs-toggle="tab" data-bs-target="#rv-symptoms" type="button" role="tab" aria-controls="rv-symptoms" aria-selected="false"><?php echo __('symptoms'); ?> & <?php echo __('diagnosis'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="rv-inquiries-tab" data-bs-toggle="tab" data-bs-target="#rv-inquiries" type="button" role="tab" aria-controls="rv-inquiries" aria-selected="false"><?php echo __('inquiries'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="rv-treatment-tab" data-bs-toggle="tab" data-bs-target="#rv-treatment" type="button" role="tab" aria-controls="rv-treatment" aria-selected="false"><?php echo __('treatment_plan'); ?> & <?php echo __('prescriptions'); ?></button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="recordVisitTabContent">
|
||||
<!-- Patient Details -->
|
||||
<div class="tab-pane fade show active" id="rv-patient" role="tabpanel" aria-labelledby="rv-patient-tab">
|
||||
<div class="row">
|
||||
<div class="col-md-12 mb-3">
|
||||
<label class="form-label"><?php echo __('appointment'); ?> (<?php echo __('optional'); ?>)</label>
|
||||
@ -1247,27 +1267,31 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<!-- Vitals -->
|
||||
<div class="tab-pane fade" id="rv-vital" role="tabpanel" aria-labelledby="rv-vital-tab">
|
||||
<h6 class="fw-bold mb-3"><?php echo __('vitals'); ?></h6>
|
||||
<div class="row">
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="col-md-6 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">
|
||||
<div class="col-md-6 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">
|
||||
<div class="col-md-6 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">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('temperature'); ?></label>
|
||||
<input type="text" name="temperature" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<!-- Symptoms & Diagnosis -->
|
||||
<div class="tab-pane fade" id="rv-symptoms" role="tabpanel" aria-labelledby="rv-symptoms-tab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __('symptoms'); ?></label>
|
||||
@ -1286,6 +1310,16 @@
|
||||
</div>
|
||||
<textarea name="diagnosis" class="form-control rich-editor" rows="2"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Inquiries -->
|
||||
<div class="tab-pane fade" id="rv-inquiries" role="tabpanel" aria-labelledby="rv-inquiries-tab">
|
||||
<div class="alert alert-info py-3">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
<?php echo __('save_visit_to_add_inquiries'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Treatment & Prescription -->
|
||||
<div class="tab-pane fade" id="rv-treatment" role="tabpanel" aria-labelledby="rv-treatment-tab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __("treatment_plan"); ?></label>
|
||||
@ -1306,6 +1340,8 @@
|
||||
<div id="visit_prescriptions_container"></div>
|
||||
</div>
|
||||
</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-info text-white px-4"><?php echo __('save'); ?></button>
|
||||
@ -1327,6 +1363,26 @@
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="nav nav-tabs mb-3" id="editVisitTabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="ev-patient-tab" data-bs-toggle="tab" data-bs-target="#ev-patient" type="button" role="tab" aria-controls="ev-patient" aria-selected="true"><?php echo __('patient'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="ev-vital-tab" data-bs-toggle="tab" data-bs-target="#ev-vital" type="button" role="tab" aria-controls="ev-vital" aria-selected="false"><?php echo __('vitals'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="ev-symptoms-tab" data-bs-toggle="tab" data-bs-target="#ev-symptoms" type="button" role="tab" aria-controls="ev-symptoms" aria-selected="false"><?php echo __('symptoms'); ?> & <?php echo __('diagnosis'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="ev-inquiries-tab" data-bs-toggle="tab" data-bs-target="#ev-inquiries" type="button" role="tab" aria-controls="ev-inquiries" aria-selected="false"><?php echo __('inquiries'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="ev-treatment-tab" data-bs-toggle="tab" data-bs-target="#ev-treatment" type="button" role="tab" aria-controls="ev-treatment" aria-selected="false"><?php echo __('treatment_plan'); ?> & <?php echo __('prescriptions'); ?></button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="editVisitTabContent">
|
||||
<!-- Patient Details -->
|
||||
<div class="tab-pane fade show active" id="ev-patient" role="tabpanel" aria-labelledby="ev-patient-tab">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('patient'); ?></label>
|
||||
@ -1347,27 +1403,31 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<!-- Vitals -->
|
||||
<div class="tab-pane fade" id="ev-vital" role="tabpanel" aria-labelledby="ev-vital-tab">
|
||||
<h6 class="fw-bold mb-3"><?php echo __('vitals'); ?></h6>
|
||||
<div class="row">
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('weight'); ?></label>
|
||||
<input type="text" name="weight" id="edit_visit_weight" class="form-control">
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('blood_pressure'); ?></label>
|
||||
<input type="text" name="blood_pressure" id="edit_visit_blood_pressure" class="form-control" placeholder="120/80">
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('heart_rate'); ?></label>
|
||||
<input type="text" name="heart_rate" id="edit_visit_heart_rate" class="form-control">
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('temperature'); ?></label>
|
||||
<input type="text" name="temperature" id="edit_visit_temperature" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<!-- Symptoms & Diagnosis -->
|
||||
<div class="tab-pane fade" id="ev-symptoms" role="tabpanel" aria-labelledby="ev-symptoms-tab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __('symptoms'); ?></label>
|
||||
@ -1386,6 +1446,23 @@
|
||||
</div>
|
||||
<textarea name="diagnosis" id="edit_visit_diagnosis" class="form-control rich-editor" rows="2"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Inquiries -->
|
||||
<div class="tab-pane fade" id="ev-inquiries" role="tabpanel" aria-labelledby="ev-inquiries-tab">
|
||||
<div class="d-flex justify-content-end gap-2 mb-3">
|
||||
<button type="button" class="btn btn-sm btn-info text-white" id="btn_add_lab_inquiry">
|
||||
<i class="bi bi-flask"></i> <?php echo __('add_inquiry'); ?>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-dark" id="btn_add_xray_inquiry">
|
||||
<i class="bi bi-camera"></i> <?php echo __('add_xray_inquiry'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<div id="edit_visit_inquiries_list" class="list-group">
|
||||
<!-- Populated by JS -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- Treatment & Prescription -->
|
||||
<div class="tab-pane fade" id="ev-treatment" role="tabpanel" aria-labelledby="ev-treatment-tab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __("treatment_plan"); ?></label>
|
||||
@ -1406,6 +1483,8 @@
|
||||
<div id="edit_visit_prescriptions_container"></div>
|
||||
</div>
|
||||
</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>
|
||||
@ -1415,6 +1494,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Create Bill Modal -->
|
||||
<div class="modal fade" id="createBillModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
@ -2563,6 +2643,75 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update Add Buttons
|
||||
const btnLab = document.getElementById('btn_add_lab_inquiry');
|
||||
const btnXray = document.getElementById('btn_add_xray_inquiry');
|
||||
if (btnLab) {
|
||||
btnLab.onclick = function() {
|
||||
showLabInquiryModalFromVisit(visit.id, visit.patient_id, visit.patient_name);
|
||||
};
|
||||
}
|
||||
if (btnXray) {
|
||||
btnXray.onclick = function() {
|
||||
showXrayInquiryModalFromVisit(visit.id, visit.patient_id, visit.patient_name);
|
||||
};
|
||||
}
|
||||
|
||||
// Populate Inquiries List
|
||||
const inqContainer = document.getElementById('edit_visit_inquiries_list');
|
||||
if (inqContainer) {
|
||||
let html = '';
|
||||
|
||||
// Lab Inquiries
|
||||
if (visit.lab_inquiries && visit.lab_inquiries.length > 0) {
|
||||
visit.lab_inquiries.forEach(li => {
|
||||
li.patient_name = visit.patient_name; // Ensure patient name is passed
|
||||
// Escape single quotes in JSON
|
||||
const jsonLi = JSON.stringify(li).replace(/'/g, "'").replace(/"/g, """);
|
||||
html += `
|
||||
<div class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="badge bg-info me-2">Lab</span>
|
||||
<span class="fw-bold">#${li.id}</span>
|
||||
<span class="text-muted small ms-2">${li.status}</span>
|
||||
${li.notes ? `<div class="small text-muted mt-1"><em>${li.notes}</em></div>` : ''}
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick='showEditInquiryModal(${jsonLi})'>
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
// Xray Inquiries
|
||||
if (visit.xray_inquiries && visit.xray_inquiries.length > 0) {
|
||||
visit.xray_inquiries.forEach(xi => {
|
||||
xi.patient_name = visit.patient_name; // Ensure patient name is passed
|
||||
const jsonXi = JSON.stringify(xi).replace(/'/g, "'").replace(/"/g, """);
|
||||
html += `
|
||||
<div class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="badge bg-dark me-2">X-Ray</span>
|
||||
<span class="fw-bold">#${xi.id}</span>
|
||||
<span class="text-muted small ms-2">${xi.status}</span>
|
||||
${xi.notes ? `<div class="small text-muted mt-1"><em>${xi.notes}</em></div>` : ''}
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick='showEditXrayInquiryModal(${jsonXi})'>
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
if (html === '') {
|
||||
html = '<div class="text-center text-muted p-3"><?php echo __("no_data_found"); ?></div>';
|
||||
}
|
||||
inqContainer.innerHTML = html;
|
||||
}
|
||||
|
||||
bootstrap.Modal.getOrCreateInstance(el).show();
|
||||
}
|
||||
}
|
||||
|
||||
2
lang.php
2
lang.php
@ -247,6 +247,7 @@ $translations = [
|
||||
'import_successfully' => 'Imported successfully',
|
||||
'csv_format_drugs' => 'CSV Format: Name (EN), Name (AR), Group Name, Price, Expiry Date (YYYY-MM-DD), Supplier Name',
|
||||
'csv_format_groups' => 'CSV Format: Name (EN), Name (AR)',
|
||||
'save_visit_to_add_inquiries' => 'Please save the visit first to add inquiries.',
|
||||
],
|
||||
'ar' => [
|
||||
'attachment' => 'المرفق',
|
||||
@ -497,5 +498,6 @@ $translations = [
|
||||
'import_successfully' => 'تم الاستيراد بنجاح',
|
||||
'csv_format_drugs' => 'تنسيق CSV: الاسم (إنجليزي)، الاسم (عربي)، اسم المجموعة، السعر، تاريخ الانتهاء، اسم المورد',
|
||||
'csv_format_groups' => 'تنسيق CSV: الاسم (إنجليزي)، الاسم (عربي)',
|
||||
'save_visit_to_add_inquiries' => 'يرجى حفظ الزيارة أولاً لإضافة الاستفسارات.',
|
||||
]
|
||||
];
|
||||
|
||||
308
update_footer.py
Normal file
308
update_footer.py
Normal file
@ -0,0 +1,308 @@
|
||||
import re
|
||||
|
||||
file_path = 'includes/layout/footer.php'
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
# Define the new content for Record Visit Modal
|
||||
record_visit_modal = """<!-- 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" enctype="multipart/form-data">
|
||||
<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 text-white"><?php echo __('add_visit'); ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="nav nav-tabs mb-3" id="recordVisitTabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="rv-patient-tab" data-bs-toggle="tab" data-bs-target="#rv-patient" type="button" role="tab" aria-controls="rv-patient" aria-selected="true"><?php echo __('patient'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="rv-vital-tab" data-bs-toggle="tab" data-bs-target="#rv-vital" type="button" role="tab" aria-controls="rv-vital" aria-selected="false"><?php echo __('vitals'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="rv-symptoms-tab" data-bs-toggle="tab" data-bs-target="#rv-symptoms" type="button" role="tab" aria-controls="rv-symptoms" aria-selected="false"><?php echo __('symptoms'); ?> & <?php echo __('diagnosis'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="rv-inquiries-tab" data-bs-toggle="tab" data-bs-target="#rv-inquiries" type="button" role="tab" aria-controls="rv-inquiries" aria-selected="false"><?php echo __('inquiries'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="rv-treatment-tab" data-bs-toggle="tab" data-bs-target="#rv-treatment" type="button" role="tab" aria-controls="rv-treatment" aria-selected="false"><?php echo __('treatment_plan'); ?> & <?php echo __('prescriptions'); ?></button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="recordVisitTabContent">
|
||||
<!-- Patient Details -->
|
||||
<div class="tab-pane fade show active" id="rv-patient" role="tabpanel" aria-labelledby="rv-patient-tab">
|
||||
<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 select2-modal" 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['start_time']; ?>
|
||||
</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 select2-modal" 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 select2-modal" 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>
|
||||
</div>
|
||||
<!-- Vitals -->
|
||||
<div class="tab-pane fade" id="rv-vital" role="tabpanel" aria-labelledby="rv-vital-tab">
|
||||
<h6 class="fw-bold mb-3"><?php echo __('vitals'); ?></h6>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('weight'); ?></label>
|
||||
<input type="text" name="weight" class="form-control">
|
||||
</div>
|
||||
<div class="col-md-6 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-6 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-6 mb-3">
|
||||
<label class="form-label"><?php echo __('temperature'); ?></label>
|
||||
<input type="text" name="temperature" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Symptoms & Diagnosis -->
|
||||
<div class="tab-pane fade" id="rv-symptoms" role="tabpanel" aria-labelledby="rv-symptoms-tab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __('symptoms'); ?></label>
|
||||
<button type="button" class="btn btn-sm btn-outline-info" onclick="generateAISuggestion(this)" data-target="symptoms">
|
||||
<i class="bi bi-stars"></i> AI Suggestion
|
||||
</button>
|
||||
</div>
|
||||
<textarea name="symptoms" class="form-control rich-editor" rows="2"></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __('diagnosis'); ?></label>
|
||||
<button type="button" class="btn btn-sm btn-outline-info" onclick="generateAISuggestion(this)" data-target="diagnosis">
|
||||
<i class="bi bi-stars"></i> AI Suggestion
|
||||
</button>
|
||||
</div>
|
||||
<textarea name="diagnosis" class="form-control rich-editor" rows="2"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Inquiries -->
|
||||
<div class="tab-pane fade" id="rv-inquiries" role="tabpanel" aria-labelledby="rv-inquiries-tab">
|
||||
<div class="alert alert-info py-3">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
<?php echo __('save_visit_to_add_inquiries'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Treatment & Prescription -->
|
||||
<div class="tab-pane fade" id="rv-treatment" role="tabpanel" aria-labelledby="rv-treatment-tab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __("treatment_plan"); ?></label>
|
||||
<button type="button" class="btn btn-sm btn-outline-info" onclick="generateAISuggestion(this)" data-target="treatment_plan">
|
||||
<i class="bi bi-stars"></i> AI Suggestion
|
||||
</button>
|
||||
</div>
|
||||
<textarea name="treatment_plan" class="form-control rich-editor" rows="2"></textarea>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0 fw-bold"><?php echo __('prescriptions'); ?></label>
|
||||
<button type="button" class="btn btn-sm btn-outline-primary" onclick="addPrescriptionRow('visit_prescriptions_container')">
|
||||
<i class="bi bi-plus-circle"></i> <?php echo __('add_drug'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<div id="visit_prescriptions_container"></div>
|
||||
</div>
|
||||
</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-info text-white px-4"><?php echo __('save'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
"
|
||||
|
||||
# Define the new content for Edit Visit Modal
|
||||
edit_visit_modal = """<!-- Edit Visit Modal -->
|
||||
<div class="modal fade" id="editVisitModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="action" value="edit_visit">
|
||||
<input type="hidden" name="id" id="edit_visit_id">
|
||||
<div class="modal-content border-0 shadow">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title fw-bold text-white"><?php echo __('edit_visit'); ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<ul class="nav nav-tabs mb-3" id="editVisitTabs" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="ev-patient-tab" data-bs-toggle="tab" data-bs-target="#ev-patient" type="button" role="tab" aria-controls="ev-patient" aria-selected="true"><?php echo __('patient'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="ev-vital-tab" data-bs-toggle="tab" data-bs-target="#ev-vital" type="button" role="tab" aria-controls="ev-vital" aria-selected="false"><?php echo __('vitals'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="ev-symptoms-tab" data-bs-toggle="tab" data-bs-target="#ev-symptoms" type="button" role="tab" aria-controls="ev-symptoms" aria-selected="false"><?php echo __('symptoms'); ?> & <?php echo __('diagnosis'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="ev-inquiries-tab" data-bs-toggle="tab" data-bs-target="#ev-inquiries" type="button" role="tab" aria-controls="ev-inquiries" aria-selected="false"><?php echo __('inquiries'); ?></button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="ev-treatment-tab" data-bs-toggle="tab" data-bs-target="#ev-treatment" type="button" role="tab" aria-controls="ev-treatment" aria-selected="false"><?php echo __('treatment_plan'); ?> & <?php echo __('prescriptions'); ?></button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content" id="editVisitTabContent">
|
||||
<!-- Patient Details -->
|
||||
<div class="tab-pane fade show active" id="ev-patient" role="tabpanel" aria-labelledby="ev-patient-tab">
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('patient'); ?></label>
|
||||
<select name="patient_id" id="edit_visit_patient_id" class="form-select select2-modal" 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="edit_visit_doctor_id" class="form-select select2-modal" 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>
|
||||
</div>
|
||||
<!-- Vitals -->
|
||||
<div class="tab-pane fade" id="ev-vital" role="tabpanel" aria-labelledby="ev-vital-tab">
|
||||
<h6 class="fw-bold mb-3"><?php echo __('vitals'); ?></h6>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('weight'); ?></label>
|
||||
<input type="text" name="weight" id="edit_visit_weight" class="form-control">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('blood_pressure'); ?></label>
|
||||
<input type="text" name="blood_pressure" id="edit_visit_blood_pressure" class="form-control" placeholder="120/80">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('heart_rate'); ?></label>
|
||||
<input type="text" name="heart_rate" id="edit_visit_heart_rate" class="form-control">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('temperature'); ?></label>
|
||||
<input type="text" name="temperature" id="edit_visit_temperature" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Symptoms & Diagnosis -->
|
||||
<div class="tab-pane fade" id="ev-symptoms" role="tabpanel" aria-labelledby="ev-symptoms-tab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __('symptoms'); ?></label>
|
||||
<button type="button" class="btn btn-sm btn-outline-info" onclick="generateAISuggestion(this)" data-target="symptoms">
|
||||
<i class="bi bi-stars"></i> AI Suggestion
|
||||
</button>
|
||||
</div>
|
||||
<textarea name="symptoms" id="edit_visit_symptoms" class="form-control rich-editor" rows="2"></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __('diagnosis'); ?></label>
|
||||
<button type="button" class="btn btn-sm btn-outline-info" onclick="generateAISuggestion(this)" data-target="diagnosis">
|
||||
<i class="bi bi-stars"></i> AI Suggestion
|
||||
</button>
|
||||
</div>
|
||||
<textarea name="diagnosis" id="edit_visit_diagnosis" class="form-control rich-editor" rows="2"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Inquiries -->
|
||||
<div class="tab-pane fade" id="ev-inquiries" role="tabpanel" aria-labelledby="ev-inquiries-tab">
|
||||
<div class="alert alert-info py-3">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
<?php echo __('save_visit_to_add_inquiries'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Treatment & Prescription -->
|
||||
<div class="tab-pane fade" id="ev-treatment" role="tabpanel" aria-labelledby="ev-treatment-tab">
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0"><?php echo __("treatment_plan"); ?></label>
|
||||
<button type="button" class="btn btn-sm btn-outline-info" onclick="generateAISuggestion(this)" data-target="treatment_plan">
|
||||
<i class="bi bi-stars"></i> AI Suggestion
|
||||
</button>
|
||||
</div>
|
||||
<textarea name="treatment_plan" id="edit_visit_treatment_plan" class="form-control rich-editor" rows="2"></textarea>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<label class="form-label mb-0 fw-bold"><?php echo __('prescriptions'); ?></label>
|
||||
<button type="button" class="btn btn-sm btn-outline-primary" onclick="addPrescriptionRow('edit_visit_prescriptions_container')">
|
||||
<i class="bi bi-plus-circle"></i> <?php echo __('add_drug'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<div id="edit_visit_prescriptions_container"></div>
|
||||
</div>
|
||||
</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>
|
||||
"
|
||||
|
||||
# Replace the blocks
|
||||
start_marker = "<!-- Record Visit Modal -->"
|
||||
end_marker = "<!-- Create Bill Modal -->"
|
||||
|
||||
start_idx = content.find(start_marker)
|
||||
end_idx = content.find(end_marker)
|
||||
|
||||
if start_idx != -1 and end_idx != -1:
|
||||
new_content = content[:start_idx] + record_visit_modal + "\n\n" + edit_visit_modal + "\n\n" + content[end_idx:]
|
||||
with open(file_path, 'w', encoding='utf-8') as f:
|
||||
f.write(new_content)
|
||||
else:
|
||||
print("Could not find markers")
|
||||
110
update_footer_inquiries.py
Normal file
110
update_footer_inquiries.py
Normal file
@ -0,0 +1,110 @@
|
||||
|
||||
import re
|
||||
|
||||
file_path = 'includes/layout/footer.php'
|
||||
|
||||
with open(file_path, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
# 1. Update HTML for #ev-inquiries
|
||||
# Search for the specific block
|
||||
html_pattern = r'(<div class="tab-pane fade" id="ev-inquiries" role="tabpanel" aria-labelledby="ev-inquiries-tab">\s*<div class="alert alert-info py-3">.*?</div>\s*</div>)'
|
||||
|
||||
new_html = r"""<div class="tab-pane fade" id="ev-inquiries" role="tabpanel" aria-labelledby="ev-inquiries-tab">
|
||||
<div class="d-flex justify-content-end gap-2 mb-3">
|
||||
<button type="button" class="btn btn-sm btn-info text-white" id="btn_add_lab_inquiry">
|
||||
<i class="bi bi-flask"></i> <?php echo __('add_inquiry'); ?>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-dark" id="btn_add_xray_inquiry">
|
||||
<i class="bi bi-camera"></i> <?php echo __('add_xray_inquiry'); ?>
|
||||
</button>
|
||||
</div>
|
||||
<div id="edit_visit_inquiries_list" class="list-group">
|
||||
<!-- Populated by JS -->
|
||||
</div>
|
||||
</div>"""
|
||||
|
||||
content = re.sub(html_pattern, new_html, content, flags=re.DOTALL)
|
||||
|
||||
|
||||
# 2. Update JS showEditVisitModal
|
||||
# We will inject the new logic before the last line of the function (bootstrap.Modal....)
|
||||
js_pattern = r'(function showEditVisitModal\(visit\) \{.*?)(bootstrap\.Modal\.getOrCreateInstance\(el\)\.show\(\);)'
|
||||
|
||||
js_injection = r"""
|
||||
// Update Add Buttons
|
||||
const btnLab = document.getElementById('btn_add_lab_inquiry');
|
||||
const btnXray = document.getElementById('btn_add_xray_inquiry');
|
||||
if (btnLab) {
|
||||
btnLab.onclick = function() {
|
||||
showLabInquiryModalFromVisit(visit.id, visit.patient_id, visit.patient_name);
|
||||
};
|
||||
}
|
||||
if (btnXray) {
|
||||
btnXray.onclick = function() {
|
||||
showXrayInquiryModalFromVisit(visit.id, visit.patient_id, visit.patient_name);
|
||||
};
|
||||
}
|
||||
|
||||
// Populate Inquiries List
|
||||
const inqContainer = document.getElementById('edit_visit_inquiries_list');
|
||||
if (inqContainer) {
|
||||
let html = '';
|
||||
|
||||
// Lab Inquiries
|
||||
if (visit.lab_inquiries && visit.lab_inquiries.length > 0) {
|
||||
visit.lab_inquiries.forEach(li => {
|
||||
li.patient_name = visit.patient_name; // Ensure patient name is passed
|
||||
// Escape single quotes in JSON
|
||||
const jsonLi = JSON.stringify(li).replace(/'/g, "'").replace(/"/g, """);
|
||||
html += `
|
||||
<div class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="badge bg-info me-2">Lab</span>
|
||||
<span class="fw-bold">#${li.id}</span>
|
||||
<span class="text-muted small ms-2">${li.status}</span>
|
||||
${li.notes ? `<div class="small text-muted mt-1"><em>${li.notes}</em></div>` : ''}
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick='showEditInquiryModal(${jsonLi})'>
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
// Xray Inquiries
|
||||
if (visit.xray_inquiries && visit.xray_inquiries.length > 0) {
|
||||
visit.xray_inquiries.forEach(xi => {
|
||||
xi.patient_name = visit.patient_name; // Ensure patient name is passed
|
||||
const jsonXi = JSON.stringify(xi).replace(/'/g, "'").replace(/"/g, """);
|
||||
html += `
|
||||
<div class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="badge bg-dark me-2">X-Ray</span>
|
||||
<span class="fw-bold">#${xi.id}</span>
|
||||
<span class="text-muted small ms-2">${xi.status}</span>
|
||||
${xi.notes ? `<div class="small text-muted mt-1"><em>${xi.notes}</em></div>` : ''}
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" onclick='showEditXrayInquiryModal(${jsonXi})'>
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
}
|
||||
|
||||
if (html === '') {
|
||||
html = '<div class="text-center text-muted p-3"><?php echo __("no_data_found"); ?></div>';
|
||||
}
|
||||
inqContainer.innerHTML = html;
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
content = re.sub(js_pattern, r'\1' + js_injection + r'\2', content, flags=re.DOTALL)
|
||||
|
||||
with open(file_path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print("Updated includes/layout/footer.php successfully.")
|
||||
Loading…
x
Reference in New Issue
Block a user