updating patient form
This commit is contained in:
parent
48924b82af
commit
6439167fd2
5
db/migrations/20260305_add_details_to_patients.sql
Normal file
5
db/migrations/20260305_add_details_to_patients.sql
Normal file
@ -0,0 +1,5 @@
|
||||
-- Add civil_id, nationality, city to patients
|
||||
ALTER TABLE patients
|
||||
ADD COLUMN civil_id VARCHAR(50) DEFAULT NULL,
|
||||
ADD COLUMN nationality VARCHAR(100) DEFAULT NULL,
|
||||
ADD COLUMN city VARCHAR(100) DEFAULT NULL;
|
||||
@ -83,10 +83,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$insurance_company_id = $_POST['insurance_company_id'] ?: null;
|
||||
$policy_number = $_POST['policy_number'] ?? '';
|
||||
$address = $_POST['address'] ?? '';
|
||||
$civil_id = $_POST['civil_id'] ?? '';
|
||||
$nationality = $_POST['nationality'] ?? '';
|
||||
$city = $_POST['city'] ?? '';
|
||||
|
||||
if ($name) {
|
||||
$stmt = $db->prepare("INSERT INTO patients (name, phone, dob, gender, blood_group, insurance_company_id, policy_number, address) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address]);
|
||||
$stmt = $db->prepare("INSERT INTO patients (name, phone, dob, gender, blood_group, insurance_company_id, policy_number, address, civil_id, nationality, city) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $civil_id, $nationality, $city]);
|
||||
$_SESSION['flash_message'] = __('add_patient') . ' ' . __('successfully');
|
||||
$redirect = true;
|
||||
}
|
||||
@ -100,10 +103,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$insurance_company_id = $_POST['insurance_company_id'] ?: null;
|
||||
$policy_number = $_POST['policy_number'] ?? '';
|
||||
$address = $_POST['address'] ?? '';
|
||||
$civil_id = $_POST['civil_id'] ?? '';
|
||||
$nationality = $_POST['nationality'] ?? '';
|
||||
$city = $_POST['city'] ?? '';
|
||||
|
||||
if ($id && $name) {
|
||||
$stmt = $db->prepare("UPDATE patients SET name = ?, phone = ?, dob = ?, gender = ?, blood_group = ?, insurance_company_id = ?, policy_number = ?, address = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $id]);
|
||||
$stmt = $db->prepare("UPDATE patients SET name = ?, phone = ?, dob = ?, gender = ?, blood_group = ?, insurance_company_id = ?, policy_number = ?, address = ?, civil_id = ?, nationality = ?, city = ? WHERE id = ?");
|
||||
$stmt->execute([$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $civil_id, $nationality, $city, $id]);
|
||||
$_SESSION['flash_message'] = __('edit_patient') . ' ' . __('successfully');
|
||||
$redirect = true;
|
||||
}
|
||||
@ -758,6 +764,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$phone = $_POST['phone'] ?? '';
|
||||
$email = $_POST['email'] ?? '';
|
||||
$address = $_POST['address'] ?? '';
|
||||
$civil_id = $_POST['civil_id'] ?? '';
|
||||
$nationality = $_POST['nationality'] ?? '';
|
||||
$city = $_POST['city'] ?? '';
|
||||
|
||||
if ($name_en && $name_ar) {
|
||||
$stmt = $db->prepare("INSERT INTO suppliers (name_en, name_ar, contact_person, phone, email, address) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
@ -773,6 +782,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$phone = $_POST['phone'] ?? '';
|
||||
$email = $_POST['email'] ?? '';
|
||||
$address = $_POST['address'] ?? '';
|
||||
$civil_id = $_POST['civil_id'] ?? '';
|
||||
$nationality = $_POST['nationality'] ?? '';
|
||||
$city = $_POST['city'] ?? '';
|
||||
|
||||
if ($id && $name_en && $name_ar) {
|
||||
$stmt = $db->prepare("UPDATE suppliers SET name_en = ?, name_ar = ?, contact_person = ?, phone = ?, email = ?, address = ? WHERE id = ?");
|
||||
|
||||
@ -19,4 +19,4 @@ $scheduled_appointments = $db->query("
|
||||
FROM appointments a
|
||||
JOIN patients p ON a.patient_id = p.id
|
||||
WHERE a.status = 'Scheduled'
|
||||
ORDER BY a.start_time ASC")->fetchAll();
|
||||
ORDER BY a.start_time ASC")->fetchAll();$all_countries = require __DIR__ . "/countries.php";
|
||||
|
||||
28
includes/countries.php
Normal file
28
includes/countries.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// includes/countries.php
|
||||
return [
|
||||
"Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan",
|
||||
"Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei", "Bulgaria", "Burkina Faso", "Burundi",
|
||||
"Cabo Verde", "Cambodia", "Cameroon", "Canada", "Central African Republic", "Chad", "Chile", "China", "Colombia", "Comoros", "Congo (Congo-Brazzaville)", "Costa Rica", "Croatia", "Cuba", "Cyprus", "Czechia (Czech Republic)",
|
||||
"Democratic Republic of the Congo", "Denmark", "Djibouti", "Dominica", "Dominican Republic",
|
||||
"Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Eswatini (fmr. 'Swaziland')", "Ethiopia",
|
||||
"Fiji", "Finland", "France",
|
||||
"Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana",
|
||||
"Haiti", "Holy See", "Honduras", "Hungary",
|
||||
"Iceland", "India", "Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Ivory Coast",
|
||||
"Jamaica", "Japan", "Jordan",
|
||||
"Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan",
|
||||
"Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg",
|
||||
"Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Montenegro", "Morocco", "Mozambique", "Myanmar (formerly Burma)",
|
||||
"Namibia", "Nauru", "Nepal", "Netherlands", "New Zealand", "Nicaragua", "Niger", "Nigeria", "North Korea", "North Macedonia", "Norway",
|
||||
"Oman",
|
||||
"Pakistan", "Palau", "Palestine State", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Poland", "Portugal",
|
||||
"Qatar",
|
||||
"Romania", "Russia", "Rwanda",
|
||||
"Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Korea", "South Sudan", "Spain", "Sri Lanka", "Sudan", "Suriname", "Sweden", "Switzerland", "Syria",
|
||||
"Tajikistan", "Tanzania", "Thailand", "Timor-Leste", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu",
|
||||
"Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States of America", "Uruguay", "Uzbekistan",
|
||||
"Vanuatu", "Venezuela", "Vietnam",
|
||||
"Yemen",
|
||||
"Zambia", "Zimbabwe"
|
||||
];
|
||||
@ -18,6 +18,24 @@
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?php echo __('name'); ?></label>
|
||||
<input type="text" name="name" class="form-control" required>
|
||||
</div>\1\n <div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('civil_id'); ?></label>
|
||||
<input type="text" name="civil_id" class="form-control">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('nationality'); ?></label>
|
||||
<select name="nationality" class="form-select select2-modal">
|
||||
<option value=""><?php echo __('search'); ?>...</option>
|
||||
<?php foreach ($all_countries as $c): ?>
|
||||
<option value="<?php echo htmlspecialchars($c); ?>"><?php echo htmlspecialchars($c); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?php echo __('city'); ?></label>
|
||||
<input type="text" name="city" class="form-control">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
@ -90,6 +108,25 @@
|
||||
<label class="form-label"><?php echo __('name'); ?></label>
|
||||
<input type="text" name="name" id="edit_patient_name" class="form-control" required>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('civil_id'); ?></label>
|
||||
<input type="text" name="civil_id" id="edit_patient_civil_id" class="form-control">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('nationality'); ?></label>
|
||||
<select name="nationality" id="edit_patient_nationality" class="form-select select2-modal">
|
||||
<option value=""><?php echo __('search'); ?>...</option>
|
||||
<?php foreach ($all_countries as $c): ?>
|
||||
<option value="<?php echo htmlspecialchars($c); ?>"><?php echo htmlspecialchars($c); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?php echo __('city'); ?></label>
|
||||
<input type="text" name="city" id="edit_patient_city" class="form-control">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('phone'); ?></label>
|
||||
@ -2159,6 +2196,10 @@
|
||||
var fields = {
|
||||
'edit_patient_id': patient.id,
|
||||
'edit_patient_name': patient.name,
|
||||
'edit_patient_civil_id': patient.civil_id || '',
|
||||
'edit_patient_nationality': patient.nationality || '',
|
||||
'edit_patient_city': patient.city || '',
|
||||
|
||||
'edit_patient_phone': patient.phone,
|
||||
'edit_patient_dob': patient.dob,
|
||||
'edit_patient_gender': patient.gender,
|
||||
@ -2169,7 +2210,12 @@
|
||||
};
|
||||
for (var id in fields) {
|
||||
var field = document.getElementById(id);
|
||||
if (field) field.value = fields[id];
|
||||
if (field) {
|
||||
field.value = fields[id];
|
||||
if (id === 'edit_patient_nationality') {
|
||||
$(field).val(fields[id]).trigger('change');
|
||||
}
|
||||
}
|
||||
}
|
||||
bootstrap.Modal.getOrCreateInstance(el).show();
|
||||
}
|
||||
|
||||
6
lang.php
6
lang.php
@ -250,6 +250,9 @@ $translations = [
|
||||
'save_visit_to_add_inquiries' => 'Please save the visit first to add inquiries.',
|
||||
'or' => 'or',
|
||||
'no_patients_found' => 'No patients found',
|
||||
'civil_id' => 'Civil ID',
|
||||
'nationality' => 'Nationality',
|
||||
'city' => 'City',
|
||||
],
|
||||
'ar' => [
|
||||
'attachment' => 'المرفق',
|
||||
@ -503,5 +506,8 @@ $translations = [
|
||||
'save_visit_to_add_inquiries' => 'يرجى حفظ الزيارة أولاً لإضافة الاستفسارات.',
|
||||
'or' => 'أو',
|
||||
'no_patients_found' => 'لم يتم العثور على مرضى',
|
||||
'civil_id' => 'الرقم المدني',
|
||||
'nationality' => 'الجنسية',
|
||||
'city' => 'المدينة',
|
||||
]
|
||||
];
|
||||
@ -63,12 +63,18 @@ try {
|
||||
.prescription-header { border-bottom: 2px solid #000; padding-bottom: 20px; margin-bottom: 30px; }
|
||||
.prescription-footer { border-top: 2px solid #000; padding-top: 20px; margin-top: 50px; }
|
||||
.rx-symbol { font-size: 40px; font-weight: bold; font-family: cursive; margin-bottom: 10px; }
|
||||
.drug-item { margin-bottom: 15px; border-bottom: 1px dashed #ccc; padding-bottom: 10px; }
|
||||
.drug-name { font-weight: bold; font-size: 18px; }
|
||||
.drug-dose { font-style: italic; }
|
||||
|
||||
/* Grid Table Styles */
|
||||
.drug-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||
.drug-grid td { border: 1px solid #000; padding: 8px; vertical-align: top; }
|
||||
.drug-name { font-weight: bold; font-size: 15px; margin-bottom: 4px; display: block; }
|
||||
.drug-meta { font-size: 13px; line-height: 1.4; }
|
||||
.drug-meta strong { color: #555; }
|
||||
|
||||
@media print {
|
||||
.no-print { display: none; }
|
||||
body { padding: 20px; }
|
||||
.drug-grid td { page-break-inside: avoid; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@ -116,26 +122,32 @@ try {
|
||||
<?php if (empty($prescriptions)): ?>
|
||||
<p class="text-muted text-center py-5">No medications prescribed.</p>
|
||||
<?php else: ?>
|
||||
<div class="list-group list-group-flush">
|
||||
<?php foreach ($prescriptions as $index => $p): ?>
|
||||
<div class="drug-item">
|
||||
<div class="row">
|
||||
<div class="col-1 text-muted fw-bold"><?php echo $index + 1; ?>.</div>
|
||||
<div class="col-11">
|
||||
<table class="drug-grid">
|
||||
<?php
|
||||
$chunks = array_chunk($prescriptions, 3); // 3 columns
|
||||
foreach ($chunks as $row):
|
||||
?>
|
||||
<tr>
|
||||
<?php foreach ($row as $p): ?>
|
||||
<td>
|
||||
<div class="drug-name"><?php echo htmlspecialchars($p['drug_name']); ?></div>
|
||||
<div class="row mt-1">
|
||||
<div class="col-md-6">
|
||||
<span class="text-muted">Dose:</span> <span class="drug-dose"><?php echo htmlspecialchars($p['dosage']); ?></span>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<span class="text-muted">Instructions:</span> <span><?php echo htmlspecialchars($p['instructions']); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="drug-meta">
|
||||
<div><strong>Dose:</strong> <?php echo htmlspecialchars($p['dosage']); ?></div>
|
||||
<div><strong>Instr:</strong> <?php echo htmlspecialchars($p['instructions']); ?></div>
|
||||
</div>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Fill empty cells if the last row has fewer than 3 items
|
||||
$missing = 3 - count($row);
|
||||
for ($i = 0; $i < $missing; $i++):
|
||||
?>
|
||||
<td> </td>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
@ -2,109 +2,37 @@ import re
|
||||
|
||||
file_path = 'includes/actions.php'
|
||||
|
||||
try:
|
||||
with open(file_path, 'r') as f:
|
||||
content = f.read()
|
||||
except FileNotFoundError:
|
||||
print(f"Error: {file_path} not found.")
|
||||
exit(1)
|
||||
|
||||
# New function implementation
|
||||
new_function = r""" function parse_import_file($file_input) {
|
||||
if (!isset($file_input['error']) || $file_input['error'] !== UPLOAD_ERR_OK) {
|
||||
$_SESSION['import_error'] = 'Upload error code: ' . ($file_input['error'] ?? 'unknown');
|
||||
return false;
|
||||
}
|
||||
$ext = strtolower(pathinfo($file_input['name'], PATHINFO_EXTENSION));
|
||||
$rows = [];
|
||||
# 1. Update variable assignments
|
||||
# This is safe to replace globally as it adds variables where address is defined.
|
||||
content = content.replace(
|
||||
"$address = $_POST['address'] ?? '';",
|
||||
"$address = $_POST['address'] ?? '';\n $civil_id = $_POST['civil_id'] ?? '';\n $nationality = $_POST['nationality'] ?? '';\n $city = $_POST['city'] ?? '';"
|
||||
)
|
||||
|
||||
if ($ext === 'csv') {
|
||||
$handle = fopen($file_input['tmp_name'], 'r');
|
||||
if ($handle === false) {
|
||||
$_SESSION['import_error'] = 'Failed to open CSV file.';
|
||||
return false;
|
||||
}
|
||||
# Skip header
|
||||
fgetcsv($handle);
|
||||
while (($row = fgetcsv($handle)) !== false) {
|
||||
if (array_filter($row)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
if (empty($rows)) {
|
||||
$_SESSION['import_error'] = 'CSV file is empty or could not be parsed.';
|
||||
}
|
||||
} elseif ($ext === 'xlsx' || $ext === 'xls') {
|
||||
require_once __DIR__ . '/SimpleXLSX.php';
|
||||
if ($xlsx = \Shuchkin\SimpleXLSX::parse($file_input['tmp_name'])) {
|
||||
$rows = $xlsx->rows();
|
||||
array_shift($rows); # Skip header
|
||||
if (empty($rows)) {
|
||||
$_SESSION['import_error'] = 'Excel file is empty.';
|
||||
}
|
||||
} else {
|
||||
$_SESSION['import_error'] = 'SimpleXLSX Error: ' . \Shuchkin\SimpleXLSX::parseError();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$_SESSION['import_error'] = "Unsupported file extension: $ext. Please upload .csv or .xlsx";
|
||||
return false;
|
||||
}
|
||||
return $rows;
|
||||
}"""
|
||||
# 2. Update INSERT query (Add Patient)
|
||||
old_insert = '"INSERT INTO patients (name, phone, dob, gender, blood_group, insurance_company_id, policy_number, address) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"'
|
||||
new_insert = '"INSERT INTO patients (name, phone, dob, gender, blood_group, insurance_company_id, policy_number, address, civil_id, nationality, city) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"'
|
||||
content = content.replace(old_insert, new_insert)
|
||||
|
||||
# Escape specific regex characters in the new function if we used it in regex, but here we use it as replacement string.
|
||||
# We need to escape backslashes in the replacement string if we use re.sub, because \1, \g<1> etc have meaning.
|
||||
# However, our replacement string doesn't have those. But PHP has backslashes (namespaces).
|
||||
# So we need to escape backslashes for python string, and then for re.sub.
|
||||
# Update INSERT execution array
|
||||
old_exec_insert = '[$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address]'
|
||||
new_exec_insert = '[$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $civil_id, $nationality, $city]'
|
||||
content = content.replace(old_exec_insert, new_exec_insert)
|
||||
|
||||
# Actually, let's use string.replace() if possible, but we don't know the exact content of the old function to replace it exactly if it varies.
|
||||
# But we know the structure.
|
||||
# Let's try to identify the start and end of the function.
|
||||
# 3. Update UPDATE query (Edit Patient)
|
||||
old_update = '"UPDATE patients SET name = ?, phone = ?, dob = ?, gender = ?, blood_group = ?, insurance_company_id = ?, policy_number = ?, address = ? WHERE id = ?"'
|
||||
new_update = '"UPDATE patients SET name = ?, phone = ?, dob = ?, gender = ?, blood_group = ?, insurance_company_id = ?, policy_number = ?, address = ?, civil_id = ?, nationality = ?, city = ? WHERE id = ?"'
|
||||
content = content.replace(old_update, new_update)
|
||||
|
||||
start_marker = "function parse_import_file($file_input) {"
|
||||
end_marker = "return $rows;\n }"
|
||||
|
||||
start_pos = content.find(start_marker)
|
||||
if start_pos != -1:
|
||||
end_pos = content.find(end_marker, start_pos)
|
||||
if end_pos != -1:
|
||||
end_pos += len(end_marker)
|
||||
# Replace the function
|
||||
content = content[:start_pos] + new_function.strip() + "\n" + content[end_pos:]
|
||||
print("Replaced function parse_import_file.")
|
||||
else:
|
||||
print("Could not find end of function parse_import_file.")
|
||||
# Fallback to regex if simple find fails (e.g. whitespace diff)
|
||||
pattern = r"function parse_import_file\(\$file_input\) \{[\s\S]+?return \$rows;\s+\}"
|
||||
if re.search(pattern, content):
|
||||
content = re.sub(pattern, new_function, content, count=1)
|
||||
print("Replaced function parse_import_file using regex.")
|
||||
else:
|
||||
print("Could not find function parse_import_file using regex.")
|
||||
else:
|
||||
print("Could not find start of function parse_import_file.")
|
||||
# Fallback to regex
|
||||
pattern = r"function parse_import_file\(\$file_input\) \{[\s\S]+?return \$rows;\s+\}"
|
||||
if re.search(pattern, content):
|
||||
content = re.sub(pattern, new_function, content, count=1)
|
||||
print("Replaced function parse_import_file using regex (fallback).")
|
||||
else:
|
||||
print("Could not find function parse_import_file using regex (fallback).")
|
||||
|
||||
|
||||
# Update the calling logic
|
||||
old_msg = "$_SESSION['flash_message'] = 'Failed to parse file or empty.';"
|
||||
new_msg = "$_SESSION['flash_message'] = $_SESSION['import_error'] ?? 'Failed to parse file or empty.'; unset($_SESSION['import_error']);"
|
||||
|
||||
if old_msg in content:
|
||||
content = content.replace(old_msg, new_msg)
|
||||
print("Updated error message logic.")
|
||||
else:
|
||||
print("Could not find old error message logic.")
|
||||
# Update UPDATE execution array
|
||||
old_exec_update = '[$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $id]'
|
||||
new_exec_update = '[$name, $phone, $dob, $gender, $blood_group, $insurance_company_id, $policy_number, $address, $civil_id, $nationality, $city, $id]'
|
||||
content = content.replace(old_exec_update, new_exec_update)
|
||||
|
||||
with open(file_path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print("Finished updating includes/actions.php")
|
||||
print("Updated actions.php")
|
||||
368
update_footer.py
368
update_footer.py
@ -1,308 +1,114 @@
|
||||
|
||||
|
||||
import re
|
||||
|
||||
file_path = 'includes/layout/footer.php'
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
with open(file_path, 'r') 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>
|
||||
# 1. Update Add Patient Modal
|
||||
# Look for the name input in addPatientModal
|
||||
pattern_add = r'(<div class="modal fade" id="addPatientModal".*?name="name".*?</div>)'
|
||||
replacement_add = r'\1\n' + \
|
||||
r''' <div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('civil_id'); ?></label>
|
||||
<input type="text" name="civil_id" class="form-control">
|
||||
</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()">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label"><?php echo __('nationality'); ?></label>
|
||||
<select name="nationality" class="form-select select2-modal">
|
||||
<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 foreach ($all_countries as $c): ?>
|
||||
<option value="<?php echo htmlspecialchars($c); ?>"><?php echo htmlspecialchars($c); ?></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>
|
||||
"
|
||||
<label class="form-label"><?php echo __('city'); ?></label>
|
||||
<input type="text" name="city" class="form-control">
|
||||
</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">
|
||||
# We need to be careful not to match too much.
|
||||
# Let's find the specific div for name inside addPatientModal
|
||||
# It's better to find the index.
|
||||
|
||||
add_modal_start = content.find('id="addPatientModal"')
|
||||
if add_modal_start != -1:
|
||||
# Find the name input div AFTER this start
|
||||
name_div_end = content.find('</div>', content.find('name="name"', add_modal_start)) + 6
|
||||
|
||||
# Check if we already added it (idempotency)
|
||||
if 'name="civil_id"' not in content[name_div_end:name_div_end+500]:
|
||||
content = content[:name_div_end] + replacement_add + content[name_div_end:]
|
||||
|
||||
# 2. Update Edit Patient Modal
|
||||
edit_modal_start = content.find('id="editPatientModal"')
|
||||
if edit_modal_start != -1:
|
||||
# Find the name input div AFTER this start
|
||||
name_div_end = content.find('</div>', content.find('name="name"', edit_modal_start)) + 6
|
||||
|
||||
replacement_edit = r'''
|
||||
<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>
|
||||
<label class="form-label"><?php echo __('civil_id'); ?></label>
|
||||
<input type="text" name="civil_id" id="edit_patient_civil_id" class="form-control">
|
||||
</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>
|
||||
<label class="form-label"><?php echo __('nationality'); ?></label>
|
||||
<select name="nationality" id="edit_patient_nationality" class="form-select select2-modal">
|
||||
<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 foreach ($all_countries as $c): ?>
|
||||
<option value="<?php echo htmlspecialchars($c); ?>"><?php echo htmlspecialchars($c); ?></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>
|
||||
"
|
||||
<label class="form-label"><?php echo __('city'); ?></label>
|
||||
<input type="text" name="city" id="edit_patient_city" class="form-control">
|
||||
</div>'''
|
||||
|
||||
# Replace the blocks
|
||||
start_marker = "<!-- Record Visit Modal -->"
|
||||
end_marker = "<!-- Create Bill Modal -->"
|
||||
if 'name="civil_id"' not in content[name_div_end:name_div_end+500]:
|
||||
content = content[:name_div_end] + replacement_edit + content[name_div_end:]
|
||||
|
||||
start_idx = content.find(start_marker)
|
||||
end_idx = content.find(end_marker)
|
||||
# 3. Update JS showEditPatientModal
|
||||
js_func = 'function showEditPatientModal(patient) {'
|
||||
js_start = content.find(js_func)
|
||||
if js_start != -1:
|
||||
# Find the fields object
|
||||
fields_start = content.find("var fields = {", js_start)
|
||||
if fields_start != -1:
|
||||
# Insert new fields
|
||||
insert_pos = content.find("'edit_patient_name': patient.name,", fields_start) + len("'edit_patient_name': patient.name,")
|
||||
|
||||
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")
|
||||
new_js_fields = r'''
|
||||
'edit_patient_civil_id': patient.civil_id || '',
|
||||
'edit_patient_nationality': patient.nationality || '',
|
||||
'edit_patient_city': patient.city || '',
|
||||
'''''
|
||||
|
||||
if "'edit_patient_civil_id'" not in content[fields_start:fields_start+500]:
|
||||
content = content[:insert_pos] + new_js_fields + content[insert_pos:]
|
||||
|
||||
# Find the loop to add trigger
|
||||
loop_start = content.find("for (var id in fields) {", js_start)
|
||||
if loop_start != -1:
|
||||
# We want to add the trigger inside the loop
|
||||
# Find 'if (field) field.value = fields[id];'
|
||||
val_set = content.find("if (field) field.value = fields[id];", loop_start)
|
||||
if val_set != -1:
|
||||
replace_js = '''if (field) {
|
||||
field.value = fields[id];
|
||||
if (id === 'edit_patient_nationality') {
|
||||
$(field).val(fields[id]).trigger('change');
|
||||
}
|
||||
}'''
|
||||
content = content.replace("if (field) field.value = fields[id];", replace_js, 1)
|
||||
|
||||
with open(file_path, 'w') as f:
|
||||
f.write(content)
|
||||
|
||||
print("Updated footer.php")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user