diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 42e8d530..ec4f7478 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1078,7 +1078,8 @@ class EmployeeRestController extends AdminController $id = $this->request->getGet('id'); $emp_code = $this->request->getGet('emp_code'); $client_id = $this->request->getGet('client_id'); - $client_branch_id = $this->request->getGet('client_branch_id'); + $client_branch_id = $this->request->getGet('client_branch_id'); + $login_by_hr = $this->request->getGet('login_by_hr'); // This is an array containing keys to be removed from the terms and conditions array $keysToRemove = ["removable_keys"]; @@ -1112,7 +1113,7 @@ class EmployeeRestController extends AdminController $array->GridMaster = $getSlabAndGridData['grid_master']; if($array->tpa_id != null){ - $array->eCardDownload = base_url('download-e-card/') . $array->rand_string; + $array->eCardDownload = base_url('download-e-card/') . $array->rand_string.'/1'; }else{ $array->eCardDownload = null; } @@ -1121,9 +1122,12 @@ class EmployeeRestController extends AdminController if($array->policy_type_id == 1 && $this->request->getGet('policy') == 'GPA') { + $si_value = 0; + // Filter employee data where the family_floater_key is 'self' $selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self'); $employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow(); + $si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0; $self['is_value_exist'] = true; $self['data']['family_floater_key'] = 'self'; @@ -1137,14 +1141,15 @@ class EmployeeRestController extends AdminController $array->mapped_family_floaters = $self; $array->type = 'GPA'; + $array->si_value = $si_value; $res = []; array_push($res,$array); - $EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id); + $EDLIPolicy = $this->getAdditionalGPAPolicy($employeeData,6,$emp_code,$client_id,$client_branch_id,$login_by_hr); if($EDLIPolicy){ array_push($res,$EDLIPolicy); } - $GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id); + $GTLIPolicy = $this->getAdditionalGPAPolicy($employeeData,7,$emp_code,$client_id,$client_branch_id,$login_by_hr); if($GTLIPolicy){ array_push($res,$GTLIPolicy); } return $this->respond(['status' => 'success','code' => 200,'data' => $res ], 200); @@ -1351,7 +1356,7 @@ class EmployeeRestController extends AdminController { if($tpaArray[0]->tpa_id != null) - $array->eCardDownload = base_url('download-e-card/') . $tpaArray[0]->rand_string; + $array->eCardDownload = base_url('download-e-card/') . $tpaArray[0]->rand_string.'/1'; else $array->eCardDownload = null; @@ -1481,7 +1486,7 @@ class EmployeeRestController extends AdminController } - public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id) + public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id,$login_by_hr) { $checkPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms , client_policy.enrolment_visibility') ->where('client_policy.policy_type_id', $policy_type ) @@ -1498,18 +1503,23 @@ class EmployeeRestController extends AdminController $decodedArray = json_decode($array->Policy_Terms); $array->Policy_Terms = $decodedArray; - + $si_value = 0; // Filter employee data where the family_floater_key is 'self' $selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self'); $employee_policy = $this->employeePolicyModel->where('employee_id',$selfData[0]['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow(); + $si_value = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0; $policyTypeData = $this->policyTypeModel->where('id',$policy_type)->get()->getRow(); + $array->type = $policyTypeData->policy_type; $array->Policy_Name = $policyTypeData->long_name; + $array->si_value = $si_value; + + if($employee_policy){ if($employee_policy->tpa_id != null){ - $array->eCardDownload = base_url('download-e-card/') . $employee_policy->rand_string; + $array->eCardDownload = base_url('download-e-card/') . $employee_policy->rand_string.'/1'; }else{ $array->eCardDownload = null; } $self['is_value_exist'] = true; @@ -1523,10 +1533,20 @@ class EmployeeRestController extends AdminController $self['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0; $array->mapped_family_floaters = $self; - if($array->enrolment_visibility == 1) + + if (isset($login_by_hr) && $login_by_hr == true) + { return $array; - else - return false; + }else{ + + if($array->enrolment_visibility == 1) + return $array; + else + return false; + + } + + }else{ return false; @@ -1722,7 +1742,7 @@ class EmployeeRestController extends AdminController if(count($tpaArray)) { if($tpaArray[0]->tpa_id != null) - $responce['eCardDownload'] = base_url('download-e-card/') . $tpaArray[0]->rand_string; + $responce['eCardDownload'] = base_url('download-e-card/') . $tpaArray[0]->rand_string.'/1'; else $responce['eCardDownload'] = null; @@ -2520,7 +2540,7 @@ class EmployeeRestController extends AdminController if($employee_policy[0]['tpa_id'] != null) - $data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string']; + $data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'].'/1'; else $data['eCardDownload'] = null; @@ -2619,7 +2639,7 @@ class EmployeeRestController extends AdminController $finalarray[$value] = $termsValue; } } - if(is_array($terms->gpa_special_condition_label) && is_array($terms->gpa_special_condition_input)){ + if(isset(($terms->gpa_special_condition_label)) && is_array($terms->gpa_special_condition_label) && is_array($terms->gpa_special_condition_input)){ for ($i=0; $i < count($terms->gpa_special_condition_label); $i++) { $finalarray[$terms->gpa_special_condition_label[$i]] = $terms->gpa_special_condition_input[$i]; } @@ -2641,7 +2661,7 @@ class EmployeeRestController extends AdminController $finalarray[$value] = $termsValue; } } - if(is_array($terms->special_condition_label) && is_array($terms->special_condition_input)){ + if(isset(($terms->special_condition_label)) && is_array($terms->special_condition_label) && is_array($terms->special_condition_input)){ for ($i=0; $i < count($terms->special_condition_label); $i++) { $finalarray[$terms->special_condition_label[$i]] = $terms->special_condition_input[$i]; } diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php index 10c42716..b3ca2187 100755 --- a/app/Controllers/LoginController.php +++ b/app/Controllers/LoginController.php @@ -19,17 +19,16 @@ class LoginController extends BaseController // set_session_data($session_data); // $isLoggedIn = check_session(); $isLoggedIn = check_session(); - - if ($isLoggedIn) { + $hasCookie = check_cookie(); + if ($isLoggedIn || $hasCookie) { return redirect()->to(base_url('/dashboard/view')); } return view('login'); } - + public function receiveGoogleOAuthResponse() { - $UserModel = new UserModel(); //echo 'DONE';die(); if ($this->request->getGet('code')) { @@ -52,7 +51,10 @@ class LoginController extends BaseController 'userProfile' => $value->picture, 'user_team' => $user_team, ]; - + $path = getenv('cookie.Path'); + $domain = getenv('cookie.Domain'); + $https = getenv('ccokie.secure'); + setcookie('session_data', json_encode($session_data), time() + 12 * 60 * 60, $path, $domain, $https, true); set_session_data($session_data); log_message('error', 'Set The UserId : `'. $user->id .'` in Session'); @@ -82,12 +84,14 @@ class LoginController extends BaseController public function initiateGoogleOAuth() { - return googleOAuthLogin(false); + return googleOAuthLogin(false); } public function logout() { + $path = getenv('cookie.Path'); session()->destroy(); + setcookie('session_data', '', time() - 3600, $path); return redirect()->to(base_url('login')); } diff --git a/app/Filters/AuthMVC.php b/app/Filters/AuthMVC.php index aa406108..1e0be969 100755 --- a/app/Filters/AuthMVC.php +++ b/app/Filters/AuthMVC.php @@ -9,7 +9,7 @@ class AuthMVC implements FilterInterface { public function before(RequestInterface $request, $arguments = null) { - if (!check_session()) { + if (!check_session() && !check_cookie()) { return redirect()->to(base_url('/login')); } diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index 3c254374..436ae854 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -1492,6 +1492,7 @@ if (!function_exists('premium_calculation_manager')) $emp_data['policy_details']['rata_premimum'] = 0; $emp_data['policy_details']['gst'] = 0; $emp_data['policy_details']['days'] = 0; + $emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date']; } else { $log_message .= '- skipping, slab rate not found'; } $myLogger->logme('error',$log_message); diff --git a/app/Helpers/session_helper.php b/app/Helpers/session_helper.php index 4a13df4d..f5c6e513 100755 --- a/app/Helpers/session_helper.php +++ b/app/Helpers/session_helper.php @@ -1,5 +1,39 @@ getUserByEmail($value['userData']->email); + if($user){ + if($user->is_active !== '0'){ + $user_team = $UserModel->getUserTeamsByUserID($user->id); + // dd($user_team); + + $session_data = [ + 'isLoggedIn' => True , + 'userid' => $user->id, + 'userData' => $user, + 'userProfile' => $value['userProfile'], + 'user_team' => $user_team, + ]; + set_session_data($session_data); + // $this->getUserDeviceInfo($user->id, 'NhanceUser'); + // return redirect()->to(base_url('/dashboard/view')); + return true; + + } + // $session_data = (array)json_decode($_COOKIE['session_data']); + // set_session_data($session_data); + } + }else{ + return false; + } +} if (!function_exists('check_session')) { function check_session() @@ -150,7 +184,7 @@ if (!function_exists('user_team')) { } - +} diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 7df9b70b..2c23c619 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -115,6 +115,7 @@ class EmployeePolicyModel extends Model 'client_branch.branch_name as client_branch_name', 'client_branch.branch_code as client_branch_code', 'cp.policy_no', + 'cp.policy_type_id', ]) ->join('employees emp', 'employee_polices.employee_id = emp.id') ->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy @@ -192,7 +193,7 @@ class EmployeePolicyModel extends Model $result = $this->select([ 'employee_polices.id' ]) - ->join('employees emp', 'employee_polices.employee_id = emp.id AND emp.relationship = "Self" '); + ->join('employees emp', 'employee_polices.employee_id = emp.id'); if ($policy_id !=0 && !empty($policy_id)) { $result->where('employee_polices.client_policy_id', $policy_id); } @@ -201,7 +202,9 @@ class EmployeePolicyModel extends Model ->where('employee_polices.status', 'active') ->where('employee_polices.tpa_id is not null') ->where('employee_polices.ecard_sent_status',0) - ->where('emp.relationship','Self'); + // ->where('emp.relationship','Self'); + ->where('emp.email_corporate !=','') + ->where('emp.email_corporate is not null'); return $result->findAll(); // $result->findAll(); diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 7b7fc338..5e555ef2 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -157,11 +157,11 @@ Edit - + View E-Card - + Send E-Card Mail diff --git a/app/Views/test_members_list.php b/app/Views/test_members_list.php index 385aeb37..aaaf425e 100644 --- a/app/Views/test_members_list.php +++ b/app/Views/test_members_list.php @@ -87,6 +87,27 @@ color: #16181b !important; cursor: pointer !important; } +th, td { + text-align: center; /* Or left/right depending on your preference */ + vertical-align: middle; /* Ensures content is vertically centered */ +} +input[type="checkbox"] { + width: 16px; /* Standard checkbox size */ + height: 16px; + margin: 0; /* Remove default margin */ + vertical-align: middle; /* Align with text or other elements */ +} +th:first-child, td:first-child { + width: 50px; /* Adjust width as needed */ +} +.table-responsive { + overflow-x: auto; +} + +.table { + table-layout: fixed; /* Prevent columns from resizing dynamically */ +} + @@ -156,12 +177,13 @@ + - - + } --> + */ + ?> @@ -392,7 +415,7 @@