From d98b8c86b33a50b311df3babe4dd0c81e45b5a64 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Mon, 25 May 2026 15:26:03 +0530 Subject: [PATCH 1/8] FEAT_VISIT_ONBOARD_RESET --- app/Config/Routes.php | 1 + app/Controllers/ClientController.php | 2 + app/Controllers/EmployeeController.php | 64 +++++- app/Controllers/TicketController.php | 2 +- app/Models/UserModel.php | 2 + app/Views/employee_data_list.php | 6 + app/Views/employee_list.php | 258 ++++++++++++++++--------- 7 files changed, 235 insertions(+), 100 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 55fa525f..4b2155c4 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -49,6 +49,7 @@ $routes->get("updatajson", "EmpDataServiceController::updatajson"); $routes->get("view", "EmployeeController::viewECard/$1"); $routes->get("checkWellnessOnboardStatus/(:any)", "EmployeeController::checkWellnessOnboardStatus/$1"); $routes->get("initiateWellnessOnboard/(:any)", "EmployeeController::initiateWellnessOnboard/$1"); +$routes->get("resetWellnessOnboard/(:any)", "EmployeeController::resetWellnessOnboard/$1"); $routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1"); $routes->get("testMailAttachments", "ClientController::testMailAttachments"); $routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey"); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index d14c8de7..56087644 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -7312,6 +7312,8 @@ class ClientController extends AdminController // dd($res); $employeeController = new EmployeeController(); + // $payload = json_decode('{"client_policy_id":"6272"}', true); + // $response = $employeeController->initiateWellnessOnboardJob($payload); dd($response); // $response = $employeeController->getEmployeeEcardFromTmpFolderAndZipToS3(json_decode('{"batch_no":2,"last_emp_policy_id":"13218","folder_name":"bulk_ecards_IOCL-77448855996699885555_2026-02-05_09-32-22","processed_in_this_batch_data_count":7,"pdf_count":0,"hr_id":"1"}', true)); // $response = $employeeController->bulkEcardDownloadAsZipFromS3(json_decode('{"client_policy_id":"6066","hr_id":"1"}', true)); // dd($response); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 4722727d..1c806014 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -896,7 +896,7 @@ class EmployeeController extends AdminController session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.'); return redirect()->to(base_url('employee/upload')); } else { - session()->setFlashdata($return['status'], $return['message']); + session()->setFlashdata($return['status'] ?? 'error', $return['message'] ?? 'Something went wrong! Try Later'); return redirect()->to(base_url('employee/upload')); } } else if ($event_type == 'correction') { @@ -3622,7 +3622,22 @@ class EmployeeController extends AdminController public function checkWellnessOnboardStatus($client_policy_id) - { + { + + + $fetch_onboarded_employees = $this->request->getGet('fetch_onboarded_employees') ?? false; + + if($fetch_onboarded_employees){ + $data = $this->employeePolicyModel->select('employee_polices.*') + ->where('employee_polices.is_active', 1) + ->where('employee_polices.status', 'active') + ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('employee_polices.wellness_onboard !=', '0') + ->findAll(); + return $this->respond(['status' => true, 'code' => 200, 'data' => count($data)], 200); + } + + // echo $client_policy_id;die(); $data = $this->employeePolicyModel->select('employee_polices.*,emp.name,emp.relationship,emp.emp_code,emp.name,emp.email_corporate,emp.mobile,emp.dob,cp.policy_no,cp.wellness_plan_id,cp.wellness_vendor_id,cp.policy_start_date as cp_policy_start_date,cp.policy_end_date,cls.short_name') ->join('client_policy cp', 'cp.id = employee_polices.client_policy_id') @@ -3656,9 +3671,9 @@ class EmployeeController extends AdminController // return $this->respond(['status' => true, 'code' => 200, 'message' => 'Inception and Member data comparision skiped successfully!'], 200); } - public function initiateWellnessOnboard($client_policy_id) + public function initiateWellnessOnboard($client_policy_id, $emp_code = null) { - $r = Jobs::addJob(['job_name' => 'initiateWellnessOnboardJob','payload' => ['client_policy_id' => $client_policy_id]]); + $r = Jobs::addJob(['job_name' => 'initiateWellnessOnboardJob','payload' => ['client_policy_id' => $client_policy_id, 'emp_code' => $emp_code ?? null ]]); // $this->initiateWellnessOnboardJob(['client_policy_id' => $client_policy_id]); return $this->respond(['status' => true, 'code' => 200, 'message' => 'Process started'], 200); } @@ -3774,6 +3789,7 @@ class EmployeeController extends AdminController public function initiateWellnessOnboardJob($arr) { $client_policy_id = $arr['client_policy_id'] ?? null; + $emp_code = $arr['emp_code'] ?? null; if (!$client_policy_id) { log_message('error', '[WellnessOnboard] Missing client_policy_id in payload'); @@ -3789,7 +3805,7 @@ class EmployeeController extends AdminController // ---------------------------------------------------------------- // 1. FETCH DATA // ---------------------------------------------------------------- - $data = $this->employeePolicyModel + $query = $this->employeePolicyModel ->select('employee_polices.*, emp.name, emp.relationship, emp.emp_code, emp.email_corporate, emp.mobile, emp.dob, emp.gender, @@ -3817,8 +3833,13 @@ class EmployeeController extends AdminController ->orWhere('cp.wellness_vendor_id =', 0) ->groupEnd() ->where('cp.policy_status', 1) - ->where('cp.is_active', 1) - ->findAll($perPage, $offset); + ->where('cp.is_active', 1); + + if(!empty($emp_code)){ + $query->where('emp.emp_code', trim($emp_code)); + } + + $data = $query->findAll($perPage, $offset); // ---------------------------------------------------------------- // 2. NO DATA FOUND @@ -3852,7 +3873,7 @@ class EmployeeController extends AdminController foreach ($families as $empCode => $members) { $familiesPayload[$empCode] = $this->buildFamilyPayload($empCode, $members); } - log_message('error', "[WellnessOnboard] Page {$page} API calls done. Families processed: " . json_encode($familiesPayload)); + log_message('error', "[WellnessOnboard] Page {$page} API calls done. Families processed: " . json_encode($familiesPayload)); // ---------------------------------------------------------------- // 5. SEND TO WELLNESS API // ---------------------------------------------------------------- @@ -3885,6 +3906,33 @@ class EmployeeController extends AdminController return true; } + public function resetWellnessOnboard($client_policy_id, $emp_code = null) + { + if(!empty($emp_code)){ + + $employees = db_connect()->table('employees') + ->select('id') + ->where('emp_code', trim($emp_code)) + ->get() + ->getResult(); + + if (!empty($employees)) { + $employeeIds = array_column($employees, 'id'); + + $this->employeePolicyModel + ->where('client_policy_id', $client_policy_id) + ->whereIn('employee_id', $employeeIds) + ->set('wellness_onboard', '0') + ->update(); + } + + } else { + $this->employeePolicyModel->where('client_policy_id', $client_policy_id)->set('wellness_onboard', '0')->update(); + } + + return $this->respond(['status' => true, 'code' => 200, 'message' => 'Wellness onboard resetted successfully'], 200); + } + # ------------------ FUNCTION TO BUILD FAMILY PAYLOAD ------------------ diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 4e219a4a..ed1fdc15 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -3560,7 +3560,7 @@ class TicketController extends BaseController { $fileId = $this->claimFilesModel->insert([ 'ticket_id' => $ticketId, - 'ticket_type' => $ticketTypeId, + // 'ticket_type' => $ticketTypeId, 'file_type' => 3, 'doc_name' => $docName, 'file_name' => $uploadedFile['file_name'], diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index 32272925..a73d35ef 100755 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -133,6 +133,7 @@ class UserModel extends Model ->select('user_profiles.*') ->select('roles.role as user_role') ->join('roles', 'roles.id = user_profiles.role') + ->where('user_profiles.is_active', 1) ->get() ->getResultArray(); } @@ -143,6 +144,7 @@ class UserModel extends Model ->select('roles.role as user_role') ->join('roles', 'roles.id = user_profiles.role') ->join('user_teams', 'user_teams.user_id = user_profiles.id') + ->where('user_profiles.is_active', 1) ->get() ->getResultArray(); diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 9097d532..bc7408b2 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -361,6 +361,12 @@ $gst_total = 0; Re-Generate E-Card + + Initiate Wellness Onboard + + Reset Wellness Onboard + + diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php index a03e40e4..cb3e0ea8 100755 --- a/app/Views/employee_list.php +++ b/app/Views/employee_list.php @@ -81,7 +81,7 @@

