CHANGE_RFQ_CHANGES : RV

This commit is contained in:
VENKATESHWARAN 2025-02-19 15:40:55 +05:30
parent 467b2197fa
commit ebd7fe14ce
5 changed files with 2333 additions and 1936 deletions

View File

@ -3839,6 +3839,8 @@ class ClientController extends AdminController
continue;
}
// dd($policyTerms);
$is_addon = $data[$i]['is_addon'];
$payable_arr = [];
@ -3861,7 +3863,7 @@ class ClientController extends AdminController
if(in_array($data[$i]['policy_type_id'], [2,3,4,5])){
// Set default value of copayzonewisecopay to "empty"
$ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
// $ans = isset($policyTerms['copayzonewisecopay']) ? $policyTerms['copayzonewisecopay'] : 'empty';
// add is_payable_employee for the GMC Policy
if (isset($policyTerms['age_ratio'])) {
@ -3875,31 +3877,31 @@ class ClientController extends AdminController
}
}
// Add copayzonewisecopay and copayzonewisecopaydata if they exist_
if (isset($policyTerms['copayzonewisecopay'])) {
// // Add copayzonewisecopay and copayzonewisecopaydata if they exist_
// if (isset($policyTerms['copayzonewisecopay'])) {
if(!isset($policyTerms['co_pay_details'])){
// if(!isset($policyTerms['co_pay_details'])){
$co_pay_details_value = "";
if (strtolower($ans) == "nil" || $ans == 0) {
$policyTerms['copayzonewisecopay'] = 0;
$co_pay_details_value = "";
} elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
$policyTerms['copayzonewisecopay'] = 1;
$co_pay_details_value = $ans;
}
// $co_pay_details_value = "";
// if (strtolower($ans) == "nil" || $ans == 0) {
// $policyTerms['copayzonewisecopay'] = 0;
// $co_pay_details_value = "";
// } elseif ($ans != 'empty' && $ans !== 'Nil' && $ans !== null && $ans != '' && $ans != 0) {
// $policyTerms['copayzonewisecopay'] = 1;
// $co_pay_details_value = $ans;
// }
$co_pay_index = array_search('copayzonewisecopay', array_keys($policyTerms));
$orderedPolicyTerms[] = [
"key" => "co_pay_details",
"value" => $co_pay_details_value,
"position" => $co_pay_index + 2,
];
// $co_pay_index = array_search('copayzonewisecopay', array_keys($policyTerms));
// $orderedPolicyTerms[] = [
// "key" => "co_pay_details",
// "value" => $co_pay_details_value,
// "position" => $co_pay_index + 2,
// ];
unset($policyTerms['optionalparentalcopay']);
// unset($policyTerms['optionalparentalcopay']);
}
}
// }
// }
// Add ailmentcapping and ailmentcappingdata if they exist
if (isset($policyTerms['ailmentcapping'])) {
@ -3908,7 +3910,7 @@ class ClientController extends AdminController
$orderedPolicyTerms[] = [
"key" => "ailment_capping_details",
"value" => "",
"position" => $aliment_index + 3,
"position" => $aliment_index + 2,
];
}
}
@ -3942,8 +3944,6 @@ class ClientController extends AdminController
}
foreach ($orderedPolicyTerms as $term) {
$position = $term['position'];
$key = $term['key'];
@ -3955,8 +3955,117 @@ class ClientController extends AdminController
);
}
if(in_array($data[$i]['policy_type_id'], [2,3,4,5])){
if (!isset($policyTerms['waiver_of_90_days_waiting_period'])) {
$policyTerms['waiver_of_90_days_waiting_period'] = "";
}
if (!isset($policyTerms['waiver_of_other_waiting_periods'])) {
$policyTerms['waiver_of_other_waiting_periods'] = "";
}
if (!isset($policyTerms['maternity_benefit'])) {
$policyTerms['maternity_benefit'] = "";
}
if (!isset($policyTerms['well_baby_well_mother_expenses'])) {
$policyTerms['well_baby_well_mother_expenses'] = "";
}
if (!isset($policyTerms['icu_limit'])) {
$policyTerms['icu_limit'] = "";
}
if (!isset($policyTerms['infertility_treatment_coverage'])) {
$policyTerms['infertility_treatment_coverage'] = "";
}
if (!isset($policyTerms['mid_term_addition_of_new_born_newly_wedded_spouse'])) {
$policyTerms['mid_term_addition_of_new_born_newly_wedded_spouse'] = "";
}
if (!isset($policyTerms['non_admissible_contingency_corporate_buffer'])) {
$policyTerms['non_admissible_contingency_corporate_buffer'] = "";
}
if (!isset($policyTerms['terrorism'])) {
$policyTerms['terrorism'] = "";
}
if (!isset($policyTerms['widower_cover'])) {
$policyTerms['widower_cover'] = "";
}
if (!isset($policyTerms['breavement_cover'])) {
$policyTerms['breavement_cover'] = "";
}
if (!isset($policyTerms['enrollment_display_key'])) {
$policyTerms['enrollment_display_key'] = [];
}
} else if($data[$i]['policy_type_id'] == 1){
if (!isset($policyTerms['medical_expenses_medical_extension'])) {
$policyTerms['medical_expenses_medical_extension'] = "";
}
if (!isset($policyTerms['opd_treatment_cover'])) {
$policyTerms['opd_treatment_cover'] = "";
}
if (!isset($policyTerms['repatriation_of_mortal_remains'])) {
$policyTerms['repatriation_of_mortal_remains'] = "";
}
if (!isset($policyTerms['family_transportation_benefits'])) {
$policyTerms['family_transportation_benefits'] = "";
}
if (!isset($policyTerms['fractures_dislocation_burns'])) {
$policyTerms['fractures_dislocation_burns'] = "";
}
if (!isset($policyTerms['coma'])) {
$policyTerms['coma'] = "";
}
if (!isset($policyTerms['travel_expenses_for_medical_treatment'])) {
$policyTerms['travel_expenses_for_medical_treatment'] = "";
}
if (!isset($policyTerms['daily_cash_allowance'])) {
$policyTerms['daily_cash_allowance'] = "";
}
if (!isset($policyTerms['artifical_limb_and_prosthesis'])) {
$policyTerms['artifical_limb_and_prosthesis'] = "";
}
if (!isset($policyTerms['air_ambulance'])) {
$policyTerms['air_ambulance'] = "";
}
if (!isset($policyTerms['enrollment_display_key'])) {
$policyTerms['enrollment_display_key'] = [];
}
}
foreach ($policyTerms as $key => $term) {
if ($term == "0") {
$policyTerms[$key] = "No"; // Use = for assignment
} elseif ($term == "1") {
$policyTerms[$key] = "Yes"; // Use = for assignment
}
}
// dd($policyTerms);
// Re-encode the ordered policy terms
$updatedPolicyTerms = json_encode($policyTerms);
// dd($updatedPolicyTerms);
// dd($orderedPolicyTerms, $updatedPolicyTerms);
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
@ -3997,9 +4106,9 @@ class ClientController extends AdminController
$employeeRestController = new EmployeeServiceController();
// $employeeRestController->excelFileDataValidation(['file_id' => 823]);
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 835]);
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]);
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
$employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);

