From 45c20b5ffb23a0077f82b1d82268c93c2a013b03 Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 8 Apr 2026 12:58:17 +0530 Subject: [PATCH 1/4] FIX_NONEB_FILE_ASSINGERS_ISSUE --- app/Controllers/LeadsController.php | 53 ++++++++++--------- ...non_eb_claim_api.md => non_eb_claim_api.md | 0 {dev_logs => public/dev_logs}/2026-04-01.md | 0 ...-06_inception_form_live_validation_plan.md | 0 4 files changed, 27 insertions(+), 26 deletions(-) rename dev_logs/non_eb_claim_api.md => non_eb_claim_api.md (100%) rename {dev_logs => public/dev_logs}/2026-04-01.md (100%) rename {dev_logs => public/dev_logs}/2026-04-06_inception_form_live_validation_plan.md (100%) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 9384b60d..bf3de0c8 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -5393,31 +5393,32 @@ class LeadsController extends BaseController $this->myLogger->logme('error', "QCR Sheet: copied from RFQ sheet | lead_id={$leadId}, rfq_sheet_id={$rfqSheetId}, new_sheet_id={$newSheetId}"); // Apply permissions: sales team as editors - $salesTeam = $this->userModel - ->select('user_profiles.email') - ->join('user_teams', 'user_profiles.id = user_teams.user_id') - ->where('user_teams.team_id', 5) - ->where('user_teams.is_active', 1) - ->where('user_profiles.is_active', 1) - ->findAll(); - $editorEmails = array_values(array_filter(array_unique(array_column($salesTeam, 'email')))); + // $salesTeam = $this->userModel + // ->select('user_profiles.email') + // ->join('user_teams', 'user_profiles.id = user_teams.user_id') + // ->where('user_teams.team_id', 5) + // ->where('user_teams.is_active', 1) + // ->where('user_profiles.is_active', 1) + // ->findAll(); + // $editorEmails = array_values(array_filter(array_unique(array_column($salesTeam, 'email')))); // Decode rfq_qcr_viewers from lead and add as viewers - $viewerEmails = []; + $editorEmails = []; if (! empty($lead['rfq_qcr_viewers'])) { $decoded = json_decode($lead['rfq_qcr_viewers'], true); if (is_array($decoded)) { - $viewerEmails = array_values(array_filter(array_unique($decoded))); + $editorEmails = array_values(array_filter(array_unique($decoded))); } } - if (! empty($editorEmails) || ! empty($viewerEmails)) { + // !dd($editorEmails); + if (! empty($editorEmails)) { try { $sheetLib->applyPermissions($newSheetId, [ 'editors' => $editorEmails, - 'viewers' => $viewerEmails, + // 'viewers' => $viewerEmails, ]); - $this->myLogger->logme('error', "QCR Sheet: permissions applied | sheet_id={$newSheetId}, editors=" . count($editorEmails) . ", viewers=" . count($viewerEmails)); + $this->myLogger->logme('error', "QCR Sheet: permissions applied | sheet_id={$newSheetId}, editors=" . count($editorEmails)); } catch (\Throwable $e) { $this->myLogger->logme('error', "QCR Sheet: failed to apply permissions | sheet_id={$newSheetId}, error=" . $e->getMessage()); } @@ -5634,30 +5635,30 @@ class LeadsController extends BaseController $this->myLogger->logme('error', "Placement Sheet: copied from QCR | lead_id={$leadId}, qcr_sheet_id={$qcrSheetId}, placement_sheet_id={$placementSheetId}"); // Apply same permissions as QCR (editors: sales team, viewers: rfq_qcr_viewers) - $salesTeam = $this->userModel - ->select('user_profiles.email') - ->join('user_teams', 'user_profiles.id = user_teams.user_id') - ->where('user_teams.team_id', 5) - ->where('user_teams.is_active', 1) - ->where('user_profiles.is_active', 1) - ->findAll(); - $editorEmails = array_values(array_filter(array_unique(array_column($salesTeam, 'email')))); + // $salesTeam = $this->userModel + // ->select('user_profiles.email') + // ->join('user_teams', 'user_profiles.id = user_teams.user_id') + // ->where('user_teams.team_id', 5) + // ->where('user_teams.is_active', 1) + // ->where('user_profiles.is_active', 1) + // ->findAll(); + // $editorEmails = array_values(array_filter(array_unique(array_column($salesTeam, 'email')))); - $viewerEmails = []; + $editorEmails = []; if (! empty($lead_data['rfq_qcr_viewers'])) { $decoded = json_decode($lead_data['rfq_qcr_viewers'], true); if (is_array($decoded)) { - $viewerEmails = array_values(array_filter(array_unique($decoded))); + $editorEmails = array_values(array_filter(array_unique($decoded))); } } - if (! empty($editorEmails) || ! empty($viewerEmails)) { + if (! empty($editorEmails) ) { try { $sheetLib->applyPermissions($placementSheetId, [ 'editors' => $editorEmails, - 'viewers' => $viewerEmails, + // 'viewers' => $viewerEmails, ]); - $this->myLogger->logme('error', "Placement Sheet: permissions applied | sheet_id={$placementSheetId}, editors=" . count($editorEmails) . ", viewers=" . count($viewerEmails)); + $this->myLogger->logme('error', "Placement Sheet: permissions applied | sheet_id={$placementSheetId}, editors=" . count($editorEmails)); } catch (\Throwable $e) { $this->myLogger->logme('error', "Placement Sheet: failed to apply permissions | sheet_id={$placementSheetId}, error=" . $e->getMessage()); } diff --git a/dev_logs/non_eb_claim_api.md b/non_eb_claim_api.md similarity index 100% rename from dev_logs/non_eb_claim_api.md rename to non_eb_claim_api.md diff --git a/dev_logs/2026-04-01.md b/public/dev_logs/2026-04-01.md similarity index 100% rename from dev_logs/2026-04-01.md rename to public/dev_logs/2026-04-01.md diff --git a/dev_logs/2026-04-06_inception_form_live_validation_plan.md b/public/dev_logs/2026-04-06_inception_form_live_validation_plan.md similarity index 100% rename from dev_logs/2026-04-06_inception_form_live_validation_plan.md rename to public/dev_logs/2026-04-06_inception_form_live_validation_plan.md From 38e218f585032a223c885600f4c69d626d672b58 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 8 Apr 2026 17:26:30 +0530 Subject: [PATCH 2/4] FIX_RFQ_PLACEMENT_NOT_SENT_ISSUE --- app/Controllers/LeadsController.php | 72 ++++++++++++++++++----------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index fd5ab968..7a8636e7 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -2126,6 +2126,7 @@ class LeadsController extends BaseController $data = $this->convertJsonForQCR($data, $type); } // dd($data); + $lead_data = []; if ($rfq_data['lead_type'] == 1) { if (in_array($rfq_data['policy_type_id'], [2, 3, 4, 5])) { @@ -2152,6 +2153,12 @@ class LeadsController extends BaseController // 'TPA' => $rfq_data['tpa_name'] ?? " - ", 'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "", ]; + }else { + + $lead_data = [ + 'Insured' => $rfq_data['client_name'], + 'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "" + ]; } } else { @@ -2239,6 +2246,11 @@ class LeadsController extends BaseController // 'TPA' => $rfq_data['tpa_name'] ?? " - ", // 'Total Lives at Inception' => $rfq_data['total_lives_at_incept'], ]; + } else { + $lead_data = [ + 'Insured' => $rfq_data['client_name'], + 'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "" + ]; } } // print_r($lead_data); die; @@ -2274,39 +2286,43 @@ class LeadsController extends BaseController $maxWidthA = 0; $maxWidthB = 0; - foreach ($lead_data as $key => $value) { + // dd($lead_data); - // Merge A:B for key and C:D for value - $mergeRangeKey = "A{$rowNumber}:B{$rowNumber}"; - // $mergeRangeValue = "C{$rowNumber}"; - $sheet->mergeCells($mergeRangeKey); - // $sheet->mergeCells($mergeRangeValue); + if(! empty($lead_data)) { + foreach ($lead_data as $key => $value) { - // Set values in merged cells - $sheet->setCellValue("A{$rowNumber}", $key); - $sheet->setCellValue("C{$rowNumber}", $value); + // Merge A:B for key and C:D for value + $mergeRangeKey = "A{$rowNumber}:B{$rowNumber}"; + // $mergeRangeValue = "C{$rowNumber}"; + $sheet->mergeCells($mergeRangeKey); + // $sheet->mergeCells($mergeRangeValue); - // // Apply styles for alignment and bold text in A:B - // $sheet->getStyle($mergeRangeKey)->applyFromArray([ - // 'font' => ['bold' => true], - // 'alignment' => [ - // 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, - // 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, - // ], - // ]); + // Set values in merged cells + $sheet->setCellValue("A{$rowNumber}", $key); + $sheet->setCellValue("C{$rowNumber}", $value); - // Apply bold style to B column if the key is "Insured" - if ($key == "Insured") { - $sheet->getStyle("C{$rowNumber}")->applyFromArray([ - 'font' => ['bold' => true], - ]); + // // Apply styles for alignment and bold text in A:B + // $sheet->getStyle($mergeRangeKey)->applyFromArray([ + // 'font' => ['bold' => true], + // 'alignment' => [ + // 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, + // 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, + // ], + // ]); + + // Apply bold style to B column if the key is "Insured" + if ($key == "Insured") { + $sheet->getStyle("C{$rowNumber}")->applyFromArray([ + 'font' => ['bold' => true], + ]); + } + + // Track max width needed for columns + $maxWidthA = max($maxWidthA, mb_strlen($key)); + $maxWidthB = max($maxWidthB, mb_strlen($value)); + + $rowNumber++; } - - // Track max width needed for columns - $maxWidthA = max($maxWidthA, mb_strlen($key)); - $maxWidthB = max($maxWidthB, mb_strlen($value)); - - $rowNumber++; } // Set column width based on max content length (adjusted for padding) From 3149cc29d221bc1ce8809873649563b18e805d96 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 8 Apr 2026 17:35:50 +0530 Subject: [PATCH 3/4] FIX_ISSUE_EMPLOYEE_SUCCESS_UPDATE --- app/Controllers/EmployeeServiceController.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 0864c3c2..0ade2eb7 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1457,17 +1457,17 @@ class EmployeeServiceController extends AdminController // } } - // if ($employee_insert_count > 0) { - // $this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update(); - // $this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]); - // } else { - // $reason = json_encode([ - // 'error_summary' => [5 => 1], - // 'error_data' => "Rack rate configuration issue: Please check the slab rates configuration" - // ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); - // $this->fileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => $reason])->update(); - // $this->myLogger->logme("error", '{file_id} uploaded failed with reason: Rack rate configuration issue: Please check the slab rates configuration', ['file_id' => $file_id]); - // } + if ($employee_insert_count > 0) { + $this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update(); + $this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]); + } else { + $reason = json_encode([ + 'error_summary' => [5 => 1], + 'error_data' => "Rack rate configuration issue: Please check the slab rates configuration" + ], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); + $this->fileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => $reason])->update(); + $this->myLogger->logme("error", '{file_id} uploaded failed with reason: Rack rate configuration issue: Please check the slab rates configuration', ['file_id' => $file_id]); + } // $this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'success')); } else if (isset($params['client_policy_id'])) //handle data from enrollment to inception From bdde7bfe82fc119ce36193c68b3cb8aed738b2d9 Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Wed, 8 Apr 2026 18:19:19 +0530 Subject: [PATCH 4/4] FIX_EMPLYEE_INSERT_ISSUE --- app/Controllers/EmployeeServiceController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Controllers/EmployeeServiceController.php b/app/Controllers/EmployeeServiceController.php index 0ade2eb7..d49e6609 100755 --- a/app/Controllers/EmployeeServiceController.php +++ b/app/Controllers/EmployeeServiceController.php @@ -1450,11 +1450,11 @@ class EmployeeServiceController extends AdminController $data = calculate_premium_new(family_data: $family, policy_terms: $policy_terms, slab_details: $slab_details, fileArr: $file, existing_units: $existing_units); // dd($data); $employee_data_group_by_family[$emp_id] = $data; - // $res = $this->employeesOnboardProcess(['familiy_data' => $data, 'file' => $file]); + $res = $this->employeesOnboardProcess(['familiy_data' => $data, 'file' => $file]); - // if ($res > 0) { - // $employee_insert_count++; - // } + if ($res > 0) { + $employee_insert_count++; + } } if ($employee_insert_count > 0) {