diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 15533b25..07fb963a 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4295,7 +4295,7 @@ class ClientController extends AdminController // dd($policyTerms); // Re-encode the ordered policy terms $updatedPolicyTerms = json_encode($policyTerms); - dd($updatedPolicyTerms); + // dd($updatedPolicyTerms); // dd($orderedPolicyTerms, $updatedPolicyTerms); $this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]); @@ -4574,7 +4574,7 @@ class ClientController extends AdminController $employeeRestController = new EmployeeServiceController(); // $employeeRestController->excelFileDataValidation(['file_id' => 823]); - // $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]); + // $employeeRestController->employeesOnboardPreprocess(['file_id' => 726]); // $employeeRestController->employeesOnboardProcess(['file_id' => 835]); // $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]); // $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]); @@ -4705,6 +4705,9 @@ class ClientController extends AdminController // $this->loadLayout('tat_report_band_wise_list', $reportData); // $data = $ticketModel->getTATReport(1); + // $empmodel = new EmployeeModel(); + // $data = $empmodel->getEmployeePolicy(348); + // dd($data); } // ------------------------------------------------------------------------------------------------------- diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index 752d116c..616a69cd 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -102,70 +102,68 @@ class RestAuthenticationController extends AdminController { try { $email = $this->request->getJSON()->email; - - $employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id') - ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner') - ->where('employees.is_active', 1) - ->where('employees.relationship', 'self') - ->where('employees.emp_status !=', 'truncated') - ->where('employees.email_corporate', $email) - ->where('EP.is_active', 1) - ->whereIn('EP.status', ['active']) - ->first(); - - if (isset($employeeData['employee_id'])) - { + + $employeeData = $this->employeeModel->select(' + employees.relationship, + EP.employee_id, + employees.client_id, + employees.client_branch_id, + employees.email_corporate + + ') + ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner') + ->where('employees.is_active', 1) + ->where('employees.relationship', 'Self') + ->where('employees.emp_status !=', 'truncated') + ->where('employees.email_corporate', $email) + ->where('EP.is_active', 1) + ->whereIn('EP.status', ['draft', 'enrolled']) + ->first(); + + if (isset($employeeData['employee_id'])) { $otp = random_int(100000, 999999); - $update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self') - ->where('is_active', 1)->set(array('otp' => $otp )) - ->update(); - if($update) - { + $update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'Self') + ->where('is_active', 1)->set(array('otp' => $otp)) + ->update(); + if ($update) { $common = [ 'client_id' => $employeeData['client_id'], 'client_branch_id' => $employeeData['client_branch_id'], 'client_policy_id' => null, 'employee_policy_id' => null, - 'employee_id' => $employeeData['id'], + 'employee_id' => $employeeData['employee_id'], 'mail_type' => 'otp_mail', - ]; + ]; $subject = 'Nhance user verification - OTP'; - $mail_content = $otp.' is your verification code for Nhance.'; - $res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject ,'common'=>$common ,'message' => $mail_content]); + $mail_content = $otp . ' is your verification code for Nhance.'; + $res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], '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); + 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 { - }else{ - - $result = ['user_verification' => false , 'message' => "Verification failed , try again"]; - return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200); - + $result = ['user_verification' => false, 'message' => "Verification failed , try again"]; + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200); } - - } else { - $result = ['user_verification' => false , 'message' => "User not found"]; - return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200); - + $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); + return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $th], 500); } } - + public function getVerifiedUserData() { diff --git a/app/Helpers/excel_util_helper.php b/app/Helpers/excel_util_helper.php index a5cd1bda..c90eebb3 100755 --- a/app/Helpers/excel_util_helper.php +++ b/app/Helpers/excel_util_helper.php @@ -682,7 +682,7 @@ if (!function_exists('generate_relationship_code')) $slug = \Config\Services::slug(); $relationship_code = $slug->slugify($arr['relationship']); $emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03'); - $relationship_code = $gender[ $arr['gender'] ] . $relationship[ $relationship_code ] ; + $relationship_code = $gender[ trim($arr['gender']) ] . $relationship[ trim($relationship_code) ]; return ['relationship_code' => $relationship_code,'emp_type_code' => $emp_type_code]; } } diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index 44bea402..bd66c776 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -1247,7 +1247,7 @@ class sendMailNotification $subject = $notification['subject']; $rand_string = 'HX3kUh'; - $link = generate_download_link($rand_string); + $link = generate_download_link($rand_string).'/1'; $name = 'John Doe'; $mobile = 9080706050; diff --git a/app/Models/EmployeeModel.php b/app/Models/EmployeeModel.php index 14ec368d..57ac791b 100755 --- a/app/Models/EmployeeModel.php +++ b/app/Models/EmployeeModel.php @@ -149,7 +149,21 @@ 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,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 + ->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, + CASE + WHEN client_policy.open_for_enrollment IS NULL THEN 0 + ELSE client_policy.open_for_enrollment + END AS OpenForEnrollment, + client_policy.disclaimer, + client_policy.policy_type_id , + employee_polices.tpa_id as tpa_id , + employee_polices.rand_string as rand_string + ', FALSE) // 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) diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index bb5f5954..e2a25cc6 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -607,7 +607,8 @@ class PolicyTransactionModel extends Model policy_type.policy_type, pt_co_share_details.agreed_amt AS amount, pt_co_share_details.bp_amt AS bp, - pt_co_share_details.tp_amt AS tp + pt_co_share_details.tp_amt AS tp, + clients.pan ') ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left') diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index f26439e5..66d00a2a 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -691,111 +691,121 @@ - + -