MERGE_LIVE_FIXES

This commit is contained in:
Ubuntu 2026-05-16 10:21:52 +05:30
commit b665a4ee4f
5 changed files with 89 additions and 67 deletions

View File

@ -571,69 +571,71 @@ class LeadsController extends BaseController
} }
// $leadFormType = (int) ($postData['lead_form_type'] ?? 1); $leadFormType = (int) ($postData['lead_form_type'] ?? 1);
// $postedPolicyTypeIds = array_map('intval', (array) ($postData['policy_type_id'] ?? [])); $postedPolicyTypeIds = array_map('intval', (array) ($postData['policy_type_id'] ?? []));
// $isEbRenewalGpaClaimHistory = $leadFormType === 1 $claimHistoryPolicyTypes = [1, 6, 7];
// && (int) ($postData['lead_type'] ?? 0) === 2 $hasClaimHistoryPolicy = count(array_intersect($postedPolicyTypeIds, $claimHistoryPolicyTypes)) > 0;
// && in_array(1, $postedPolicyTypeIds, true) $isEbClaimHistory = $leadFormType === 1
// && (int) ($postData['claim_history'] ?? 0) === 1; && in_array((int) ($postData['lead_type'] ?? 0), [2, 3], true)
&& $hasClaimHistoryPolicy
&& (int) ($postData['claim_history'] ?? 0) === 1;
// if ($isEbRenewalGpaClaimHistory) { if ($isEbClaimHistory) {
// $rules['first_year.*'] = [ $rules['first_year.*'] = [
// 'rules' => 'required|regex_match[/^\d{4}-\d{4}$/]', 'rules' => 'required|regex_match[/^\d{4}-\d{4}$/]',
// 'errors' => [ 'errors' => [
// 'required' => 'Claim Year is required for all entries.', 'required' => 'Claim Year is required for all entries.',
// 'regex_match' => 'Year must be in format YYYY-YYYY.', 'regex_match' => 'Year must be in format YYYY-YYYY.',
// ], ],
// ]; ];
// $rules['emp_id.*'] = [ $rules['emp_id.*'] = [
// 'rules' => 'required', 'rules' => 'required',
// 'errors' => ['required' => 'Employee ID is required in Claim History.'], 'errors' => ['required' => 'Employee ID is required in Claim History.'],
// ]; ];
// $rules['emp_name.*'] = [ $rules['emp_name.*'] = [
// 'rules' => 'required', 'rules' => 'required',
// 'errors' => ['required' => 'Employee Name is required in Claim History.'], 'errors' => ['required' => 'Employee Name is required in Claim History.'],
// ]; ];
// $rules['gender.*'] = [ $rules['gender.*'] = [
// 'rules' => 'required|in_list[Female,Male]', 'rules' => 'required|in_list[Female,Male]',
// 'errors' => [ 'errors' => [
// 'required' => 'Gender is required in Claim History.', 'required' => 'Gender is required in Claim History.',
// 'in_list' => 'Gender must be Female or Male.', 'in_list' => 'Gender must be Female or Male.',
// ], ],
// ]; ];
// $rules['designation.*'] = [ $rules['designation.*'] = [
// 'rules' => 'required', 'rules' => 'required',
// 'errors' => ['required' => 'Designation is required in Claim History.'], 'errors' => ['required' => 'Designation is required in Claim History.'],
// ]; ];
// $rules['sum_insured.*'] = [ $rules['sum_insured.*'] = [
// 'rules' => 'required|numeric', 'rules' => 'required|numeric',
// 'errors' => [ 'errors' => [
// 'required' => 'Sum Insured is required in Claim History.', 'required' => 'Sum Insured is required in Claim History.',
// 'numeric' => 'Sum Insured must be a number.', 'numeric' => 'Sum Insured must be a number.',
// ], ],
// ]; ];
// $rules['first_death_date.*'] = [ $rules['first_death_date.*'] = [
// 'rules' => 'required|regex_match[/^[0-9]{2}-([0-9]{2}|[A-Za-z]{3})-[0-9]{4}$/]', 'rules' => 'required|regex_match[/^[0-9]{2}-([0-9]{2}|[A-Za-z]{3})-[0-9]{4}$/]',
// 'errors' => [ 'errors' => [
// 'required' => 'Date of Death is required.', 'required' => 'Date of Death is required.',
// 'regex_match' => 'Date of Death must be in DD-MM-YYYY or DD-MMM-YYYY format.', 'regex_match' => 'Date of Death must be in DD-MM-YYYY or DD-MMM-YYYY format.',
// ], ],
// ]; ];
// $rules['first_cause_of_death.*'] = [ $rules['first_cause_of_death.*'] = [
// 'rules' => 'required|in_list[natural_death,suicide,accident,cardiac_arrest,septic_shock,heart_attack]', 'rules' => 'required|in_list[natural_death,suicide,accident,cardiac_arrest,septic_shock,heart_attack]',
// 'errors' => [ 'errors' => [
// 'required' => 'Nature/Cause Of Death is required.', 'required' => 'Nature/Cause Of Death is required.',
// 'in_list' => 'Nature/Cause Of Death is invalid.', 'in_list' => 'Nature/Cause Of Death is invalid.',
// ], ],
// ]; ];
// $rules['first_claim_amount.*'] = [ $rules['first_claim_amount.*'] = [
// 'rules' => 'required|numeric', 'rules' => 'required|numeric',
// 'errors' => [ 'errors' => [
// 'required' => 'Claim/Settled Amount is required.', 'required' => 'Claim/Settled Amount is required.',
// 'numeric' => 'Claim/Settled Amount must be a number.', 'numeric' => 'Claim/Settled Amount must be a number.',
// ], ],
// ]; ];
// } }
// 1. MANUALLY VALIDATE FILES BEFORE PROCESSING // 1. MANUALLY VALIDATE FILES BEFORE PROCESSING
// $allFiles = $this->request->getFiles(); // $allFiles = $this->request->getFiles();

