diff --git a/app/Config/Routes.php b/app/Config/Routes.php index eca94e6..67cbf08 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -435,6 +435,7 @@ $routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationControll //HR login api's $routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); +$routes->post("/employeeRest/verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail"); $routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData"); $routes->group("/api", ["filter" => "authJWT"], function ($routes) { @@ -476,7 +477,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn"); $routes->get("exportDataByClientPolicyId", "EmployeeRestController::exportDataByClientPolicyId"); - $routes->get("getCashDepositData", "EmployeeRestController::getCashDepositData"); + + $routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPolicyLevelEmployeeSummaryData"); $routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData"); $routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData"); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 7e57728..3f03147 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -10,6 +10,7 @@ use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; use App\Helpers\sendMailNotification; +use App\Helpers\EmployeeHelper; use App\Models\EmployeeModel; @@ -75,6 +76,7 @@ class EmployeeRestController extends AdminController protected $clientBranchModel; protected $auditHistoryModel; protected $siMappingModel; + protected $employeeHelper; public function __construct() @@ -100,6 +102,7 @@ class EmployeeRestController extends AdminController $this->clientBranchModel = new ClientBranchModel(); $this->auditHistoryModel = new AuditHistoryModel(); $this->siMappingModel = new SIMappingModel(); + $this->employeeHelper = new EmployeeHelper(); } @@ -227,10 +230,23 @@ class EmployeeRestController extends AdminController try { $data = $this->request->getJSON(); - // dd($data); - + //enrolment check $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id); - if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); } + if($openForEnrollment == false){ + return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => 'Enrollment closed.'], 200); + } + + //dependent duplicate check + if ( ! isset($data[0]->id) ) { + $validationFailed = $this->employeeHelper->validation_addEmployeeAndDependence($data); + + if($validationFailed){ + return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => "Relation already exists."], 200); + } + } + + + if ($data) { @@ -279,14 +295,14 @@ class EmployeeRestController extends AdminController $this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code , $data[0]->client_branch_id); $result = []; - return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200); + return $this->respond(['status' => 'success','code' => 200,'data' => $result,'message' => "Successfully updated."], 200); } else { $result = "No Matches"; - return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404); + return $this->respond(['status' => 'failed','code' => 404,'data' => $result,'message' => "Action failed."], 200); } } } catch (\Exception $e) { - return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); + return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage(),'message' => "Action failed."], 500); } } @@ -2471,72 +2487,46 @@ class EmployeeRestController extends AdminController } - public function getCashDepositData() + public function getPolicyLevelEmployeeSummaryData() { - $ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name') - ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') - ->where('client_policy.client_id', $this->request->getGet('client_id') ) - ->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') ) - ->where('client_policy.is_active', 1 ) - ->where('client_policy.policy_status', 1) - ->groupBy('client_policy.insurer_id') - ->findAll(); - $result = []; - - if(count($ClientPolicyData)) - { - foreach ($ClientPolicyData as $key => $value) { - - $data['clientId'] = $value['clientId']; - $data['insurerId'] = $value['insurerId']; - $data['insurerName'] = $value['insurer_name']; - $data['depositData'] = $this->clientPolicyModel->getdepositData($value['clientId'],$value['insurerId']); - $data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0; - - $data['policyDetails'] = []; - $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, 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 ') - - ->where('client_policy.insurer_id', $value['insurerId'] ) - ->where('client_policy.client_id', $this->request->getGet('client_id') ) - ->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') ) - ->where('client_policy.is_active', 1 ) - ->where('client_policy.policy_status', 1) - ->findAll(); - // dd( $ClientPolicyData); - foreach ($ClientPolicyData as $key => $value) + + $ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, 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 ') + ->where('client_policy.client_id', $this->request->getGet('client_id') ) + ->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') ) + ->where('client_policy.is_active', 1 ) + ->where('client_policy.policy_status', 1) + ->findAll(); + $result = []; + // dd( $ClientPolicyData); + foreach ($ClientPolicyData as $key => $value) + { + $policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow(); + $value['type'] = $policyTypeData->policy_type; + $value['policy_name'] = $policyTypeData->long_name; + $employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id')); + $enrolledCount = 0; + $draftCount = 0; + if(count($employeeDetails)) { - $policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow(); - $value['type'] = $policyTypeData->policy_type; - $value['policy_name'] = $policyTypeData->long_name; - $employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id')); - $enrolledCount = 0; - $draftCount = 0; - if(count($employeeDetails)) - { - foreach ($employeeDetails as $item) { - if ($item['emp_status'] === 'enrolled') { - $enrolledCount++; - } elseif ($item['emp_status'] === 'draft') { - $draftCount++; - } + foreach ($employeeDetails as $item) { + if ($item['emp_status'] === 'enrolled') { + $enrolledCount++; + } elseif ($item['emp_status'] === 'draft') { + $draftCount++; } } - - $value['totalMembersCount'] = count($employeeDetails); - $value['membersCountOfEnrolled'] = $enrolledCount; - $value['membersCountOfDraft'] = $draftCount; - - array_push($data['policyDetails'],$value); } - - - array_push($result,$data); - } - } - + $value['totalMembersCount'] = count($employeeDetails); + $value['membersCountOfEnrolled'] = $enrolledCount; + $value['membersCountOfDraft'] = $draftCount; + + array_push($result,$value); + } + + if($result) { diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 7f2f9f4..2c57f1a 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -75,7 +75,7 @@ class RestAuthenticationController extends AdminController - + // employee auth api's start public function verifyEmployeeWithMobileNumber() { @@ -90,7 +90,7 @@ class RestAuthenticationController extends AdminController ->where('employees.emp_status !=', 'truncated') ->where('employees.mobile', $mobile_number) ->where('EP.is_active', 1) - ->whereIn('EP.status', ['draft', 'enrolled']) + ->whereIn('EP.status', ['draft', 'enrolled', 'expired']) ->first(); @@ -131,7 +131,7 @@ class RestAuthenticationController extends AdminController ->where('employees.emp_status !=', 'truncated') ->where('employees.email_corporate', $email) ->where('EP.is_active', 1) - ->whereIn('EP.status', ['draft', 'enrolled']) + ->whereIn('EP.status', ['draft', 'enrolled', 'expired']) ->first(); if (isset($employeeData['employee_id'])) { @@ -268,6 +268,11 @@ class RestAuthenticationController extends AdminController } } + // employee auth api's end + + + // HR auth api's start + public function verifyHrWithMobileNumber() { try { @@ -283,8 +288,74 @@ class RestAuthenticationController extends AdminController $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); + // Call the third-party API function + return $this->callThirdPartyAPI($this->request->getJSON(),'verifyHrWithMobileNumber'); + + } + } catch (\Throwable $th) { + return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); + } + } + + public function verifyHrWithEmail() + { + try { + + $data = $this->request->getJSON(); + + $email = $data->email; + + $HrData = $this->hrModel->where('email', $email) + ->where('contact_type', 'client') + ->where('is_active', 1) + ->first(); + + if ($HrData) { + + $otp = random_int(100000, 999999); + + $sql = " + UPDATE level_contacts + SET otp = ? + WHERE email = ? + AND contact_type = 'client' + AND is_active = 1 + "; + + $db = db_connect(); + $update = $db->query($sql, [$otp, $email]); + + if($update) + { + $data->otp = $otp; + $this->callThirdPartyAPI($data, 'updateHROTP'); + + $common = [ + 'login_type' => 'HR login', + 'login_email' => $email, + 'mail_type' => 'otp_mail' + ]; + $subject = 'Nhance user verification - OTP'; + $mail_content = $otp . ' is your verification code for Nhance.'; + $res = MailHelper::send_email(['mail' => $email, 'subject' => $subject, 'common' => $common, 'message' => $mail_content]); + $this->myLogger->logme("info", $res); + + if (json_decode($res)->status == 'success') { + $result = ['user_verification' => true, 'message' => "Verified Successfully"]; + return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200); + } else { + $result = ['user_verification' => false, 'message' => "Mail sending failed , try again"]; + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200); + } + } else { + + $result = ['user_verification' => false, 'message' => "Verification failed , try again"]; + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200); + } + + } else { + // Call the third-party API function + return $this->callThirdPartyAPI($this->request->getJSON(),'verifyHrWithEmail'); } } catch (\Throwable $th) { @@ -296,11 +367,23 @@ class RestAuthenticationController extends AdminController public function getVerifiedHrData() { try { - $mobile_number = $this->request->getJSON()->mobile_number; - $otp_verification = $this->request->getJSON()->otp_verification; + // mobile number + $otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null; + $mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null; + // email id + $otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null; + $email = isset($this->request->getJSON()->email) ? $this->request->getJSON()->email : null; + + if (isset($mobile_number)) + { + $hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first(); + }else{ + $hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('otp', $otp)->first(); + } + + if ($hrData && $otp_verification == true || $hrData && isset($this->request->getJSON()->otp) ) + { - $hrData = $this->hrModel->where('mobile', $mobile_number)->first(); - if ($hrData && $otp_verification == true) { $auth = HttpRequestHelper::getRequestInfo(); if ($auth) { $data = [ @@ -316,15 +399,37 @@ class RestAuthenticationController extends AdminController } - $hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id') + if(isset($this->request->getJSON()->mobile_number)){ + + $hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id') + ->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left') + ->where('level_contacts.mobile', $mobile_number ) + ->where('level_contacts.contact_type', 'client') + ->find(); + + }else if(isset($this->request->getJSON()->otp)){ + + $this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update(); + + $hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id') ->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left') - ->where('level_contacts.mobile', $mobile_number ) + ->where('level_contacts.email', $email ) + ->where('level_contacts.contact_type', 'client') ->find(); + } $result = JWTToken::encode($hrData['0']); - return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); + + // Call the third-party API function + $apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData'); + return $this->respond(['status' => 'success','code' => 200,'data' => $result , 'post_enrollment'=> json_decode($apiResponse, true)],200); + + } else { - return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200); + + // Call the third-party API function + $apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData'); + return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" , 'post_enrollment'=> json_decode($apiResponse, true)],200); } } catch (\Exception $e) { return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500); diff --git a/app/Helpers/EmployeeHelper.php b/app/Helpers/EmployeeHelper.php new file mode 100644 index 0000000..6feadc8 --- /dev/null +++ b/app/Helpers/EmployeeHelper.php @@ -0,0 +1,337 @@ +employeeModel = new EmployeeModel(); + $this->employeePolicyModel = new EmployeePolicyModel(); + $this->clientPolicyModel = new ClientPolicyModel(); + + } + + public function validation_addEmployeeAndDependence($data){ + + + $employeeData = $this->employeeModel->where('emp_code',$data[0]->emp_code) + ->where('client_id',$data[0]->client_id) + ->where('client_branch_id',$data[0]->client_branch_id) + ->where('is_active', 1 ) + ->where('is_addon_value',0) + ->findAll(); + + $arr [] = $data; + + $client_policy_id = $data[0]->client_policy_id ; + + $array = $this->clientPolicyModel + ->where('id',$client_policy_id) + ->find(); + + $array = $array[0]; + + $array = $this->arrayToObject($array); + + + // Map family floaters that already exist in the employee table + $familyFloates = json_decode( $array->policy_terms)->family_floaters; + + $decodedArray = json_decode( $array->policy_terms); + + // Generate Notes string based on familyFloates terms + $array->notes = $this->FloterNotesConvertion($familyFloates); + + // remove parent and parent-in-law from familyFloaters + if($familyFloates->{'either-parents-pil'} != 0){ + unset($familyFloates->parents); + unset($familyFloates->parents_in_law); + } + + $floters = $this->FloterConvertion($familyFloates); + + $newData = []; + $dependent_and_si_value = 0; + $dependent_and_si_premium_value = 0; + $dependent_and_si_gst_value = 0; + foreach ($floters as $familyFloatesValue) { + $dependent = preg_replace('/\d/', '', $familyFloatesValue); + + if(count($employeeData)){ + foreach ($employeeData as $key => $value) { + if ($value['family_floater_key'] === $dependent) { + $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->id)->where('is_active', 1 )->get()->getRow(); + if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; } + if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1) + { + if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;} + if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;} + } + + $temp['is_value_exist'] = true; + $temp['data']['family_floater_key'] = $familyFloatesValue; + $temp['data']['employee_id'] = $value['id']; + $temp['data']['relationship'] = $value['relationship']; + $temp['data']['name'] = $value['name']; + $temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']); + $temp['data']['client_policy_id'] = $array->id; + $temp['data']['form_type'] = $dependent; + $temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0; + + + $temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue); + + array_push($newData,$temp); + unset($employeeData[$key]); + $floters = array_diff($floters, [$familyFloatesValue]); + break; + } + } + } + } + + + + // Remove Unwanted floter key from floters array based on either-parents-pil term value + if($familyFloates->{'either-parents-pil'} == 1 && count($floters)) + { + $count_parent = 0; + $count_parent_in_law = 0; + foreach ($floters as $value) { + if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; } + if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;} + } + if($count_parent != 2) { + $floters = array_filter($floters, fn($value) => strpos($value, 'parent_in_law') === false); + } + if($count_parent_in_law != 2) { + $floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false); + } + } + else if($familyFloates->{'either-parents-pil'} == 2 && count($floters)) + { + $count_parent = 0; + $count_parent_in_law = 0; + foreach ($floters as $value) { + if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; } + if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;} + } + if(($count_parent + $count_parent_in_law) == 2) { + $floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false); + } + + } + + // Add family floter buttons placement data for FE validation + if(count($floters)){ + foreach ($floters as $familyFloatesValue) { + + $temp2['is_value_exist'] = false; + $temp2['data']['family_floater_key'] = $familyFloatesValue; + $temp2['data']['client_policy_id'] = $array->id; + $temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue))); + $temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue); + + + $temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue); + + array_push($newData,$temp2); + + } + } + + $validationFailed = true ; + + $input_relationship = $data[0]->relationship ; + + + foreach($newData as $index => $eachData){ + + if($eachData['is_value_exist'] == false){ + + if( $eachData['data']['form_type'] == 'child' && ($input_relationship == 'Son' || $input_relationship == "Daughter")){ + + $validationFailed = false ; + + } + + if( $eachData['data']['form_type'] == 'parent' && ($input_relationship == 'Father' || $input_relationship == "Mother")){ + + $validationFailed = false ; + } + + if( $eachData['data']['form_type'] == 'spouse' && ($input_relationship == 'Spouse') ){ + + $validationFailed = false ; + } + + if( $eachData['data']['form_type'] == 'parent_in_law' && ($input_relationship == 'Father in Law' || $input_relationship == "Mother in Law")){ + + $validationFailed = false ; + } + + + } + + } + + if(empty($newData) && $validationFailed){ + $validationFailed = false ; + } + + + return $validationFailed ; + + } + + function arrayToObject($array) { + if (!is_array($array)) { + return $array; + } + + $object = new \stdClass(); + foreach ($array as $key => $value) { + $object->$key = $this->arrayToObject($value); + } + + return $object; + } + + function objectToArray($object) { + + if (is_object($object)) { + $object = get_object_vars($object); + } + + if (is_array($object)) { + return array_map('objectToArray', $object); + } + + return $object; + } + + public function FloterNotesConvertion($array){ + + $result = ' '; + foreach ($array as $key => $value) { + if ($value > 0) { + if($value == 1 && $key ==='either-parents-pil') { + $result .= ' + Either 2 Parents or 2 Parents in law'; + }else if($value == 2 && $key ==='either-parents-pil') { + $result .= ' + Any 2 of Parents and Parents in law'; + }else if($value != 0 && $key ==='spouse') { + $string = str_replace('-', ' ', $key); + $string = ucwords($string); + $result .= ' + '.$string; + }else if($value != 0 && $key ==='self') { + $result = 'Allowed members Self '; + }else if($value != 0 && $key ==='childrens') { + if($value > 1){ $result .= ' + '.$value.' Children'; }else{ $result .= ' + '.$value.' Child'; } + }else if($value != 0 && $key ==='elders_count') { + + }else{ + $string = str_replace('-', ' ', $key); + $string = ucwords($string); + $result .= ' + '.$value.' '.$string; + } + + + } + } + + $first_two_chars = substr($result, 0, 3); + + if($first_two_chars == " +"){ + $modified_string = substr($result, 3); + return "Allowed members ".$modified_string; + }else{ + return $result; + } + return substr($result, 0, 2) !== " +"; + + + } + + public function getAgeRange($terms,$familyFloatesValue) + { + + $ageRangeArray = ['self' => ['min' => 18, 'max' => 60] , 'spouse' => ['min' => 18, 'max' => 60] , 'child' => ['min' => 0, 'max' => 25] , 'elders' => ['min' => 18, 'max' => 60] ]; + + $ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue); + if(isset($terms->age_ratio)){ + return $terms->age_ratio->$ageKey; + }else{ + return $ageRangeArray[$ageKey]; + } + + + } + + public function FloterConvertion($array){ + + $result = []; + + 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; + } + } else if($value != 0 && $key ==='parents') { + for ($i = 1; $i <= $value; $i++) { + $result[] = "parent" . $i; + } + }else if($value != 0 && $key ==='parents-in-law') { + for ($i = 1; $i <= $value; $i++) { + $result[] = "parent_in_law" . $i; + } + }else if($value != 0 && $key ==='either-parents-pil') { + for ($i = 1; $i <= 2; $i++) { + $result[] = "parent" . $i; + $result[] = "parent_in_law" . $i; + } + }else { + $result[] = $key; + } + } + } + + return $result; + } + + private function convertDateFormatDMY($dateString) + { + // Attempt to create a DateTime object from the provided date string + $dateTime = \DateTime::createFromFormat('Y-m-d', $dateString); + + if ($dateTime instanceof \DateTime) { + return $dateTime->format('d-m-Y'); + } else { + return null; + } + } + + + +} + +?> \ No newline at end of file diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 68ae324..0d9b2bd 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -97,8 +97,6 @@ label { } - -
- +