MERGE_TEST_WHATSAPP_REPORTED_ISSUES
This commit is contained in:
commit
9fe2143401
@ -1907,7 +1907,7 @@ class ClientController extends AdminController
|
|||||||
"sum_insured" => "Sum Insured",
|
"sum_insured" => "Sum Insured",
|
||||||
"family_floater" => "Family Floater",
|
"family_floater" => "Family Floater",
|
||||||
"family_floaters" => "Family Floaters",
|
"family_floaters" => "Family Floaters",
|
||||||
"member_count" => "Elders Count:",
|
"elders_count" => "Elders Count:",
|
||||||
"other_member_min_age" => "Min Age:",
|
"other_member_min_age" => "Min Age:",
|
||||||
"other_member_max_age" => "Min Age:",
|
"other_member_max_age" => "Min Age:",
|
||||||
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
|
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
|
||||||
@ -2068,18 +2068,26 @@ class ClientController extends AdminController
|
|||||||
$transformedData[$mapping[$key]] = $value;
|
$transformedData[$mapping[$key]] = $value;
|
||||||
} else if ($key == 'special_condition_label') {
|
} else if ($key == 'special_condition_label') {
|
||||||
|
|
||||||
foreach ($value as $key => $value) {
|
if (is_array($value)) {
|
||||||
$transformedData[$value] = $data['special_condition_input'][$key];
|
foreach ($value as $key => $value) {
|
||||||
|
$transformedData[$value] = $data['special_condition_input'][$key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if ($key == 'gpa_special_condition_label') {
|
|
||||||
|
|
||||||
foreach ($value as $key => $value) {
|
} else if ($key == 'gpa_special_condition_label') {
|
||||||
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $key => $value) {
|
||||||
|
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ($key == 'other_special_condition_label') {
|
||||||
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $key => $value) {
|
||||||
|
$transformedData[$value] = $data['other_special_condition_label'][$key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if ($key == 'age_ratio') {
|
} else if ($key == 'age_ratio') {
|
||||||
|
|
||||||
if (isset($data['sumInsured2'])) {
|
if (isset($data['sumInsured2'])) {
|
||||||
|
|
||||||
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
|
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -2217,24 +2225,53 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPolicyTerms($client_policy_id){
|
public function getPolicyTerms($client_policy_id)
|
||||||
|
{
|
||||||
$policy_terms = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$policy_terms = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
|
||||||
if(isset($policy_terms['policy_terms']) && $policy_terms['policy_terms'] != null){
|
if (!$policy_terms) {
|
||||||
|
return $this->respond(['status' => false, 'error' => 'Policy not found'], 404);
|
||||||
$JSON = json_decode($policy_terms['policy_terms']);
|
|
||||||
$si = $JSON->sum_insured ?? $JSON->sumInsured2;
|
|
||||||
$multi_si = $JSON->multiple_sum_insured;
|
|
||||||
$multi_si[] = $si;
|
|
||||||
}else{
|
|
||||||
$$multi_si = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'data'=>$multi_si], 200);
|
if (is_array($policy_terms)) {
|
||||||
|
if (!isset($policy_terms['policy_terms'])) {
|
||||||
|
return $this->respond(['status' => false, 'error' => 'Policy terms not found in array'], 500);
|
||||||
|
}
|
||||||
|
$JSON = json_decode($policy_terms['policy_terms']);
|
||||||
|
} elseif (is_object($policy_terms)) {
|
||||||
|
if (!isset($policy_terms->policy_terms)) {
|
||||||
|
return $this->respond(['status' => false, 'error' => 'Policy terms not found in object'], 500);
|
||||||
|
}
|
||||||
|
$JSON = json_decode($policy_terms->policy_terms);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => false, 'error' => 'Unexpected data type for policy terms'], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$JSON) {
|
||||||
|
return $this->respond(['status' => false, 'error' => 'Invalid JSON format in policy terms'], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
$multi_si = [];
|
||||||
|
|
||||||
|
if (isset($JSON->sum_insured) && !empty($JSON->sum_insured)) {
|
||||||
|
$multi_si[] = $JSON->sum_insured;
|
||||||
|
} elseif (isset($JSON->sumInsured2) && !empty($JSON->sumInsured2)) {
|
||||||
|
$multi_si[] = $JSON->sumInsured2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($JSON->multiple_sum_insured) && is_array($JSON->multiple_sum_insured)) {
|
||||||
|
foreach ($JSON->multiple_sum_insured as $msi) {
|
||||||
|
if (!empty($msi)) {
|
||||||
|
$multi_si[] = $msi;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'data' => $multi_si], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function getPolicyTermsFormJson($policy_type_id){
|
public function getPolicyTermsFormJson($policy_type_id){
|
||||||
|
|
||||||
$JSON = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
$JSON = $this->policyTypeModel->where('id', $policy_type_id)->first();
|
||||||
|
|||||||
@ -270,18 +270,30 @@ $(document).ready(function() {
|
|||||||
$(document).on('click', '.policy_terms', function() {
|
$(document).on('click', '.policy_terms', function() {
|
||||||
var terms = $(this).data('id');
|
var terms = $(this).data('id');
|
||||||
console.log(terms);
|
console.log(terms);
|
||||||
|
console.log(JSON.stringify(terms));
|
||||||
|
|
||||||
// terms = JSON.parse(terms);
|
// terms = JSON.parse(terms);
|
||||||
|
|
||||||
$('#modal_body').empty();
|
$('#modal_body').empty();
|
||||||
|
|
||||||
function createListItems(obj) {
|
function createListItems(obj) {
|
||||||
|
|
||||||
const fragment = document.createDocumentFragment();
|
const fragment = document.createDocumentFragment();
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
if (obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== '' && key !=
|
if (
|
||||||
'family_floater' && key != 'gpa_special_condition_input' && key !=
|
obj.hasOwnProperty(key) &&
|
||||||
'gpa_special_condition_label' && key != 'special_condition_label' && key !=
|
obj[key] !== null &&
|
||||||
'special_condition_input' && key != 'age_ratio') {
|
obj[key] !== '' &&
|
||||||
|
key != 'family_floater' &&
|
||||||
|
key != 'family_floater' &&
|
||||||
|
key != 'gpa_special_condition_input' &&
|
||||||
|
key != 'gpa_special_condition_label' &&
|
||||||
|
key != 'special_condition_label' &&
|
||||||
|
key != 'special_condition_input' &&
|
||||||
|
key != 'age_ratio' &&
|
||||||
|
key != "multiple_sum_insured" &&
|
||||||
|
key != "other_special_condition_label" &&
|
||||||
|
key != "other_special_condition_input") {
|
||||||
|
|
||||||
const listItem = document.createElement('li');
|
const listItem = document.createElement('li');
|
||||||
|
|
||||||
@ -326,6 +338,7 @@ $(document).on('click', '.policy_terms', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#modal_body').append(createListItems(terms));
|
$('#modal_body').append(createListItems(terms));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -78,7 +78,8 @@ label {
|
|||||||
|
|
||||||
<span id="otherPolicyTermsClose"
|
<span id="otherPolicyTermsClose"
|
||||||
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
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="nameOfThePolicyOnOther"></span></label>
|
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span
|
||||||
|
id="nameOfThePolicyOnOther"></span></label>
|
||||||
</h5>
|
</h5>
|
||||||
<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() ?>" />
|
||||||
@ -87,7 +88,7 @@ label {
|
|||||||
<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="append_html_for_other_policy_terms" ></div>
|
<div id="append_html_for_other_policy_terms"></div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
@ -108,8 +109,6 @@ label {
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
$("#otherPolicyTerms").submit(function(event) {
|
$("#otherPolicyTerms").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -133,30 +132,37 @@ $("#otherPolicyTerms").submit(function(event) {
|
|||||||
var formData = new FormData($('#otherPolicyTerms')[0]);
|
var formData = new FormData($('#otherPolicyTerms')[0]);
|
||||||
var policy_form_action = '<?= base_url("client/terms/other_terms") ?>';
|
var policy_form_action = '<?= base_url("client/terms/other_terms") ?>';
|
||||||
|
|
||||||
// Convert the FormData object to a JSON object
|
// Convert the FormData object to a JSON object
|
||||||
const formObject = {};
|
const formObject = {};
|
||||||
formData.forEach((value, key) => {
|
formData.forEach((value, key) => {
|
||||||
if(key != 'csrf_test_name' && key != 'client_policy_id' && key != 'policy_id' && key != 'client_id'){
|
if (key != 'csrf_test_name' && key != 'client_policy_id' && key != 'policy_id' && key !=
|
||||||
if (key.endsWith('[]')) {
|
'client_id') {
|
||||||
const baseKey = key.slice(0, -2);
|
|
||||||
if (!formObject[baseKey]) {
|
if (key.endsWith('[]')) {
|
||||||
formObject[baseKey] = [];
|
const baseKey = key.slice(0, -2);
|
||||||
}
|
if (!formObject[baseKey]) {
|
||||||
formObject[baseKey].push(value);
|
formObject[baseKey] = [];
|
||||||
} else {
|
|
||||||
formObject[key] = value;
|
|
||||||
}
|
}
|
||||||
|
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||||
|
} else if(key == 'sum_insureds'){
|
||||||
|
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||||
}
|
}
|
||||||
});
|
else {
|
||||||
|
formObject[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
console.log(formObject);
|
console.log(formObject);
|
||||||
|
|
||||||
|
|
||||||
const jsonString = JSON.stringify(formObject);
|
const jsonString = JSON.stringify(formObject);
|
||||||
console.log(jsonString);
|
console.log(jsonString);
|
||||||
|
|
||||||
// Append the JSON string to the FormData object
|
// return;
|
||||||
formData.append('policy_terms', jsonString);
|
|
||||||
|
// Append the JSON string to the FormData object
|
||||||
|
formData.append('policy_terms', jsonString);
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -189,7 +195,6 @@ $("#otherPolicyTerms").submit(function(event) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
$('#OtherPolicyTermsForm').css('display', 'none');
|
$('#OtherPolicyTermsForm').css('display', 'none');
|
||||||
@ -208,7 +213,7 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
var client_policy_id = $(this).data('id');
|
var client_policy_id = $(this).data('id');
|
||||||
var policy_type_id = $(this).data('typeid');
|
var policy_type_id = $(this).data('typeid');
|
||||||
console.log('policy_type_id', policy_type_id);
|
console.log('policy_type_id', policy_type_id);
|
||||||
console.log('client_policy_id :' ,client_policy_id);
|
console.log('client_policy_id :', client_policy_id);
|
||||||
|
|
||||||
$('#other_client_policy_id').val(client_policy_id);
|
$('#other_client_policy_id').val(client_policy_id);
|
||||||
|
|
||||||
@ -287,7 +292,16 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key.includes("multiple_sum_insured")) {
|
||||||
|
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
||||||
|
appendOtherSIAddMore(value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -295,9 +309,15 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
let jsonObject = JSON.parse(res.data);
|
let jsonObject = JSON.parse(res.data);
|
||||||
Object.keys(jsonObject).forEach(function(key) {
|
Object.keys(jsonObject).forEach(function(key) {
|
||||||
|
|
||||||
|
console.log(key)
|
||||||
|
|
||||||
let elements = document.getElementsByName(key);
|
let elements = document.getElementsByName(key);
|
||||||
|
|
||||||
// console.log(elements)
|
if(key == 'sum_insured'){
|
||||||
|
elements = document.getElementsByName('sum_insureds')
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(elements)
|
||||||
|
|
||||||
if (elements && elements.length > 0) {
|
if (elements && elements.length > 0) {
|
||||||
let element = elements[0];
|
let element = elements[0];
|
||||||
@ -309,7 +329,6 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
element.checked = jsonObject[key] === '1';
|
element.checked = jsonObject[key] === '1';
|
||||||
} else if (element.type === 'radio') {
|
} else if (element.type === 'radio') {
|
||||||
element.checked = element.value === jsonObject[key];
|
element.checked = element.value === jsonObject[key];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -317,7 +336,11 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
if (jsonObject[key] == undefined) {
|
if (jsonObject[key] == undefined) {
|
||||||
element.value = " ";
|
element.value = " ";
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
element.value = jsonObject[key];
|
element.value = jsonObject[key];
|
||||||
|
console.log(element);
|
||||||
|
console.log(jsonObject[key]);
|
||||||
|
console.log(element.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -327,6 +350,10 @@ $('body').on('click', '.btnPolicyMaster', function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$('#sum_insured_others').trigger('keyup');
|
||||||
|
$(".multiple_sum_insured").trigger("keyup");
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
@ -395,13 +422,14 @@ $(document).on('click', '#otherPolicyTermsClose', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#sumInsured2").on("keyup", function() {
|
$("#sum_insured_others").on("keyup", function() {
|
||||||
var inputNumber = $(this).val();
|
var inputNumber = $(this).val();
|
||||||
|
console.log('sum_insured_others keyup', inputNumber)
|
||||||
if (inputNumber) {
|
if (inputNumber) {
|
||||||
var result = convertCommaNumberToWords(inputNumber);
|
var result = convertCommaNumberToWords(inputNumber);
|
||||||
$("#numberToWordSumInsured").text(result);
|
$("#numberToWordOthers").text(result);
|
||||||
} else {
|
} else {
|
||||||
$("#numberToWordSumInsured").text("");
|
$("#numberToWordOthers").text("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -417,6 +445,20 @@ $("#totalSumInsured").on("keyup", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function si_keup_num_to_word2(input) {
|
||||||
|
|
||||||
|
console.log('keyup sum insured');
|
||||||
|
var inputNumber = $(input).val();
|
||||||
|
console.log(inputNumber)
|
||||||
|
if (inputNumber) {
|
||||||
|
var result = convertCommaNumberToWords(inputNumber);
|
||||||
|
|
||||||
|
$("#numberToWordOthers").text(result);
|
||||||
|
} else {
|
||||||
|
$("#numberToWordOthers").text("");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function appendPolicyTermsHTML(policy_type) {
|
function appendPolicyTermsHTML(policy_type) {
|
||||||
|
|
||||||
@ -429,6 +471,25 @@ function appendPolicyTermsHTML(policy_type) {
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
|
<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;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="totalSumInsured">Policy Type</label>
|
<label for="totalSumInsured">Policy Type</label>
|
||||||
@ -528,6 +589,25 @@ function appendPolicyTermsHTML(policy_type) {
|
|||||||
|
|
||||||
<div class="form-group EDLI">
|
<div class="form-group EDLI">
|
||||||
|
|
||||||
|
<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;">
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="totalSumInsured">Existing Insurer</label>
|
<label for="totalSumInsured">Existing Insurer</label>
|
||||||
@ -592,28 +672,31 @@ function appendPolicyTermsHTML(policy_type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendOtherTermsSIAddMore(data = null){
|
function appendOtherSIAddMore(data = null) {
|
||||||
|
|
||||||
console.log('function called')
|
const addMoreContainer = document.getElementById('sum_insured_add_more');
|
||||||
|
|
||||||
var html = `
|
console.log(addMoreContainer)
|
||||||
<div class="row" style="margin-bottom: 10px;">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<label for="sumInsured">Additional Sum Insured</label>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-4">
|
|
||||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
|
||||||
</div>
|
|
||||||
<div class="col-md-2">
|
|
||||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-6">
|
|
||||||
<div class="text-danger-2 numberToWordSumInsured"></div>
|
|
||||||
</div>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
$('#other_si_add_more').append(html);
|
const html = `
|
||||||
|
<div class="row" style="margin-bottom: 10px;">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="sumInsured">Additional Sum Insured</label>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<input style="width: 128%;" value="${data ? data : ''}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
|
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||||
|
<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 class="text-danger-2 numberToWordSumInsured"></div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
addMoreContainer.insertAdjacentHTML('beforeend', html);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -111,9 +111,9 @@
|
|||||||
<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 type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word(this)">
|
<input style="width: 128%;" type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -141,14 +141,14 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
||||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
||||||
<td style="width: 28%;" ><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 > 0) ? $self_min_age : '18'; ?>" style="width: 35%;;" type="number" name="self_min_age" id="self_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><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 > 0) ? $self_min_age : '18'; ?>" style="width: 35%;;" type="number" name="self_min_age" id="self_min_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
<td style="width: 28%;" ><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: 35%;;" type="number" name="self_max_age" id="self_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><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: 35%;;" type="number" name="self_max_age" id="self_max_age" onchange="lowerIsEighteen(this)"></div></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>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
||||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
||||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 35%;;" type="number" name="spouse_min_age" id="spouse_min_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 35%;;" type="number" name="spouse_max_age" id="spouse_max_age" onchange="lowerIsEighteen(this)"></div></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>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 11%;"><span for="children">Children:</span></td>
|
<td style="width: 11%;"><span for="children">Children:</span></td>
|
||||||
@ -190,8 +190,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 30%; width: 30%;background: lightgray;" type="number" name="elder_member_count" id="member_count" readonly></div></td>
|
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 30%; width: 30%;background: lightgray;" type="number" name="elder_member_count" id="member_count" readonly></div></td>
|
||||||
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 32px;"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 35%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 32px;"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 35%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 17px;"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 35%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" oninput="lowerIsEighteen(this)"></div></td>
|
<td style="width: 28%;" ><div class="other-member-age" style="margin-left: 17px;"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 35%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" onchange="lowerIsEighteen(this)"></div></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -507,7 +507,7 @@
|
|||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="totalSumInsured">AYUSH treatment cover Data</label>
|
<label for="totalSumInsured">AYUSH treatment cover Limit</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="ayushTreatmentCoverData" id="ayushTreatmentCoverData" class="form-control">
|
<input type="text" name="ayushTreatmentCoverData" id="ayushTreatmentCoverData" class="form-control">
|
||||||
@ -637,7 +637,7 @@
|
|||||||
|
|
||||||
<div class="row" style="margin-bottom: 10px;display:none;">
|
<div class="row" style="margin-bottom: 10px;display:none;">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="totalSumInsured">Cataract Data</label>
|
<label for="totalSumInsured">Cataract Limit</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<input type="text" name="cataractData" id="cataractData" class="form-control">
|
<input type="text" name="cataractData" id="cataractData" class="form-control">
|
||||||
@ -929,10 +929,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (key.includes("multiple_sum_insured")) {
|
// if (key.includes("multiple_sum_insured")) {
|
||||||
jsonObject[key].forEach((value, index) => {
|
// jsonObject[key].forEach((value, index) => {
|
||||||
appendGMCSIAddMore(value);
|
// appendGMCSIAddMore(value);
|
||||||
});
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (key.includes("multiple_sum_insured") && key != "") {
|
||||||
|
|
||||||
|
if (Array.isArray(jsonObject[key])) {
|
||||||
|
jsonObject[key].forEach((value, index) => {
|
||||||
|
appendGMCSIAddMore(value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error(`${key} is not an array.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.includes("family_floaters")) {
|
if (key.includes("family_floaters")) {
|
||||||
@ -1418,9 +1429,9 @@
|
|||||||
<label for="sumInsured">Additional Sum Insured</label>
|
<label for="sumInsured">Additional Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
<input style="width: 128%;" value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGMCSIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -91,9 +91,9 @@
|
|||||||
<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 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>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@ -137,13 +137,13 @@
|
|||||||
<td style="width: 20%;">
|
<td style="width: 20%;">
|
||||||
<div class="self-age">
|
<div class="self-age">
|
||||||
<span style="margin-right: 20px;">Min Age:</span>
|
<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" oninput="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>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td style="width: 20%;">
|
<td style="width: 20%;">
|
||||||
<div class="self-age">
|
<div class="self-age">
|
||||||
<span style="margin-right: 20px;">Max Age:</span>
|
<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" oninput="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>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td ></td>
|
<td ></td>
|
||||||
@ -575,11 +575,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.includes("multiple_sum_insured")) {
|
if (key.includes("multiple_sum_insured") && key != "") {
|
||||||
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
|
||||||
appendGPASIAddMore(value);
|
if (Array.isArray(gpaJsonObjectForSpecialCondition[key])) {
|
||||||
});
|
gpaJsonObjectForSpecialCondition[key].forEach((value, index) => {
|
||||||
|
appendGPASIAddMore(value);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error(`${key} is not an array.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let jsonObject = JSON.parse(res.data);
|
let jsonObject = JSON.parse(res.data);
|
||||||
@ -792,9 +798,9 @@
|
|||||||
<label for="sumInsured">Additional Sum Insured</label>
|
<label for="sumInsured">Additional Sum Insured</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<input value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
<input style="width: 128%;" value="${data == null || data == undefined || data == "" ? '' : data}" type="text" name="multiple_sum_insured[]" class="form-control multiple_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this); numtowordinkeyup(this)">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||||
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
<button type="button" class="btn btn-danger si-remove-multi" onclick="removeGMCAdditionalSI(this)">x</button>
|
||||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
<button type="button" class="btn btn-primary si-add-more" onclick="appendGPASIAddMore()">+</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -63,8 +63,7 @@
|
|||||||
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
||||||
Individual </label>
|
Individual </label>
|
||||||
<input type="radio" id="single" name="premium_type" value="1">
|
<input type="radio" id="single" name="premium_type" value="1">
|
||||||
<label for="single" style="position: relative;top: 5px;left: 5px;"> Single
|
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
|
||||||
Insurance </label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -123,8 +122,7 @@
|
|||||||
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
||||||
Individual </label>
|
Individual </label>
|
||||||
<input type="radio" id="single_2" name="premium_type" value="1">
|
<input type="radio" id="single_2" name="premium_type" value="1">
|
||||||
<label for="single" style="position: relative;top: 5px;left: 5px;"> Single
|
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
|
||||||
Insurance </label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -827,12 +825,16 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$("#GridForm").submit(async function(event) {
|
$("#GridForm").submit(function(event) {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
var check = checkDuplicate(0);
|
var check = checkDuplicate(0);
|
||||||
console.log(check)
|
console.log(check)
|
||||||
|
if(check){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
if ($('#grid_emp_count').val() == 'false') {
|
if ($('#grid_emp_count').val() == 'false') {
|
||||||
toastr.warning('Client has active employees', 'Warning');
|
toastr.warning('Client has active employees', 'Warning');
|
||||||
@ -854,9 +856,16 @@ $("#GridForm").submit(async function(event) {
|
|||||||
|
|
||||||
|
|
||||||
checkPolicyTermsSI(function(result) {
|
checkPolicyTermsSI(function(result) {
|
||||||
|
|
||||||
|
console.log('checkPolicyTermsSI callback')
|
||||||
|
console.log(result);
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
|
||||||
if (check) {
|
console.log('after result');
|
||||||
|
|
||||||
|
|
||||||
|
if (check = false) {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
} else {
|
} else {
|
||||||
@ -901,15 +910,14 @@ $("#GridForm").submit(async function(event) {
|
|||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
toastr.warning(`Value does not exist in the Policy Terms.`);
|
toastr.warning(`Sum Insured Amount does not exist in the Policy Terms.`);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
console.error('Error checking policy terms:', error);
|
console.error('Error checking policy terms:', error);
|
||||||
// Handle error if necessary
|
// Handle error if necessary
|
||||||
toastr.error(`Error checking policy terms: ${error}`);
|
console.log(`Error checking policy terms: ${error}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -941,46 +949,61 @@ $("#AdditionalGridForm").submit(function(event) {
|
|||||||
var formData = new FormData($('#AdditionalGridForm')[0]);
|
var formData = new FormData($('#AdditionalGridForm')[0]);
|
||||||
var policy_form_action = '<?= base_url("client/premimum/create") ?>';
|
var policy_form_action = '<?= base_url("client/premimum/create") ?>';
|
||||||
|
|
||||||
|
checkPolicyTermsSI(function(result) {
|
||||||
|
|
||||||
if (check) {
|
if (!result) {
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
} else {
|
|
||||||
$.ajax({
|
|
||||||
data: formData,
|
|
||||||
url: policy_form_action,
|
|
||||||
type: "POST",
|
|
||||||
dataType: 'json',
|
|
||||||
processData: false,
|
|
||||||
contentType: false,
|
|
||||||
success: function(res) {
|
|
||||||
|
|
||||||
//console.log("Response", res);
|
|
||||||
|
|
||||||
if (res.status === false) {
|
|
||||||
toastr.error('Policy Dose Not Create', 'Error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (check) {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
data: formData,
|
||||||
|
url: policy_form_action,
|
||||||
|
type: "POST",
|
||||||
|
dataType: 'json',
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
success: function(res) {
|
||||||
|
|
||||||
var message = (policy_PrimaryKey === '') ?
|
//console.log("Response", res);
|
||||||
'Policy Additional Rack Rate Added successfully' :
|
|
||||||
'Policy Additional Rack Rate Added Successfully';
|
|
||||||
toastr.success(message, 'Success');
|
|
||||||
$('.close').click();
|
|
||||||
|
|
||||||
},
|
if (res.status === false) {
|
||||||
error: function(xhr, status, error) {
|
toastr.error('Policy Dose Not Create', 'Error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
console.error(xhr.responseText);
|
$('.loader').fadeOut();
|
||||||
console.error(status, error);
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
var message = (policy_PrimaryKey === '') ?
|
||||||
|
'Policy Additional Rack Rate Added successfully' :
|
||||||
|
'Policy Additional Rack Rate Added Successfully';
|
||||||
|
toastr.success(message, 'Success');
|
||||||
|
$('.close').click();
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}else{
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
toastr.warning(`Sum Insured Amount does not exist in the Policy Terms.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch(function(error) {
|
||||||
|
console.error('Error checking policy terms:', error);
|
||||||
|
// Handle error if necessary
|
||||||
|
console.log(`Error checking policy terms: ${error}`);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -2936,10 +2959,9 @@ function checkTermsSISameAsRackRateSI(input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function checkPolicyTermsSI(callback) {
|
function checkPolicyTermsSI(callback) {
|
||||||
|
|
||||||
|
console.log('checkPolicyTermsSI function called');
|
||||||
console.log('r function called');
|
|
||||||
|
|
||||||
var id = $('#additional_grid')[0];
|
var id = $('#additional_grid')[0];
|
||||||
var container = $('#additional_grid_content_input');
|
var container = $('#additional_grid_content_input');
|
||||||
@ -2951,111 +2973,109 @@ function checkTermsSISameAsRackRateSI(input) {
|
|||||||
container = $('#grid_content_input');
|
container = $('#grid_content_input');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
console.log(id);
|
console.log(id);
|
||||||
console.log(container);
|
console.log(container);
|
||||||
|
|
||||||
var siInputs = 0;
|
var siInputs = null;
|
||||||
|
|
||||||
if (id.value === '2') {
|
switch (id.value) {
|
||||||
siInputs = container.find('input[name="gpa_si"]');
|
case '1':
|
||||||
} else if (id.value === '3') {
|
var selectedValue = $('#si_or_bp').val();
|
||||||
siInputs = container.find('input[name="3_si[]"]');
|
if (selectedValue == 1) {
|
||||||
} else if (id.value === '4') {
|
siInputs = container.find('input[name="gpa_sum_si[]"]');
|
||||||
siInputs = container.find('input[name="4_si[]"]');
|
} else if (selectedValue == 3) {
|
||||||
} else if (id.value === '5') {
|
siInputs = container.find('input[name="gpa_sum_si2[]"]');
|
||||||
siInputs = container.find('input[name="5_si[]"]');
|
}
|
||||||
} else if (id.value === '6') {
|
break;
|
||||||
siInputs = container.find('input[name="6_si[]"]');
|
case '2':
|
||||||
} else if (id.value === '7') {
|
siInputs = container.find('input[name="gpa_si"]');
|
||||||
siInputs = container.find('input[name="7_si[]"]');
|
break;
|
||||||
} else if (id.value === '8') {
|
case '3':
|
||||||
siInputs = container.find('input[name="8_si[]"]');
|
siInputs = container.find('input[name="3_si[]"]');
|
||||||
} else if (id.value === '9') {
|
break;
|
||||||
siInputs = container.find('input[name="9_si[]"]');
|
case '4':
|
||||||
} else if (id.value === '10') {
|
siInputs = container.find('input[name="4_si[]"]');
|
||||||
siInputs = container.find('input[name="10_si[]"]');
|
break;
|
||||||
} else if (id.value === '11') {
|
case '5':
|
||||||
siInputs = container.find('input[name="11_si[]"]');
|
siInputs = container.find('input[name="5_si[]"]');
|
||||||
} else if (id.value === '1') {
|
break;
|
||||||
var selectedValue = $('#si_or_bp').val();
|
case '6':
|
||||||
|
siInputs = container.find('input[name="6_si[]"]');
|
||||||
if (selectedValue == 1) {
|
break;
|
||||||
siInputs = container.find('input[name="gpa_sum_si[]"]');
|
case '7':
|
||||||
} else if (selectedValue == 3) {
|
siInputs = container.find('input[name="7_si[]"]');
|
||||||
siInputs = container.find('input[name="gpa_sum_si2[]"]');
|
break;
|
||||||
}
|
case '8':
|
||||||
|
siInputs = container.find('input[name="8_si[]"]');
|
||||||
|
break;
|
||||||
|
case '9':
|
||||||
|
siInputs = container.find('input[name="9_si[]"]');
|
||||||
|
break;
|
||||||
|
case '10':
|
||||||
|
siInputs = container.find('input[name="10_si[]"]');
|
||||||
|
break;
|
||||||
|
case '11':
|
||||||
|
siInputs = container.find('input[name="11_si[]"]');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
siInputs = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('siInputs', siInputs);
|
||||||
|
|
||||||
var client_policy_id = $('#client_policy_id').val();
|
var client_policy_id = $('#client_policy_id').val();
|
||||||
console.log('client_policy_id', client_policy_id)
|
console.log('client_policy_id', client_policy_id);
|
||||||
|
|
||||||
var url = '<?php echo base_url('util/getPolicyTerms/') ?>' + client_policy_id;
|
var url = '<?php echo base_url('util/getPolicyTerms/') ?>' + client_policy_id;
|
||||||
|
|
||||||
var arrayLength = 0;
|
console.log('url', url);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
|
||||||
console.log(response);
|
console.log(response);
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
|
|
||||||
var array1 = response.data;
|
var policy_terms_si = response.data;
|
||||||
var array2 = [];
|
var rack_rate_si = [];
|
||||||
|
|
||||||
siInputs.each(function() {
|
siInputs.each(function() {
|
||||||
var input = $(this).val();
|
var input = $(this).val();
|
||||||
array2.push(input.replace(/,/g, ''));
|
rack_rate_si.push(input.replace(/,/g, ''));
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('array1', array1)
|
console.log('policy_terms_si', policy_terms_si);
|
||||||
console.log('array2', array2)
|
console.log('rack_rate_si', rack_rate_si);
|
||||||
|
|
||||||
|
let new_array = [];
|
||||||
|
|
||||||
function intersection(arr1, arr2) {
|
rack_rate_si.forEach(element => {
|
||||||
return arr1.filter(value => arr2.includes(value));
|
if (!policy_terms_si.includes(element)) {
|
||||||
|
new_array.push(element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('filtered array', new_array);
|
||||||
|
|
||||||
|
var arrayLength = new_array.length;
|
||||||
|
console.log('arrayLength', arrayLength);
|
||||||
|
|
||||||
|
if (arrayLength > 0) {
|
||||||
|
callback(true);
|
||||||
|
} else {
|
||||||
|
callback(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var commonElements = intersection(array1, array2);
|
|
||||||
|
|
||||||
function removeCommonElements(arr, common) {
|
|
||||||
return arr.filter(value => !common.includes(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
array1 = removeCommonElements(array1, commonElements);
|
|
||||||
array2 = removeCommonElements(array2, commonElements);
|
|
||||||
|
|
||||||
console.log('array1', array1)
|
|
||||||
console.log('array2', array2)
|
|
||||||
|
|
||||||
|
|
||||||
// var result = array1.concat(array2);
|
|
||||||
var result = array1;
|
|
||||||
|
|
||||||
console.log('result', result)
|
|
||||||
|
|
||||||
arrayLength = result.length;
|
|
||||||
|
|
||||||
console.log('arrayLength', arrayLength)
|
|
||||||
|
|
||||||
if (arrayLength > 0) {
|
|
||||||
callback(true);
|
|
||||||
} else {
|
|
||||||
callback(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.log(xhr.responseText);
|
||||||
console.error(status, error);
|
console.log(status, error);
|
||||||
toastr.error(`Failed to retrieve Policy Terms. Error: ${error}`);
|
console.log(`Failed to retrieve Policy Terms. Error: ${error}`);
|
||||||
callback(false);
|
callback(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user