FIX_CLIENT_INFO_AND_RR_CHECK_SI : RV

This commit is contained in:
VENKATESHWARAN 2024-06-21 19:57:29 +05:30
parent 9ff46033eb
commit 644a525976
2 changed files with 62 additions and 43 deletions

View File

@ -16,7 +16,8 @@
<div class="row">
<div class="col-6" style="position: relative;left: 455px;">
<button id="close_btn" class="btn btn-primary waves-effect waves-light client_info_close">Close</button>
<button id="close_btn"
class="btn btn-primary waves-effect waves-light client_info_close">Close</button>
</div>
<div class="col-1 float-right" style="position: relative;left: 255px;">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse"
@ -33,7 +34,7 @@
<div class="card-body" style="position: relative;bottom: 25px;">
<div class="row" >
<div class="row">
<div class="col-6">
@ -204,7 +205,7 @@
</div>
</div>
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" style="position: relative;bottom: 25px;">
<div class="card-body" style="position: relative;bottom: 25px;">
<div class="row">
<table id="tb1" class="table table-hover m-0 table-centered dt-responsive nowrap w-100"
cellspacing="0">
@ -253,7 +254,7 @@
</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body" id="modal_body" >
<div class="modal-body" id="modal_body">
</div>
</div><!-- /.modal-content -->
@ -270,62 +271,71 @@ $(document).ready(function() {
$(document).on('click', '.policy_terms', function() {
var terms = $(this).data('id');
console.log(terms);
console.log(terms.length);
console.log(JSON.stringify(terms));
// terms = JSON.parse(terms);
$('#modal_body').empty();
function createListItems(obj) {
if (obj.length == 0) {
const message = document.createElement('div');
message.textContent = 'Policy Terms Not Available';
message.style.display = 'flex';
message.style.justifyContent = 'center';
message.style.alignItems = 'center';
message.style.height = '100%'; // Adjust as necessary to fit the context
message.style.textAlign = 'center';
return message;
}
const fragment = document.createDocumentFragment();
for (const key in obj) {
if (
obj.hasOwnProperty(key) &&
obj[key] !== null &&
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") {
obj.hasOwnProperty(key) &&
obj[key] !== null &&
obj[key] !== '' &&
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');
let formattedKey = key.replace(/_/g, ' ');
var formattedKey = '';
formattedKey = key.replace(/_/g, ' ');
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
console.log('type', typeof obj[key])
// Strip HTML tags from values
if (typeof obj[key] === 'string') {
console.log('before', obj[key])
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
console.log('after', obj[key])
}
// Convert 0 and 1 to 'No' and 'Yes'
if (obj[key] == 0) {
obj[key] = 'No';
}
if (obj[key] == 1) {
obj[key] = 'Yes';
}
console.log(formattedKey)
if (key == 'burnExpenses' && obj[key] == 'Yes') {
listItem.innerHTML =
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${obj['burnExpensesData']}`;
} else if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
// Handle nested objects
if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
listItem.innerHTML =
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong>`;
const nestedList = document.createElement('ul');
nestedList.appendChild(createListItems(obj[key]));
listItem.appendChild(nestedList);
} else {
listItem.innerHTML =
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${Array.isArray(obj[key]) ? JSON.stringify(obj[key]) : obj[key]}`;
@ -337,8 +347,8 @@ $(document).on('click', '.policy_terms', function() {
return fragment;
}
$('#modal_body').append(createListItems(terms));
});
</script>

View File

@ -2597,6 +2597,8 @@ function si_orbp_change_function() {
// $('.gpa_sum_insure_remove').remove();
var selectedValue = $('#si_or_bp').val();
console.log('selectedValue', selectedValue)
if (selectedValue == 2) {
$('.gpa_sum_insure_remove').hide();
@ -2682,8 +2684,8 @@ function si_orbp_change_function() {
$('#basic_multiplier').removeAttr('required', false);
$('#premium_multiplier').removeAttr('required', false);
$('#basic_pay').removeAttr('required', false);
$('#gpa_basic_si').removeAttr('required', false);
$('#gpa_basic_premium').removeAttr('required', false);
$('#gpa_basic_si_first').removeAttr('required', false);
$('#gpa_basic_premium_first').removeAttr('required', false);
$('#gpa_sum_multiplier2').removeAttr('required', false);
$('#gpa_sum_si2').removeAttr('required', false);
@ -2734,8 +2736,8 @@ function si_orbp_change_function() {
$('#basic_multiplier').removeAttr('required', false);
$('#premium_multiplier').removeAttr('required', false);
$('#basic_pay').removeAttr('required', false);
$('#gpa_basic_si').removeAttr('required', false);
$('#gpa_basic_premium').removeAttr('required', false);
$('#gpa_basic_si_first').removeAttr('required', false);
$('#gpa_basic_premium_first').removeAttr('required', false);
$('#gpa_sum_multiplier').attr('required', false);
$('#gpa_sum_si').attr('required');
@ -2994,13 +2996,13 @@ function checkPolicyTermsSI(callback) {
siInputs = container.find('input[name="3_si[]"]');
break;
case '4':
siInputs = container.find('input[name="4_si[]"]');
siInputs = container.find('input[name="4_si"]');
break;
case '5':
siInputs = container.find('input[name="5_si[]"]');
break;
case '6':
siInputs = container.find('input[name="6_si[]"]');
siInputs = container.find('input[name="6_si"]');
break;
case '7':
siInputs = container.find('input[name="7_si[]"]');
@ -3009,7 +3011,7 @@ function checkPolicyTermsSI(callback) {
siInputs = container.find('input[name="8_si[]"]');
break;
case '9':
siInputs = container.find('input[name="9_si[]"]');
siInputs = container.find('input[name="gpa_si"]');
break;
case '10':
siInputs = container.find('input[name="10_si[]"]');
@ -3017,6 +3019,12 @@ function checkPolicyTermsSI(callback) {
case '11':
siInputs = container.find('input[name="11_si[]"]');
break;
case '12':
siInputs = container.find('input[name="12_si[]"]');
break;
case '13':
siInputs = container.find('input[name="13_si[]"]');
break;
default:
siInputs = [];
}
@ -3044,6 +3052,7 @@ function checkPolicyTermsSI(callback) {
siInputs.each(function() {
var input = $(this).val();
console.log('input value', input);
rack_rate_si.push(input.replace(/,/g, ''));
});