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