View File

@ -975,7 +975,7 @@ class EmpDataServiceController extends BaseController
$balance = $this->CDMasterModel
->where('client_id', $export_data['client_id'])
->where('insurer_id', $policy_details['insurer_id'])
->where('cd_ac_no', $policy_details['cd_ac_no'])
->where('id', $policy_details['cd_ac_pk'])
->first();
$cash_balance['balance'] = $balance['opening_bal'];

View File

@ -1642,7 +1642,7 @@ class LeadsController extends BaseController
}
// dd($lead_data);
$reply_to = $lead_data['created_person_email'];
$reply_to = $lead_data['created_person_email'] ?? "";
//get file path to attach
$file_info = $this->constructExcelToSaveTemp($lead_id, ($file_type == 'rfq' ? 1 : 2), $propsal_and_insurer);
@ -1661,9 +1661,10 @@ class LeadsController extends BaseController
// print_rr($result);
}
}else{
return $this->respond(['status' => 'fail', 'code' => 200, 'messgae' => 'File Not Found'], 200);
$result = $file_info['filePath'];
// return $this->respond(['status' => 'fail', 'code' => 200, 'messgae' => 'File Not Found'], 200);
}
// print_rr($lead_data);
// print_rr($result); die;
// print_rr($file_info);
// $file_path = WRITEPATH."uploads/excel/sample/correction.xls";
// $file_name = $file_type.'.xlsx';

