Merge branch 'dev' of bitbucket.org:jubilian/nhance-enrollment into dev

This commit is contained in:
velz 2026-01-02 13:03:06 +05:30
commit d5bf26fd99
5 changed files with 65 additions and 3 deletions

View File

@ -533,10 +533,12 @@ $routes->group("employeeRest", ['filter' => ['appSignature'] ], function ($route
$routes->post("verifyOtp", "RestAuthenticationController::verifyOtp");
$routes->post("checkPassword", "RestAuthenticationController::checkPassword");
$routes->get("downloadSampleExcel", "EmployeeRestController::downloadSampleExcel");
$routes->post("getPreEmployeePolicyCount", "EmployeeRestController::getPreEmployeePolicyCount");
// $routes->post("getPreEmployeePolicyCount", "EmployeeRestController::getPreEmployeePolicyCount");
});
$routes->post("getPreEmployeePolicyCount","EmployeeRestController::getPreEmployeePolicyCount", ['filter' => ['appSignature']]);
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
$routes->post("sendEmail", "EmployeeRestController::send_email");

View File

@ -1069,6 +1069,20 @@ class EmployeeServiceController extends AdminController
}
}
// check the employee code if dublicate exist
if(($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment'))
{
$res = check_emp_code_duplication($family, $file);
// dd($res);
if($res['status'])
{
foreach ($res['row_ids'] as $row_id) {
array_push($result['error_summary'],26);
$result['error_data'][ $row_id ]['emp_id']['error'][] = "Employee Code is already exist in the system";
}
}
}
//check self avaialbe either same policy DB level(i.e.) gMC parents
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && !$is_self_available_in_policy_terms)) // 3 is GMC parents as base policy not as dep addon)
{

View File

@ -553,6 +553,47 @@ if (!function_exists('name_and_empid_check_in_db'))
}
}
if (!function_exists('check_emp_code_duplication')) {
function check_emp_code_duplication($family_data, $actionArr)
{
$employeeModel = new EmployeeModel();
$row_ids = [];
$status = false;
$client_id = $actionArr['client_id'];
$policy_id = $actionArr['policy_id'];
$client_branch_id = $actionArr['client_branch_id'];
$current_action = $actionArr['action'];
foreach ($family_data as $rkey => $row) {
if ($current_action != 'dependent_addition' || (isset($row['temp']) && $row['temp']['source'] != 'db')) {
$res = $employeeModel
->join('client_policy cp', "employees.client_id = cp.client_id")
->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
->where("cp.id", $policy_id)
->where("employees.client_id", $client_id)
->where("employees.client_branch_id", $client_branch_id)
->where("employees.is_active", 1)
->where("employees.emp_status", 'active')
->where("ep.is_active", 1)
->where("ep.status", 'active')
->where('TRIM(emp_code)', trim($row[1]))
->findAll();
if(count($res) > 0){
$row_ids[] = $row[0];
}
}
}
if(!empty($row_ids)){
$status = true;
}
return ['status' => $status, 'row_ids' => $row_ids];
}
}
if (!function_exists('check_dependent_conflict'))
{
function check_dependent_conflict($family_data,$policy_terms,$actionArr,$is_lgbtq)

View File

@ -2437,7 +2437,7 @@ $(document).ready(function () {
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<! -- <td>${tpaValue}</td> -->
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<!-- <td style="text-align: center;">${(enrollmentStatus)}</td> -->
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
<div class="btn-group dropdown">
@ -2474,7 +2474,7 @@ $(document).ready(function () {
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<! -- <td>${tpaValue}</td> -->
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td>
<! -- <td style="text-align: center;">${(enrollmentStatus)}</td> -->
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
<div class="btn-group dropdown">

View File

@ -571,6 +571,11 @@ function fetchFileError(file_id) {
"<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break;
case 26:
file_error_html +=
"<strong>Duplicate Employee code found</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>";
break;
default:
file_error_html += "";