From 528d8dcb267be4d93feb62fb3cf296e38ec742fe Mon Sep 17 00:00:00 2001 From: Venkatesh Date: Sat, 16 May 2026 09:55:02 +0530 Subject: [PATCH] FIX_CLAIM_HISTORY_SHOW_ROLL_OVER --- .../PolicyTransactionController.php | 3 +++ app/Views/leads_form.php | 21 ++++++++++++++++--- app/Views/leads_form_handler.php | 4 +++- app/Views/rfq/gpa.php | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index b0a7cb12..26da53b2 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -5321,6 +5321,8 @@ class PolicyTransactionController extends BaseController try { + $bdsInstallmentData = []; + try { $bdsInstallmentData = $this->BdsPlacementModel->getClientInstallmentDetails(); @@ -5328,6 +5330,7 @@ class PolicyTransactionController extends BaseController $this->myLogger->logme('error', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine()); } + $this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData)); // dd($bdsInstallmentData); diff --git a/app/Views/leads_form.php b/app/Views/leads_form.php index 278fec55..36d930c8 100644 --- a/app/Views/leads_form.php +++ b/app/Views/leads_form.php @@ -1162,7 +1162,7 @@ if (lead_type == 1) { $('.claim-row').hide(); - } else { + } else if (!shouldShowClaimHistorySwitch(lead_type, policy_type_id)) { $('.claim-row').show(); if (policy_type_id == 1) { @@ -1174,6 +1174,10 @@ } } + if ($('#claim_history').length && typeof claimHistoryToggle === 'function') { + claimHistoryToggle(); + } + if (lead_type != 1 && policy_type_id != 1 && policy_type_id != 6 && policy_type_id != 7) { if (lead_type == 1) { updateRenewalFields(dataIncrement); @@ -2188,6 +2192,14 @@ // toggleRequiredFields(); // } + function isClaimHistoryPolicyType(policyTypeId) { + return ['1', '6', '7'].includes(String(policyTypeId)); + } + + function shouldShowClaimHistorySwitch(leadType, policyTypeId) { + return (leadType == 2 || leadType == 3) && isClaimHistoryPolicyType(policyTypeId); + } + function appendThreeYearsClaims(count) { // let count = $('#appendAreaForClaim').data('count'); @@ -2197,7 +2209,7 @@ console.log('policy_type_id', policy_type_id); let lead_type = $('#lead_type').val(); - let showClaimHistorySwitch = lead_type == 2 && (policy_type_id == 1 || policy_type_id == 6 || policy_type_id == 7); + let showClaimHistorySwitch = shouldShowClaimHistorySwitch(lead_type, policy_type_id); console.log('claimIndex from parent', claimIndex); let increment = claimIndex; @@ -2432,7 +2444,6 @@ } else if (value == 3) { $('.btnDiv').hide(); - $('.claim-row').show(); $('.emp_title_text').text('No of Employees at Inception') $('.depnd_title_text').text(' No of Dependents at Inception') @@ -2546,6 +2557,10 @@ } + if ($('#claim_history').length && typeof claimHistoryToggle === 'function') { + claimHistoryToggle(); + } + toggleRequiredFields(); restoreActualLeadGstNumber(); restoreActualLeadContactDetails(); diff --git a/app/Views/leads_form_handler.php b/app/Views/leads_form_handler.php index 426f43fe..0b12c3af 100644 --- a/app/Views/leads_form_handler.php +++ b/app/Views/leads_form_handler.php @@ -851,7 +851,9 @@ if (isset($selected_lead_type)) { if (lead_type == 1 || lead_type == 3) { - $('.claim-row').hide(); + if (lead_type == 1 || !shouldShowClaimHistorySwitch(lead_type, policy_type_id)) { + $('.claim-row').hide(); + } if(!isExistingClient){ $('#exixting_client').prop('checked', false); diff --git a/app/Views/rfq/gpa.php b/app/Views/rfq/gpa.php index 8d29fd05..7fe37fb4 100644 --- a/app/Views/rfq/gpa.php +++ b/app/Views/rfq/gpa.php @@ -45,7 +45,7 @@ $savedClaims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : []; $isClaimHistoryChecked = (isset($lead_edit_data['claim_history']) && (int) $lead_edit_data['claim_history'] === 1) || !empty($savedClaims); $showClaimHistorySwitch = isset($lead_edit_data['lead_type'], $lead_edit_data['policy_type_id']) - && (int) $lead_edit_data['lead_type'] === 2 + && in_array((int) $lead_edit_data['lead_type'], [2, 3], true) && in_array((int) $lead_edit_data['policy_type_id'], [1, 6, 7], true); ?>