CHANGE_RFQ_MODULE : RV
This commit is contained in:
parent
c07be07f3d
commit
fb1cfe3286
@ -1354,6 +1354,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$employee_data = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($ref_data, 1);
|
$employee_data = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($ref_data, 1);
|
||||||
|
|
||||||
|
// dd($employee_data, $excel_data);
|
||||||
// ->select('
|
// ->select('
|
||||||
|
|
||||||
// employee_polices.id as emp_policy_id,
|
// employee_polices.id as emp_policy_id,
|
||||||
@ -1475,17 +1476,22 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($insurer_or_tpa == 'tpa') {
|
if ($insurer_or_tpa == 'tpa') {
|
||||||
|
|
||||||
if ($excel_data[$key][13] === null) {
|
if ($excel_data[$key][13] === null) {
|
||||||
$missing_id[$key][] = [
|
$missing_id[$key][] = [
|
||||||
'row' => $key,
|
'row' => $key,
|
||||||
'column' => 15,
|
'column' => 13,
|
||||||
|
'db_data' => "TPA ID is Must",
|
||||||
|
'excel_data' => $excel_data[$key][13]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} else if ($insurer_or_tpa == 'insurer') {
|
} else if ($insurer_or_tpa == 'insurer') {
|
||||||
if ($excel_data[$key][14] === null) {
|
if ($excel_data[$key][14] === null) {
|
||||||
$missing_id[$key][] = [
|
$missing_id[$key][] = [
|
||||||
'row' => $key,
|
'row' => $key,
|
||||||
'column' => 16,
|
'column' => 14,
|
||||||
|
'db_data' => "UHID or Risk ID is Must",
|
||||||
|
'excel_data' => $excel_data[$key][14]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1591,6 +1597,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($emp_value['gst'] != $excel_data[$key][16]) {
|
if ($emp_value['gst'] != $excel_data[$key][16]) {
|
||||||
|
|
||||||
$errors[$key][] = [
|
$errors[$key][] = [
|
||||||
'row' => $key,
|
'row' => $key,
|
||||||
'column' => 16,
|
'column' => 16,
|
||||||
@ -1632,7 +1639,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$missing_id_count = count($missing_id);
|
$missing_id_count = count($missing_id);
|
||||||
$json_missing_id = json_encode($missing_id);
|
$json_missing_id = json_encode($missing_id);
|
||||||
|
|
||||||
// dd($error_count, $missing_id_count, $json_errors, $json_missing_id);
|
// dd($error_count, $missing_id_count, $json_errors, $json_missing_id, $employee_data, $excel_data);
|
||||||
|
|
||||||
if ($missing_id_count > 0) {
|
if ($missing_id_count > 0) {
|
||||||
|
|
||||||
|
|||||||
@ -194,11 +194,9 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
foreach($data['policy_type_id'] as $index => $value){
|
foreach($data['policy_type_id'] as $index => $value){
|
||||||
|
|
||||||
|
|
||||||
// Separate the insurer and insurer branch, handle missing or invalid data
|
// Separate the insurer and insurer branch, handle missing or invalid data
|
||||||
if (isset($data['insurer'][$index]) && strpos($data['insurer'][$index], '-') !== false) {
|
if (isset($data['insurer'][$index]) && strpos($data['insurer'][$index], '-') !== false) {
|
||||||
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer'][$index]);
|
list($insurer_branch_id, $insurer_id) = explode('-', $data['insurer'][$index]);
|
||||||
} else {
|
|
||||||
$insurer_branch_id = 0;
|
$insurer_branch_id = 0;
|
||||||
$insurer_id = 0;
|
$insurer_id = 0;
|
||||||
}
|
}
|
||||||
@ -210,7 +208,6 @@ class LeadsController extends BaseController
|
|||||||
$tpa_id = 0;
|
$tpa_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Separate the insurer and insurer branch, handle missing or invalid data
|
// Separate the insurer and insurer branch, handle missing or invalid data
|
||||||
if (isset($data['proposed_insurer'][$index]) && strpos($data['proposed_insurer'][$index], '-') !== false) {
|
if (isset($data['proposed_insurer'][$index]) && strpos($data['proposed_insurer'][$index], '-') !== false) {
|
||||||
list($proposed_insurer_branch_id, $proposed_insurer_id) = explode('-', $data['proposed_insurer'][$index]);
|
list($proposed_insurer_branch_id, $proposed_insurer_id) = explode('-', $data['proposed_insurer'][$index]);
|
||||||
@ -252,6 +249,11 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$file_name = file_Upload($files[$index], $uploadFilePath);
|
$file_name = file_Upload($files[$index], $uploadFilePath);
|
||||||
|
|
||||||
|
$last_3_years_claims = null;
|
||||||
|
if($value != 2){
|
||||||
|
$last_3_years_claims = $data['finyear'];
|
||||||
|
}
|
||||||
|
|
||||||
$processedData[] = [
|
$processedData[] = [
|
||||||
'lead_type' => $data['lead_type'],
|
'lead_type' => $data['lead_type'],
|
||||||
@ -308,6 +310,9 @@ class LeadsController extends BaseController
|
|||||||
'annualised_claims' => $data['annualised_claims'][$index] ?? 0,
|
'annualised_claims' => $data['annualised_claims'][$index] ?? 0,
|
||||||
'incurred_claims_ratio' => $data['incurred_claims_ratio'][$index] ?? 0,
|
'incurred_claims_ratio' => $data['incurred_claims_ratio'][$index] ?? 0,
|
||||||
'earned_claims_ratio' => $data['earned_claims_ratio'][$index] ?? 0,
|
'earned_claims_ratio' => $data['earned_claims_ratio'][$index] ?? 0,
|
||||||
|
'total_si_at_incept' => $data['total_si_at_incept'][$index] ?? 0,
|
||||||
|
'total_si_at_renewal' => $data['total_si_at_renewal'][$index] ?? 0,
|
||||||
|
'fin_years_claims' => $last_3_years_claims,
|
||||||
|
|
||||||
'file_name' => $file_name,
|
'file_name' => $file_name,
|
||||||
|
|
||||||
@ -573,48 +578,71 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
if($rfq_data['lead_type'] == 1){
|
if($rfq_data['lead_type'] == 1){
|
||||||
|
|
||||||
$lead_data = [
|
if($rfq_data['policy_type_id'] == 2){
|
||||||
|
$lead_data = [
|
||||||
|
|
||||||
'Insured' => $rfq_data['client_name'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
'Policy Status' => $rfq_data['status'],
|
'Policy Status' => $rfq_data['status'],
|
||||||
|
|
||||||
'No of Employees' => $rfq_data['incept_emp_count'],
|
'No of Employees' => $rfq_data['incept_emp_count'],
|
||||||
'No of Dependents' => $rfq_data['incept_dept_count'],
|
'No of Dependents' => $rfq_data['incept_dept_count'],
|
||||||
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
||||||
|
|
||||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||||
];
|
];
|
||||||
|
}else if($rfq_data['policy_type_id'] == 1){
|
||||||
|
$lead_data = [
|
||||||
|
'Insured' => $rfq_data['client_name'],
|
||||||
|
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||||
|
'Total Sum Insured at Inception ' => $rfq_data['total_si_at_incept'],
|
||||||
|
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||||
|
'Policy Status' => $rfq_data['status'],
|
||||||
|
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||||
|
'TPA ' => $rfq_data['tpa_name'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
if($rfq_data['policy_type_id'] == 2){
|
||||||
|
$lead_data = [
|
||||||
|
|
||||||
$lead_data = [
|
'Insured' => $rfq_data['client_name'],
|
||||||
|
'Policy Status' => $rfq_data['status'],
|
||||||
|
|
||||||
'Insured' => $rfq_data['client_name'],
|
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
||||||
'Policy Status' => $rfq_data['status'],
|
'No of Dependents at Inception' => $rfq_data['incept_dept_count'],
|
||||||
|
'Total Lives at Inception ' => $rfq_data['incept_no_of_lives'],
|
||||||
|
|
||||||
'No of Employees at Inception' => $rfq_data['incept_emp_count'],
|
'No of Employees at Expiry' => $rfq_data['exp_emp_count'],
|
||||||
'No of Dependents at Inception' => $rfq_data['incept_dept_count'],
|
'No of Dependents at Expiry' => $rfq_data['exp_dept_count'],
|
||||||
'Total Lives at Inception ' => $rfq_data['incept_no_of_lives'],
|
'Total Lives at Expiry ' => $rfq_data['exp_no_of_lives'],
|
||||||
|
|
||||||
'No of Employees at Expiry' => $rfq_data['exp_emp_count'],
|
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||||
'No of Dependents at Expiry' => $rfq_data['exp_dept_count'],
|
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
||||||
'Total Lives at Expiry ' => $rfq_data['exp_no_of_lives'],
|
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
||||||
|
|
||||||
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||||
'No of Dependents at Renewal' => $rfq_data['renewal_dept_count'],
|
'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||||
'Total Lives at Renewal ' => $rfq_data['renewal_no_of_lives'],
|
'Inception Premium' => $rfq_data['premium_at_inception'],
|
||||||
|
'Premium as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['premium_date'],
|
||||||
'Period of Insurance ' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
'Earned Premium' => $rfq_data['earned_premium'],
|
||||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
'Incurred Claims as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['incurred_claims_date'],
|
||||||
'Inception Premium' => $rfq_data['premium_at_inception'],
|
'Annualised Claims' => $rfq_data['annualised_claims'],
|
||||||
'Premium as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['premium_date'],
|
'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'],
|
||||||
'Earned Premium' => $rfq_data['earned_premium'],
|
'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'],
|
||||||
'Incurred Claims as on (Date - DD MM YYYY should be entered based on the claims dump report)' => $rfq_data['incurred_claims_date'],
|
];
|
||||||
'Annualised Claims' => $rfq_data['annualised_claims'],
|
}else if($rfq_data['policy_type_id'] == 1){
|
||||||
'Incurred Claims Ratio' => $rfq_data['incurred_claims_ratio'],
|
$lead_data = [
|
||||||
'Earned Claims Ratio' => $rfq_data['earned_claims_ratio'],
|
'Insured' => $rfq_data['client_name'],
|
||||||
];
|
'No of Employees at Renewal' => $rfq_data['renewal_emp_count'],
|
||||||
|
'Total Sum Insured at Renewal ' => $rfq_data['total_si_at_renewal'],
|
||||||
|
'Policy Period' => date('d/m/Y', strtotime($rfq_data['policy_start_date'])).' to '. date('d/m/Y', strtotime($rfq_data['policy_end_date'])),
|
||||||
|
'Policy Status' => $rfq_data['status'],
|
||||||
|
'Existing Insurer' => $rfq_data['insurer_name'],
|
||||||
|
'TPA ' => $rfq_data['tpa_name'],
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = json_decode($rfq_data['json'], true);
|
$data = json_decode($rfq_data['json'], true);
|
||||||
|
|||||||
@ -80,6 +80,10 @@ class LeadsModel extends Model
|
|||||||
'premium_amount',
|
'premium_amount',
|
||||||
'total_amount',
|
'total_amount',
|
||||||
'cd_amount',
|
'cd_amount',
|
||||||
|
|
||||||
|
'total_si_at_incept',
|
||||||
|
'total_si_at_renewal',
|
||||||
|
'fin_years_claims',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -384,7 +384,7 @@ function getLeadsDataForEdit(input) {
|
|||||||
$('#contact_person_name').val(res.data.contact_person_name);
|
$('#contact_person_name').val(res.data.contact_person_name);
|
||||||
$('#contact_person_mobile').val(res.data.contact_person_mobile);
|
$('#contact_person_mobile').val(res.data.contact_person_mobile);
|
||||||
$('#contact_person_email').val(res.data.contact_person_email);
|
$('#contact_person_email').val(res.data.contact_person_email);
|
||||||
|
$('#policy_type_id_1').val(res.data.policy_type_id).change();
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000)
|
}, 1000)
|
||||||
@ -397,7 +397,6 @@ function getLeadsDataForEdit(input) {
|
|||||||
var proposed_insurer = res.data.proposed_insurer_branch_id + '-' + res.data.proposed_insurer_id;
|
var proposed_insurer = res.data.proposed_insurer_branch_id + '-' + res.data.proposed_insurer_id;
|
||||||
var proposed_tpa = res.data.proposed_tpa_branch_id + '-' + res.data.proposed_tpa_id;
|
var proposed_tpa = res.data.proposed_tpa_branch_id + '-' + res.data.proposed_tpa_id;
|
||||||
|
|
||||||
$('#policy_type_id_1').val(res.data.policy_type_id).change();
|
|
||||||
$('#insurer_1').val(insurer).select2();
|
$('#insurer_1').val(insurer).select2();
|
||||||
$('#tpa_1').val(tpa).select2();
|
$('#tpa_1').val(tpa).select2();
|
||||||
$('#proposed_insurer_1').val(proposed_insurer).select2();
|
$('#proposed_insurer_1').val(proposed_insurer).select2();
|
||||||
@ -433,6 +432,9 @@ function getLeadsDataForEdit(input) {
|
|||||||
$('#file_name_display').text('Upload File Name : ' + res.data.file_name);
|
$('#file_name_display').text('Upload File Name : ' + res.data.file_name);
|
||||||
// $('#file_name').val(res.data.file_name);
|
// $('#file_name').val(res.data.file_name);
|
||||||
|
|
||||||
|
$('#total_si_at_incept_' + increment).val(res.data.total_si_at_incept);
|
||||||
|
$('#total_si_at_renewal_' + increment).val(res.data.total_si_at_renewal);
|
||||||
|
|
||||||
|
|
||||||
if (res.data.salse_person_id) {
|
if (res.data.salse_person_id) {
|
||||||
selecSalsePerson(res.data.salse_person_id);
|
selecSalsePerson(res.data.salse_person_id);
|
||||||
@ -477,6 +479,33 @@ function getLeadsDataForEdit(input) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(res.data.policy_type_id != 2){
|
||||||
|
|
||||||
|
$('.gpa_hide_div_'+increment).hide();
|
||||||
|
$('.gpa_show_div_'+increment).show();
|
||||||
|
$('.gpa_div_elements_'+increment).show();
|
||||||
|
$('.emp_title').text('No of Employees at Inception');
|
||||||
|
|
||||||
|
let claimExperience = JSON.parse(res.data.fin_years_claims);
|
||||||
|
|
||||||
|
claimExperience[0].finyear.forEach((data, index) => {
|
||||||
|
const year = document.querySelector(`#${["first", "second", "third"][index]}_year_${increment}`);
|
||||||
|
const claimAmount = document.querySelector(`#${["first", "second", "third"][index]}_claim_amount_${increment}`);
|
||||||
|
const claimStatus = document.querySelector(`#${["first", "second", "third"][index]}_claim_status_${increment}`);
|
||||||
|
const causeOfDeath = document.querySelector(`#${["first", "second", "third"][index]}_casue_of_death_${increment}`);
|
||||||
|
const deathDate = document.querySelector(`#${["first", "second", "third"][index]}_death_date_${increment}`);
|
||||||
|
|
||||||
|
if (year) year.value = data.year;
|
||||||
|
if (claimAmount) claimAmount.value = data.claim_amount;
|
||||||
|
if (claimStatus) claimStatus.value = data.status;
|
||||||
|
if (causeOfDeath) causeOfDeath.value = data.cause_of_death;
|
||||||
|
if (deathDate) deathDate.value = data.death_date;
|
||||||
|
});
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$('.gpa_hide_div_'+increment).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log('No data found');
|
console.log('No data found');
|
||||||
@ -625,7 +654,6 @@ function getPolicyData(client_policy_id, increment_count) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Salse team user list data
|
// Salse team user list data
|
||||||
function selecSalsePerson(salse_person_ids) {
|
function selecSalsePerson(salse_person_ids) {
|
||||||
|
|
||||||
@ -671,6 +699,22 @@ function addHTMLInput(check) {
|
|||||||
const newRow8 = document.createElement('div');
|
const newRow8 = document.createElement('div');
|
||||||
newRow8.className = 'form-row dynamic-form-row';
|
newRow8.className = 'form-row dynamic-form-row';
|
||||||
|
|
||||||
|
const newRow6 = document.createElement('div');
|
||||||
|
newRow6.className = `form-row dynamic-form-row gpa_div_elements_${increment}`;
|
||||||
|
newRow6.style.display = 'none';
|
||||||
|
|
||||||
|
const newRow9 = document.createElement('div');
|
||||||
|
newRow9.className = `form-row dynamic-form-row gpa_div_elements_${increment}`;
|
||||||
|
newRow9.style.display = 'none';
|
||||||
|
|
||||||
|
const newRow10 = document.createElement('div');
|
||||||
|
newRow10.className = `form-row dynamic-form-row gpa_div_elements_${increment}`;
|
||||||
|
newRow10.style.display = 'none';
|
||||||
|
|
||||||
|
const newRow11 = document.createElement('div');
|
||||||
|
newRow11.className = `form-row dynamic-form-row gpa_div_elements_${increment}`;
|
||||||
|
newRow11.style.display = 'none';
|
||||||
|
|
||||||
// Add an <hr> element
|
// Add an <hr> element
|
||||||
const hrElement = document.createElement('hr');
|
const hrElement = document.createElement('hr');
|
||||||
container.appendChild(hrElement);
|
container.appendChild(hrElement);
|
||||||
@ -680,7 +724,7 @@ function addHTMLInput(check) {
|
|||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3">
|
||||||
<label for="policy_type_id">Policy Type <span class="text-danger">*</span></label>
|
<label for="policy_type_id">Policy Type <span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="policy_type_id_${increment}" name="policy_type_id[]" required>
|
<select class="form-control" id="policy_type_id_${increment}" name="policy_type_id[]" onchange="showGpaColumns(this)" required>
|
||||||
<option value="">Select Policy Type</option>
|
<option value="">Select Policy Type</option>
|
||||||
<?php
|
<?php
|
||||||
if (isset($policy_type) && count($policy_type)) {
|
if (isset($policy_type) && count($policy_type)) {
|
||||||
@ -834,15 +878,20 @@ function addHTMLInput(check) {
|
|||||||
<input type="text" class="form-control" id="renewal_emp_count_${increment}" name="renewal_emp_count[]" placeholder="Enter Lives" >
|
<input type="text" class="form-control" id="renewal_emp_count_${increment}" name="renewal_emp_count[]" placeholder="Enter Lives" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3 gpa_hide_div_${increment}" style="display:none;">
|
||||||
<label for="renewal_dept_count_${increment}"> No of Dependents at Renewal <span class="text-danger">*</span></label>
|
<label for="renewal_dept_count_${increment}"> No of Dependents at Renewal <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="renewal_dept_count_${increment}" name="renewal_dept_count[]" placeholder="Enter Lives" >
|
<input type="text" class="form-control" id="renewal_dept_count_${increment}" name="renewal_dept_count[]" placeholder="Enter Lives" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3 gpa_hide_div_${increment}" style="display:none;">
|
||||||
<label for="renewal_no_of_lives_${increment}"> Total Lives at Renewal <span class="text-danger">*</span></label>
|
<label for="renewal_no_of_lives_${increment}"> Total Lives at Renewal <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="renewal_no_of_lives_${increment}" name="renewal_no_of_lives[]" placeholder="Enter Lives" >
|
<input type="text" class="form-control" id="renewal_no_of_lives_${increment}" name="renewal_no_of_lives[]" placeholder="Enter Lives" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3 gpa_show_div_${increment}" style="display:none;">
|
||||||
|
<label for="total_si_at_renewal_${increment}"> Total Sum Insured at Renewal <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="total_si_at_renewal_${increment}" name="total_si_at_renewal[]" placeholder="Enter Lives" >
|
||||||
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
//inception div
|
//inception div
|
||||||
@ -853,15 +902,20 @@ function addHTMLInput(check) {
|
|||||||
<input type="text" class="form-control" id="incept_emp_count_${increment}" name="incept_emp_count[]" placeholder="Enter Lives" >
|
<input type="text" class="form-control" id="incept_emp_count_${increment}" name="incept_emp_count[]" placeholder="Enter Lives" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3 gpa_hide_div_${increment}" style="display:none;">
|
||||||
<label for="incept_dept_count_${increment}" class="depnd_title"> No of Dependents at Inception <span class="text-danger">*</span></label>
|
<label for="incept_dept_count_${increment}" class="depnd_title"> No of Dependents at Inception <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="incept_dept_count_${increment}" name="incept_dept_count[]" placeholder="Enter Lives" >
|
<input type="text" class="form-control" id="incept_dept_count_${increment}" name="incept_dept_count[]" placeholder="Enter Lives" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-3">
|
<div class="form-group col-md-3 gpa_hide_div_${increment}" style="display:none;">
|
||||||
<label for="incept_no_of_lives_${increment}" class="total_title"> Total Lives at Inception <span class="text-danger">*</span></label>
|
<label for="incept_no_of_lives_${increment}" class="total_title"> Total Lives at Inception <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="incept_no_of_lives_${increment}" name="incept_no_of_lives[]" placeholder="Enter Lives" >
|
<input type="text" class="form-control" id="incept_no_of_lives_${increment}" name="incept_no_of_lives[]" placeholder="Enter Lives" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-3 gpa_show_div_${increment}" style="display:none;">
|
||||||
|
<label for="total_si_at_incept_${increment}" class="total_title"> Total Sum Insured at Inception <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="total_si_at_incept_${increment}" name="total_si_at_incept[]" placeholder="Enter Lives" >
|
||||||
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
//expiry div
|
//expiry div
|
||||||
@ -893,9 +947,86 @@ function addHTMLInput(check) {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
newRow9.innerHTML +=`<div class="form-group col-md-3"><h5>Claims Experience for last 3 Years </h5></div>`;
|
||||||
|
|
||||||
|
//Last 3 years claims expirence div
|
||||||
|
newRow6.innerHTML += `
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="first_year_${increment}" name="first_year[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="first_claim_amount_${increment}">Claim Amount / Settled Amount<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="first_casue_of_death_${increment}">Nature / Casue Of Death <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="first_casue_of_death_${increment}" name="first_casue_of_death[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="first_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="first_death_date_${increment}" name="first_death_date[]">
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
//Last 3 years claims expirence div
|
||||||
|
newRow10.innerHTML += `
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="second_year_${increment}">Year<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="second_year_${increment}" name="second_year[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="second_claim_amount_${increment}">Claim Amount / Settled Amount<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="second_claim_amount_${increment}" name="second_claim_amount[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="second_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="second_claim_status_${increment}" name="second_claim_status[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="second_casue_of_death_${increment}">Nature / Casue Of Death <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="second_casue_of_death_${increment}" name="second_casue_of_death[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="second_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="second_death_date_${increment}" name="second_death_date[]">
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
//Last 3 years claims expirence div
|
||||||
|
newRow11.innerHTML += `
|
||||||
|
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="third_year_${increment}">Year<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="third_year_${increment}" name="third_year[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="third_claim_amount_${increment}">Claim Amount / Settled Amount<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="third_claim_amount_${increment}" name="third_claim_amount[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="third_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="third_claim_status_${increment}" name="third_claim_status[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="third_casue_of_death_${increment}">Nature / Casue Of Death <span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="third_casue_of_death_${increment}" name="third_casue_of_death[]">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="third_death_date_${increment}">Date of Death<span class="text-danger">*</span></label>
|
||||||
|
<input type="text" class="form-control" id="third_death_date_${increment}" name="third_death_date[]">
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
//button div
|
//button div
|
||||||
newRow5.innerHTML += `
|
newRow5.innerHTML += `
|
||||||
|
|
||||||
<div class="form-group col-md-12 btnDiv" style="position: relative;top: 28px;float: right;text-align: end;">
|
<div class="form-group col-md-12 btnDiv" style="position: relative;top: 28px;float: right;text-align: end;">
|
||||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(1)">+</a>
|
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(1)">+</a>
|
||||||
@ -903,25 +1034,44 @@ function addHTMLInput(check) {
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
container.appendChild(newRow);
|
container.appendChild(newRow);
|
||||||
container.appendChild(newRow8);
|
container.appendChild(newRow8);
|
||||||
|
|
||||||
const hrElement2 = document.createElement('hr');
|
const hrElement2 = document.createElement('hr');
|
||||||
container.appendChild(hrElement2);
|
container.appendChild(hrElement2);
|
||||||
|
|
||||||
|
//inception div
|
||||||
container.appendChild(newRow3);
|
container.appendChild(newRow3);
|
||||||
|
|
||||||
|
//renewal div
|
||||||
container.appendChild(newRow2);
|
container.appendChild(newRow2);
|
||||||
|
|
||||||
|
//expiry div
|
||||||
container.appendChild(newRow4);
|
container.appendChild(newRow4);
|
||||||
|
|
||||||
|
const hrElement3 = document.createElement('hr');
|
||||||
|
hrElement3.className = "gpa_div_elements"; // Set class to hrElement3
|
||||||
|
container.appendChild(hrElement3); // Append hrElement3 to container
|
||||||
|
|
||||||
|
|
||||||
|
container.appendChild(newRow9);
|
||||||
|
|
||||||
|
//Last 3 years claims expirence div
|
||||||
|
container.appendChild(newRow6);
|
||||||
|
container.appendChild(newRow10);
|
||||||
|
container.appendChild(newRow11);
|
||||||
|
|
||||||
|
//file upload div
|
||||||
container.appendChild(newRow7);
|
container.appendChild(newRow7);
|
||||||
|
|
||||||
|
//button div
|
||||||
container.appendChild(newRow5);
|
container.appendChild(newRow5);
|
||||||
|
|
||||||
|
|
||||||
var lead_type = $('#lead_type').val();
|
var lead_type = $('#lead_type').val();
|
||||||
|
|
||||||
if (lead_type == 2) {
|
if (lead_type == 2) {
|
||||||
|
|
||||||
// $('.proposed_div').show().find('select, input').attr('required', 'required');
|
// $('.proposed_div').show().find('select, input').attr('required', 'required');
|
||||||
$('.proposed_div').show();
|
$('.proposed_div').show();
|
||||||
$('.freashDiv').show()
|
$('.freashDiv').show()
|
||||||
@ -930,11 +1080,13 @@ function addHTMLInput(check) {
|
|||||||
$('.emp_title').text('No of Employees at Inception')
|
$('.emp_title').text('No of Employees at Inception')
|
||||||
$('.depnd_title').text(' No of Dependents at Inception')
|
$('.depnd_title').text(' No of Dependents at Inception')
|
||||||
$('.total_title').text('Total Lives at Inception')
|
$('.total_title').text('Total Lives at Inception')
|
||||||
|
$('.gpa_div_elements').show();
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// $('.proposed_div').hide().find('select, input').removeAttr('required');
|
// $('.proposed_div').hide().find('select, input').removeAttr('required');
|
||||||
$('.proposed_div').hide()
|
$('.proposed_div').hide()
|
||||||
|
$('.gpa_div_elements').hide();
|
||||||
|
|
||||||
if(lead_type == 1){
|
if(lead_type == 1){
|
||||||
$('.freashDiv').hide()
|
$('.freashDiv').hide()
|
||||||
@ -948,6 +1100,7 @@ function addHTMLInput(check) {
|
|||||||
$('.emp_title').text('No of Employees at Inception')
|
$('.emp_title').text('No of Employees at Inception')
|
||||||
$('.depnd_title').text(' No of Dependents at Inception')
|
$('.depnd_title').text(' No of Dependents at Inception')
|
||||||
$('.total_title').text('Total Lives at Inception')
|
$('.total_title').text('Total Lives at Inception')
|
||||||
|
$('.gpa_div_elements').show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1040,8 +1193,7 @@ function addHTMLInput(check) {
|
|||||||
increment++; // Increment after adding the input
|
increment++; // Increment after adding the input
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeHTMLInput(element)
|
function removeHTMLInput(element) {
|
||||||
{
|
|
||||||
const container = document.getElementById('dynamic-form-container');
|
const container = document.getElementById('dynamic-form-container');
|
||||||
const rows = container.querySelectorAll('.dynamic-form-row');
|
const rows = container.querySelectorAll('.dynamic-form-row');
|
||||||
|
|
||||||
@ -1129,7 +1281,6 @@ function incurredClaimSum(input) {
|
|||||||
$('#earned_claims_ratio_' + increment).val(earned_claims_ratio);
|
$('#earned_claims_ratio_' + increment).val(earned_claims_ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function earnedPremiumCalc(input) {
|
function earnedPremiumCalc(input) {
|
||||||
|
|
||||||
let increment = input.id.split('_').pop(); // Extract the increment part
|
let increment = input.id.split('_').pop(); // Extract the increment part
|
||||||
@ -1150,7 +1301,6 @@ function earnedPremiumCalc(input) {
|
|||||||
$('#earned_premium_' + increment).val(earned_premium.toFixed(2));
|
$('#earned_premium_' + increment).val(earned_premium.toFixed(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
$("#leads_form_id").submit(function(event) {
|
$("#leads_form_id").submit(function(event) {
|
||||||
@ -1187,6 +1337,11 @@ $("#leads_form_id").submit(function(event) {
|
|||||||
// Append the JSON string to the FormData object
|
// Append the JSON string to the FormData object
|
||||||
formData.append('salse_person_id', jsonString);
|
formData.append('salse_person_id', jsonString);
|
||||||
|
|
||||||
|
// Convert the claim experience array to JSON
|
||||||
|
const finyearJsonString = gatherClaimExperienceData();
|
||||||
|
console.log('finyearJsonString', finyearJsonString);
|
||||||
|
formData.append('finyear', finyearJsonString);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
url: form_action,
|
url: form_action,
|
||||||
@ -1239,6 +1394,7 @@ $('#lead_type').change(function() {
|
|||||||
$('#freshDiv').hide();
|
$('#freshDiv').hide();
|
||||||
$('.freashDiv').show()
|
$('.freashDiv').show()
|
||||||
$('.renewalDiv').hide()
|
$('.renewalDiv').hide()
|
||||||
|
$('.gpa_div_elements').show();
|
||||||
|
|
||||||
$('#gst').val('');
|
$('#gst').val('');
|
||||||
$('#pan').val('');
|
$('#pan').val('');
|
||||||
@ -1280,6 +1436,8 @@ $('#lead_type').change(function() {
|
|||||||
$('.emp_title').text('No of Employees')
|
$('.emp_title').text('No of Employees')
|
||||||
$('.depnd_title').text('No of Dependents')
|
$('.depnd_title').text('No of Dependents')
|
||||||
$('.total_title').text('Total Lives')
|
$('.total_title').text('Total Lives')
|
||||||
|
$('.gpa_div_elements').show();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
$('.freashDiv').show()
|
$('.freashDiv').show()
|
||||||
$('.renewalDiv').hide()
|
$('.renewalDiv').hide()
|
||||||
@ -1287,6 +1445,7 @@ $('#lead_type').change(function() {
|
|||||||
$('.emp_title').text('No of Employees at Inception')
|
$('.emp_title').text('No of Employees at Inception')
|
||||||
$('.depnd_title').text(' No of Dependents at Inception')
|
$('.depnd_title').text(' No of Dependents at Inception')
|
||||||
$('.total_title').text('Total Lives at Inception')
|
$('.total_title').text('Total Lives at Inception')
|
||||||
|
$('.gpa_div_elements').show();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1315,6 +1474,79 @@ function tpaChange(input, unique_id) {
|
|||||||
|
|
||||||
function sumOfLives(input){
|
function sumOfLives(input){
|
||||||
|
|
||||||
|
}
|
||||||
|
function gatherClaimExperienceData() {
|
||||||
|
// Initialize an empty array for the claim experience data
|
||||||
|
let claimExperience = [];
|
||||||
|
|
||||||
|
// Loop through the rows and extract data for each year
|
||||||
|
$('input[name="first_year[]"]').each(function(index) {
|
||||||
|
// Extract values for the first, second, and third year claims
|
||||||
|
const firstYear = $(this).val();
|
||||||
|
const firstClaimAmount = $(`input[name="first_claim_amount[]"]`).eq(index).val();
|
||||||
|
const firstClaimStatus = $(`input[name="first_claim_status[]"]`).eq(index).val();
|
||||||
|
const firstCauseOfDeath = $(`input[name="first_casue_of_death[]"]`).eq(index).val() || null;
|
||||||
|
const firstDeathDate = $(`input[name="first_death_date[]"]`).eq(index).val() || null;
|
||||||
|
|
||||||
|
const secondYear = $(`input[name="second_year[]"]`).eq(index).val();
|
||||||
|
const secondClaimAmount = $(`input[name="second_claim_amount[]"]`).eq(index).val();
|
||||||
|
const secondClaimStatus = $(`input[name="second_claim_status[]"]`).eq(index).val();
|
||||||
|
const secondCauseOfDeath = $(`input[name="second_casue_of_death[]"]`).eq(index).val() || null;
|
||||||
|
const secondDeathDate = $(`input[name="second_death_date[]"]`).eq(index).val() || null;
|
||||||
|
|
||||||
|
const thirdYear = $(`input[name="third_year[]"]`).eq(index).val();
|
||||||
|
const thirdClaimAmount = $(`input[name="third_claim_amount[]"]`).eq(index).val();
|
||||||
|
const thirdClaimStatus = $(`input[name="third_claim_status[]"]`).eq(index).val();
|
||||||
|
const thirdCauseOfDeath = $(`input[name="third_casue_of_death[]"]`).eq(index).val() || null;
|
||||||
|
const thirdDeathDate = $(`input[name="third_death_date[]"]`).eq(index).val() || null;
|
||||||
|
|
||||||
|
// Push each year's data into the array
|
||||||
|
claimExperience.push({
|
||||||
|
"finyear": [
|
||||||
|
{
|
||||||
|
"year": firstYear,
|
||||||
|
"claim_amount": firstClaimAmount,
|
||||||
|
"status": firstClaimStatus,
|
||||||
|
"cause_of_death": firstCauseOfDeath,
|
||||||
|
"death_date": firstDeathDate
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"year": secondYear,
|
||||||
|
"claim_amount": secondClaimAmount,
|
||||||
|
"status": secondClaimStatus,
|
||||||
|
"cause_of_death": secondCauseOfDeath,
|
||||||
|
"death_date": secondDeathDate
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"year": thirdYear,
|
||||||
|
"claim_amount": thirdClaimAmount,
|
||||||
|
"status": thirdClaimStatus,
|
||||||
|
"cause_of_death": thirdCauseOfDeath,
|
||||||
|
"death_date": thirdDeathDate
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return JSON.stringify(claimExperience);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showGpaColumns(input){
|
||||||
|
|
||||||
|
let policy_type_id = $(input).val()
|
||||||
|
let increment = input.id.split("_").pop();
|
||||||
|
if(policy_type_id != 2){
|
||||||
|
$('.gpa_hide_div_'+increment).hide();
|
||||||
|
$('.gpa_show_div_'+increment).show();
|
||||||
|
$('.gpa_div_elements_'+increment).show();
|
||||||
|
$('.emp_title').text('No of Employees at Inception')
|
||||||
|
$('.total_title').text('Total Sum Insured at Inception')
|
||||||
|
}else{
|
||||||
|
$('.gpa_hide_div_'+increment).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -518,7 +518,7 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4 payby d-none">
|
<div class="form-group col-md-4 payby d-none">
|
||||||
<label class="switch" style="position: relative;top: 30px;left: 4px;">
|
<label class="switch" style="position: relative;top: 30px;left: 4px;">
|
||||||
<input id="bro_payable_by" type="checkbox" name="bro_payable_by">
|
<input id="bro_payable_by" type="checkbox" name="bro_payable_by" checked>
|
||||||
<span class="slider round" style="height: 27px;"></span>
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@ -1281,15 +1281,16 @@ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', funct
|
|||||||
|
|
||||||
let isAnyChecked = $('input[type="checkbox"][name="co_share_type[]"]:checked').length > 1;
|
let isAnyChecked = $('input[type="checkbox"][name="co_share_type[]"]:checked').length > 1;
|
||||||
|
|
||||||
var unique_id = $(this).data('count')
|
|
||||||
console.log(unique_id);
|
|
||||||
|
|
||||||
if (isAnyChecked) {
|
if (isAnyChecked) {
|
||||||
toastr.warning('Only one leader can be selected.', 'WARNING!');
|
toastr.warning('Only one leader can be selected.', 'WARNING!');
|
||||||
$(this).prop('checked', false);
|
$(this).prop('checked', false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function checkLeaderSelected(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// $(document).on('input', '[name="cgst[]"]', function() {
|
// $(document).on('input', '[name="cgst[]"]', function() {
|
||||||
|
|
||||||
// let val = $(this).val();
|
// let val = $(this).val();
|
||||||
@ -1813,9 +1814,9 @@ function amountCalculation(input) {
|
|||||||
|
|
||||||
// console.log(standard_bp_per, standard_tp_per, standard_tep_per);
|
// console.log(standard_bp_per, standard_tp_per, standard_tep_per);
|
||||||
|
|
||||||
let co_premium_amt = ((bp + tp + tep) * co_share_per) / 100;
|
// let co_premium_amt = ((bp + tp + tep) * co_share_per) / 100;
|
||||||
|
|
||||||
$('#co_premium_' + input).val(!isNaN(co_premium_amt) && isFinite(co_premium_amt) ? co_premium_amt.toFixed(2) : '0.00');
|
// $('#co_premium_' + input).val(!isNaN(co_premium_amt) && isFinite(co_premium_amt) ? co_premium_amt.toFixed(2) : '0.00');
|
||||||
|
|
||||||
|
|
||||||
// Calculate GST percentage
|
// Calculate GST percentage
|
||||||
@ -1833,7 +1834,7 @@ function amountCalculation(input) {
|
|||||||
console.log('sgst', sgst);
|
console.log('sgst', sgst);
|
||||||
|
|
||||||
// Calculate the total premium (Base + TP + Co-Premium)
|
// Calculate the total premium (Base + TP + Co-Premium)
|
||||||
let tpTotal = bp + tp + tep + cop;
|
let tpTotal = bp + tp + tep;
|
||||||
|
|
||||||
console.log('bp', bp);
|
console.log('bp', bp);
|
||||||
console.log('tp', tp);
|
console.log('tp', tp);
|
||||||
@ -2400,6 +2401,48 @@ function co_share_percentage_calculation(input, extra = null){
|
|||||||
// console.log('Final input values:', inputValues);
|
// console.log('Final input values:', inputValues);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// $(document).on('change', '[name="base_premium[]"]', function(e) {
|
||||||
|
|
||||||
|
|
||||||
|
// console.log('############################################################');
|
||||||
|
// console.log(e)
|
||||||
|
|
||||||
|
// // Get the index of the changed input field
|
||||||
|
// const index = $('input[name="base_premium[]"]').index(this);
|
||||||
|
|
||||||
|
// // Get the corresponding co_share_per value
|
||||||
|
// const coSharePer = parseFloat($('input[name="co_share_per[]"]').eq(index).val()) || 0;
|
||||||
|
|
||||||
|
// // Get the base_premium value
|
||||||
|
// const basePremium = parseFloat($(this).val()) || 0;
|
||||||
|
|
||||||
|
// // Calculate the co_premium value using the formula
|
||||||
|
// const coPremium = (basePremium * coSharePer) / 100;
|
||||||
|
|
||||||
|
// // Set the calculated value to the corresponding co_premium field
|
||||||
|
// $('input[name="co_premium[]"]').eq(index).val(coPremium.toFixed(2)); // Limiting to two decimal places
|
||||||
|
// });
|
||||||
|
|
||||||
|
$(document).on('change', '[name="base_premium[]"], [name="co_share_per[]"]', function(e) {
|
||||||
|
|
||||||
|
// Get the base premium value (assuming there's only one)
|
||||||
|
const basePremium = parseFloat($('input[name="base_premium[]"]').val()) || 0; // Get base_premium value
|
||||||
|
console.log('basePremium', basePremium);
|
||||||
|
|
||||||
|
|
||||||
|
// Loop through all co_share_per[] fields
|
||||||
|
$('input[name="co_share_per[]"]').each(function(index) {
|
||||||
|
const coSharePer = parseFloat($(this).val()) || 0; // Get co_share_per value
|
||||||
|
|
||||||
|
// Calculate co_premium using the formula: base_premium * co_share_per / 100
|
||||||
|
const coPremium = (basePremium * coSharePer) / 100;
|
||||||
|
|
||||||
|
// Set the calculated value in the corresponding co_premium input
|
||||||
|
$('input[name="co_premium[]"]').eq(index).val(coPremium.toFixed(2)); // Limiting to two decimal places
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function select_leader_disable_premium_amt(input, value) {
|
function select_leader_disable_premium_amt(input, value) {
|
||||||
@ -2420,6 +2463,7 @@ function select_leader_disable_premium_amt(input, value) {
|
|||||||
|
|
||||||
$('input[name="co_premium[]"]').addClass('readonly-select');
|
$('input[name="co_premium[]"]').addClass('readonly-select');
|
||||||
$('#co_premium_' + value).removeClass('readonly-select');
|
$('#co_premium_' + value).removeClass('readonly-select');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Enable and remove readonly-select class from all premiums except the one with the given value
|
// Enable and remove readonly-select class from all premiums except the one with the given value
|
||||||
$('input[name="base_premium[]"]').removeClass('readonly-select');
|
$('input[name="base_premium[]"]').removeClass('readonly-select');
|
||||||
@ -3305,7 +3349,7 @@ $('#cop_yes').change(function() {
|
|||||||
} else {
|
} else {
|
||||||
$('#add_more_row').addClass('d-none');
|
$('#add_more_row').addClass('d-none');
|
||||||
$('.payby').addClass('d-none');
|
$('.payby').addClass('d-none');
|
||||||
$('#bro_payable_by').prop('checked', false);
|
// $('#bro_payable_by').prop('checked', false);
|
||||||
$('#table_tr_2').hide()
|
$('#table_tr_2').hide()
|
||||||
$('#table_tr_3').hide()
|
$('#table_tr_3').hide()
|
||||||
$('#table_tr_7').hide()
|
$('#table_tr_7').hide()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user