FIX_popupRestriction

This commit is contained in:
venba-Inspriron-3558 2025-11-26 14:39:27 +05:30
parent 320acb0863
commit 85b8d813ef
2 changed files with 120 additions and 8 deletions

View File

@ -108,7 +108,7 @@ class ThzController extends BaseController
$data = $this->request->getGet();
if ($returnType === 'web' && in_array(get_role_id(), [3, 4])) {
if ($returnType === 'web' && in_array(get_role_id(), [4])) {
$data['assign_to'] = $data['assign_to'] ?? get_session_userid();
}

View File

@ -54,7 +54,7 @@
}
?>
<div class="modal fade" id="empDetailsModal" role="dialog" aria-labelledby="empDetailsModalLabel" aria-hidden="true">
<!-- <div class="modal fade" id="empDetailsModal" role="dialog" aria-labelledby="empDetailsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
@ -63,6 +63,23 @@
onclick="toResetTheModelFields()">
<span aria-hidden="true">&times;</span>
</button>
</div> -->
<div class="modal fade"
id="empDetailsModal"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Fetch Employee Data</h5>
<!-- <button type="button" class="btn-close" data-bs-dismiss="modal"></button> -->
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="accordion">
@ -194,16 +211,110 @@
</div>
</div>
</div>
<div class="modal-footer">
<!-- <div class="modal-footer">
<a class="btn btn-primary" data-dismiss="modal" aria-label="Close"
onclick="toResetTheModelFields()">Submit</a>
</div> -->
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">
Submit
</button>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade"
id="empDetailsModal"
role="dialog"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="empDetailsModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="empDetailsModalLabel">Fetch Employee Data</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close" onclick="toResetTheModelFields()">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- your modal body content -->
</div>
<div class="modal-footer">
<a class="btn btn-primary" data-bs-dismiss="modal" aria-label="Close" onclick="toResetTheModelFields()">Submit</a>
</div>
</div>
</div>
</div>
<!-- Inline JS right after modal HTML -->
<script>
var empModal; // global modal instance
// ✅ Initialize after DOM is fully loaded
document.addEventListener("DOMContentLoaded", function () {
var empModalEl = document.getElementById("empDetailsModal");
if (!empModalEl) {
console.error("Modal element not found!");
return;
}
empModal = new bootstrap.Modal(empModalEl, {
backdrop: 'static',
keyboard: false
});
});
// ✅ FINAL OPEN FUNCTION (RESET → THEN OPEN)
function openFetchEmpDataodal() {
// 1⃣ FIRST reset everything
toResetTheModelFields();
// 2⃣ THEN open modal
empModal.show();
}
// ✅ FINAL RESET FUNCTION (WORKS FOR INPUT + SELECT + SELECT2)
function toResetTheModelFields() {
var modal = document.getElementById("empDetailsModal");
if (!modal) return;
// ✅ Reset all input fields
modal.querySelectorAll("input").forEach(function (el) {
el.value = "";
});
// ✅ Reset all select dropdowns
modal.querySelectorAll("select").forEach(function (el) {
el.selectedIndex = 0;
});
// ✅ Reset Select2 / custom dropdowns
if (window.$) {
$("#empDetailsModal .SelExample").val(null).trigger("change");
}
// ✅ Optional: Close accordion
modal.querySelectorAll(".accordion-content").forEach(function (el) {
el.style.display = "none";
});
// ✅ Optional: Reset arrows
modal.querySelectorAll(".arrow").forEach(function (el) {
el.innerHTML = "";
});
console.log("✅ Modal reset completed");
}
var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list
@ -297,10 +408,10 @@
}
function openFetchEmpDataodal() {
var myModal = new bootstrap.Modal(document.getElementById('empDetailsModal'));
myModal.show();
}
// function openFetchEmpDataodal() {
// var myModal = new bootstrap.Modal(document.getElementById('empDetailsModal'));
// myModal.show();
// }
//get client , branch, policy data
function getClientAndBranchAndPolicy() {
@ -935,7 +1046,8 @@
function toResetTheModelFields() {
$('#emp_mobile_number_for_claim').val('');
$('#employee_data_points').val();
$('#employee_data_points').val('emp_code').attr('autocomplete', 'off').trigger('change');
$('#mobile_emp_client_data_list').val('0').select2();
$('#employee_by_number').val('');
$('#member_by_number').val('0').select2();
$('#emp_client_data_list').val('0').select2();