Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
2d4d910714
@ -92,13 +92,25 @@ class ApiServiceController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $employee_policy = $this->employeePolicyModel
|
||||||
|
// ->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||||
|
// ->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
|
// ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||||
|
// ->where('employee_polices.employee_id',$id)
|
||||||
|
// ->where('employee_polices.client_policy_id',$client_policy_id)
|
||||||
|
// ->where('employee_polices.is_active', 1 )->findAll();
|
||||||
|
|
||||||
$employee_policy = $this->employeePolicyModel
|
$employee_policy = $this->employeePolicyModel
|
||||||
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||||
->where('employee_polices.employee_id',$id)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employee_polices.client_policy_id',$client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employee_polices.is_active', 1 )->findAll();
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employee_polices.status', 'active')
|
||||||
|
->where('employees.emp_status', 'active')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
|
||||||
if(count($employee_policy) > 0)
|
if(count($employee_policy) > 0)
|
||||||
|
|||||||
@ -2726,7 +2726,9 @@ class ClientController extends AdminController
|
|||||||
$search_term = 'GMC';
|
$search_term = 'GMC';
|
||||||
} else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) {
|
} else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) {
|
||||||
$search_term = 'GPA';
|
$search_term = 'GPA';
|
||||||
} else {
|
} else if($policy_type_id == 72){
|
||||||
|
$search_term = 'GMC';
|
||||||
|
}else {
|
||||||
$search_term = "";
|
$search_term = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2736,7 +2738,7 @@ class ClientController extends AdminController
|
|||||||
if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) {
|
if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) {
|
||||||
|
|
||||||
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||||
} else if ($search_term === 'GMC') {
|
} else if ($search_term === 'GMC' || $policy_type_id == 72) {
|
||||||
|
|
||||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||||
|
|
||||||
@ -2766,7 +2768,7 @@ class ClientController extends AdminController
|
|||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// echo $family_floater;
|
// echo $family_floater;
|
||||||
|
|
||||||
if ($search_term === 'GMC') {
|
if ($search_term === 'GMC' || $policy_type_id == 72 ) {
|
||||||
|
|
||||||
// $resultss = [];
|
// $resultss = [];
|
||||||
$resultss = $results;
|
$resultss = $results;
|
||||||
@ -3400,6 +3402,7 @@ class ClientController extends AdminController
|
|||||||
[
|
[
|
||||||
'Status' => true,
|
'Status' => true,
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
|
'policy_type_id' => $record['policy_type_id'],
|
||||||
'data' => $record['policy_terms'],
|
'data' => $record['policy_terms'],
|
||||||
'policy_addon' => $record['is_addon'],
|
'policy_addon' => $record['is_addon'],
|
||||||
'emp_count_by_policy' => $emp_count_by_policy
|
'emp_count_by_policy' => $emp_count_by_policy
|
||||||
@ -4225,34 +4228,41 @@ class ClientController extends AdminController
|
|||||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||||
$policy_terms = $this->request->getPost("policy_terms");
|
$policy_terms = $this->request->getPost("policy_terms");
|
||||||
$policy_terms = json_decode($policy_terms, true);
|
$policy_terms = json_decode($policy_terms, true);
|
||||||
|
|
||||||
$data = [];
|
|
||||||
|
|
||||||
foreach ($policy_terms as $key => $value) {
|
|
||||||
|
|
||||||
if (str_ends_with($key, '_display')) {
|
|
||||||
|
|
||||||
$original_key = substr($key, 0, -8);
|
|
||||||
|
|
||||||
$newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
|
|
||||||
|
|
||||||
$data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$data[$key] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data)) {
|
|
||||||
$policy_terms['is_payable_employee']['self'] = 0;
|
|
||||||
$policy_terms = json_encode($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
// print_r($policy_terms); die;
|
||||||
|
|
||||||
|
if(empty($policy_terms)){
|
||||||
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Policy terms data could not be empty', 'formdata' => $this->request->getPost()], 200);
|
||||||
|
}
|
||||||
|
|
||||||
if ($record) {
|
if ($record) {
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
foreach ($policy_terms as $key => $value) {
|
||||||
|
|
||||||
|
if (str_ends_with($key, '_display')) {
|
||||||
|
|
||||||
|
$original_key = substr($key, 0, -8);
|
||||||
|
|
||||||
|
$newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
|
||||||
|
|
||||||
|
$data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$data[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($record['policy_type_id'] == 72){
|
||||||
|
$data['enrollment_display_key'] = $this->otherPolicyTermsDisplayKeyConstruct($policy_terms);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data)) {
|
||||||
|
$policy_terms['is_payable_employee']['self'] = 0;
|
||||||
|
$policy_terms = json_encode($data);
|
||||||
|
}
|
||||||
|
|
||||||
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
|
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
|
||||||
|
|
||||||
if ($update) {
|
if ($update) {
|
||||||
@ -4260,12 +4270,34 @@ class ClientController extends AdminController
|
|||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function otherPolicyTermsDisplayKeyConstruct($data)
|
||||||
|
{
|
||||||
|
$labels = $data['special_condition_label'] ?? [];
|
||||||
|
$values = $data['special_condition_input'] ?? [];
|
||||||
|
|
||||||
|
$special_conditions = [];
|
||||||
|
|
||||||
|
foreach ($labels as $i => $label) {
|
||||||
|
$value = $values[$i] ?? '';
|
||||||
|
|
||||||
|
// skip if label or value is empty
|
||||||
|
if (trim($label) === '' || trim($value) === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$special_conditions[$label] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $special_conditions;
|
||||||
|
}
|
||||||
|
|
||||||
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
|
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -5971,8 +6003,8 @@ class ClientController extends AdminController
|
|||||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||||
|
|
||||||
$empServiceController = new EmployeeServiceController();
|
$empServiceController = new EmployeeServiceController();
|
||||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1126']);
|
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']);
|
||||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
|
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1248']);
|
||||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
|
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
|
||||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
|
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
|
||||||
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
||||||
|
|||||||
@ -72,6 +72,11 @@
|
|||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
width: 689px;
|
width: 689px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.other-speciial-condition{
|
||||||
|
margin-left: 150px;
|
||||||
|
width: 564px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="OtherPolicyTermsForm" style="display:none">
|
<div id="OtherPolicyTermsForm" style="display:none">
|
||||||
@ -83,35 +88,180 @@
|
|||||||
|
|
||||||
<form role="form" class="parsley-examples" method="post" id="otherPolicyTerms" enctype="multipart/form-data">
|
<form role="form" class="parsley-examples" method="post" id="otherPolicyTerms" enctype="multipart/form-data">
|
||||||
|
|
||||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"/>
|
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
<input type="hidden" name="client_policy_id" id="other_client_policy_id" />
|
<input type="hidden" name="client_policy_id" id="other_client_policy_id" />
|
||||||
<input type="hidden" name="policy_id" id="gpa_policy_id" />
|
<input type="hidden" name="policy_id" id="gpa_policy_id" />
|
||||||
<input type="hidden" id="emp_count" />
|
<input type="hidden" id="emp_count" />
|
||||||
|
|
||||||
<div id="sumInsuredDiv" class="row" style="margin-bottom: 10px;">
|
<div id="sumInsuredDiv" class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="sumInsured">Sum Insured</label>
|
<label for="sumInsured">Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress="return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div id='numberToWordOthers' class="text-danger-2" ></div>
|
<div id='numberToWordOthers' class="text-danger-2"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin-top: 10px;margin-bottom:15px;" id="sum_insured_add_more" ></div>
|
<div style="margin-top: 10px;margin-bottom:15px;" id="sum_insured_add_more"></div>
|
||||||
<div id="append_html_for_other_policy_terms"></div>
|
<div id="append_html_for_other_policy_terms"></div>
|
||||||
|
|
||||||
<hr>
|
<div id="familyFloaterDiv_others" class="row mb-2">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label">Family Floater</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input" type="radio" id="familyFloaterYes_others" name="family_floater" value="1">
|
||||||
|
<label class="form-check-label" for="familyFloaterYes_others" style="width: 52px !important">Yes</label>
|
||||||
|
|
||||||
|
<input class="form-check-input" type="radio" id="familyFloaterNo_others" name="family_floater" value="0">
|
||||||
|
<label class="form-check-label" for="familyFloaterNo_others">No</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="familyFloaterDiv_others_two" class="row" style="margin-bottom: 10px;">
|
||||||
|
|
||||||
|
<div class="col" style="background-color:#F5FFFF;border-radius:10px;box-shadow:0px 2px 2px 0px #00000040;padding:20px;">
|
||||||
|
|
||||||
|
<!-- SELF -->
|
||||||
|
<div class="d-flex align-items-center policy-base-info">
|
||||||
|
<input type="checkbox" name="family_floaters[]" value="self" id="self_others" checked>
|
||||||
|
|
||||||
|
<span style="margin-right:150px;color:black;">Self:</span>
|
||||||
|
|
||||||
|
<div class="self-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||||
|
<input class="underline-input min_age"
|
||||||
|
type="number"
|
||||||
|
name="self_min_age"
|
||||||
|
id="self_min_age_others"
|
||||||
|
value="<?= isset($self_min_age) && $self_min_age > 0 ? $self_min_age : '18'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="self-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||||
|
<input class="underline-input max_age"
|
||||||
|
type="number"
|
||||||
|
name="self_max_age"
|
||||||
|
id="self_max_age_others"
|
||||||
|
value="<?= isset($self_max_age) ? $self_max_age : '60'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- SPOUSE -->
|
||||||
|
<div class="d-flex align-items-center policy-base-info">
|
||||||
|
<input type="checkbox" name="family_floaters[]" value="spouse" id="spouse_others">
|
||||||
|
|
||||||
|
<span style="margin-right:125px;color:black;">Spouse:</span>
|
||||||
|
|
||||||
|
<div class="spouse-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||||
|
<input class="underline-input min_age"
|
||||||
|
type="number"
|
||||||
|
name="spouse_min_age"
|
||||||
|
id="spouse_min_age_others"
|
||||||
|
value="<?= isset($spouse_min_age) ? $spouse_min_age : '18'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="spouse-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||||
|
<input class="underline-input max_age"
|
||||||
|
type="number"
|
||||||
|
name="spouse_max_age"
|
||||||
|
id="spouse_max_age_others"
|
||||||
|
value="<?= isset($spouse_max_age) ? $spouse_max_age : '60'; ?>"
|
||||||
|
onchange="lowerIsEighteenOthers(this)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- CHILDREN -->
|
||||||
|
<div class="d-flex align-items-center policy-base-info">
|
||||||
|
<span style="color:black;" class="mr-2">Children:</span>
|
||||||
|
|
||||||
|
<select name="family_floaters[]" id="children_others" class="px-1" style="margin-right:60px;">
|
||||||
|
<option value="0">None</option>
|
||||||
|
<option value="1">1</option>
|
||||||
|
<option value="2">2</option>
|
||||||
|
<option value="3">3</option>
|
||||||
|
<option value="4">4</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<div class="child-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||||
|
<input class="underline-input min_age"
|
||||||
|
type="number"
|
||||||
|
name="child_min_age"
|
||||||
|
id="child_min_age_others"
|
||||||
|
value="<?= isset($child_min_age) ? $child_min_age : '0'; ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="child-age">
|
||||||
|
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||||
|
<input class="underline-input max_age"
|
||||||
|
type="number"
|
||||||
|
name="child_max_age"
|
||||||
|
id="child_max_age_others"
|
||||||
|
value="<?= isset($child_max_age) ? $child_max_age : '25'; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- OTHER MEMBERS -->
|
||||||
|
<div class="d-flex align-items-center policy-base-info flex-nowrap">
|
||||||
|
|
||||||
|
<span class="fw-bold text-dark mr-3"><b>Select Other Members:</b></span>
|
||||||
|
|
||||||
|
<select name="family_floaters[]" id="family_floaters_others" class="form-select mr-3 px-1">
|
||||||
|
<option value="0">None</option>
|
||||||
|
<option value="1P">Only one parent</option>
|
||||||
|
<option value="2P">Only two parents</option>
|
||||||
|
<option value="1PIL">Only one parent in law</option>
|
||||||
|
<option value="2PIL">Only two parents in law</option>
|
||||||
|
<option value="2EPORPIL">Parents or PIL (Any two)</option>
|
||||||
|
<option value="EPORPIL">Either Parents or PIL</option>
|
||||||
|
<option value="4EPORPIL">Parents + PIL</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<span class="text-dark mr-2">Elders Count:</span>
|
||||||
|
<input class="underline-input"
|
||||||
|
type="number"
|
||||||
|
name="elder_member_count"
|
||||||
|
id="member_count_others"
|
||||||
|
readonly>
|
||||||
|
|
||||||
|
<span class="text-dark mr-2">Min Age:</span>
|
||||||
|
<input class="underline-input"
|
||||||
|
type="number"
|
||||||
|
name="other_member_min_age"
|
||||||
|
id="other_member_min_age_others"
|
||||||
|
value="<?= isset($other_member_min_age) ? $other_member_min_age : '18'; ?>">
|
||||||
|
|
||||||
|
<span class="text-dark mr-2">Max Age:</span>
|
||||||
|
<input class="underline-input"
|
||||||
|
type="number"
|
||||||
|
name="other_member_max_age"
|
||||||
|
id="other_member_max_age_others"
|
||||||
|
value="<?= isset($other_member_max_age) ? $other_member_max_age : '60'; ?>">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="other_special_condition">
|
<div class="other_special_condition">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@ -126,7 +276,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$("#otherPolicyTerms").submit(function(event) {
|
$("#otherPolicyTerms").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -162,10 +311,9 @@
|
|||||||
formObject[baseKey] = [];
|
formObject[baseKey] = [];
|
||||||
}
|
}
|
||||||
formObject[baseKey].push(value.replace(/,/g, ''));
|
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||||
} else if(key == 'sum_insureds'){
|
} else if (key == 'sum_insureds') {
|
||||||
formObject['sum_insured'] = value.replace(/,/g, '');
|
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
formObject[key] = value;
|
formObject[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,7 +363,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: 'smooth'
|
||||||
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -295,7 +446,7 @@
|
|||||||
if (key.includes("special_condition_label") || key.includes(
|
if (key.includes("special_condition_label") || key.includes(
|
||||||
"special_condition_input")) {
|
"special_condition_input")) {
|
||||||
if (key.includes("special_condition_label")) {
|
if (key.includes("special_condition_label")) {
|
||||||
|
|
||||||
for (let index = 0; index <
|
for (let index = 0; index <
|
||||||
otherTermsJsonObjectSpecialCondition[key].length; index++) {
|
otherTermsJsonObjectSpecialCondition[key].length; index++) {
|
||||||
specialConditionForOthers();
|
specialConditionForOthers();
|
||||||
@ -319,12 +470,12 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key.startsWith("special_condition") && !key.startsWith('multiple_sum_insured') && !key.startsWith("sum_insured") && !key.startsWith("enrollment_display_key") ) {
|
if (!key.startsWith("special_condition") && !key.startsWith('multiple_sum_insured') && !key.startsWith("sum_insured") && !key.startsWith("enrollment_display_key")) {
|
||||||
|
|
||||||
termsHTML = `
|
termsHTML = `
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-1">
|
<div class="col-md-1">
|
||||||
<input type="checkbox" style="margin-top: 12px" name="${key}_display"
|
<input type="checkbox" style="margin-top: 12px" name="${key}_display"
|
||||||
@ -350,7 +501,7 @@
|
|||||||
value.forEach(item => appendOtherSIAddMore(item));
|
value.forEach(item => appendOtherSIAddMore(item));
|
||||||
} else if (typeof value === 'object' && value !== null) {
|
} else if (typeof value === 'object' && value !== null) {
|
||||||
Object.values(value).forEach(item => appendOtherSIAddMore(item));
|
Object.values(value).forEach(item => appendOtherSIAddMore(item));
|
||||||
}
|
}
|
||||||
// else if (typeof value === 'string') {
|
// else if (typeof value === 'string') {
|
||||||
// appendOtherSIAddMore(value); // Use directly, no loop
|
// appendOtherSIAddMore(value); // Use directly, no loop
|
||||||
// }
|
// }
|
||||||
@ -368,10 +519,10 @@
|
|||||||
|
|
||||||
let elements = document.getElementsByName(key);
|
let elements = document.getElementsByName(key);
|
||||||
|
|
||||||
if(key == 'sum_insured'){
|
if (key == 'sum_insured') {
|
||||||
elements = document.getElementsByName('sum_insureds')
|
elements = document.getElementsByName('sum_insureds')
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(elements)
|
console.log(elements)
|
||||||
|
|
||||||
if (elements && elements.length > 0) {
|
if (elements && elements.length > 0) {
|
||||||
@ -424,17 +575,19 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(policy_type_id > 7) {
|
if (policy_type_id > 7 && policy_type_id != 72) {
|
||||||
|
$("#sumInsuredDiv").empty();
|
||||||
|
}
|
||||||
|
|
||||||
$("#sumInsuredDiv").empty();
|
if(policy_type_id != 72){
|
||||||
|
$("#familyFloaterDiv_others").empty();
|
||||||
|
$("#familyFloaterDiv_others_two").empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
document.getElementById('otherButtonSpecialCondition').addEventListener('click', function(event) {
|
document.getElementById('otherButtonSpecialCondition').addEventListener('click', function(event) {
|
||||||
|
|
||||||
console.log('specialConditionForOthers callback clicked')
|
console.log('specialConditionForOthers callback clicked')
|
||||||
@ -461,7 +614,7 @@
|
|||||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control s special_condition_input[]">
|
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control other-speciial-condition special_condition_input[]">
|
||||||
</div>`;
|
</div>`;
|
||||||
console.log($(this));
|
console.log($(this));
|
||||||
$('.other_special_condition').each(function() {
|
$('.other_special_condition').each(function() {
|
||||||
@ -475,7 +628,7 @@
|
|||||||
|
|
||||||
$(document).on('click', '#otherPolicyTermsClose', function() {
|
$(document).on('click', '#otherPolicyTermsClose', function() {
|
||||||
|
|
||||||
//clear the intervel for the autosave
|
//clear the intervel for the autosave
|
||||||
stopAutoSubmit();
|
stopAutoSubmit();
|
||||||
|
|
||||||
$('#OtherPolicyTermsForm').css('display', 'none');
|
$('#OtherPolicyTermsForm').css('display', 'none');
|
||||||
@ -528,27 +681,27 @@
|
|||||||
|
|
||||||
if (policy_type == 7) {
|
if (policy_type == 7) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// <div class="row" style="margin-bottom: 10px;">
|
|
||||||
// <div class="col-md-6">
|
|
||||||
// <label for="sumInsured">Sum Insured</label>
|
|
||||||
// </div>
|
|
||||||
// <div class="col-md-4">
|
|
||||||
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
|
||||||
// </div>
|
|
||||||
// <div class="col-md-2" style="position: relative;left: 88px;">
|
|
||||||
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
|
||||||
// </div>
|
|
||||||
// <div class="col-md-6">
|
|
||||||
// </div>
|
|
||||||
// <div class="col-md-6">
|
|
||||||
// <div id='numberToWordOthers' class="text-danger-2" ></div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <div id="sum_insured_add_more" ></div>
|
// <div class="row" style="margin-bottom: 10px;">
|
||||||
termsHTML = `
|
// <div class="col-md-6">
|
||||||
|
// <label for="sumInsured">Sum Insured</label>
|
||||||
|
// </div>
|
||||||
|
// <div class="col-md-4">
|
||||||
|
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||||
|
// </div>
|
||||||
|
// <div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
|
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||||
|
// </div>
|
||||||
|
// <div class="col-md-6">
|
||||||
|
// </div>
|
||||||
|
// <div class="col-md-6">
|
||||||
|
// <div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||||
|
// </div>
|
||||||
|
// </div>
|
||||||
|
|
||||||
|
// <div id="sum_insured_add_more" ></div>
|
||||||
|
termsHTML = `
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
@ -646,27 +799,27 @@
|
|||||||
|
|
||||||
} else if (policy_type == 6) {
|
} else if (policy_type == 6) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// <div class="row" style="margin-bottom: 10px;">
|
|
||||||
// <div class="col-md-6">
|
|
||||||
// <label for="sumInsured">Sum Insured</label>
|
|
||||||
// </div>
|
|
||||||
// <div class="col-md-4" >
|
|
||||||
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
|
||||||
// </div>
|
|
||||||
// <div class="col-md-2" style="position: relative;left: 88px;">
|
|
||||||
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
|
||||||
// </div>
|
|
||||||
// <div class="col-md-6">
|
|
||||||
// </div>
|
|
||||||
// <div class="col-md-6">
|
|
||||||
// <div id='numberToWordOthers' class="text-danger-2" ></div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <div id="sum_insured_add_more" ></div>
|
// <div class="row" style="margin-bottom: 10px;">
|
||||||
termsHTML = `
|
// <div class="col-md-6">
|
||||||
|
// <label for="sumInsured">Sum Insured</label>
|
||||||
|
// </div>
|
||||||
|
// <div class="col-md-4" >
|
||||||
|
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||||
|
// </div>
|
||||||
|
// <div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
|
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||||
|
// </div>
|
||||||
|
// <div class="col-md-6">
|
||||||
|
// </div>
|
||||||
|
// <div class="col-md-6">
|
||||||
|
// <div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||||
|
// </div>
|
||||||
|
// </div>
|
||||||
|
|
||||||
|
// <div id="sum_insured_add_more" ></div>
|
||||||
|
termsHTML = `
|
||||||
|
|
||||||
<div class="form-group EDLI">
|
<div class="form-group EDLI">
|
||||||
|
|
||||||
@ -765,14 +918,14 @@
|
|||||||
|
|
||||||
function beautifyString(str) {
|
function beautifyString(str) {
|
||||||
return str
|
return str
|
||||||
.split('_') // Split the string by underscores
|
.split('_') // Split the string by underscores
|
||||||
.map(word =>
|
.map(word =>
|
||||||
word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word
|
word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word
|
||||||
)
|
)
|
||||||
.join(' '); // Join with spaces instead of underscores
|
.join(' '); // Join with spaces instead of underscores
|
||||||
}
|
}
|
||||||
|
|
||||||
function autoSaveOtherTerms(){
|
function autoSaveOtherTerms() {
|
||||||
|
|
||||||
console.log('autoSaveOtherTerms function called');
|
console.log('autoSaveOtherTerms function called');
|
||||||
|
|
||||||
@ -789,10 +942,10 @@
|
|||||||
var formData = new FormData(form);
|
var formData = new FormData(form);
|
||||||
var hasData = false;
|
var hasData = false;
|
||||||
|
|
||||||
|
|
||||||
for (let [key, value] of formData.entries()) {
|
for (let [key, value] of formData.entries()) {
|
||||||
console.log("Key:", key, "Value:", value);
|
console.log("Key:", key, "Value:", value);
|
||||||
if(key == "sum_insureds"){
|
if (key == "sum_insureds") {
|
||||||
if (value && value.toString().trim() !== '') {
|
if (value && value.toString().trim() !== '') {
|
||||||
hasData = true;
|
hasData = true;
|
||||||
break;
|
break;
|
||||||
@ -820,10 +973,9 @@
|
|||||||
formObject[baseKey] = [];
|
formObject[baseKey] = [];
|
||||||
}
|
}
|
||||||
formObject[baseKey].push(value.replace(/,/g, ''));
|
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||||
} else if(key == 'sum_insureds'){
|
} else if (key == 'sum_insureds') {
|
||||||
formObject['sum_insured'] = value.replace(/,/g, '');
|
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
formObject[key] = value;
|
formObject[key] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -853,7 +1005,7 @@
|
|||||||
|
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
showTinyToast();
|
showTinyToast();
|
||||||
}else{
|
} else {
|
||||||
console.log('Policy terms Dose Not save', 'Error');
|
console.log('Policy terms Dose Not save', 'Error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -867,19 +1019,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function debounceothers(fn, delay) {
|
function debounceothers(fn, delay) {
|
||||||
let timeout;
|
let timeout;
|
||||||
return function () {
|
return function() {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
timeout = setTimeout(fn, delay);
|
timeout = setTimeout(fn, delay);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function() {
|
||||||
const form = document.querySelector("#otherPolicyTerms");
|
const form = document.querySelector("#otherPolicyTerms");
|
||||||
|
|
||||||
// MutationObserver (always runs)
|
// MutationObserver (always runs)
|
||||||
const observer = new MutationObserver(() => {
|
const observer = new MutationObserver(() => {
|
||||||
$("#otherPolicyTerms").find("input, select, textarea").each(function () {
|
$("#otherPolicyTerms").find("input, select, textarea").each(function() {
|
||||||
if (other_auto_save_enable) { // only bind autosave if enabled
|
if (other_auto_save_enable) { // only bind autosave if enabled
|
||||||
if (!$(this).attr("data-observed")) {
|
if (!$(this).attr("data-observed")) {
|
||||||
const debouncedSave = debounceothers(autoSaveOtherTerms, 1000);
|
const debouncedSave = debounceothers(autoSaveOtherTerms, 1000);
|
||||||
@ -890,18 +1042,103 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
observer.observe(form, { childList: true, subtree: true });
|
observer.observe(form, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
|
||||||
// Bind for existing fields (only if enabled)
|
// Bind for existing fields (only if enabled)
|
||||||
if (other_auto_save_enable) {
|
if (other_auto_save_enable) {
|
||||||
const debouncedSave = debounceothers(autoSaveOtherTerms, 1000);
|
const debouncedSave = debounceothers(autoSaveOtherTerms, 1000);
|
||||||
$("#otherPolicyTerms").find("input, select, textarea").each(function () {
|
$("#otherPolicyTerms").find("input, select, textarea").each(function() {
|
||||||
$(this).on("input change", debouncedSave);
|
$(this).on("input change", debouncedSave);
|
||||||
$(this).attr("data-observed", "true");
|
$(this).attr("data-observed", "true");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log("This policy has employee processed (autosave disabled) -- OTHERS") ;
|
console.log("This policy has employee processed (autosave disabled) -- OTHERS");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#self_others').change(function() {
|
||||||
|
if ($(this).prop('checked')) {
|
||||||
|
$('.self-age').css('display', '');
|
||||||
|
} else {
|
||||||
|
$('.self-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#spouse_others').change(function() {
|
||||||
|
console.log('spouse changed')
|
||||||
|
if ($(this).prop('checked')) {
|
||||||
|
$('.spouse-age').css('display', '');
|
||||||
|
if ($('#spouse_min_age_others').val() < 17 || $('#spouse_min_age_others').val() == '') {
|
||||||
|
$('#spouse_min_age_others').val(18);
|
||||||
|
}
|
||||||
|
if ($('#spouse_max_age_others').val() < 17 || $('#spouse_max_age_others').val() == '') {
|
||||||
|
$('#spouse_max_age_others').val(60);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('.spouse-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#children_others').change(function() {
|
||||||
|
if ($(this).val() != 0) {
|
||||||
|
$('.child-age').css('display', '');
|
||||||
|
|
||||||
|
if ($('#child_min_age_others').val() < 0 || $('#child_min_age_others').val() == '') {
|
||||||
|
$('#child_min_age_others').val(0);
|
||||||
|
}
|
||||||
|
if ($('#child_max_age_others').val() < 24 || $('#child_max_age_others').val() == '') {
|
||||||
|
$('#child_max_age_others').val(25);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('.child-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#family_floaters_others').change(function() {
|
||||||
|
|
||||||
|
checkAdditionPremiumJSON()
|
||||||
|
|
||||||
|
var family_floaters = $(this).val();
|
||||||
|
if ($('#family_floaters').val() != 0) {
|
||||||
|
$('.other-member-age').css('display', '');
|
||||||
|
if ($('#other_member_min_age_others').val() < 17 || $('#other_member_min_age_others').val() == '') {
|
||||||
|
$('#other_member_min_age_others').val(18);
|
||||||
|
}
|
||||||
|
if ($('#other_member_max_age_others').val() < 79 || $('#other_member_max_age_others').val() == '') {
|
||||||
|
$('#other_member_max_age_others').val(60);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('.other-member-age').css('display', 'none');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (family_floaters == '1P') {
|
||||||
|
$('#member_count_others').val(1);
|
||||||
|
} else if (family_floaters == '2P') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '1PIL') {
|
||||||
|
$('#member_count_others').val(1);
|
||||||
|
} else if (family_floaters == '2PIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '2EPORPIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == 'EPORPIL') {
|
||||||
|
$('#member_count_others').val(2);
|
||||||
|
} else if (family_floaters == '4EPORPIL') {
|
||||||
|
$('#member_count_others').val(4);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function lowerIsEighteenOthers(params) {
|
||||||
|
var value = $(params).val();
|
||||||
|
|
||||||
|
if (value < 18) {
|
||||||
|
$(params).val(18);
|
||||||
|
} else if (value > 99) {
|
||||||
|
$(params).val(99);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -3522,7 +3522,7 @@ function hideShowPolicyPremium(policy_type_string, unique_id = null)
|
|||||||
individual = $('#individual_' + unique_id);
|
individual = $('#individual_' + unique_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (policy_type_string == 'GMC') {
|
if (policy_type_string == 'GMC' || policy_type_string == 'OPD') {
|
||||||
premium_type.show();
|
premium_type.show();
|
||||||
individual.prop('checked', true)
|
individual.prop('checked', true)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user