-
Self
+
Self
Spouse
Child 1
Child 2
@@ -351,17 +351,12 @@
var policy_grid_id = $('#client_id').val();
var grid_html = '';
-$('#gmc_remove').hide();
-$('#btnGridSubmit').hide();
$('.close').click(function(){
$('#sum_insured').val("");
$('#familyfloater').val("");
$('#waiverofpreexistingdiseases').prop('checked', false);
$('#maternitycoverage').val("");
- for (var i = 1; i <= 11; i++) {
- $('#grid_' + i).remove();
- }
});
@@ -501,438 +496,123 @@ $('body').on('click', '.btnPolicyMaster', function () {
var client_id = $('#Client_id').val();
$('#client_policy_id').val(policy_id);
+
+ var policy_type_id = $(this).attr('id');
+ console.log('policy_type_id', typeof policy_type_id)
- $('#policyGMCTerms').css('display', '');
- $('#police-tab').css('display', 'none');
- $('.nav.nav-pills.navtab-bg').css('display','none');
- $('.nav.nav-pills.navtab-bg').prev().css('display','none');
+ if(policy_type_id >= '2'){
+
+ $('#policyGMCTerms').css('display', '');
+ $('#police-tab').css('display', 'none');
+ $('.nav.nav-pills.navtab-bg').css('display','none');
+ $('.nav.nav-pills.navtab-bg').prev().css('display','none');
- $.ajax({
- url: '= base_url("client/policy/getterms") ?>',
- method: 'GET',
- data: { policy_id : policy_id , client_id: client_id},
- success: function(response) {
- if (response) {
- let jsonObject = JSON.parse(response);
- Object.keys(jsonObject).forEach(function(key) {
- if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
- if (key.includes("special_condition_label")) {
- for (let index = 0; index < jsonObject[key].length; index++) {
- specialCondition();
- }
- }
- let elements = document.getElementsByName(`${key}[]`);
-
- if (elements) {
- elements.forEach((element,index) => {
- element.value = jsonObject[key][index];
- });
- }
- }
-
- if (key.includes("family_floaters")) {
- let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
- if (jsonObject[key]) {
- jsonObject[key].forEach(element => {
- let checkbox = $(`#${element}`);
- if (checkbox.is(":checkbox")) {
- checkbox.prop("checked", true);
- }
- });
- }
-
- }
-
-
- let elements = document.getElementsByName(key);
- if (elements && elements.length > 0) {
- let element = elements[0]; // Assuming you want to update the first element with the name
-
-
- if (element.tagName === 'INPUT' && (element.type === 'checkbox' || element.type === 'radio')) {
-
- if (element.type === 'checkbox') {
- element.checked = jsonObject[key] === '1'; // Assuming jsonObject[key] is '1' or '0' for checkbox
- } else if (element.type === 'radio') {
-
- if (element.value === jsonObject[key]) {
- element.checked = element.value === jsonObject[key];
-
- if(element.name === "family_floater") {
- element.parentElement.nextElementSibling.style.display='';
- element.parentElement.parentElement.parentElement.nextElementSibling.style.display='';
- }else if(element.name === "waiverofpreexistingdiseases"){
- element.parentElement.parentElement.nextElementSibling.style.display='';
- element.parentElement.parentElement.nextElementSibling.nextElementSibling.style.display='';
- element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.style.display='';
- element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.style.display='';
-
+ $.ajax({
+ url: '= base_url("client/policy/getterms") ?>',
+ method: 'GET',
+ data: { policy_id : policy_id , client_id: client_id},
+ success: function(response) {
+ if (response) {
+ let jsonObject = JSON.parse(response);
+ Object.keys(jsonObject).forEach(function(key) {
+ if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
+ if (key.includes("special_condition_label")) {
+ for (let index = 0; index < jsonObject[key].length; index++) {
+ specialCondition();
}
-
+ }
+ let elements = document.getElementsByName(`${key}[]`);
- } else {
- element.nextElementSibling.checked = element.value ;
+ if (elements) {
+ elements.forEach((element,index) => {
+ element.value = jsonObject[key][index];
+ });
}
}
- }else if(key === "Wellness" || key === "additionalsicknessbenefit"){
- let wysiwygElement = element.previousElementSibling.querySelector('.jodit-wysiwyg');
+
+ if (key.includes("family_floaters")) {
+ let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
+ if (jsonObject[key]) {
+ jsonObject[key].forEach(element => {
+ let checkbox = $(`#${element}`);
+ if (checkbox.is(":checkbox")) {
+ checkbox.prop("checked", true);
+ }
+ });
+ }
+
+ }
- if (wysiwygElement) {
- let pTag = wysiwygElement.querySelector('p'); // Find the
tag inside the wysiwyg element
- if (pTag) {
- // pTag.innerHTML = ''; // Clear the content inside the
tag
- pTag.innerHTML = jsonObject[key]; // Add your new content inside the
tag
+ let elements = document.getElementsByName(key);
+ if (elements && elements.length > 0) {
+ let element = elements[0]; // Assuming you want to update the first element with the name
+
+
+ if (element.tagName === 'INPUT' && (element.type === 'checkbox' || element.type === 'radio')) {
+
+ if (element.type === 'checkbox') {
+ element.checked = jsonObject[key] === '1'; // Assuming jsonObject[key] is '1' or '0' for checkbox
+ } else if (element.type === 'radio') {
+
+ if (element.value === jsonObject[key]) {
+ element.checked = element.value === jsonObject[key];
+
+ if(element.name === "family_floater") {
+ element.parentElement.nextElementSibling.style.display='';
+ element.parentElement.parentElement.parentElement.nextElementSibling.style.display='';
+ }else if(element.name === "waiverofpreexistingdiseases"){
+ element.parentElement.parentElement.nextElementSibling.style.display='';
+ element.parentElement.parentElement.nextElementSibling.nextElementSibling.style.display='';
+ element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.style.display='';
+ element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.style.display='';
+
+ }
+
+
+ } else {
+ element.nextElementSibling.checked = element.value ;
+ }
+ }
+ }else if(key === "Wellness" || key === "additionalsicknessbenefit"){
+ let wysiwygElement = element.previousElementSibling.querySelector('.jodit-wysiwyg');
+
+
+ if (wysiwygElement) {
+ let pTag = wysiwygElement.querySelector('p'); // Find the
tag inside the wysiwyg element
+ if (pTag) {
+ // pTag.innerHTML = ''; // Clear the content inside the
tag
+ pTag.innerHTML = jsonObject[key]; // Add your new content inside the
tag
+ }
+ }
+ // console.log(jsonObject[key]);
+ }else {
+ element.value = jsonObject[key];
}
}
- // console.log(jsonObject[key]);
- }else {
- element.value = jsonObject[key];
- }
+ });
+ }
+
+
+ $('.jodit-wysiwyg').each(function() {
+ $(this).click();
+ });
+
+
+ },
+
+ error: function(xhr, status, error) {
+ console.error('Error:', status, error);
}
});
+
}
-
- $('.jodit-wysiwyg').each(function() {
- $(this).click();
- });
-
-
-},
-
- error: function(xhr, status, error) {
- console.error('Error:', status, error);
- }
});
- // $.ajax({
- // url: '= base_url("util/policy-premium") ?>' ,
- // type: "GET",
- // data: { policy_id: policy_id, client_id: client_id },
- // dataType: 'json',
- // success: function (res) {
- // console.log('responce :', res);
-
- // if (res.status === false) {
- // toastr.error(res.status);
- // return;
- // }
- // var policy_grid_id_value = '';
- // if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) {
- // policy_grid_id_value = res.premiumData[0].policy_grid_id;
- // }
-
- // $('#grid_content_input').empty();
- // var policeGridOptionHTML = '';
- // policeGridOptionHTML += ` `;
- // $.each(res.data, function(index, item) {
- // policeGridOptionHTML += '';
- // });
- // $('#grid').html(policeGridOptionHTML);
-
-
- // console.log('Length', res.premiumData.length)
- // if (res.premiumData && res.premiumData.length > 0) {
-
- // addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id);
-
- // res.premiumData.shift();
- // console.log(res.premiumData)
- // $.each(res.premiumData, function(index, item){
- // console.log('premiumData index :',index)
- // appendGridtHtml(item.policy_grid_id, item);
- // });
-
- // } else {
- // console.log("res.premiumData is undefined, null, or empty.");
- // }
-
- // $('#bs-example-modal-sm').modal('show');
- // },
- // error: function (xhr, status, error) {
- // console.error(xhr.responseText);
- // console.error(status, error);
- // }
- // });
-});
-
-
-var Count = 1
-function appendGridtHtml(ui_type = false, data = false,) {
-
- var html = '';
- console.log('appendGridtHtml function called ');
- // console.log('Grid Content',data)
- console.log('UI TYPE :', ui_type);
- Count++;
- var container = document.getElementById('grid_content_input');
-
- if(ui_type == '3'){
-
- html = `
-
- `;
-
- }else if(ui_type == '4'){
-
-
- html =`
-
`;
-
- }else if(ui_type == '5'){
-
-
- html = `
-
`;
-
- }else if(ui_type == '6'){
-
- html =`
-
`;
-
- }else if(ui_type == '7'){
-
- html = `
-
`;
-
- }else if(ui_type == '8'){
-
- html = `
-
`;
-
- }else if(ui_type == '9'){
-
- html = `
-
`;
-
- }else if(ui_type == '10'){
-
- html = `
-
`;
-
- }else if(ui_type == '11'){
-
- html = `
-
`;
- }
-
-
-
-
- container.insertAdjacentHTML('beforeend', html);
- $('#gmc_add_more').hide()
- $('#gmc_remove').show()
- // console.log('count 1',Count)
- Count--
- // console.log('count 2',Count)
- $('#gmc_add_more_'+Count).hide()
- Count++
- // console.log('count 3',Count)
-
-}
-
-function removebutton(index, type) {
-
- if(index == 0){
- var inputs = document.querySelectorAll('#grid_'+ type +' input');
- inputs.forEach(function(input) {
- input.value = '';
- });
- }else{
-
- var element = document.getElementById('removeChild_'+ index);
- var gridContentDiv = document.getElementById('grid_content_input');
- var count = gridContentDiv.childElementCount;
-
- if (element) {
- element.remove();
- }
-
- if(count == 2){
- $('#gmc_add_more').show();
- }
-
- index--;
- $('#gmc_add_more_'+index).show();
- }
-
-}
-
diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php
index 624cca84..2168552b 100644
--- a/app/Views/policy_gpa_terms.php
+++ b/app/Views/policy_gpa_terms.php
@@ -1,4 +1,3 @@
-
-