File diff suppressed because it is too large Load Diff

View File

@ -75,8 +75,10 @@
</style>
<div id="policyGPATermsForm" style="display:none">
<span id="policyGPATermsClose" style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span id="nameOfThePolicyInGPA"></span></label></h5>
<span id="policyGPATermsClose"
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span id="nameOfThePolicyInGPA"></span></label>
</h5>
<form role="form" class="parsley-examples" method="post" id="policyGPATerms" enctype="multipart/form-data">
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
@ -91,7 +93,9 @@
<label for="sumInsured">Sum Insured</label>
</div>
<div class="col-md-4">
<input style="width: 128%;" class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
<input style="width: 128%;" class="form-control" type="text" name="sumInsured2" id="sumInsured2"
onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)"
style="width: 100% !important;">
</div>
<div class="col-md-2" style="position: relative;left: 88px;">
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
@ -110,7 +114,8 @@
<label for="totalSumInsured">Total Sum Assured</label>
</div>
<div class="col-md-6">
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured" id="totalSumInsured" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)">
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured"
id="totalSumInsured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
</div>
<div class="col-md-6">
</div>
@ -126,28 +131,52 @@
<div class="col-md-6">
<table>
<tbody>
<tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td style="width: 5%;">
<span style="margin-right: 20px;">Self:</span>
</td>
<td style="width: 11%;">
<input disabled type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked>
<input disabled type="checkbox" style="margin-right: 70px;" name="family_floaters[]"
value="self" id="self" checked>
</td>
<td style="width: 20%;">
<div class="self-age">
<span style="margin-right: 20px;">Min Age:</span>
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa" onchange="lowerIsEighteen(this)">
<input class="underline-input min_age"
value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>"
style="width: 65%;" type="number" name="self_min_age" id="self_min_age_gpa"
onchange="lowerIsEighteen(this)">
</div>
</td>
<td style="width: 20%;">
<div class="self-age">
<span style="margin-right: 20px;">Max Age:</span>
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa" onchange="lowerIsEighteen(this)">
<input class="underline-input max_age"
value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>"
style="width: 65%;" type="number" name="self_max_age" id="self_max_age_gpa"
onchange="lowerIsEighteen(this)">
</div>
</td>
<td></td>
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
</tbody>
</table>
</div>
@ -157,176 +186,262 @@
</div>
</div>
<hr>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="accidentalDeathBenefit_display" id="accidentalDeathBenefit_display" checked>
</div>
<div class="col-md-4">
<label for="totalSumInsured">Accidental Death Benefit</label>
</div>
<div class="col-md-6">
<input type="radio" name="accidentalDeathBenefit" value="1"> Yes
<input type="radio" name="accidentalDeathBenefit" value="0" style="margin-left:10px" checked> No
<input type="text" name="accidentalDeathBenefit" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Permanent Total Disablement</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="permanentTotalDisablement_display" id="permanentTotalDisablement_display" checked>
</div>
<div class="col-md-4">
<label for="permanentTotalDisablement">Permanent Total Disablement</label>
</div>
<div class="col-md-6">
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement" class="form-control">
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement"
class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Permanent Partial Disablement</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="permanentPartialDisablement_display" id="permanentPartialDisablement_display" checked>
</div>
<div class="col-md-4">
<label for="permanentPartialDisablement">Permanent Partial Disablement</label>
</div>
<div class="col-md-6">
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement" class="form-control">
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement"
class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Temporary Total Disablement benefit</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="temporaryTotalDisablementBenefit_display" id="temporaryTotalDisablementBenefit_display" checked>
</div>
<div class="col-md-4">
<label for="temporaryTotalDisablementBenefit">Temporary Total Disablement Benefit</label>
</div>
<div class="col-md-6">
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit" class="form-control">
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit"
class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Accidental Hospitalization Expenses</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="medical_expenses_medical_extension_display" id="medical_expenses_medical_extension_display" checked>
</div>
<div class="col-md-4">
<label for="medical_expenses_medical_extension">Medical Expenses / Medical Extension (IPD)</label>
</div>
<div class="col-md-6">
<select name="accidentalHospitalizationExpenses" id="accidentalHospitalizationExpenses" class="form-control">
<option value="">Select an option</option>
<option value="No">No</option>
<option value="10%-40%">Covered upto 10% of SI or 40% of actual which ever is less</option>
<option value="20%-50%">Covered upto 20% of SI or 50% of actual which ever is less</option>
<option value="50K-500k">INR 50K, to vary in multiples of 25K till 5 Lacs</option>
</select>
<input type="text" name="medical_expenses_medical_extension" id="medical_expenses_medical_extension"
class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Children Education Welfare Fund</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="opd_treatment_cover_display" id="opd_treatment_cover_display" checked>
</div>
<div class="col-md-4">
<label for="opd_treatment_cover">OPD Treatment Cover</label>
</div>
<div class="col-md-6">
<select name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
<option value="">Select an option</option>
<option value="No">No</option>
<option value="10000">Covered upto 10,000/­ per child ( Restricted to 2 children)</option>
<option value="5000">Covered upto 5,000/­ per child ( Restricted to 2 children)</option>
</select>
<input type="text" name="opd_treatment_cover" id="opd_treatment_cover" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Compassionate Visit Expenses</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="ambulanceCharges_display" id="ambulanceCharges_display" checked>
</div>
<div class="col-md-4">
<label for="ambulanceCharges"> Ambulance Charges</label>
</div>
<div class="col-md-6">
<input type="radio" name="compassionateVisitExpenses" value="1"> Yes
<input type="radio" name="compassionateVisitExpenses" value="0" style="margin-left:10px" checked> No
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<label for="totalSumInsured">Compassionate Visit Expenses Data</label>
</div>
<div class="col-md-6">
<input type="text" name="compassionateVisitExpensesData" id="compassionateVisitExpensesData" class="form-control">
<input type="text" name="ambulanceCharges" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Broken Bone Expenses</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="repatriation_of_mortal_remains_display" id="repatriation_of_mortal_remains_display" checked>
</div>
<div class="col-md-4">
<label for="repatriation_of_mortal_remains">Repatriation of Mortal Remains</label>
</div>
<div class="col-md-6">
<input type="radio" name="brokenBoneExpenses" value="1"> Yes
<input type="radio" name="brokenBoneExpenses" value="0" style="margin-left:10px" checked> No
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<label for="totalSumInsured">Broken Bone Expenses Data</label>
</div>
<div class="col-md-6">
<input type="text" name="brokenBoneExpensesData" id="brokenBoneExpensesData" class="form-control">
<input type="text" name="repatriation_of_mortal_remains" id="repatriation_of_mortal_remains" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured"> Ambulance charges</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="childrenEducationWelfareFund_display" id="childrenEducationWelfareFund_display" checked>
</div>
<div class="col-md-4">
<label for="childrenEducationWelfareFund">Children Education Welfare Fund</label>
</div>
<div class="col-md-6">
<input type="radio" name="ambulanceCharges" value="1"> Yes
<input type="radio" name="ambulanceCharges" value="0" style="margin-left:10px" checked> No
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<label for="totalSumInsured">Ambulance charges Data</label>
</div>
<div class="col-md-6">
<input type="text" name="ambulanceChargesData" id="ambulanceChargesData" class="form-control">
<input type="text" name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured"> Burn Expenses</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="terrorism_display" id="gpa_terrorism_display" checked>
</div>
<div class="col-md-4">
<label for="terrorism">Terrorism</label>
</div>
<div class="col-md-6">
<input type="radio" name="burnExpenses" value="1"> Yes
<input type="radio" name="burnExpenses" value="0" style="margin-left:10px" checked> No
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<label for="totalSumInsured">Burn Expenses Data</label>
</div>
<div class="col-md-6">
<input type="text" name="burnExpensesData" id="burnExpensesData" class="form-control">
<input type="text" name="terrorism" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Carriage of Dead Body</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="worldwideCover_display" id="worldwideCover_display" checked>
</div>
<div class="col-md-4">
<label for="worldwideCover">Worldwide Cover</label>
</div>
<div class="col-md-6">
<input type="radio" name="carriageOfDeadBody" value="1"> Yes
<input type="radio" name="carriageOfDeadBody" value="0" style="margin-left:10px" checked> No
</div>
</div>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
<label for="totalSumInsured">Carriage of Dead Body Data</label>
</div>
<div class="col-md-6">
<input type="text" name="carriageOfDeadBodyData" id="carriageOfDeadBodyData" class="form-control">
<input type="text" name="worldwideCover" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Animal/Snake/Insect bite</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="family_transportation_benefits_display" id="family_transportation_benefits_display" checked>
</div>
<div class="col-md-4">
<label for="family_transportation_benefits">Family Transportation Benefits</label>
</div>
<div class="col-md-6">
<input type="radio" name="animalSnakeInsectBite" value="1"> Yes
<input type="radio" name="animalSnakeInsectBite" value="0" style="margin-left:10px" checked> No
<input type="text" name="family_transportation_benefits" id="family_transportation_benefits" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Terrorism</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="fractures_dislocation_burns_display" id="fractures_dislocation_burns_display" checked>
</div>
<div class="col-md-4">
<label for="fractures_dislocation_burns">Fractures / Dislocation / Burns</label>
</div>
<div class="col-md-6">
<input type="radio" name="terrorism" value="1"> Yes
<input type="radio" name="terrorism" value="0" style="margin-left:10px" checked> No
<input type="text" name="fractures_dislocation_burns" id="fractures_dislocation_burns" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Worldwide Cover</label>
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="coma_display" id="coma_display" checked>
</div>
<div class="col-md-4">
<label for="coma">Coma</label>
</div>
<div class="col-md-6">
<input type="radio" name="worldwideCover" value="1"> Yes
<input type="radio" name="worldwideCover" value="0" style="margin-left:10px" checked> No
<input type="text" name="coma" id="coma" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="carriageofDeadBody_display" id="carriageofDeadBody_display" checked>
</div>
<div class="col-md-4">
<label for="carriageOfDeadBody">Carriage of Dead Body</label>
</div>
<div class="col-md-6">
<input type="text" name="carriageOfDeadBody" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="compassionateVisitExpenses_display" id="compassionateVisitExpenses_display" checked>
</div>
<div class="col-md-4">
<label for="compassionateVisitExpenses">Compassionate Visit Expenses</label>
</div>
<div class="col-md-6">
<input type="text" name="compassionateVisitExpenses" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="travel_expenses_for_medical_treatment_display" id="travel_expenses_for_medical_treatment_display" checked>
</div>
<div class="col-md-4">
<label for="travel_expenses_for_medical_treatment">Travel expenses for Medical Treatment</label>
</div>
<div class="col-md-6">
<input type="text" name="travel_expenses_for_medical_treatment" id="travel_expenses_for_medical_treatment" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="daily_cash_allowance_display" id="daily_cash_allowance_display" checked>
</div>
<div class="col-md-4">
<label for="daily_cash_allowance">Daily cash Allowance</label>
</div>
<div class="col-md-6">
<input type="text" name="daily_cash_allowance" id="daily_cash_allowance" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="artifical_limb_and_prosthesis_display" id="artifical_limb_and_prosthesis_display" checked>
</div>
<div class="col-md-4">
<label for="artifical_limb_and_prosthesis">Artifical Limb and Prosthesis</label>
</div>
<div class="col-md-6">
<input type="text" name="artifical_limb_and_prosthesis" id="artifical_limb_and_prosthesis" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="animalSnakeInsectBite_display" id="animalSnakeInsectBite_display" checked>
</div>
<div class="col-md-4">
<label for="animalSnakeInsectBite">Animal/Snake/Insect bite</label>
</div>
<div class="col-md-6">
<input type="text" name="animalSnakeInsectBite" id="animalSnakeInsectBite" class="form-control">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-1">
<input type="checkbox" style="margin-top: 12px" class="unchecked" name="air_ambulance_display" id="air_ambulance_display" checked>
</div>
<div class="col-md-4">
<label for="air_ambulance">Air Ambulance</label>
</div>
<div class="col-md-6">
<input type="text" name="air_ambulance" id="air_ambulance" class="form-control">
</div>
</div>
@ -339,8 +454,10 @@
<br>
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
<a href="#" class="button-like" id="gpaButtonSpecialCondition" title="Special Condition">Special Condition</a>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button>
<a href="#" class="button-like" id="gpaButtonSpecialCondition" title="Special Condition">Special
Condition</a>
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit"
style="margin-top: 100px;">Submit</button>
</div>
</div>
@ -428,7 +545,6 @@
}
});
$("#policyGPATerms").submit(function(event) {
@ -500,7 +616,6 @@
});
$('body').on('click', '.btnPolicyMaster', function() {
var client_policy_id = $(this).data('id');
@ -550,13 +665,15 @@
}
if (res) {
if (res && res.data) {
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
if (key.includes("gpa_special_condition_label") || key.includes("gpa_special_condition_input")) {
if (key.includes("gpa_special_condition_label") || key.includes(
"gpa_special_condition_input")) {
if (key.includes("gpa_special_condition_label")) {
for (let index = 0; index < gpaJsonObjectForSpecialCondition[key].length; index++) {
for (let index = 0; index <
gpaJsonObjectForSpecialCondition[key].length; index++) {
specialConditionForGPA();
}
}
@ -565,10 +682,15 @@
if (elements) {
elements.forEach((element, index) => {
if(gpaJsonObjectForSpecialCondition[key][index] == undefined){
if (gpaJsonObjectForSpecialCondition[key][
index
] == undefined) {
element.value = " ";
} else {
element.value = gpaJsonObjectForSpecialCondition[key][index];
element.value =
gpaJsonObjectForSpecialCondition[key][
index
];
}
});
}
@ -577,7 +699,8 @@
if (key.includes("multiple_sum_insured") && key != "") {
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
gpaJsonObjectForSpecialCondition[key].forEach((value,
index) => {
appendGPASIAddMore(value);
});
} else {
@ -585,22 +708,36 @@
}
}
if (key.includes("enrollment_display_key") && key != "") {
console.log('enrollment_display_key');
console.log(gpaJsonObjectForSpecialCondition[key]);
processJsonObject(gpaJsonObjectForSpecialCondition);
}
});
let jsonObject = JSON.parse(res.data);
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject.sumInsured2) ?? '' );
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject.totalSumInsured) ?? '');
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject
.sumInsured2) ?? '');
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject
.totalSumInsured) ?? '');
if (jsonObject.compassionateVisitExpenses == '1') {
var element = $('input[name="compassionateVisitExpenses"]').parent().parent().next()[0];
var element = $('input[name="compassionateVisitExpenses"]').parent()
.parent().next()[0];
$(element).css("display", "");
}
if (jsonObject.brokenBoneExpenses == '1') {
var element = $('input[name="brokenBoneExpenses"]').parent().parent().next()[0];
var element = $('input[name="brokenBoneExpenses"]').parent().parent()
.next()[0];
$(element).css("display", "");
}
if (jsonObject.ambulanceCharges == '1') {
var element = $('input[name="ambulanceCharges"]').parent().parent().next()[0];
var element = $('input[name="ambulanceCharges"]').parent().parent().next()[
0];
$(element).css("display", "");
}
if (jsonObject.burnExpenses == '1') {
@ -608,22 +745,23 @@
$(element).css("display", "");
}
if (jsonObject.carriageOfDeadBody == '1') {
var element = $('input[name="carriageOfDeadBody"]').parent().parent().next()[0];
var element = $('input[name="carriageOfDeadBody"]').parent().parent()
.next()[0];
$(element).css("display", "");
}
Object.keys(jsonObject).forEach(function(key) {
console.log('jsonObject key', key)
console.log('jsonObject value', jsonObject[key])
console.log('jsonObject value type',typeof jsonObject[key])
// console.log('jsonObject key', key)
// console.log('jsonObject value', jsonObject[key])
// console.log('jsonObject value type', typeof jsonObject[key])
let elements = document.getElementsByName(key);
if (elements && elements.length > 0) {
let element = elements[0];
if (element.tagName === 'INPUT' && (element.type === 'checkbox' || element.type === 'radio')) {
if (element.tagName === 'INPUT' && (element.type ===
'checkbox' || element.type === 'radio')) {
if (element.type === 'checkbox') {
element.checked = jsonObject[key] === '1';
@ -657,7 +795,6 @@
$('.multiple_sum_insured').trigger("keyup");
$("#totalSumInsured").trigger("keyup");
},
error: function(xhr, status, error) {
@ -676,7 +813,6 @@
}
});
</script>
@ -690,7 +826,6 @@
});
function specialConditionForGPA(count = 0) {
console.log('specialConditionForGPA function called')
@ -721,8 +856,6 @@
}
}
$(document).on('click', '#policyGPATermsClose', function() {
$('#policyGPATermsForm').css('display', 'none');
$('#police-tab').css('display', '');
@ -733,7 +866,6 @@
});
$("#sumInsured2").on("keyup", function() {
var inputNumber = $(this).val();
if (inputNumber) {
@ -759,7 +891,6 @@
}
});
function numtowordinkeyup(input) {
console.log('testing......')
console.log(input);
@ -779,7 +910,6 @@
}
$("#totalSumInsured").on("keyup", function() {
var inputNumber = $(this).val();
if (inputNumber) {
@ -790,9 +920,7 @@
}
});
function appendGPASIAddMore(data = null)
{
function appendGPASIAddMore(data = null) {
console.log('appendGPASIAddMore function called')
console.log('appendGPASIAddMore function data', data)
@ -818,4 +946,61 @@
$('#gpa_si_add_more').append(html);
}
function inArray(key, array) {
return array.includes(key);
}
function processJsonObject(jsonObject) {
if (typeof jsonObject !== 'object' || Array.isArray(jsonObject)) {
console.log("jsonObject Input is not a valid object.");
return;
}
$('.unchecked').prop('checked', false);
for (let key in jsonObject) {
if (typeof jsonObject[key] === 'object' && !Array.isArray(jsonObject[key])) {
console.log('enrollment_display_key');
console.log(jsonObject[key]);
for (let innerKey in jsonObject[key]) {
const keysToCheck = [
"OPD Treatment Cover",
"Repatriation of Mortal Remains",
"Family Transportation Benefits",
"Fractures / Dislocation / Burns",
"Travel expenses for Medical Treatment",
"Daily cash Allowance",
"Artifical Limb and Prosthesis",
"Air Ambulance",
];
//let base_id = innerKey.replace(/[\s\-\/,&]+/g, '').toLowerCase();
let base_id = innerKey.replace(/[\s\-\/,&]+/g, '');
base_id = base_id.charAt(0).toLowerCase() + base_id.slice(1);
if (keysToCheck.includes(innerKey)) {
console.log("Key found: " + innerKey);
base_id = innerKey.replace(/[\s\-\/]+/g, '_').toLowerCase();
} else if (innerKey == "Medical Expenses / Medical Extension (IPD)") {
console.log("Key found: " + innerKey);
base_id = "medical_expenses_medical_extension";
} else if (innerKey == "Terrorism") {
console.log("Key found: " + innerKey);
base_id = "gpa_terrorism";
}
let display_id = base_id + "_display";
$('#' + display_id).prop('checked', true);
console.log('display_id : ', display_id);
console.log($('#' + display_id))
}
} else {
console.log(`${key} is not an object.`);
}
}
}
</script>