-
@@ -90,7 +90,7 @@
- + @@ -981,7 +983,7 @@
- + @@ -4139,7 +4141,7 @@ function appendInput(data) {
- + @@ -4205,10 +4207,11 @@ function appendInput(data) {
// - // $year";} ?> + // $year";} ?> // //
//
@@ -2187,7 +2187,7 @@ // // //
// //
@@ -2245,7 +2245,7 @@ } function getClaimHistoryLabel(leadType) { - return String(leadType) === '1' ? 'Mortality Claims' : 'Claims History'; + return String(leadType) === '1' ? 'Mortality Experience' : 'Claims Experience'; } function shouldShowClaimHistorySwitch(leadType, policyTypeId) { @@ -2304,7 +2304,7 @@ @@ -2361,7 +2361,7 @@ @@ -2381,7 +2381,7 @@ diff --git a/app/Views/leads_non_eb.php b/app/Views/leads_non_eb.php index d13ecb49..dd046a61 100644 --- a/app/Views/leads_non_eb.php +++ b/app/Views/leads_non_eb.php @@ -400,7 +400,7 @@ var pageBackButton = ' @@ -906,11 +906,11 @@ var pageBackButton = '" class="topbar-icon diff --git a/app/Views/rfq/claims_details_non_eb.php b/app/Views/rfq/claims_details_non_eb.php index 3141be9b..8eb69793 100644 --- a/app/Views/rfq/claims_details_non_eb.php +++ b/app/Views/rfq/claims_details_non_eb.php @@ -16,7 +16,7 @@ : [['year' => '', 'claim_amount' => '', 'status' => '', 'policy_type' => '', 'date_of_loss' => '', 'cause_of_loss' => '']]; $leadType = (int) ($lead_edit_data['lead_type'] ?? 0); $showClaimsSection = in_array($leadType, [1, 2, 3], true); - $claimHistoryLabel = $leadType === 1 ? 'Mortality Claims' : 'Claims History'; + $claimHistoryLabel = $leadType === 1 ? 'Mortality Experience' : 'Claims Experience'; ?>
diff --git a/app/Views/rfq/gpa.php b/app/Views/rfq/gpa.php index 21029eaa..d0979b55 100644 --- a/app/Views/rfq/gpa.php +++ b/app/Views/rfq/gpa.php @@ -64,8 +64,8 @@ && in_array((int) $lead_edit_data['lead_type'], [1, 2, 3], true) && in_array((int) $lead_edit_data['policy_type_id'], [1, 6, 7], true); $claimHistoryLabel = (isset($lead_edit_data['lead_type']) && (int) $lead_edit_data['lead_type'] === 1) - ? 'Mortality Claims' - : 'Claims History'; + ? 'Mortality Experience' + : 'Claims Experience'; ?>
From 49c5881ebab3f461a68ea87316f5fb32a326f755 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Fri, 29 May 2026 14:01:29 +0530 Subject: [PATCH 6/8] CHANGE_DATE_FORMATE_ALL_PLACE --- app/Controllers/ClientController.php | 2 +- app/Views/batch_list.php | 4 +- app/Views/bds_dump_file_list.php | 2 +- app/Views/cd_master_add_modal.php | 45 ++++++++++- app/Views/cd_master_list.php | 8 +- app/Views/claim_dump_file_list.php | 4 +- app/Views/client_policy.php | 111 +++++++++++++++++++------- app/Views/commission_file_upload.php | 2 +- app/Views/expense_list.php | 2 +- app/Views/file_list.php | 4 +- app/Views/hr_file_upload.php | 2 +- app/Views/non_eb_claim_list.php | 2 +- app/Views/report_bds.php | 26 +++--- app/Views/retail_endorsement_list.php | 2 +- app/Views/test_members_list.php | 2 +- app/Views/thz_list.php | 4 +- app/Views/ticket_reports.php | 2 +- 17 files changed, 160 insertions(+), 64 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 56087644..7a3a89a1 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -6652,7 +6652,7 @@ class ClientController extends AdminController // Check in Enrollment (client_policy) $client_policy_data = $this->clientPolicyModel ->where('is_active', 1) - ->where('policy_status', 1) + // ->where('policy_status', 1) ->where('TRIM(policy_no)', $policy_no) ->first(); diff --git a/app/Views/batch_list.php b/app/Views/batch_list.php index 5ebdebc5..61d395e7 100755 --- a/app/Views/batch_list.php +++ b/app/Views/batch_list.php @@ -34,7 +34,7 @@ if (!empty($batch_list) && is_array($batch_list)) { $countStr = ($file['count'] ?? null) === null ? '-' : (string) $file['count']; $batch_col_max_len[9] = max($batch_col_max_len[9], mb_strlen($countStr)); $batch_col_max_len[10] = max($batch_col_max_len[10], mb_strlen((string) format_indian_number($file['amount']))); - $userTime = change_date_format($file['created_at'] ?? '', 'Y-m-d H:i:s', 'd M Y h:i a') + $userTime = change_date_format($file['created_at'] ?? '', 'Y-m-d H:i:s', 'd/m/Y h:i a') . ' by ' . get_username($file['created_by'] ?? ''); $batch_col_max_len[11] = max($batch_col_max_len[11], mb_strlen($userTime)); @@ -350,7 +350,7 @@ for ($i = 0; $i < $batch_col_count; $i++) { - by + by diff --git a/app/Views/bds_dump_file_list.php b/app/Views/bds_dump_file_list.php index b56448fa..2ea6207a 100644 --- a/app/Views/bds_dump_file_list.php +++ b/app/Views/bds_dump_file_list.php @@ -49,7 +49,7 @@ - ' . $file['user_name'] . '' ?> + ' . $file['user_name'] . '' ?> diff --git a/app/Views/cd_master_add_modal.php b/app/Views/cd_master_add_modal.php index e73b807f..29597a75 100644 --- a/app/Views/cd_master_add_modal.php +++ b/app/Views/cd_master_add_modal.php @@ -107,13 +107,50 @@ var isCdMasterPage = ; console.log("isCdMasterPage", isCdMasterPage); + function formatCdOpeningDateForInput(inputDate) { + if (!inputDate || String(inputDate).trim() === '') { + return ''; + } + var str = String(inputDate).trim(); + var iso = str.match(/^(\d{4})-(\d{2})-(\d{2})/); + if (iso) { + return iso[3] + '/' + iso[2] + '/' + iso[1]; + } + var dmy = str.match(/^(\d{1,2})[-\/](\d{1,2})[-\/](\d{4})$/); + if (dmy) { + var day = ('0' + dmy[1]).slice(-2); + var month = ('0' + dmy[2]).slice(-2); + return day + '/' + month + '/' + dmy[3]; + } + return str; + } + + function cdOpeningDateForSubmit(inputDate) { + var formatted = formatCdOpeningDateForInput(inputDate); + if (!formatted) { + return inputDate || ''; + } + var parts = formatted.split('/'); + return parts[0] + '-' + parts[1] + '-' + parts[2]; + } + + var openingDatePicker; + $(document).ready(function(){ - var openingDatePicker = flatpickr("#opening_date", { - dateFormat: "d-m-Y", + openingDatePicker = flatpickr("#opening_date", { + dateFormat: "d/m/Y", allowInput: false }); + $('#con-close-modal').on('shown.bs.modal', function() { + var val = $('#opening_date').val(); + if (val) { + var formatted = formatCdOpeningDateForInput(val); + openingDatePicker.setDate(formatted, false); + } + }); + if(isCdMasterPage == true){ $('#cd_client_id').select2(); $('#insurer_id_for_cd').select2(); @@ -172,6 +209,10 @@ } let formData = new FormData($('#CDMasterForm')[0]); + var openingDate = formData.get('opening_date'); + if (openingDate) { + formData.set('opening_date', cdOpeningDateForSubmit(openingDate)); + } console.log("formData", formData); let url = ''; diff --git a/app/Views/cd_master_list.php b/app/Views/cd_master_list.php index 1314066a..1bd8dc4e 100755 --- a/app/Views/cd_master_list.php +++ b/app/Views/cd_master_list.php @@ -15,12 +15,12 @@ foreach ($CD_Master_Data as $index => $row) { $cdm_col_max_len[1] = max($cdm_col_max_len[1], mb_strlen($clientCell)); $cdm_col_max_len[2] = max($cdm_col_max_len[2], mb_strlen((string) ($row['insurer_name'] ?? ''))); $cdm_col_max_len[3] = max($cdm_col_max_len[3], mb_strlen((string) ($row['insurer_branch_name'] ?? ''))); - $od = ! empty($row['opening_date']) ? date('d-m-Y', strtotime((string) $row['opening_date'])) : ''; + $od = ! empty($row['opening_date']) ? date('d/m/Y', strtotime((string) $row['opening_date'])) : ''; $cdm_col_max_len[4] = max($cdm_col_max_len[4], mb_strlen($od)); $cdm_col_max_len[5] = max($cdm_col_max_len[5], mb_strlen((string) ($row['cd_ac_no'] ?? ''))); $cdm_col_max_len[6] = max($cdm_col_max_len[6], mb_strlen((string) ($row['opening_bal'] ?? ''))); $du = ! empty($row['created_at']) - ? (date('d-M-Y h:i A', strtotime((string) $row['created_at'])) . ' by ' . ($row['user_name'] ?? '')) + ? (date('d/m/Y h:i A', strtotime((string) $row['created_at'])) . ' by ' . ($row['user_name'] ?? '')) : ''; $cdm_col_max_len[7] = max($cdm_col_max_len[7], mb_strlen($du)); $cdm_col_max_len[8] = max($cdm_col_max_len[8], 4); @@ -118,10 +118,10 @@ $cdm_col_width_px = nhance_dt_column_widths_px($cdm_header_labels, $cdm_col_max_ ( ) - + -
by +
by