FIX_CLIENT_ACCESS_CONTROLL

This commit is contained in:
VENKATESHWARAN 2026-06-30 15:40:14 +05:30
parent f72bbfe799
commit 66a55f2951

View File

@ -9021,9 +9021,10 @@ class ClientController extends AdminController
// Now process any remaining HRs that didn't have access records
foreach ($hrMap as $hr) {
$temp_arr_key = $hr['hr_mobile'] . $hr['hr_mail'];
$post_hr_id = $hr['post_hr_id'];
$pre_hr_id = $hr['pre_hr_id'];
// Keep each HR entry unique; mobile/email can repeat across branches.
$temp_arr_key = $hr['hr_mobile'] . $hr['hr_mail'] . '_' . ($post_hr_id ?? 'null') . '_' . ($pre_hr_id ?? 'null');
if (empty($post_hr_id) && !empty($pre_hr_id)) {
$type_of_access_data = "PRE";
@ -9057,8 +9058,14 @@ class ClientController extends AdminController
}
}
// Sort by HR name for consistent display order.
$resultList = array_values($result);
usort($resultList, function ($a, $b) {
return strcasecmp((string)($a['hr_name'] ?? ''), (string)($b['hr_name'] ?? ''));
});
// dd($result);
$resultData['hr_access_data'] = array_values($result);
$resultData['hr_access_data'] = $resultList;
$resultData['pre_policy_data'] = $data['pre_policy_data'];
$resultData['post_policy_data'] = $data['post_policy_data'];
$resultData['post_cd_data'] = $data['post_cd_data'];