View File

@ -5321,6 +5321,8 @@ class PolicyTransactionController extends BaseController
try { try {
$bdsInstallmentData = [];
try { try {
$bdsInstallmentData = $this->BdsPlacementModel->getClientInstallmentDetails(); $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', 'Exception: ' . $e->getMessage() . 'Page: ' . $e->getFile() . ' Line: ' . $e->getLine());
} }
$this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData)); $this->myLogger->logme("error", "Data for BDS Installment " . json_encode($bdsInstallmentData));
// dd($bdsInstallmentData); // dd($bdsInstallmentData);

View File

@ -1162,7 +1162,7 @@
if (lead_type == 1) { if (lead_type == 1) {
$('.claim-row').hide(); $('.claim-row').hide();
} else { } else if (!shouldShowClaimHistorySwitch(lead_type, policy_type_id)) {
$('.claim-row').show(); $('.claim-row').show();
if (policy_type_id == 1) { 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 && policy_type_id != 1 && policy_type_id != 6 && policy_type_id != 7) {
if (lead_type == 1) { if (lead_type == 1) {
updateRenewalFields(dataIncrement); updateRenewalFields(dataIncrement);
@ -2188,6 +2192,14 @@
// toggleRequiredFields(); // 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) { function appendThreeYearsClaims(count) {
// let count = $('#appendAreaForClaim').data('count'); // let count = $('#appendAreaForClaim').data('count');
@ -2197,7 +2209,7 @@
console.log('policy_type_id', policy_type_id); console.log('policy_type_id', policy_type_id);
let lead_type = $('#lead_type').val(); 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); console.log('claimIndex from parent', claimIndex);
let increment = claimIndex; let increment = claimIndex;
@ -2432,7 +2444,6 @@
} else if (value == 3) { } else if (value == 3) {
$('.btnDiv').hide(); $('.btnDiv').hide();
$('.claim-row').show();
$('.emp_title_text').text('No of Employees at Inception') $('.emp_title_text').text('No of Employees at Inception')
$('.depnd_title_text').text(' No of Dependents at Inception') $('.depnd_title_text').text(' No of Dependents at Inception')
@ -2546,6 +2557,10 @@
} }
if ($('#claim_history').length && typeof claimHistoryToggle === 'function') {
claimHistoryToggle();
}
toggleRequiredFields(); toggleRequiredFields();
restoreActualLeadGstNumber(); restoreActualLeadGstNumber();
restoreActualLeadContactDetails(); restoreActualLeadContactDetails();

View File

@ -851,7 +851,9 @@ if (isset($selected_lead_type)) {
if (lead_type == 1 || lead_type == 3) { if (lead_type == 1 || lead_type == 3) {
if (lead_type == 1 || !shouldShowClaimHistorySwitch(lead_type, policy_type_id)) {
$('.claim-row').hide(); $('.claim-row').hide();
}
if(!isExistingClient){ if(!isExistingClient){
$('#exixting_client').prop('checked', false); $('#exixting_client').prop('checked', false);

View File

@ -45,7 +45,7 @@
$savedClaims = !empty($lead_edit_data['fin_years_claims_array']) ? $lead_edit_data['fin_years_claims_array'] : []; $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); $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']) $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); && in_array((int) $lead_edit_data['policy_type_id'], [1, 6, 7], true);
?> ?>
<?php if ($showClaimHistorySwitch) { ?> <?php if ($showClaimHistorySwitch) { ?>