CODE_MERGE : RV

This commit is contained in:
VENKATESHWARAN 2024-03-01 13:44:28 +05:30
commit d5befa4529
3 changed files with 608 additions and 225 deletions

View File

@ -55,8 +55,8 @@ $routes->group("/client", ["filter" => "authMVC"], function($routes){
$routes->post("create", "ClientController::createClientPolicy");
$routes->post("edit", "ClientController::editClientPolicy");
$routes->get("list/(:any)", "ClientController::getClientPolicyById/$1");
$routes->post("jsonPost", "ClientController::jsonPost");
$routes->get("getjson", "ClientController::getjson");
$routes->post("policyGMCTerms", "ClientController::policyGMCTerms");
$routes->get("getterms", "ClientController::getterms");
});
$routes->group("kyc", ["filter" => "authMVC"], function($routes){

View File

@ -661,15 +661,15 @@ class ClientController extends AdminController
}
public function jsonPost()
public function policyGMCTerms()
{
try {
$this->myLogger->logme('error','JSon CREATE function called');
$this->myLogger->logme('error','Terms CREATE function called');
// print_r($this->request->getPost());
$client_id = $this->request->getPost("client_id");
$policy_id = $this->request->getPost("policy_id");
$data['sumInsured'] =$this->request->getPost("sumInsured");
$data['sum_insured'] =$this->request->getPost("sum_insured");
$data['family_floater'] =$this->request->getPost("family_floater");
// print_r($data['familyfloater']);
if (!$data['family_floater'] || $data['family_floater'] == 0) {
@ -697,7 +697,9 @@ class ClientController extends AdminController
$data['waiverof1,2,3&4thyearexclusions'] =$this->request->getPost("waiverof1,2,3&4thyearexclusions");
$data['waiverof30dayswaitingperiod'] =$this->request->getPost("waiverof30dayswaitingperiod");
$data['prehospitalizationcover'] =$this->request->getPost("prehospitalizationcover");
// $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
$data['congenitaldiseasesinternal'] =$this->request->getPost("congenitaldiseasesinternal");
// $data['congenitaldiseasesexternal'] =$this->request->getPost("congenitaldiseasesexternal");
$data['copayzonewisecopay'] =$this->request->getPost("copayzonewisecopay");
$data['bioabsorbablestenttoriclensmultifocallens'] =$this->request->getPost("bioabsorbablestenttoriclensmultifocallens");
$data['roomrentlimit'] =$this->request->getPost("roomrentlimit");
@ -721,13 +723,13 @@ class ClientController extends AdminController
$data['Wellness'] =$this->request->getPost("Wellness");
$data['days_of_discharge'] =$this->request->getPost("days_of_discharge");
$data['days_from_dod'] =$this->request->getPost("days_from_dod");
$data['specialConditionLabel'] = $this->request->getPost("specialConditionLabel") ?? [];
$data['specialConditionInput'] = $this->request->getPost("specialConditionInput") ?? [];
$data['special_condition_label'] = $this->request->getPost("special_condition_label") ?? [];
$data['special_condition_input'] = $this->request->getPost("special_condition_input") ?? [];
$jsonData = json_encode($data);
$dataa = array(
'json' => $jsonData,
'policy_terms' => $jsonData,
'client_id' => $client_id,
'policy_id' => $policy_id
);

View File

@ -49,7 +49,7 @@
display:none;
}
.jodit-container{
width: 690px !important;
width: 821px !important;
margin-top: 3px;
margin-bottom: 3px;
margin-left: 30px;
@ -70,16 +70,11 @@
width: 689px;
}
</style>
<div class="modal fade" id="bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal-dialog modal-full-width">
<div class="modal-content" style="border-radius: 10px;">
<div class="modal-header" style="background-color: #02a8b5; border-top-right-radius: 10px;border-top-left-radius: 10px;">
<h4 class="modal-title" id="myLargeModalLabel" style="color: white;">Client Policy Master</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form role="form" class="parsley-examples" method="post" id="policyJsonForm" enctype="multipart/form-data">
<div id="policyGMCTerms" style="display:none">
<span id="policyGMCTermsClose" style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
<h5><label for="gmcTerms" style="margin-bottom: 20px;">Policy GMC Terms</label></h5>
<form role="form" class="parsley-examples" method="post" id="policyJsonForm" enctype="multipart/form-data" >
<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_policy_id" id="client_policy_id" />
@ -89,7 +84,7 @@
<div class="form-column">
<div class="form-group col-md-6 form-group-client-policy-master">
<label for="emp_code" class=" " style="width: 400px;">Sum Insured</label>
<input type="text" name="sumInsured" id="sumInsured" class="form-control form-control-client-policy-master">
<input type="text" name="sum_insured" id="sum_insured" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class=" " style="width: 400px;">Family Floater</label><br>
@ -98,15 +93,21 @@
<input type="radio" name="family_floater" value="1"> Yes
<input type="radio" name="family_floater" value="0" style="margin-left:10px"> No
</div>
<div style="display:none; margin-top: 27px;margin-bottom: 7px; margin-left: 31px;">
<input type="checkbox" name="family_floaters[]" value="Self" id="Self"> Self
<input type="checkbox" name="family_floaters[]" value="Spouse" id="Spouse"> Spouse
<input type="checkbox" name="family_floaters[]" value="Child1" id="Child1"> Child 1
<input type="checkbox" name="family_floaters[]" value="Child2" id="Child2"> Child 2
<input type="checkbox" name="family_floaters[]" value="Child3" id="Child3"> Child 3
<input type="checkbox" name="family_floaters[]" value="Child4" id="Child4"> Child 4
<input type="checkbox" name="family_floaters[]" value="Parent1" id="Parent1"> Parent 1
<input type="checkbox" name="family_floaters[]" value="Parent2" id="Parent2"> Parent 2
<div style="display:none; margin-top: 27px;margin-bottom: 7px; margin-left: 31px;">
<div>
<input type="checkbox" name="family_floaters[]" value="Self" id="Self"> Self
<input type="checkbox" name="family_floaters[]" value="Spouse" id="Spouse"> Spouse
<input type="checkbox" name="family_floaters[]" value="Child1" id="Child1"> Child 1
<input type="checkbox" name="family_floaters[]" value="Child2" id="Child2"> Child 2
<input type="checkbox" name="family_floaters[]" value="Child3" id="Child3"> Child 3
<input type="checkbox" name="family_floaters[]" value="Child4" id="Child4"> Child 4
</div>
<div style="margin-top:10px">
<input type="checkbox" name="family_floaters[]" value="Parent1" id="Parent1"> Parent 1
<input type="checkbox" name="family_floaters[]" value="Parent2" id="Parent2"> Parent 2
<input type="checkbox" name="family_floaters[]" value="Parent_In_Law1" id="Parent_In_Law1"> Parent-In-Law 1
<input type="checkbox" name="family_floaters[]" value="Parent_In_Law2" id="Parent_In_Law2"> Parent-In-Law 2
</div>
</div>
</div>
@ -170,6 +171,10 @@
<label for="emp_code" class=" " style="width: 400px;">Pre Hospitalization Cover</label>
<input type="text" name="prehospitalizationcover" id="prehospitalizationcover" class="form-control form-control-client-policy-master">
</div>
<!-- <div class="form-group col-md-6 form-group-client-policy-master">
<label for="emp_code" class=" " style="width: 400px;">Post Hospitalization Cover</label>
<input type="text" name="posthospitalizationcover" id="posthospitalizationcover" class="form-control form-control-client-policy-master">
</div> -->
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="congenitaldiseasesinternal" style="width: 400px;">Congenital Diseases - Internal</label>
<div class="radiobuttondiv">
@ -177,6 +182,10 @@
<input type="radio" name="congenitaldiseasesinternal" value="no" style="margin-left:10px"> No
</div>
</div>
<!-- <div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="congenitaldiseasesexternal" style="width: 400px;">Congenital Diseases - External</label>
<input type="text" name="congenitaldiseasesexternal" id="congenitaldiseasesexternal" class="form-control form-control-client-policy-master">
</div> -->
<div class="form-group col-md-6 form-group-client-policy-master">
<label for="copayzonewisecopay" class=" " style="width: 400px;">Co-Pay/Zone wise Co Pay</label>
<select name="copayzonewisecopay" id="copayzonewisecopay" class="form-control form-control-client-policy-master">
@ -319,8 +328,10 @@
</div>
</div>
</div>
<!-- <hr> -->
<!-- <div class="form-row" id="grid_content_input">
@ -333,28 +344,29 @@
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
var policy_grid_id = $('#client_id').val();
var grid_html = '';
$('#gmc_remove').hide();
$('#btnGridSubmit').hide();
$('.close').click(function(){
$('#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();
}
});
$('#sumInsured').val("");
$('#familyfloater').val("");
$('#waiverofpreexistingdiseases').prop('checked', false);
$('#maternitycoverage').val("");
for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove();
}
});
$('input[name="family_floater"]').change(function() {
@ -372,47 +384,44 @@ var grid_html = '';
}
});
$(document).ready(function() {
// $(document).ready(function() {
if ($('input[name="waiverofpreexistingdiseases"]').val() == '1') {
var element = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next()[0];
$(element).css("display", "");
var element2 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next()[0];
$(element2).css("display", "");
var element3 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next()[0];
$(element3).css("display", "");
var element4 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next().next()[0];
$(element4).css("display", "");
} else {
var element = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next()[0];
$(element).css("display", "none");
var element2 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next()[0];
$(element2).css("display", "none");
var element3 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next()[0];
$(element3).css("display", "none");
var element4 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next().next()[0];
$(element4).css("display", "none");
}
if ($('input[name="family_floater"]').val() == '1') {
var element = $('input[name="family_floater"]').parent().next()[0];
$(element).css("display", "");
var element2 = $('input[name="family_floater"]').parent().parent().parent().next()[0];
$(element2).css("display", "");
} else {
var element = $('input[name="family_floater"]').parent().next()[0];
$(element).css("display", "none");
var element2 = $('input[name="family_floater"]').parent().parent().parent().next()[0];
$(element2).css("display", "none");
}
});
// if ($('input[name="waiverofpreexistingdiseases"]').val() == '1') {
// var element = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next()[0];
// $(element).css("display", "");
// var element2 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next()[0];
// $(element2).css("display", "");
// var element3 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next()[0];
// $(element3).css("display", "");
// var element4 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next().next()[0];
// $(element4).css("display", "");
// } else {
// var element = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next()[0];
// $(element).css("display", "none");
// var element2 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next()[0];
// $(element2).css("display", "none");
// var element3 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next()[0];
// $(element3).css("display", "none");
// var element4 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next().next()[0];
// $(element4).css("display", "none");
// }
// console.log("Family_floater");
// console.log($('input[name="family_floater"]').val());
// if ($('input[name="family_floater"]').val() == '1') {
// var element = $('input[name="family_floater"]').parent().next()[0];
// $(element).css("display", "");
// var element2 = $('input[name="family_floater"]').parent().parent().parent().next()[0];
// $(element2).css("display", "");
// } else {
// var element = $('input[name="family_floater"]').parent().next()[0];
// $(element).css("display", "none");
// var element2 = $('input[name="family_floater"]').parent().parent().parent().next()[0];
// $(element2).css("display", "none");
// }
// });
$('input[name="waiverofpreexistingdiseases"]').change(function() {
console.log("test 739 line.....");
console.log($(this).val());
if ($(this).val() == '1') {
var element = $(this).parent().parent().next()[0];
$(element).css("display", "");
@ -435,182 +444,554 @@ var grid_html = '';
});
$("#policyJsonForm").submit(function(event) {
event.preventDefault();
var isValid = $('#policyJsonForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return ;
}
var formData = new FormData($('#policyJsonForm')[0]);
var policy_form_action = '<?= base_url("client/policy/jsonPost") ?>';
$.ajax({
data: formData,
url: policy_form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
if (res.status === false) {
toastr.error('Policy Dose Not Create', 'Error');
return;
}
document.querySelectorAll('.specialConditionLabel\\[\\]').forEach(element => {
element.parentNode.remove();
});
console.log(res);
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' : 'Policy Premium Added Successfully';
toastr.success(message, 'Success');
$('.close').click();
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$("#policyJsonForm").submit(function(event) {
event.preventDefault();
var isValid = $('#policyJsonForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return ;
}
var formData = new FormData($('#policyJsonForm')[0]);
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
$.ajax({
data: formData,
url: policy_form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
if (res.status === false) {
toastr.error('Policy Dose Not Create', 'Error');
return;
}
});
document.querySelectorAll('.special_condition_label\\[\\]').forEach(element => {
element.parentNode.remove();
});
console.log(res);
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' : 'Policy Premium Added Successfully';
toastr.success(message, 'Success');
$('.close').click();
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
$('#policyGMCTerms').css('display', 'none');
$('#police-tab').css('display', '');
$('.nav.nav-pills.navtab-bg').css('display','');
$('.nav.nav-pills.navtab-bg').prev().css('display','');
});
$('body').on('click', '.btnPolicyMaster', function () {
$('body').on('click', '.btnPolicyMaster', function () {
var policy_id = $(this).data('id');
// console.log('policy_id :' ,policy_id);
$('#policy_id').val(policy_id);
var policy_id = $(this).data('id');
$('#policy_id').val(policy_id);
var client_id = $('#Client_id').val();
$('#client_policy_id').val(policy_id);
// console.log('client_id :' ,client_id);
$.ajax({
url: '<?= base_url("client/policy/getjson") ?>',
method: 'GET',
data: { policy_id : policy_id , client_id: client_id},
// dataType: 'json',
success: function(response) {
console.log(response);
// let jsonString = response.substring(response.indexOf('{'), response.lastIndexOf('}') + 1);
// console.log(jsonString);
if (response) {
let jsonObject = JSON.parse(response);
// console.log(jsonObject);
Object.keys(jsonObject).forEach(function(key) {
if (key.includes("specialConditionLabel") || key.includes("specialConditionInput")) {
if (key.includes("specialConditionLabel")) {
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}[]"]`);
jsonObject[key].forEach(element => {
let checkbox = $(`#${element}`);
if (checkbox.is(":checkbox")) {
checkbox.prop("checked", true);
}
});
}
var client_id = $('#Client_id').val();
$('#client_policy_id').val(policy_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');
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
$.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 (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') {
element.checked = element.value === jsonObject[key];
}
}else if(key === "Wellness" || key === "additionalsicknessbenefit"){
let wysiwygElement = element.previousElementSibling.querySelector('.jodit-wysiwyg');
if (elements) {
elements.forEach((element,index) => {
element.value = jsonObject[key][index];
});
}
}
if (wysiwygElement) {
let pTag = wysiwygElement.querySelector('p'); // Find the <p> tag inside the wysiwyg element
if (pTag) {
// pTag.innerHTML = ''; // Clear the content inside the <p> tag
pTag.innerHTML = jsonObject[key]; // Add your new content inside the <p> tag
}
}
// console.log(jsonObject[key]);
}else {
element.value = jsonObject[key];
}
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);
}
});
}
},
}
error: function(xhr, status, error) {
console.error('Error:', status, error);
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 <p> tag inside the wysiwyg element
if (pTag) {
// pTag.innerHTML = ''; // Clear the content inside the <p> tag
pTag.innerHTML = jsonObject[key]; // Add your new content inside the <p> tag
}
}
// 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);
}
});
// $.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 += ` <option value="">Select Premium Type</option>`;
// $.each(res.data, function(index, item) {
// policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>';
// });
// $('#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 = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-5">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="gpa_si" required>
</div>
<div class="form-group col-md-5">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="gpa_premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(3)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>
`;
}else if(ui_type == '4'){
html =`
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(4)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '5'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(5)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '6'){
html =`
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-4">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(6)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>
</div>`;
}else if(ui_type == '7'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(7)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '8'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Grade/Band</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(8)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '9'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Grade/Band</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(9)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '10'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(10)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '11'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-2">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Grade/Band</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">Max SI</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Max SI" name="max_si" id="max_si[]" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(11)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}
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();
}
}
</script>
<!-- Jodit RTE -->
<script>
$(document).ready(function() {
var editor = new Jodit('#additionalsicknessbenefit', {
buttons: 'bold,italic,underline,|,align',
buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
});
var editor = new Jodit('#Wellness', {
buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
});
});
</script>
<script>
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
event.preventDefault();
specialCondition();
});
var editor = new Jodit('#Wellness', {
buttons: 'bold,italic,underline,|,align',
function specialCondition(count =0) {
if (count === 0) {
var index =$('.modifyclassinput').length;
var appendElement =`<div class="form-group col-md-6 form-group-client-policy-masters">
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 400px;"><input name="special_condition_label[]" id="special_condition_label[]"><span class="specialConditionClose" style="color: red;margin-left: 20px;">X</span></label>
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control form-control-client-policy-masters special_condition_input[]">
</div>`;
$('.form-column').each(function() {
$(this).append(appendElement);
});
}
else{
}
}
$(document).on('click', '.specialConditionClose', function() {
$(this)[0].parentNode.parentNode.remove();
});
});
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
event.preventDefault();
specialCondition();
});
function specialCondition(count =0) {
if (count === 0) {
var index =$('.modifyclassinput').length;
var appendElement =`<div class="form-group col-md-6 form-group-client-policy-masters">
<label for="specialconditionlabel" class="specialConditionLabel[]" style="width: 400px;"><input name="specialConditionLabel[]" id="specialConditionLabel[]"><span class="specialConditionClose" style="color: red;margin-left: 20px;">X</span></label>
<input type="text" name="specialConditionInput[]" id="specialConditionInput[]" class="form-control form-control-client-policy-masters specialConditionInput[]">
</div>`;
$('.form-column').each(function() {
$(this).append(appendElement);
});
}
else{
}
}
$(document).on('click', '.specialConditionClose', function() {
$(this)[0].parentNode.parentNode.remove();
});
</script>
$(document).on('click', '#policyGMCTermsClose', function() {
$('#policyGMCTerms').css('display', 'none');
$('#police-tab').css('display', '');
$('.nav.nav-pills.navtab-bg').css('display','');
$('.nav.nav-pills.navtab-bg').prev().css('display','');
});
</script>