38960-vm/includes/layout/footer.php
2026-03-12 17:45:50 +00:00

1055 lines
57 KiB
PHP

<?php
// includes/layout/footer.php
?>
</div>
</div>
<!-- Add Patient Modal -->
<div class="modal fade" id="addPatientModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog 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="add_patient">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('add_patient'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('name'); ?></label>
<input type="text" name="name" class="form-control" required>
</div>
<div class="col-md-4 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-4 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="row">
<div class="col-md-3 mb-3">
<label class="form-label"><?php echo __('phone'); ?></label>
<input type="text" name="phone" class="form-control" required>
</div>
<div class="col-md-3 mb-3">
<label class="form-label"><?php echo __('dob'); ?></label>
<input type="text" name="dob" id="add_patient_dob" class="form-control masked-date" placeholder="YYYY-MM-DD">
</div>
<div class="col-md-2 mb-3">
<label class="form-label"><?php echo __('age'); ?></label>
<input type="number" id="add_patient_age" class="form-control" placeholder="<?php echo __('age'); ?>" min="0" max="150">
</div>
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('gender'); ?></label>
<select name="gender" class="form-select">
<option value="Male"><?php echo __('male'); ?></option>
<option value="Female"><?php echo __('female'); ?></option>
<option value="Other"><?php echo __('other'); ?></option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('city'); ?></label>
<div class="d-flex gap-2">
<div class="flex-grow-1">
<select name="city" id="add_patient_city" class="form-select select2-modal">
<option value=""><?php echo __('select'); ?>...</option>
<?php foreach ($all_cities as $city): ?>
<option value="<?php echo htmlspecialchars($city['name']); ?>"><?php echo htmlspecialchars($city['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
<button type="button" class="btn btn-outline-primary" onclick="openQuickAddCityModal('add_patient_city')" title="<?php echo __('add_city'); ?>">
<i class="bi bi-plus-lg"></i>
</button>
</div>
</div>
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('blood_group'); ?></label>
<input type="text" name="blood_group" class="form-control" placeholder="O+, A-, etc.">
</div>
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('insurance_company'); ?></label>
<select name="insurance_company_id" class="form-select">
<option value=""><?php echo __('not_insured'); ?></option>
<?php foreach ($all_insurance as $i): ?>
<option value="<?php echo $i['id']; ?>"><?php echo htmlspecialchars($i['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('policy_number'); ?></label>
<input type="text" name="policy_number" class="form-control">
</div>
<div class="col-md-8 mb-3">
<label class="form-label"><?php echo __('address'); ?></label>
<textarea name="address" class="form-control" rows="1"></textarea>
</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>
<!-- Edit Patient Modal -->
<div class="modal fade" id="editPatientModal" 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_patient">
<input type="hidden" name="id" id="edit_patient_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('edit'); ?> <?php echo __('patient'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('name'); ?></label>
<input type="text" name="name" id="edit_patient_name" class="form-control" required>
</div>
<div class="col-md-4 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-4 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="row">
<div class="col-md-3 mb-3">
<label class="form-label"><?php echo __('phone'); ?></label>
<input type="text" name="phone" id="edit_patient_phone" class="form-control" required>
</div>
<div class="col-md-3 mb-3">
<label class="form-label"><?php echo __('dob'); ?></label>
<input type="text" name="dob" id="edit_patient_dob" class="form-control masked-date" placeholder="YYYY-MM-DD">
</div>
<div class="col-md-2 mb-3">
<label class="form-label"><?php echo __('age'); ?></label>
<input type="number" id="edit_patient_age" class="form-control" placeholder="<?php echo __('age'); ?>" min="0" max="150">
</div>
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('gender'); ?></label>
<select name="gender" id="edit_patient_gender" class="form-select">
<option value="Male"><?php echo __('male'); ?></option>
<option value="Female"><?php echo __('female'); ?></option>
<option value="Other"><?php echo __('other'); ?></option>
</select>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('city'); ?></label>
<div class="d-flex gap-2">
<div class="flex-grow-1">
<select name="city" id="edit_patient_city" class="form-select select2-modal">
<option value=""><?php echo __('select'); ?>...</option>
<?php foreach ($all_cities as $city): ?>
<option value="<?php echo htmlspecialchars($city['name']); ?>"><?php echo htmlspecialchars($city['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
<button type="button" class="btn btn-outline-primary" onclick="openQuickAddCityModal('edit_patient_city')" title="<?php echo __('add_city'); ?>">
<i class="bi bi-plus-lg"></i>
</button>
</div>
</div>
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('blood_group'); ?></label>
<input type="text" name="blood_group" id="edit_patient_blood_group" class="form-control" placeholder="O+, A-, etc.">
</div>
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('insurance_company'); ?></label>
<select name="insurance_company_id" id="edit_patient_insurance_company_id" class="form-select">
<option value=""><?php echo __('not_insured'); ?></option>
<?php foreach ($all_insurance as $i): ?>
<option value="<?php echo $i['id']; ?>"><?php echo htmlspecialchars($i['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="row">
<div class="col-md-4 mb-3">
<label class="form-label"><?php echo __('policy_number'); ?></label>
<input type="text" name="policy_number" id="edit_patient_policy_number" class="form-control">
</div>
<div class="col-md-8 mb-3">
<label class="form-label"><?php echo __('address'); ?></label>
<textarea name="address" id="edit_patient_address" class="form-control" rows="1"></textarea>
</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>
<!-- Delete Patient Modal -->
<div class="modal fade" id="deletePatientModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="delete_patient">
<input type="hidden" name="id" id="delete_patient_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('delete'); ?> <?php echo __('patient'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><?php echo __('confirm_delete'); ?> <strong id="delete_patient_name"></strong>?</p>
</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-danger px-4"><?php echo __('delete'); ?></button>
</div>
</div>
</form>
</div>
</div>
<!-- Add Doctor Modal -->
<div class="modal fade" id="addDoctorModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="add_doctor">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('add_doctor'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" class="form-control" dir="rtl" required>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('phone'); ?></label>
<input type="text" name="tel" class="form-control">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('email'); ?></label>
<input type="email" name="email" class="form-control">
</div>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('specialization_en'); ?></label>
<input type="text" name="specialization_en" class="form-control">
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('specialization_ar'); ?></label>
<input type="text" name="specialization_ar" class="form-control" dir="rtl">
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('department'); ?></label>
<select name="department_id" class="form-select">
<option value=""><?php echo __('search'); ?>...</option>
<?php foreach ($all_departments as $dept): ?>
<option value="<?php echo $dept['id']; ?>"><?php echo htmlspecialchars($dept['name']); ?></option>
<?php endforeach; ?>
</select>
</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>
<!-- Edit Doctor Modal -->
<div class="modal fade" id="editDoctorModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="edit_doctor">
<input type="hidden" name="id" id="edit_doctor_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('edit'); ?> <?php echo __('doctor'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" id="edit_doctor_name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" id="edit_doctor_name_ar" class="form-control" dir="rtl" required>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('phone'); ?></label>
<input type="text" name="tel" id="edit_doctor_tel" class="form-control">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('email'); ?></label>
<input type="email" name="email" id="edit_doctor_email" class="form-control">
</div>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('specialization_en'); ?></label>
<input type="text" name="specialization_en" id="edit_doctor_spec_en" class="form-control">
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('specialization_ar'); ?></label>
<input type="text" name="specialization_ar" id="edit_doctor_spec_ar" class="form-control" dir="rtl">
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('department'); ?></label>
<select name="department_id" id="edit_doctor_dept_id" class="form-select">
<option value=""><?php echo __('search'); ?>...</option>
<?php foreach ($all_departments as $dept): ?>
<option value="<?php echo $dept['id']; ?>"><?php echo htmlspecialchars($dept['name']); ?></option>
<?php endforeach; ?>
</select>
</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>
<!-- Delete Doctor Modal -->
<div class="modal fade" id="deleteDoctorModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="delete_doctor">
<input type="hidden" name="id" id="delete_doctor_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('delete'); ?> <?php echo __('doctor'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><?php echo __('confirm_delete'); ?>?</p>
</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-danger px-4"><?php echo __('delete'); ?></button>
</div>
</div>
</form>
</div>
</div>
<!-- Add Nurse Modal -->
<div class="modal fade" id="addNurseModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="add_nurse">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('add_nurse'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" class="form-control" dir="rtl" required>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('phone'); ?></label>
<input type="text" name="tel" class="form-control">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('email'); ?></label>
<input type="email" name="email" class="form-control">
</div>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('department'); ?></label>
<select name="department_id" class="form-select">
<option value=""><?php echo __('search'); ?>...</option>
<?php foreach ($all_departments as $dept): ?>
<option value="<?php echo $dept['id']; ?>"><?php echo htmlspecialchars($dept['name']); ?></option>
<?php endforeach; ?>
</select>
</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>
<!-- Edit Nurse Modal -->
<div class="modal fade" id="editNurseModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="edit_nurse">
<input type="hidden" name="id" id="edit_nurse_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('edit'); ?> <?php echo __('nurses'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" id="edit_nurse_name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" id="edit_nurse_name_ar" class="form-control" dir="rtl" required>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('phone'); ?></label>
<input type="text" name="tel" id="edit_nurse_tel" class="form-control">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('email'); ?></label>
<input type="email" name="email" id="edit_nurse_email" class="form-control">
</div>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('department'); ?></label>
<select name="department_id" id="edit_nurse_dept_id" class="form-select">
<option value=""><?php echo __('search'); ?>...</option>
<?php foreach ($all_departments as $dept): ?>
<option value="<?php echo $dept['id']; ?>"><?php echo htmlspecialchars($dept['name']); ?></option>
<?php endforeach; ?>
</select>
</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>
<!-- Delete Nurse Modal -->
<div class="modal fade" id="deleteNurseModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="delete_nurse">
<input type="hidden" name="id" id="delete_nurse_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('delete'); ?> <?php echo __('nurses'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><?php echo __('confirm_delete'); ?>?</p>
</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-danger px-4"><?php echo __('delete'); ?></button>
</div>
</div>
</form>
</div>
</div>
<!-- Add Department Modal -->
<div class="modal fade" id="addDepartmentModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="add_department">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('add_department'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" class="form-control" dir="rtl" required>
</div>
</div>
<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>
<!-- Edit Department Modal -->
<div class="modal fade" id="editDepartmentModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="edit_department">
<input type="hidden" name="id" id="edit_department_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('edit'); ?> <?php echo __('department'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" id="edit_department_name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" id="edit_department_name_ar" class="form-control" dir="rtl" required>
</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>
<!-- Delete Department Modal -->
<div class="modal fade" id="deleteDepartmentModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="delete_department">
<input type="hidden" name="id" id="delete_department_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('delete'); ?> <?php echo __('department'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><?php echo __('confirm_delete'); ?>?</p>
</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-danger px-4"><?php echo __('delete'); ?></button>
</div>
</div>
</form>
</div>
</div>
<!-- Add Insurance Modal -->
<div class="modal fade" id="addInsuranceModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=insurance" method="POST">
<input type="hidden" name="action" value="add_insurance">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('add_insurance'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name'); ?> (EN)</label>
<input type="text" name="name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name'); ?> (AR)</label>
<input type="text" name="name_ar" class="form-control" dir="rtl" required>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('email'); ?></label>
<input type="email" name="email" class="form-control">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('phone'); ?></label>
<input type="text" name="phone" class="form-control">
</div>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('contact_info'); ?></label>
<textarea name="contact_info" class="form-control" rows="2"></textarea>
</div>
</div>
<div class="modal-footer bg-light">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?php echo __('cancel'); ?></button>
<button type="submit" class="btn btn-primary px-4"><?php echo __('save'); ?></button>
</div>
</div>
</form>
</div>
</div>
<!-- Add Employee Modal -->
<div class="modal fade" id="addEmployeeModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="add_employee">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('add_employee'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" class="form-control" dir="rtl" required>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('dob'); ?></label>
<input type="text" name="dob" class="form-control masked-date" placeholder="YYYY-MM-DD">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('mobile'); ?></label>
<input type="text" name="mobile" class="form-control">
</div>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('email'); ?></label>
<input type="email" name="email" class="form-control">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('department'); ?></label>
<select name="department_id" class="form-select">
<option value=""><?php echo __('search'); ?>...</option>
<?php foreach ($all_departments as $dept): ?>
<option value="<?php echo $dept['id']; ?>"><?php echo htmlspecialchars($dept['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('position'); ?></label>
<select name="position_id" class="form-select">
<option value=""><?php echo __('select'); ?>...</option>
<?php foreach ($all_positions as $pos): ?>
<option value="<?php echo $pos['id']; ?>"><?php echo htmlspecialchars($pos['name']); ?></option>
<?php endforeach; ?>
</select>
</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>
<!-- Edit Employee Modal -->
<div class="modal fade" id="editEmployeeModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="edit_employee">
<input type="hidden" name="id" id="edit_employee_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('edit_employee'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" id="edit_employee_name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" id="edit_employee_name_ar" class="form-control" dir="rtl" required>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('dob'); ?></label>
<input type="text" name="dob" id="edit_employee_dob" class="form-control masked-date" placeholder="YYYY-MM-DD">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('mobile'); ?></label>
<input type="text" name="mobile" id="edit_employee_mobile" class="form-control">
</div>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('email'); ?></label>
<input type="email" name="email" id="edit_employee_email" class="form-control">
</div>
<div class="col-md-6 mb-3">
<label class="form-label"><?php echo __('department'); ?></label>
<select name="department_id" id="edit_employee_dept_id" class="form-select">
<option value=""><?php echo __('search'); ?>...</option>
<?php foreach ($all_departments as $dept): ?>
<option value="<?php echo $dept['id']; ?>"><?php echo htmlspecialchars($dept['name']); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('position'); ?></label>
<select name="position_id" id="edit_employee_position_id" class="form-select">
<option value=""><?php echo __('select'); ?>...</option>
<?php foreach ($all_positions as $pos): ?>
<option value="<?php echo $pos['id']; ?>"><?php echo htmlspecialchars($pos['name']); ?></option>
<?php endforeach; ?>
</select>
</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>
<!-- Delete Employee Modal -->
<div class="modal fade" id="deleteEmployeeModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=<?php echo $section; ?>" method="POST">
<input type="hidden" name="action" value="delete_employee">
<input type="hidden" name="id" id="delete_employee_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('delete'); ?> <?php echo __('employee'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><?php echo __('confirm_delete'); ?>?</p>
</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-danger px-4"><?php echo __('delete'); ?></button>
</div>
</div>
</form>
</div>
</div>
<!-- Add City Modal -->
<div class="modal fade" id="addCityModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=cities" method="POST">
<input type="hidden" name="action" value="add_city">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('add_city'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" class="form-control" dir="rtl" required>
</div>
</div>
<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>
<!-- Edit City Modal -->
<div class="modal fade" id="editCityModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=cities" method="POST">
<input type="hidden" name="action" value="edit_city">
<input type="hidden" name="id" id="edit_city_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('edit_city'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name_en'); ?></label>
<input type="text" name="name_en" id="edit_city_name_en" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label"><?php echo __('name_ar'); ?></label>
<input type="text" name="name_ar" id="edit_city_name_ar" class="form-control" dir="rtl" required>
</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>
<!-- Delete City Modal -->
<div class="modal fade" id="deleteCityModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>?section=cities" method="POST">
<input type="hidden" name="action" value="delete_city">
<input type="hidden" name="id" id="delete_city_id">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('delete_city'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p><?php echo __('confirm_delete'); ?>?</p>
</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-danger px-4"><?php echo __('delete'); ?></button>
</div>
</div>
</form>
</div>
</div>
<!-- Quick Add City Modal -->
<div class="modal fade" id="quickAddCityModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<form id="quickAddCityForm">
<div class="modal-content border-0 shadow">
<div class="modal-header">
<h5 class="modal-title fw-bold text-white"><?php echo __('add_city'); ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label"><?php echo __('name'); ?></label>
<input type="text" name="name" id="quick_city_name" class="form-control" required>
</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>
<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://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>
function showEditPatientModal(data) {
document.getElementById('edit_patient_id').value = data.id;
document.getElementById('edit_patient_name').value = data.name;
document.getElementById('edit_patient_civil_id').value = data.civil_id || '';
$('#edit_patient_nationality').val(data.nationality).trigger('change');
document.getElementById('edit_patient_phone').value = data.phone;
document.getElementById('edit_patient_dob').value = data.dob || '';
document.getElementById('edit_patient_age').value = data.age || '';
document.getElementById('edit_patient_gender').value = data.gender;
$('#edit_patient_city').val(data.city).trigger('change');
document.getElementById('edit_patient_blood_group').value = data.blood_group || '';
document.getElementById('edit_patient_insurance_company_id').value = data.insurance_company_id || '';
document.getElementById('edit_patient_policy_number').value = data.policy_number || '';
document.getElementById('edit_patient_address').value = data.address || '';
var modal = new bootstrap.Modal(document.getElementById('editPatientModal'));
modal.show();
}
function showDeletePatientModal(id, name) {
document.getElementById('delete_patient_id').value = id;
document.getElementById('delete_patient_name').innerText = name;
var modal = new bootstrap.Modal(document.getElementById('deletePatientModal'));
modal.show();
}
function showEditDoctorModal(data) {
document.getElementById('edit_doctor_id').value = data.id;
document.getElementById('edit_doctor_name_en').value = data.name_en;
document.getElementById('edit_doctor_name_ar').value = data.name_ar;
document.getElementById('edit_doctor_tel').value = data.tel || '';
document.getElementById('edit_doctor_email').value = data.email || '';
document.getElementById('edit_doctor_spec_en').value = data.specialization_en || '';
document.getElementById('edit_doctor_spec_ar').value = data.specialization_ar || '';
document.getElementById('edit_doctor_dept_id').value = data.department_id || '';
var modal = new bootstrap.Modal(document.getElementById('editDoctorModal'));
modal.show();
}
function showDeleteDoctorModal(id) {
document.getElementById('delete_doctor_id').value = id;
var modal = new bootstrap.Modal(document.getElementById('deleteDoctorModal'));
modal.show();
}
function showEditNurseModal(data) {
document.getElementById('edit_nurse_id').value = data.id;
document.getElementById('edit_nurse_name_en').value = data.name_en;
document.getElementById('edit_nurse_name_ar').value = data.name_ar;
document.getElementById('edit_nurse_tel').value = data.tel || '';
document.getElementById('edit_nurse_email').value = data.email || '';
document.getElementById('edit_nurse_dept_id').value = data.department_id || '';
var modal = new bootstrap.Modal(document.getElementById('editNurseModal'));
modal.show();
}
function showDeleteNurseModal(id) {
document.getElementById('delete_nurse_id').value = id;
var modal = new bootstrap.Modal(document.getElementById('deleteNurseModal'));
modal.show();
}
function showEditDepartmentModal(data) {
document.getElementById('edit_department_id').value = data.id;
document.getElementById('edit_department_name_en').value = data.name_en;
document.getElementById('edit_department_name_ar').value = data.name_ar;
var modal = new bootstrap.Modal(document.getElementById('editDepartmentModal'));
modal.show();
}
function showDeleteDepartmentModal(id) {
document.getElementById('delete_department_id').value = id;
var modal = new bootstrap.Modal(document.getElementById('deleteDepartmentModal'));
modal.show();
}
function showEditEmployeeModal(data) {
document.getElementById('edit_employee_id').value = data.id;
document.getElementById('edit_employee_name_en').value = data.name_en;
document.getElementById('edit_employee_name_ar').value = data.name_ar;
document.getElementById('edit_employee_dob').value = data.dob || '';
document.getElementById('edit_employee_mobile').value = data.mobile || '';
document.getElementById('edit_employee_email').value = data.email || '';
document.getElementById('edit_employee_dept_id').value = data.department_id || '';
document.getElementById('edit_employee_position_id').value = data.position_id || '';
var modal = new bootstrap.Modal(document.getElementById('editEmployeeModal'));
modal.show();
}
function showDeleteEmployeeModal(id) {
document.getElementById('delete_employee_id').value = id;
var modal = new bootstrap.Modal(document.getElementById('deleteEmployeeModal'));
modal.show();
}
function showEditCityModal(data) {
document.getElementById('edit_city_id').value = data.id;
document.getElementById('edit_city_name_en').value = data.name_en;
document.getElementById('edit_city_name_ar').value = data.name_ar;
var modal = new bootstrap.Modal(document.getElementById('editCityModal'));
modal.show();
}
function showDeleteCityModal(id) {
document.getElementById('delete_city_id').value = id;
var modal = new bootstrap.Modal(document.getElementById('deleteCityModal'));
modal.show();
}
let targetCitySelectId = null;
function openQuickAddCityModal(targetSelectId) {
targetCitySelectId = targetSelectId;
var modal = new bootstrap.Modal(document.getElementById('quickAddCityModal'));
modal.show();
}
// Handle Quick Add City Form Submission
document.getElementById('quickAddCityForm').addEventListener('submit', function(e) {
e.preventDefault();
const name = document.getElementById('quick_city_name').value;
fetch('api/cities.php', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
body: 'action=add&name=' + encodeURIComponent(name)
})
.then(response => response.json())
.then(data => {
if (data.success) {
// Add new option to the target select and select it
const newOption = new Option(data.city.name, data.city.name, true, true);
$('#' + targetCitySelectId).append(newOption).trigger('change');
// Also add to other city selects if they exist
$('.select2-modal[name="city"]').each(function() {
if (this.id !== targetCitySelectId) {
$(this).append(new Option(data.city.name, data.city.name, false, false));
}
});
// Close modal and reset form
bootstrap.Modal.getInstance(document.getElementById('quickAddCityModal')).hide();
document.getElementById('quickAddCityForm').reset();
} else {
alert('Error adding city: ' + data.error);
}
})
.catch(error => {
console.error('Error:', error);
alert('An error occurred while adding the city.');
});
});
$(document).ready(function() {
// Initialize Select2 for modals
$('.select2-modal').select2({
dropdownParent: $('.modal'),
width: '100%'
});
// Initialize Inputmask
if (typeof Inputmask !== 'undefined') {
Inputmask().mask(document.querySelectorAll("input"));
}
});
</script>
</body>
</html>