@@ -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 += `
+
+
+
Lab
+
#${li.id}
+
${li.status}
+ ${li.notes ? `
${li.notes}
` : ''}
+
+
+
+ `;
+ });
+ }
+
+ // 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 += `
+
+
+
X-Ray
+
#${xi.id}
+
${xi.status}
+ ${xi.notes ? `
${xi.notes}
` : ''}
+
+
+
+ `;
+ });
+ }
+
+ if (html === '') {
+ html = '
';
+ }
+ inqContainer.innerHTML = html;
+ }
+
bootstrap.Modal.getOrCreateInstance(el).show();
}
}
diff --git a/lang.php b/lang.php
index 1e2064d..6d6933a 100644
--- a/lang.php
+++ b/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' => 'يرجى حفظ الزيارة أولاً لإضافة الاستفسارات.',
]
];
diff --git a/update_footer.py b/update_footer.py
new file mode 100644
index 0000000..2cc2ab8
--- /dev/null
+++ b/update_footer.py
@@ -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 = """
+
+"
+
+# Define the new content for Edit Visit Modal
+edit_visit_modal = """
+
+
+
+
+
+"
+
+# Replace the blocks
+start_marker = ""
+end_marker = ""
+
+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")
\ No newline at end of file
diff --git a/update_footer_inquiries.py b/update_footer_inquiries.py
new file mode 100644
index 0000000..4fd9558
--- /dev/null
+++ b/update_footer_inquiries.py
@@ -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'(
)'
+
+new_html = r"""
"""
+
+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 += `
+
+
+
Lab
+
#${li.id}
+
${li.status}
+ ${li.notes ? `
${li.notes}
` : ''}
+
+
+
+ `;
+ });
+ }
+
+ // 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 += `
+
+
+
X-Ray
+
#${xi.id}
+
${xi.status}
+ ${xi.notes ? `
${xi.notes}
` : ''}
+
+
+
+ `;
+ });
+ }
+
+ if (html === '') {
+ html = '
';
+ }
+ 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.")