From 29a50dd0772dc57a72a0b8b5fad1c6fd7c515562 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Fri, 13 Feb 2026 17:58:36 +0530 Subject: [PATCH 1/7] GWM : health india integration --- app/Config/Filters.php | 2 +- app/Config/Routes.php | 4 +- app/Controllers/ApiServiceController.php | 27 +++++++ app/Controllers/HealthIndiaApiController.php | 80 ++++++++++++-------- app/Controllers/ICICILombardController.php | 24 +++--- app/Controllers/JobWorker.php | 4 + 6 files changed, 95 insertions(+), 46 deletions(-) diff --git a/app/Config/Filters.php b/app/Config/Filters.php index c9431b94..d96ae232 100755 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -65,7 +65,7 @@ class Filters extends BaseConfig 'before' => [ 'HttpRequestLog' => ['except' => 'cli/*'], 'Cors', - 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']], + // 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']], 'SecurityInputFilter' => ['except' => ['/client/notification/create','/ticket/crud_mail_template/*','test_mail','leads/sendMail'] ], 'GlobalPostFileUploadGuard' // 'csrf', diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0bbec752..f659dfb9 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -783,10 +783,10 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails'); //Third party - testing route $routes->get('FhplGetBenefDetails','FhplApiController::FhplGetBenefDetails'); -$routes->get('EcardRequest','FhplApiController::EcardRequest'); +$routes->get('EcardRequest','HealthIndiaApiController::EcardRequest'); $routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork'); $routes->get('VidalGetBenefDetails','VidalApiController::VidalGetBenefDetails'); -$routes->get('ClaimDetail','FhplApiController::ClaimDetail'); +$routes->get('ClaimDetail','HealthIndiaApiController::ClaimDetail'); $routes->get('SubmitClaim','HealthIndiaApiController::SubmitClaim'); $routes->get('IntimateClaim','MediAssistApiController::IntimateClaim'); $routes->get('IRSubmission','MediAssistApiController::IRSubmission'); diff --git a/app/Controllers/ApiServiceController.php b/app/Controllers/ApiServiceController.php index 6f2e8ae2..17320621 100644 --- a/app/Controllers/ApiServiceController.php +++ b/app/Controllers/ApiServiceController.php @@ -64,6 +64,10 @@ class ApiServiceController extends BaseController { // fhpl $fhplApiController = new FhplApiController; return $fhplApiController->SubmitClaim($claimId); + }else if ($tpaID == $this->health_india_primary_key) + { // health india + $healthIndiaApiController = new HealthIndiaApiController; + return $healthIndiaApiController->SubmitClaim($claimId); }else{ log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}"); } @@ -145,6 +149,12 @@ class ApiServiceController extends BaseController $fhplApiController = new FhplApiController; $data['eCardDownload'] = $fhplApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] ); + }else if($employee_policy[0]['tpa_primary_id'] == $this->health_india_primary_key)// health india + { + + $healthIndiaApiController = new HealthIndiaApiController; + $data['eCardDownload'] = $healthIndiaApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] ); + }else{ if($type == "download"){ @@ -292,6 +302,17 @@ class ApiServiceController extends BaseController return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]); + }else if ($tpa_id == $this->health_india_primary_key) // health india + { + $file_id = $fileModel->insert($data); + log_message('error', "Files table inserted successfully, File id : {$file_id}"); + // $healthIndiaApiController = new HealthIndiaApiController; + // $healthIndiaApiController->HealthIndiaGetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] ); + $r = Jobs::addJob(['job_name' => 'HealthIndiaGetBenefDetails', 'payload' => ['policy_no' => $policy_no, 'file_id' => $file_id, 'client_policy_id' => $policy_id, 'return_type' => 'job']]); + log_message('error', "HealthIndiaGetBenefDetails job pushed successfully."); + + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]); + }else{ return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA not found ','data' => [] ]); } @@ -328,6 +349,12 @@ class ApiServiceController extends BaseController $res = $fhplApiController->ClaimDetail($claimId); return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]); + }else if ($tpaID == $this->health_india_primary_key) { // health india + + $healthIndiaApiController = new HealthIndiaApiController; + $res = $healthIndiaApiController->ClaimDetail($claimId); + return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]); + }else{ log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}"); $message = "This TPA has no API service enabled"; diff --git a/app/Controllers/HealthIndiaApiController.php b/app/Controllers/HealthIndiaApiController.php index 9ac26461..f10801fb 100644 --- a/app/Controllers/HealthIndiaApiController.php +++ b/app/Controllers/HealthIndiaApiController.php @@ -79,7 +79,7 @@ class HealthIndiaApiController extends BaseController ]); } - public function SubmitClaim($claimId = 515) + public function SubmitClaim($claimId = 729) { helper('api'); @@ -205,7 +205,7 @@ class HealthIndiaApiController extends BaseController $response = call_third_party_api($url, 'POST', $headers, $body); - dd($response); + // dd($response); log_message('error', 'TPA CLAIM PUSH HEALTH_INDIA RESPONSE | claimId: ' . $claimId . ' | response: ' . json_encode($response)); @@ -239,7 +239,7 @@ class HealthIndiaApiController extends BaseController return; } - public function ClaimDetail($claimId = null) + public function ClaimDetail($claimId = 729) { helper('api'); @@ -284,6 +284,8 @@ class HealthIndiaApiController extends BaseController $response = call_third_party_api($url, 'POST', $headers, $body); + // dd($response); + log_message('error', 'CLAIM STATUS HEALTH_INDIA | claimId: ' . $claimId . ' | Response: ' . json_encode($response)); if (empty($response['data']['result'][0])) { @@ -368,9 +370,9 @@ class HealthIndiaApiController extends BaseController $url = getenv('HEALTH_INDIA_BASE_URL') . "/Member/GetMemberEcard"; $body = [ - "policY_NUMBER" => $policyNo, - "employeE_CODE" => $employeeId, - "membeR_ID" => $memberId + "policY_NUMBER" => $policyNo ,//'141600_POLICY_AWAITED', + "employeE_CODE" => $employeeId,//'DECP000', + "membeR_ID" => $memberId//'19662410E', ]; $headers = [ @@ -416,8 +418,8 @@ class HealthIndiaApiController extends BaseController try { helper('api'); - $policyNo = $requestData['policy_no'] ?? '141600_POLICY_AWAITED'; - $client_policy_id = $requestData['client_policy_id'] ?? 6473; + $policyNo = $requestData['policy_no'] ?? null; //'141600_POLICY_AWAITED'; + $client_policy_id = $requestData['client_policy_id'] ?? null; // 6473; @@ -442,24 +444,24 @@ class HealthIndiaApiController extends BaseController log_message('error', "TPA ID PULL HEALTH_INDIA | called for policy_no: {$policyNo}, client_policy_id: {$client_policy_id}"); // Fetch file download dates - // $batchFiles = $this->db->table('batch_files f') - // ->select("f.created_at") - // ->where('f.client_policy_id', $client_policy_id) - // ->where('f.insurer_or_tpa', 'tpa') - // ->where('f.actions', 'export') - // ->get() - // ->getResultArray(); + $batchFiles = $this->db->table('batch_files f') + ->select("f.created_at") + ->where('f.client_policy_id', $client_policy_id) + ->where('f.insurer_or_tpa', 'tpa') + ->where('f.actions', 'export') + ->get() + ->getResultArray(); - // if (empty($batchFiles)) { - // log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request'); - // if ($function_calling_type == "job") { - // return ['status' => false, 'message' => 'batchFiles not found']; - // } else { - // return $this->respond(['status' => false, 'message' => 'batchFiles not found']); - // } - // } + if (empty($batchFiles)) { + log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request'); + if ($function_calling_type == "job") { + return ['status' => false, 'message' => 'batchFiles not found']; + } else { + return $this->respond(['status' => false, 'message' => 'batchFiles not found']); + } + } // Generate Health India Token $tokenResponse = json_decode($this->generateAuthToken()->getBody(), true); @@ -489,9 +491,9 @@ class HealthIndiaApiController extends BaseController $response = call_third_party_api($url, 'POST', $headers, $body); - dd($response); + // dd($response); - log_message('error', "TPA ID PULL HEALTH_INDIA | API Response: " . json_encode($response)); + log_message('error', "TPA ID PULL HEALTH_INDIA | API Response Received "); if (($response['status'] ?? false) !== true) { log_message('error', 'HEALTH_INDIA API FAILED | response: ' . json_encode($response)); @@ -560,11 +562,22 @@ class HealthIndiaApiController extends BaseController $employeePolicyModel = new EmployeePolicyModel(); - $employeePolicyData = $employeePolicyModel - ->join('employees', 'employees.id = employee_polices.employee_id') - ->where('employee_polices.client_policy_id', $client_policy_id) - ->where('employee_polices.tpa_id IS NULL') - ->findAll(); + $employeePolicyData = $employeePolicyModel + ->select(' + employees.*, + employee_polices.id as emp_policy_id, + employee_polices.client_policy_id, + ') + ->join('employees', 'employees.id = employee_polices.employee_id') + ->where('employee_polices.is_active', 1) + ->where('employee_polices.status', 'active') + ->where('employees.is_active', 1) + ->where('employees.emp_status', 'active') + ->where('employee_polices.tpa_id IS NULL') + ->where('employee_polices.client_policy_id', $client_policy_id) + ->findAll(); + // echo (string) $employeePolicyModel->db->getLastQuery(); + // dd($employeePolicyData); $updated = 0; $batch_file_success = 'success'; @@ -575,10 +588,15 @@ class HealthIndiaApiController extends BaseController foreach ($allMembers as $m) { // Match based on: employee name, employee code, and relation + + if($m['relation'] == 'Employee') { $relation = 'self'; } + else if($m['relation'] == 'WIFE') { $relation = 'spouse'; } + else { $relation = $m['relation']; } + if ( strtolower(trim($policy['name'])) === strtolower(trim($m['insured_Name'] ?? '')) && ($policy['emp_code'] ?? '') == ($m['employeeCode'] ?? '') && - strtolower($policy['relationship']) === strtolower($m['relation'] ?? '') + strtolower($policy['relationship']) === strtolower($relation ?? '') ) { $hasMatchForThisPolicy = true; diff --git a/app/Controllers/ICICILombardController.php b/app/Controllers/ICICILombardController.php index e9cbdf32..4d98bc96 100644 --- a/app/Controllers/ICICILombardController.php +++ b/app/Controllers/ICICILombardController.php @@ -121,29 +121,29 @@ class ICICILombardController extends AdminController $body = [ "PolicyNumber" => "4016/PPN/A/O/53185987/00/000", "CDBGAccountNumber" => "CD-MUM-0026", - "CorrelationId" => "550e8400-e29b-41d4-a716-446655440021", + "CorrelationId" => "550e8400-e29b-41d4-a716-446655440022", "MemberDetails" => [ [ - "MemberEmpId" => "EMPID3625564", + "MemberEmpId" => "EMPID3625565", "DOJ" => "21-MAR-2019", - "InsuredName" => "Jeeva", + "InsuredName" => "sanjeev", "DOB" => "7-JUL-1993", "Relationship" => "SELF", "Gender" => "MALE", - "DOC" => '18-Nov-2025', + "DOC" => '25-Jan-2026', "SumInsured" => "500000", - "EmailId" => "Jeeva@GMAIL.COM", + "EmailId" => "sanjeev@GMAIL.COM", "FlagStatus" => "A" ], [ - "MemberEmpId" => "EMPID3625564", + "MemberEmpId" => "EMPID3625565", "DOJ" => "21-MAR-2019", - "InsuredName" => "Muthu", + "InsuredName" => "bhavya", "DOB" => "8-AUG-1970", "Relationship" => "MOTHER", "Gender" => "FEMALE", - "DOC" => '18-Nov-2025', - "EmailId" => "Muthu@GMAIL.COM", + "DOC" => '25-Jan-2026', + "EmailId" => "bhavya@GMAIL.COM", "FlagStatus" => "A" ], ] @@ -180,8 +180,8 @@ class ICICILombardController extends AdminController $body = [ "PolicyNumber" => "4016/PPN/A/O/53185987/00/000", - "BatchId" => "3727144", - "CorrelationId" => "550e8400-e29b-41d4-a716-446655440021" + "BatchId" => "3728144", + "CorrelationId" => "550e8400-e29b-41d4-a716-446655440022" ]; $response = call_third_party_api($url, 'POST', $headers, $body, true); @@ -215,7 +215,7 @@ class ICICILombardController extends AdminController $body = [ "PolicyNumber" => "4016/PPN/A/O/53185987/00/000", "IMID" => "201580517901", - "CorrelationId" => "550e8400-e29b-41d4-a716-446655440020" + "CorrelationId" => "550e8400-e29b-41d4-a716-446655440022" ]; $response = call_third_party_api($url, 'POST', $headers, $body, true); diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php index d6ae550f..11338171 100755 --- a/app/Controllers/JobWorker.php +++ b/app/Controllers/JobWorker.php @@ -195,6 +195,10 @@ class JobWorker extends AdminController 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\FhplApiController', ], + 'HealthIndiaGetBenefDetails' => [ + 'type' => 'CC', // Handler Category + 'handler' => 'App\Controllers\HealthIndiaApiController', + ], 'bdsDumpExcelFileFormatValidation' => [ 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\PolicyTransactionController', From 1f708e536d4de4c5ef10f4facf914ee15f7468de Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Fri, 13 Feb 2026 17:59:17 +0530 Subject: [PATCH 2/7] GWM : health india integration --- app/Config/Filters.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Config/Filters.php b/app/Config/Filters.php index d96ae232..c9431b94 100755 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -65,7 +65,7 @@ class Filters extends BaseConfig 'before' => [ 'HttpRequestLog' => ['except' => 'cli/*'], 'Cors', - // 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']], + 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','employeeRest/*','processjob','getCommission']], 'SecurityInputFilter' => ['except' => ['/client/notification/create','/ticket/crud_mail_template/*','test_mail','leads/sendMail'] ], 'GlobalPostFileUploadGuard' // 'csrf', From 04cd1328089e1de768f0343374b9f3ad734309a3 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Fri, 13 Feb 2026 18:02:26 +0530 Subject: [PATCH 3/7] GWM : health india -env updated --- .env.sample | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index ceb7085a..49343c62 100755 --- a/.env.sample +++ b/.env.sample @@ -120,4 +120,13 @@ FHPL_USER_NAME = FHPL_PASSWORD = FHPL_GRANT_TYPE = -METABASE_SECRET_KEY= \ No newline at end of file +METABASE_SECRET_KEY= + + +# Health care api details +HEALTH_INDIA_BASE_URL = +HEALTH_INDIA_TOKEN_URL = +HEALTH_INDIA_USERNAME = +HEALTH_INDIA_PASSWORD = + +HEALTH_INDIA_PRIMARY_KEY_CONSTANT = \ No newline at end of file From 69754588d9dc6f09fdc8b3fa60d33a8cf65b3e1a Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 13 Feb 2026 18:08:54 +0530 Subject: [PATCH 4/7] FIX_ISSUE --- app/Controllers/ClientController.php | 9 +++++---- app/Views/client_basic_info.php | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 468e0864..780a56ac 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1036,12 +1036,13 @@ class ClientController extends AdminController // ] // ], 'client_logo' => [ + 'label' => 'Client Logo', 'rules' => 'permit_empty|is_image[client_logo]|max_size[client_logo,200]|ext_in[client_logo,jpg,jpeg,png]|max_dims[client_logo,100,100]', 'errors' => [ - 'is_image' => 'The uploaded file must be an image', - 'max_size' => 'File size should not exceed 200 KB', - 'ext_in' => 'Allowed file types: jpg, jpeg, png', - 'max_dims' => 'Image dimensions must be 100 x 100 pixels', + 'is_image' => 'Please upload a valid image file.', + 'max_size' => 'The logo is too heavy (Max 200KB).', + 'ext_in' => 'Only JPG, JPEG, and PNG files are allowed.', + 'max_dims' => 'The logo must be no larger than 100x100 pixels.', ] ], ]; diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php index b1d2ab8a..055a0e33 100755 --- a/app/Views/client_basic_info.php +++ b/app/Views/client_basic_info.php @@ -221,6 +221,7 @@ input:checked + .slider:before { $(document).ready(function() { $('#client_logo').change(function() { validateFile(this); + return; }); $('#parent_client_id').select2(); }); From 189e89469139e9e7f4b0cafedc181fdf5e9edf31 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Mon, 16 Feb 2026 16:53:00 +0530 Subject: [PATCH 5/7] FIX_Validation Date Of Comm and Expry_Policy and Lead module --- app/Controllers/LeadsController.php | 83 ++++++++++++++++++- .../PolicyTransactionController.php | 42 +++++++++- app/Views/leads_non_eb.php | 30 +++++-- 3 files changed, 145 insertions(+), 10 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index c09b0e43..713c7ecc 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -465,7 +465,7 @@ class LeadsController extends BaseController // print_r($rules); die; - if (isset($data['lead_form_type']) && (int)$data['lead_form_type'] === 2) { + if ((int)$this->request->getPost('lead_form_type') === 2) { $rules['client_type'] = [ 'rules' => 'required', 'errors' => ['required' => 'Client Type is required'] @@ -482,6 +482,51 @@ class LeadsController extends BaseController 'rules' => 'required', 'errors' => ['required' => 'Date of Expiry is required'] ]; + + if ((int)$this->request->getPost('claim_history') === 1) { + $rules['first_year.*'] = [ + 'rules' => 'required|regex_match[/^\d{4}-\d{4}$/]', + 'errors' => ['required' => 'Claim Year is required for all entries.','regex_match' => 'Year must be in format YYYY-YYYY.'] + ]; + $rules['first_policy_type_.*'] = [ + 'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]', + 'errors' => ['required' => 'Policy Type is required in Claim History.', + 'regex_match' => 'Policy Type only letters, numbers, space, hyphens and underscores are allowed' + ] + ]; + $rules['first_date_of_loss_.*'] = [ + 'rules' => 'required|regex_match[/^[0-9]{2}-[0-9]{2}-[0-9]{4}$/]', + 'errors' => ['required' => 'Date of Loss is required.', + 'regex_match' => 'Date of Loss must be inValid format.'] + ]; + $rules['first_cause_of_loss.*'] = [ + 'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]', + 'errors' => [ + 'required' => 'Cause of Loss is required.', + 'regex_match' => 'Cause of Loss only letters, numbers, space, hyphens and underscores are allowed' + ] + ]; + $rules['first_claim_amount.*'] = [ + 'rules' => 'required|numeric', + 'errors' => [ + 'required' => 'Claim Amount is required.', + 'numeric' => 'Claim Amount must be a number.' + ] + ]; + $rules['first_settled_amount.*'] = [ + 'rules' => 'required|numeric', + 'errors' => ['required' => 'Settled Amount is required.', + 'numeric' => 'Settled Amount must be a number.'] + ]; + $rules['first_claim_status.*'] = [ + 'rules' => 'required|alpha_space', + 'errors' => [ + 'required' => 'Claim Status is required.', + 'alpha_space' => 'Claim Status should only contain letters and spaces.' + ] + ]; + } + } // 1. MANUALLY VALIDATE FILES BEFORE PROCESSING @@ -516,7 +561,41 @@ class LeadsController extends BaseController // } // } - if (!$this->validate($rules)) { + + $isValid = $this->validate($rules); + + $start_dates = $this->request->getPost('policy_start_date'); + $end_dates = $this->request->getPost('policy_end_date'); + + if ($start_dates && $end_dates) { + + $starts = is_array($start_dates) ? $start_dates : [$start_dates]; + $ends = is_array($end_dates) ? $end_dates : [$end_dates]; + + foreach ($starts as $index => $s_date) { + $e_date = $ends[$index] ?? null; + + if ($s_date && $e_date) { + + $f_start = change_date_format($s_date, 'd/m/Y', 'Y-m-d'); + $f_end = change_date_format($e_date, 'd/m/Y', 'Y-m-d'); + + if ($f_start && $f_end && ($f_end < $f_start)) { + $isValid = false; + + // Determine the error key name + // If it's an array, we use index (e.g., policy_end_date.0) + $errorKey = is_array($start_dates) ? "policy_end_date.$index" : "policy_end_date"; + + $this->validator->setError($errorKey, 'Date of Expiry cannot be before Date of Commencement.'); + } + } + } + } + + + if (!$isValid) { + return $this->response->setStatusCode(400)->setJSON([ 'status' => false, 'message' => 'Input validation failed', diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 838c646e..e390e00d 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -1052,7 +1052,47 @@ class PolicyTransactionController extends BaseController 'exp_amt.*' => ['label' => 'Expected Amount', 'rules' => 'permit_empty|decimal', 'errors' => ['decimal' => 'The Expected Amount field must contain a valid number.']] ]; - if (!$this->validate($rules)) { + + $isValid = $this->validate($rules); + + // $Date_of_commencement = $this->request->getPost('policy_start_date'); + // $Date_of_expiry = $this->request->getPost('policy_end_date'); + + // if ($Date_of_commencement && $Date_of_expiry && ($Date_of_expiry < $Date_of_commencement)) { + // $this->validator->setError('policy_end_date', '$Date of Commencement and Date of Expiry are mismatched (Date of Expiry cannot be before $Date of Commencement).'); + // $isValid = false; + // } + + $start_dates = $this->request->getPost('policy_start_date'); + $end_dates = $this->request->getPost('policy_end_date'); + + if ($start_dates && $end_dates) { + // Standardize: If it's a single string (Type 2), wrap it in an array + $starts = is_array($start_dates) ? $start_dates : [$start_dates]; + $ends = is_array($end_dates) ? $end_dates : [$end_dates]; + + foreach ($starts as $index => $s_date) { + $e_date = $ends[$index] ?? null; + + if ($s_date && $e_date) { + + $f_start = change_date_format($s_date, 'Y-m-d', 'Y-m-d'); // be carefully here we made so many times mistakes on here + $f_end = change_date_format($e_date, 'Y-m-d', 'Y-m-d');// be carefully here we made so many times mistakes on here + + if ($f_start && $f_end && ($f_end < $f_start)) { + $isValid = false; + + // Determine the error key name + // If it's an array, we use index (e.g., policy_end_date.0) + $errorKey = is_array($start_dates) ? "policy_end_date.$index" : "policy_end_date"; + + $this->validator->setError($errorKey, 'D.O.E(Date of Expiry) cannot be before D.O.C(Date of Commencement).'); + } + } + } + } + + if (!$isValid) { return $this->response->setStatusCode(400)->setJSON([ 'status' => false, 'message' => 'Input validation failed', diff --git a/app/Views/leads_non_eb.php b/app/Views/leads_non_eb.php index 8f5a82f8..6456935a 100644 --- a/app/Views/leads_non_eb.php +++ b/app/Views/leads_non_eb.php @@ -1027,7 +1027,7 @@
- $year"; @@ -1036,27 +1036,27 @@
- +
- +
- +
- +
- +
- +
@@ -1072,6 +1072,16 @@ referenceDiv.insertAdjacentHTML('beforeend', claimsFields); + let isChecked = $("#claim_history").length > 0 ? $("#claim_history").prop("checked") : true; + let lastRow = $(".claim-row").last(); + if (isChecked) { + lastRow.show(); + lastRow.find(".claim-input").attr("required", true); + } else { + lastRow.hide(); + lastRow.find(".claim-input").removeAttr("required"); + } + // Increment claim index increment = increment + 1; @@ -1143,9 +1153,15 @@ // No rows yet, so create them appendThreeYearsClaims(); } + $(".claim-input").attr("required", true); } else { $(".claim-row").hide(); + $(".claim-input").removeAttr("required"); // Required Attributes Remove + $(".claim-input").val(""); // Value Reset + $(".claim-input").each(function() { + $(this).parsley().reset(); // Validation Reset + }); } } From e2325e4ca3be373871295972ed052b336ae50abf Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 17 Feb 2026 10:27:12 +0530 Subject: [PATCH 6/7] FIX_ISSUE_OF_LEAD_REMINDER_DATE --- app/Controllers/LeadsController.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index c09b0e43..ff4aa2cd 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -447,7 +447,14 @@ class LeadsController extends BaseController 'status' => [ 'rules' => 'required', 'errors' => ['required' => 'Status is required'] - ] + ], + 'next_reminder_date' => [ + 'label' => 'Next Reminder Date', + 'rules' => 'permit_empty|valid_date[d/m/Y]', + 'errors' => [ + 'valid_date' => 'The {field} must be in the format DD/MM/YYYY.' + ] + ], ]; foreach ($postData as $key => $value) { @@ -715,9 +722,13 @@ class LeadsController extends BaseController $data['source_policy_end_date'] = null; } - //convert the date - if (!empty($data['next_reminder_date'])) { - $data['next_reminder_date'] = change_date_format($data['next_reminder_date']); + // convert the date + // Clean the input and handle empty strings + $reminderDate = trim($data['next_reminder_date'] ?? ''); + + if ($reminderDate !== '' && $reminderDate != null && $reminderDate != 0) { + $convertedDate = change_date_format($reminderDate); + $data['next_reminder_date'] = $convertedDate ?: null; } else { $data['next_reminder_date'] = null; } From db12c957304144eb005a4bfafd8fae2fdbe58d9c Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 17 Feb 2026 10:36:07 +0530 Subject: [PATCH 7/7] CHANGE_HR_SAMPLE_FILE_DOWNLOAD --- app/Config/Routes.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f659dfb9..0645578c 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -694,6 +694,7 @@ $routes->group("employeeRest", ["filter" => ['GlobalPostFileUploadGuard', 'ratel $routes->get("getPolicyAndEndorsementFiles", "EmployeeRestController::getPolicyAndEndorsementFiles"); $routes->get("downloadPolicyFiles", "EmployeeRestController::downloadPolicyFiles"); $routes->post("bulkEcardDownloadAsZip", "EmployeeRestController::bulkEcardDownloadAsZip"); + $routes->get("downloadSampleExcel/(:any)", "EmployeeController::downloadSampleExcelFile/$1"); }); $routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");