diff --git a/app/Config/Routes.php b/app/Config/Routes.php index aba39a78..4f0213c0 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -397,6 +397,7 @@ $routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationControlle $routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData"); $routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin"); $routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin"); +$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId"); //HR login api's $routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 8a1eed85..663187c2 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1082,9 +1082,11 @@ class EmployeeRestController extends AdminController // Construct value for policy type GPA - if($getSlabAndGridData['grid_master']['policy_type'] == "GPA" && $this->request->getGet('policy') == 'GPA'){ + // $getSlabAndGridData['grid_master']['policy_type'] == "GPA" + if($array->policy_type_id == 1 && $this->request->getGet('policy') == 'GPA') + { - // Filter employee data where the family_floater_key is 'self' + // 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(); @@ -1119,7 +1121,9 @@ class EmployeeRestController extends AdminController } // Construct value for policy type GMC - }else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC" && $this->request->getGet('policy') == 'GMC' ){ + // $getSlabAndGridData['grid_master']['policy_type'] == "GMC" + }else if($array->policy_type_id == 2 && $this->request->getGet('policy') == 'GMC' ) + { @@ -1493,6 +1497,9 @@ class EmployeeRestController extends AdminController foreach ($array as $key => $value) { if ($value > 0 && $key != 'elders_count') { if ($value != 0 && $key === 'childrens') { + + if($value > 2){ $value = 2; } + for ($i = 1; $i <= $value; $i++) { $result[] = "child" . $i; } @@ -1649,6 +1656,7 @@ class EmployeeRestController extends AdminController $responce['OpenForEnrollment'] = $array['open_for_enrollment']; $responce['policy_terms'] = $decodedArray; $responce['policy_type_id'] = $array['policy_type_id']; + $responce['is_member_modify_allowed'] = $array['is_member_modify_allowed']; $responce['disclaimer'] = $array['disclaimer']; $tpaArray = $this->employeeModel->select('employees.name as name , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') @@ -1941,6 +1949,7 @@ class EmployeeRestController extends AdminController $this->employeeModel->where('emp_code', $emp_code ) ->where('client_id', $client_id ) ->where('is_active', 1 ) + ->where('emp_status', 'draft' ) ->set(array('emp_status'=>'enrolled')) ->update(); @@ -1962,6 +1971,7 @@ class EmployeeRestController extends AdminController $this->employeePolicyModel->where('client_policy_id', $value ) ->where('is_active', 1 ) ->where('employee_id', $empDataValue['id'] ) + ->where('status', 'draft' ) ->set(array('status'=>'enrolled')) ->update(); } diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index a7b77c09..58f38940 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -90,25 +90,68 @@ class RestAuthenticationController extends AdminController return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); } } + + public function verifyEmployeeWithEmailId() + { + try { + $email = $this->request->getJSON()->email; + + + $employeeData = $this->employeeModel->where('email', $email) + ->where('relationship', 'self') + ->where('emp_status !=', 'truncated') + ->where('is_active', 1) + ->first(); + + if ($employeeData) { + + $result = ['user_verification' => true ,'message' => "Verified Successfully"]; + return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); + } else { + $result = ['user_verification' => false , 'message' => "User not found"]; + return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200); + + } + } catch (\Throwable $th) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); + } + } public function getVerifiedUserData() { try { - $mobile_number = $this->request->getJSON()->mobile_number; + $otp_verification = $this->request->getJSON()->otp_verification; if (isset($this->request->getJSON()->login_by_hr)) { - $employeeData = $this->employeeModel->where('id', $this->request->getJSON()->employee_id)->where('relationship', 'self')->first(); + $employeeData = $this->employeeModel->where('id', $this->request->getJSON()->employee_id)->where('relationship', 'self') + ->where('emp_status !=', 'truncated') + ->where('is_active', 1) + ->first(); }else{ - //$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first(); - $employeeData = $this->employeeModel->where('mobile', $mobile_number) + + $mobile_number = $this->request->getJSON()->mobile_number; + $email_id = $this->request->getJSON()->email_id; + + if (isset($mobile_number)) { + $employeeData = $this->employeeModel->where('mobile', $mobile_number) ->where('relationship', 'self') ->where('emp_status !=', 'truncated') ->where('is_active', 1) ->first(); - + } else { + + $employeeData = $this->employeeModel->where('email', $email_id) + ->where('relationship', 'self') + ->where('emp_status !=', 'truncated') + ->where('is_active', 1) + ->first(); + } + + // $employeeData = $employeeData->first(); + } diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index b84b96a9..edffa781 100755 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -149,7 +149,7 @@ class EmployeeModel extends Model { return $this->db->table('employee_polices') - ->select(' policy_type.long_name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables + ->select(' policy_type.long_name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment, client_policy.is_member_modify_allowed, client_policy.disclaimer,client_policy.policy_type_id , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id') ->join('policy_type', 'policy_type.id = client_policy.policy_type_id') ->where('client_policy.policy_status', 1)