diff --git a/app/Views/client_info.php b/app/Views/client_info.php
index 9eebe82d..94bc56ee 100644
--- a/app/Views/client_info.php
+++ b/app/Views/client_info.php
@@ -16,7 +16,8 @@
-
+
-
+
-
+
@@ -253,7 +254,7 @@
-
@@ -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 =
- `${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}: ${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 =
`${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:`;
const nestedList = document.createElement('ul');
-
nestedList.appendChild(createListItems(obj[key]));
-
listItem.appendChild(nestedList);
-
} else {
listItem.innerHTML =
`${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}: ${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));
});
-
\ No newline at end of file
diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php
index d80a764c..a4f5a177 100644
--- a/app/Views/policy_grid.php
+++ b/app/Views/policy_grid.php
@@ -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, ''));
});