3398 lines
165 KiB
PHP
3398 lines
165 KiB
PHP
|
||
<?php include('policy_grid_excel.php')?>
|
||
|
||
<style>
|
||
|
||
/* .modal-full-width {
|
||
width: 95% !important;
|
||
} */
|
||
|
||
.radio-group {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.radio-group .form-check {
|
||
margin-right: -110px;
|
||
}
|
||
|
||
.radioalign{
|
||
position: relative;
|
||
bottom: 6px;
|
||
}
|
||
|
||
/* .unitDiv{
|
||
display: none;
|
||
} */
|
||
</style>
|
||
|
||
<!-- Modal content for the Large example -->
|
||
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||
aria-hidden="true" aria-modal="true" data-backdrop="static" style="padding-right: 15px">
|
||
<div class="modal-dialog modal-full-width">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<div class="col-md-6">
|
||
<h4 class="modal-title" id="myLargeModalLabel">Rack Rate <span id="PolicyNameForTitle"></span></h4>
|
||
</div>
|
||
<div class="col-md-5" style="position: relative;left: 20px;" id="add_new_rack_rate_tab_div">
|
||
<button class="btn btn-info waves-effect waves-light mr-1 float-right" id="add_new_rack_rate_tab" onclick="appendNewTab()">Add Tab</button>
|
||
</div>
|
||
<div class="col-md-1" style="position: relative;top: 10px;">
|
||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||
</div>
|
||
</div>
|
||
<div class="modal-body">
|
||
|
||
<input type="hidden" id="policy_terms_count">
|
||
<div class="text-center" id="no_data"></div>
|
||
|
||
<ul class="nav nav-pills navtab-bg" id="nav_pills">
|
||
<li class="nav-item" id="primary_rack_rate_tab_list">
|
||
<a href="#primary_rack_rate_tab" data-toggle="tab" aria-expanded="false"
|
||
class="nav-link px-3 py-2 active" id="rack_rate_one">
|
||
<span class="mr-1">Primary Rack Rate</span>
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
|
||
<div class="tab-content" id="tab_content">
|
||
|
||
<div class="tab-pane fade active show" id="primary_rack_rate_tab">
|
||
<form role="form" class="parsley-examples" method="post" id="GridForm_"
|
||
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" />
|
||
<input type="hidden" name="rack_rate_name" id="rack_rate_name" value="Primary" />
|
||
<input type="hidden" id="grid_emp_count" />
|
||
<div class="form-group">
|
||
|
||
<div class="form-row" id="rac_rate_dropdown">
|
||
<div class="form-group col-md-6">
|
||
<label for="emp_code">Policy Premium Type<span
|
||
class="text-danger">*</span></label>
|
||
<select class="form-control" id="grid" name="policy_grid_id"
|
||
onchange="addGridHTML(this)" required>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="form-group col-md-4"
|
||
style="position: relative; left: 45px; display:none" id="premium_type">
|
||
<label for="css"> Premium Calculation </label>
|
||
<div style="display: flex; align-items: center;">
|
||
<input type="radio" id="individual" name="premium_type" value="2">
|
||
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
||
Individual </label>
|
||
<input type="radio" id="single" name="premium_type" value="1">
|
||
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row" id="relationship" class="relationship" >
|
||
</div>
|
||
|
||
<a href="#" id="copyfromexcel" onclick="copyFromExcel(this)">Copy from excel</a>
|
||
<hr>
|
||
|
||
<div class="form-row" id="grid_content_input" style="display: true;">
|
||
</div>
|
||
|
||
|
||
<div class="form-row" id="grid_content_from_excel" style="display: none;">
|
||
<p>Paste excel data here: <a href="#" type="button" onclick="copyHeaders('na')">Copy Excel Headers</a></p>
|
||
<textarea class="form-control excel_textarea" id="copied_excel_data" name="copied_excel_data" style="width:100%;height:200px;" oninput="generateTable('na')"></textarea><br>
|
||
<hr>
|
||
<div class="excel_table_class" id="excel_table" style="display: none;"></div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||
<button class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2">Submit</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div><!-- /.modal-content -->
|
||
</div><!-- /.modal-dialog -->
|
||
</div><!-- /.modal -->
|
||
|
||
|
||
<script>
|
||
var policy_grid_id = $('#client_id').val();
|
||
var grid_html = '';
|
||
|
||
$('#btnGridSubmit').hide();
|
||
|
||
$('.close').click(function()
|
||
{
|
||
$('#grid_content_input').show();
|
||
$('#grid_content_from_excel').hide();
|
||
|
||
if ($('#copyfromexcel').text() == "Manual entry") {
|
||
$('#copyfromexcel').text("Copy from excel")
|
||
} else {
|
||
$('#copyfromexcel').text("Copy from excel");
|
||
}
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#grid_' + i).remove();
|
||
$('#add_grid_' + i).remove();
|
||
$('#removeChild_' + i).remove();
|
||
}
|
||
});
|
||
|
||
$(document).on('click', '.close', function() {
|
||
console.log("Close button clicked");
|
||
$('#tab_content .tab-pane').not('#primary_rack_rate_tab').remove();
|
||
$('#nav_pills li').not('#primary_rack_rate_tab_list').remove();
|
||
console.log("Tab panes removed");
|
||
});
|
||
|
||
|
||
var rarc_rate_json_array = [];
|
||
|
||
$(document).on('submit', 'form[id^="GridForm_"]', function(event) {
|
||
|
||
console.log('submitted function called')
|
||
|
||
event.preventDefault(); // Prevent the default form submission
|
||
|
||
var form = $(this);
|
||
console.log('form', form)
|
||
var formId = form.attr('id'); // Get the form ID
|
||
console.log('formId', formId)
|
||
|
||
var secondaryValue = '';
|
||
if(formId){
|
||
var unique_id = formId.split('_');
|
||
if (unique_id.length > 1) {
|
||
secondaryValue = unique_id[1];
|
||
secondaryValue = String(secondaryValue);
|
||
}
|
||
}
|
||
console.log('formId secondaryValue', secondaryValue);
|
||
|
||
var check = checkDuplicate(secondaryValue);
|
||
if (check) {
|
||
return;
|
||
}
|
||
|
||
// Validate the form using Parsley
|
||
var isValid = $('#' + formId).parsley().validate();
|
||
if (!isValid) {
|
||
toastr.log('Form is Empty', 'Warning');
|
||
return;
|
||
}
|
||
|
||
// Create FormData object
|
||
var formData = new FormData(form[0]);
|
||
// for (var pair of formData.entries()) {
|
||
// console.log(pair[0] + ': ' + pair[1]);
|
||
// }
|
||
|
||
let desiredKeys = ["self", "spouse", "childrens", "parents", "parents-in-law"];
|
||
|
||
// Convert FormData to a plain object, only including desired keys
|
||
let formObject = {};
|
||
formData.forEach((value, key) => {
|
||
if (desiredKeys.includes(key)) {
|
||
formObject[key] = value;
|
||
}
|
||
});
|
||
|
||
console.log('formObject', formObject)
|
||
let isEqual = checkFamiliFloatersKeysDuplicate(rarc_rate_json_array, formObject);
|
||
|
||
if(isEqual){
|
||
toastr.warning('Family floaters alerdey exist', 'warning');
|
||
return false;
|
||
}
|
||
|
||
// Show loader
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
|
||
|
||
var policy_form_action = '<?= base_url("client/premimum/create") ?>'; // Action URL
|
||
var result = false;
|
||
result = checkPolicyTermsSI(secondaryValue);
|
||
|
||
if (!result) {
|
||
|
||
if (check = false) {
|
||
$('.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("rack rate submit Response", res);
|
||
console.log("rack rate submit Response JSON", res.rack_rate_json);
|
||
|
||
if (res.status === false) {
|
||
toastr.error('Policy Dose Not Create', 'Error');
|
||
return;
|
||
}
|
||
|
||
rarc_rate_json_array.push(res.rack_rate_json);
|
||
|
||
console.log('rarc_rate_json_array', rarc_rate_json_array)
|
||
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' :'Policy Premium Added Successfully';
|
||
toastr.success(message, 'Success');
|
||
|
||
if($('#grid').val() == 1 || $('#grid').val() == 2){
|
||
$('.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.`);
|
||
}
|
||
|
||
});
|
||
|
||
var rack_rate_array = '';
|
||
var policy_type_string = '';
|
||
var family_floter_obj = '';
|
||
var employee_count = '';
|
||
var client_policy_for_additional_rack_rate = '';
|
||
var terms_si_amount_array = [];
|
||
var unit_length = 0;
|
||
|
||
$('body').on('click', '.btnPolicyModel', function()
|
||
{
|
||
$('#tab_content .tab-pane').not('#primary_rack_rate_tab').remove();
|
||
$('#nav_pills li').not('#primary_rack_rate_tab_list').remove();
|
||
|
||
var client_policy_id = $(this).data('id');
|
||
var policy_type_id = $(this).data('typeid');
|
||
policy_type_string = $(this).attr('id');
|
||
|
||
$('#client_policy_id').val(client_policy_id);
|
||
client_policy_for_additional_rack_rate = String(client_policy_id);
|
||
|
||
if (policy_type_id) {
|
||
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
|
||
if (policy_type_string == 'GPA' || policy_type_id == 6 || policy_type_id == 7) {
|
||
$('#add_new_rack_rate_tab_div').hide()
|
||
$('#rack_rate_one').hide()
|
||
} else {
|
||
$('#add_new_rack_rate_tab_div').show()
|
||
$('#rack_rate_one').show()
|
||
}
|
||
|
||
$.ajax({
|
||
url: '<?= base_url("util/policy-premium") ?>',
|
||
type: "GET",
|
||
data: { client_policy_id: client_policy_id },
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
|
||
console.log('rack rate responce', res)
|
||
// console.log('rack rate responce.premium data', res.premiumData)
|
||
// console.log('rack rate responce.premium data parsed', JSON.parse(res.premiumData));
|
||
|
||
var data_for_the_rack_rate = JSON.parse(res.premiumData) ?? [];
|
||
var groupedData = groupByRackRateName(data_for_the_rack_rate);
|
||
|
||
if(policy_type_string == 'GMC'){
|
||
if (res.self == "") {
|
||
$('.close').click();
|
||
toastr.warning('Unable to create rack rate due to the absence of policy terms.','Warning');
|
||
}
|
||
}
|
||
|
||
setTimeout(function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}, 500);
|
||
|
||
hideShowPolicyPremium(policy_type_string)
|
||
hideShowSubmitButton(res.count);
|
||
|
||
rack_rate_array = res.data;
|
||
family_floter_obj = res.self;
|
||
employee_count = res.count;
|
||
terms_si_amount_array = res.terms_si_amount_array;
|
||
localStorage.setItem('client_units', res.branch_units)
|
||
client_units_for_hide_unit_text_field = JSON.parse(res.branch_units);
|
||
|
||
if(client_units_for_hide_unit_text_field){
|
||
unit_length = client_units_for_hide_unit_text_field.length;
|
||
}
|
||
|
||
console.log('unit_length', unit_length);
|
||
|
||
var policy_grid_id_value = null;
|
||
var secondary_policy_grid_id_value = null;
|
||
var secondary = 0;
|
||
var additional_relationship = null;
|
||
var premium_type_for_primary_rr = [];
|
||
var first = 0;
|
||
|
||
premiumData = []
|
||
if(policy_type_string == 'GMC'){
|
||
$.each(groupedData, function(index, item){
|
||
if(index !== 'Primary'){
|
||
appendNewTab(index, item)
|
||
}else{
|
||
premiumData = item;
|
||
}
|
||
});
|
||
}else{
|
||
$.each(groupedData, function(index, item){
|
||
if(index == 'Primary'){
|
||
premiumData = item;
|
||
}
|
||
});
|
||
}
|
||
|
||
if (premiumData.length > 0) {
|
||
$.each(premiumData, function(index, item) {
|
||
|
||
policy_grid_id_value = item.policy_grid_id;
|
||
first = item.policy_grid_id;
|
||
|
||
if (policy_type_string == 'GPA' || policy_type_id == 6 || policy_type_id == 7) {
|
||
premium_type_for_primary_rr.push(item.premium_type);
|
||
|
||
} else {
|
||
secondary_policy_grid_id_value = item.policy_grid_id;
|
||
secondary = item.policy_grid_id;
|
||
additional_relationship = item.additional_relationship;
|
||
}
|
||
});
|
||
}
|
||
console.log('premiumData for primary rack rate', premiumData);
|
||
console.log('additional_relationship for primary rack rate', additional_relationship);
|
||
|
||
var checkboxdata = res.self;
|
||
|
||
if (policy_type_string === 'GPA' || policy_type_id === 6 || policy_type_id === 7) {
|
||
|
||
const checkboxDataObject = {
|
||
self: 1,
|
||
spouse: 0,
|
||
childrens: 0,
|
||
parents: 0,
|
||
parents_in_law: 0
|
||
};
|
||
|
||
checkboxdata = checkboxDataObject;
|
||
}
|
||
createCheckboxes(checkboxdata, additional_relationship, null, policy_type_id);
|
||
appendGridData(res.data, policy_grid_id_value);
|
||
if(premiumData[0]){
|
||
if(premiumData[0].premium_type){
|
||
editPolicyPremiumCalculationSetValue(premiumData[0].premium_type)
|
||
}
|
||
}
|
||
|
||
var si_or_bp_value = '';
|
||
if (premiumData.length > 0) {
|
||
|
||
if (premiumData[0].si_or_bp) {
|
||
si_or_bp_value = premiumData[0].si_or_bp;
|
||
}
|
||
|
||
addGridHTML(false, premiumData[0], premiumData[0].policy_grid_id, si_or_bp_value);
|
||
|
||
premiumData.shift();
|
||
$.each(premiumData, function(index, item) {
|
||
if (item.si_or_bp == '1') {
|
||
console.log('gpa basic pay items', item)
|
||
appendGridtHtml('1', null, item);
|
||
} else {
|
||
appendGridtHtml(item.policy_grid_id, null, item);
|
||
}
|
||
});
|
||
|
||
} else {
|
||
console.log("res.premiumData is undefined, null, or empty.");
|
||
}
|
||
|
||
$('#bs-example-modal-lg').modal('show');
|
||
$("#gpa_si").trigger("keyup");
|
||
$("#gpa_si_9").trigger("keyup");
|
||
$("#gpa_premium").trigger("keyup");
|
||
$('#basic_pay').trigger('keyup');
|
||
$('#4_si').trigger('keyup');
|
||
|
||
$('input[name="gpa_si"]').each(function() {
|
||
console.log('gpa_si[]', $(this));
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
$('input[name="gpa_sum_si[]"]').each(function() {
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
$('input[name="gpa_sum_si2[]"]').each(function() {
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
$('input[name="gpa_sum_premium[]"]').each(function() {
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
$('input[name="11_max_si[]"]').each(function() {
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
$('input[name="gpa_basic_si[]"]').each(function() {
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
$('input[name="gpa_basic_premium[]"]').each(function() {
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
$('input[name="basic_pay[]"]').each(function() {
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
|
||
|
||
$(`input[name="${first}_si[]"]`).each(function() {
|
||
// console.log(first+'_si[]', $(this));
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
$(`input[name="${first}_premium[]"]`).each(function() {
|
||
// console.log(first+"_premium[]", $(this));
|
||
$(this).trigger('keyup');
|
||
});
|
||
|
||
},
|
||
error: function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
console.log('Something Wrong!', 'warning');
|
||
}
|
||
});
|
||
|
||
} else {
|
||
|
||
$('#grid').empty();
|
||
$('#PolicyNameForTitle').html('');
|
||
$('#GridForm').hide();
|
||
$('#no_data').html('The policy has no Policy Rack Rate');
|
||
toastr.warning("The policy has no Policy Rack Rate", "Warning")
|
||
}
|
||
|
||
|
||
});
|
||
|
||
$(document).on('change', 'select[id^="grid_"]', function(event)
|
||
{
|
||
|
||
$('.excel_textarea').val('');
|
||
var grid_id = $(this)[0].value;
|
||
var client_policy_id = $('#client_policy_id')[0].value;
|
||
|
||
if(unit_length == 1 || unit_length == 0){
|
||
|
||
$('.unitDiv').hide();
|
||
$('.unitDiv').find('input').removeAttr('required');
|
||
}else{
|
||
$('.unitDiv').show();
|
||
$('.unitDiv').find('input').attr('required', true);
|
||
}
|
||
|
||
$.ajax({
|
||
url: '<?= base_url("util/policy-premium") ?>',
|
||
type: "GET",
|
||
data: {
|
||
client_policy_id: client_policy_id
|
||
},
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
|
||
|
||
if (res.data[0].policy_type == "GPA") {
|
||
$('#si_or_bp').val('2');
|
||
|
||
setTimeout(() => {
|
||
$('#si_or_bp').trigger('change')
|
||
}, 300);
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
setTimeout(function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
toastr.warning('Something Wrong!', 'warning');
|
||
}, 1000);
|
||
}
|
||
});
|
||
})
|
||
|
||
$('#grid').change(function()
|
||
{
|
||
console.log('unit_length', unit_length)
|
||
|
||
$('.excel_textarea').val('');
|
||
var grid_id = $(this)[0].value;
|
||
var client_policy_id = $('#client_policy_id')[0].value;
|
||
|
||
if(unit_length == 1 || unit_length == 0){
|
||
|
||
$('.unitDiv').hide();
|
||
$('.unitDiv').find('input').removeAttr('required');
|
||
}else{
|
||
$('.unitDiv').show();
|
||
$('.unitDiv').find('input').attr('required', true);
|
||
}
|
||
|
||
$.ajax({
|
||
url: '<?= base_url("util/policy-premium") ?>',
|
||
type: "GET",
|
||
data: {
|
||
client_policy_id: client_policy_id
|
||
},
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
|
||
|
||
if (res.data[0].policy_type == "GPA") {
|
||
$('#si_or_bp').val('2');
|
||
|
||
setTimeout(() => {
|
||
$('#si_or_bp').trigger('change')
|
||
}, 300);
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
console.log('Something Wrong!', 'warning');
|
||
}
|
||
});
|
||
})
|
||
|
||
function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = false, unique_id = false)
|
||
{
|
||
console.log('addgridhtmll function data', data)
|
||
console.log('addgridhtmll function unique id', unique_id)
|
||
console.log('addGridHTML si_or_bp', si_or_bp);
|
||
console.log('addGridHTML event', event);
|
||
console.log('addGridHTML ui_type', ui_type);
|
||
|
||
secondaryValue = unique_id;
|
||
// console.log('typeof secondaryValue');
|
||
// console.log(typeof secondaryValue);
|
||
|
||
// if(event.id){
|
||
// var unique_id = event.id.split('_');
|
||
// if (unique_id.length > 1) {
|
||
// secondaryValue = unique_id[1];
|
||
// secondaryValue = String(secondaryValue);
|
||
// }
|
||
// }
|
||
|
||
// console.log('unique_id', unique_id)
|
||
// console.log('secondaryValue', secondaryValue)
|
||
|
||
var grid_container = document.getElementById('grid_content_input');
|
||
// console.log(grid_container);
|
||
|
||
if (secondaryValue != false) {
|
||
grid_container_id = 'grid_content_input_' + secondaryValue;
|
||
grid_container = document.getElementById(grid_container_id);
|
||
}
|
||
|
||
var id_var = 'grid_';
|
||
|
||
var dataIdValue = ''
|
||
if (event === false) {
|
||
var dataIdValue = ui_type
|
||
} else {
|
||
var dataIdValue = event.value;
|
||
}
|
||
|
||
$(grid_container).empty();
|
||
|
||
if (dataIdValue == '1') {
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}1">
|
||
<input value="1" type="hidden" name="policy_type">
|
||
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Select <span class="text-danger">*</span></label>
|
||
<select class="form-control" id="si_or_bp" name="si_or_bp" onchange="si_orbp_change_function()" required>
|
||
<option value="2">Basic Pay</option>
|
||
<option value="1">Sum Insured</option>
|
||
<option value="3">Band/Grade</option>
|
||
</select>
|
||
</div>
|
||
|
||
<div id="si_or_bp_full_div" style="display:none;">
|
||
|
||
<div id="si_or_bp_grade" class="form-row">
|
||
|
||
<div class="form-row col-md-4" style="margin-left: 346px; margin-top: -114px;">
|
||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.multiplier : '') : ''}" type="text" class="form-control" placeholder="Multiplier" name="gpa_sum_multiplier2" id="gpa_sum_multiplier2" onchange="gpaSumInsureMultiplier(this)" required>
|
||
</div>
|
||
|
||
<div class="form-row" style="width:101%;padding: 10px;" id="removeChild_${Count}">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.unit : '') : ''}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit[]" id="gpa_unit3" required>
|
||
</div>
|
||
<div class="form-group col-md-1" id="">
|
||
<label for="mobile">Grade<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.grade : '') : ''}" type="text" class="form-control" placeholder="Band" name="gpa_band[]" id="gpa_band" required>
|
||
</div>
|
||
<div class="form-group col-md-3" id="">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.si : '') : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si2[]" id="gpa_sum_si2" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_sum_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.premium : '') : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_sum_premium2[]" id="gpa_sum_premium2" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_sum_premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
|
||
<div class="form-group col-md-2" style="/*position: absolute;*//*left: 870px;*/">
|
||
<button style="margin-top: 44px;position: relative;right: 0px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton()">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more2" onclick="appendGridtHtml('1', ${secondaryValue})">+</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div id="si_or_bp_sum_insure_child"></div>
|
||
|
||
</div>
|
||
|
||
<div id="si_or_bp_sum_insure" class="form-row">
|
||
|
||
<div class="form-row col-md-4" style="margin-left: 346px; margin-top: -114px;">
|
||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.multiplier : '') : ''}" type="text" class="form-control" placeholder="Multiplier" name="gpa_sum_multiplier" id="gpa_sum_multiplier" onchange="gpaSumInsureMultiplier(this)" required>
|
||
</div>
|
||
<div class="form-row" style="width:101%;padding: 10px;" id="removeChild_${Count}">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.unit : '') : ''}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit[]" id="gpa_unit1" required>
|
||
</div>
|
||
<div class="form-group col-md-3" id="">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.si : '') : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si[]" id="gpa_sum_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_sum_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.premium : '') : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_sum_premium[]" id="gpa_sum_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_sum_premium_number_word' class="text-danger-2" ></div>
|
||
|
||
</div>
|
||
<div class="form-group col-md-3" style="position: relative;right: 6px;">
|
||
<button style="margin-top: 44px;position: relative;right: 0px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton()">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml('1', ${secondaryValue})">+</button>
|
||
</div>
|
||
</div>
|
||
<div id="si_or_bp_sum_insure_child"></div>
|
||
</div>
|
||
|
||
<div id="si_or_bp_basic_pay" class="form-row">
|
||
|
||
<div class="form-row" style="margin-left: 347px;/* margin-bottom: -106px; */margin-top: -97px;">
|
||
|
||
<div class="form-col col-md-6">
|
||
<label for="mobile">Basic Multiplier<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_multiplier : '') : ''}" type="text" class="form-control basic_multiplier" placeholder="Basic Multiplier" name="basic_multiplier" id="basic_multiplier" onchange='basicMultiplierAndPremiumMultipiler(this)' required>
|
||
</div>
|
||
|
||
<div class="form-col col-md-6">
|
||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.multiplier : '') : ''}" type="text" class="form-control premium_multiplier" placeholder="Premium Multiplier" name="premium_multiplier" id="premium_multiplier" onchange='basicMultiplierAndPremiumMultipiler(this)' required>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-row" style="padding: 10px;">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.unit : '') : ''}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit[]" id="gpa_unit2" required>
|
||
</div>
|
||
<div class="form-col col-md-2">
|
||
<label for="mobile">Basic Pay<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_pay : '') : ''}" type="text" class="form-control basic_pay" placeholder="Enter Basic Pay" name="basic_pay[]" id="basic_pay" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this); basicPayMultiple(this)" required>
|
||
<div id='gpa_basic_pay_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
|
||
<div class="form-group col-md-3" id="" style="/*width:84%*/">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control gpa_basic_si" placeholder="Enter Sum Insured" name="gpa_basic_si[]" id="gpa_basic_si_first" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required readonly>
|
||
<div id='basic_gpa_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.premium : '') : ''}" type="text" class="form-control basic_gpa_premium gpa_basic_premium" placeholder="Enter Premium" name="gpa_basic_premium[]" id="gpa_basic_premium_first" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)" required readonly>
|
||
<div id='basic_gpa_premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
|
||
<div class="form-group col-md-2" style="position: relative;right: 6px;">
|
||
<button style="margin-top: 44px;position: relative;right: 0px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton()">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more3" onclick="appendGridtHtml('1', ${secondaryValue})">+</button>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '2') {
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}2" style="/*width:84%*/">
|
||
<input value="1" type="hidden" name="policy_type">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit" id="gpa_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="gpa_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_premium" id="gpa_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '3') {
|
||
|
||
console.log('secondaryValue type 3 step 1', secondaryValue)
|
||
console.log('secondaryValue type 3', secondaryValue)
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}3" style="/*width:84%*/">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="3_unit[]" id="3_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="3_si[]" id="3_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" oninput="" required>
|
||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="3_premium[]" id="3_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0, 3)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(3, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '4') {
|
||
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}4" style="/*width:84%*/">
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="4_si" id="4_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="4_unit[]" id="4_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="4_age_from[]" id="4_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="4_age_to[]" id="4_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="4_premium[]" id="4_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,4)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(4, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '5') {
|
||
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}5" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="5_unit[]" id="5_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="5_si[]" id="5_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="5_age_from[]" id="5_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="5_age_to[]" id="5_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="5_premium[]" id="5_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,5)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(5, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '6') {
|
||
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}6" style="/*width:84%*/">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="6_si" id="6_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-row">
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="6_unit[]" id="6_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="6_age_from[]" id="6_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="6_age_to[]" id="6_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="6_premium[]" id="6_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,6)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(6, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '7') {
|
||
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}7" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="7_unit[]" id="7_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="7_si[]" id="7_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="7_age_from[]" id="7_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="7_age_to[]" id="7_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="7_premium[]" id="7_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,7)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(7, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '8') {
|
||
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
|
||
grid_html = `
|
||
|
||
<div class="form-row" id="${id_var}8" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="8_unit[]" id="8_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="8_si[]" id="8_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Grade<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Band " name="8_grade[]" id="8_grade" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="8_premium[]" id="8_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,8)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(8, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '9') {
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}9" style="/*width:84%*/">
|
||
<input value="1" type="hidden" name="policy_type">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit[]" id="gpa_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="gpa_si_9" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_premium" id="gpa_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '10') {
|
||
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
<div class="form-row" id="${id_var}10" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="10_unit[]" id="10_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="10_si[]" id="10_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="10_age_from[]" id="10_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="10_age_to[]" id="10_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="10_premium[]" id="10_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,10)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(10, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '11') {
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
|
||
<div class="form-row" id="${id_var}11" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="11_unit[]" id="11_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="11_si[]" id="11_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">Grade<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Band " name="11_grade[]" id="11_grade" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="11_premium[]" id="11_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Max SI<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control" placeholder="Enter Max SI" name="11_max_si[]" id="11_max_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='max_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,11)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(11, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '12') {
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
|
||
<div class="form-row" id="${id_var}12" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="12_unit[]" id="12_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="12_si[]" id="12_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Releationship<span class="text-danger">*</span></label>
|
||
<select class="form-control" name="12_relationship[]" id="12_relationship" required>
|
||
<option value="">Select</option>
|
||
<option value="self" ${data !== false && data !== undefined && data !== '' && data.relationship === 'self' ? 'selected' : ''}>Self</option>
|
||
<option value="spouse" ${data !== false && data !== undefined && data !== '' && data.relationship === 'spouse' ? 'selected' : ''}>Spouse</option>
|
||
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
|
||
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
|
||
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
|
||
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
|
||
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="12_premium[]" id="12_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,12)">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(12, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (dataIdValue == '13') {
|
||
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
|
||
grid_html = `
|
||
|
||
<div class="form-row" id="${id_var}13" style="/*width:84%*/">
|
||
<div class="form-group col-md-2 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="13_unit[]" id="13_unit" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="13_si[]" id="13_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="13_age_from[]" id="13_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="13_age_to[]" id="13_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Relationship<span class="text-danger">*</span></label>
|
||
<select class="form-control" name="13_relationship[]" id="13_relationship" required>
|
||
<option value="">Select</option>
|
||
<option value="self" ${data !== false && data !== undefined && data !== '' && data.relationship === 'self' ? 'selected' : ''}>Self</option>
|
||
<option value="spouse" ${data !== false && data !== undefined && data !== '' && data.relationship === 'spouse' ? 'selected' : ''}>Spouse</option>
|
||
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
|
||
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
|
||
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
|
||
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
|
||
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="13_premium[]" id="13_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,13)">x</button>
|
||
<button style="margin-top: 44px;position: absolute;margin-left: 5px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(13, '${secondaryValue}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else {
|
||
for (var i = 1; i <= 13; i++) {
|
||
$('#' + id_var + i).remove();
|
||
}
|
||
grid_html = '';
|
||
$('#btnGridSubmit').hide();
|
||
|
||
}
|
||
|
||
// console.log('grid_container', grid_container)
|
||
// console.log('grid_html', grid_html)
|
||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||
|
||
if (dataIdValue == '1') {
|
||
$('#gpa_sum_si').trigger('keyup');
|
||
$('#gpa_sum_si2').trigger('keyup');
|
||
$('#gpa_basic_si_first').trigger('keyup');
|
||
// $('input[name="gpa_sum_si[]"]').each(function() {
|
||
// //console.log($(this));
|
||
// $(this).trigger('keyup');
|
||
// });
|
||
}
|
||
|
||
if(unit_length == 1 || unit_length == 0){
|
||
|
||
$('.unitDiv').hide();
|
||
$('.unitDiv').find('input').removeAttr('required');
|
||
}else{
|
||
$('.unitDiv').show();
|
||
$('.unitDiv').find('input').attr('required', true);
|
||
}
|
||
|
||
$('#gpa_sum_insured').hide();
|
||
$('#btnGridSubmit').show();
|
||
|
||
$('#si_or_bp').val(si_or_bp);
|
||
setTimeout(() => {
|
||
$('#si_or_bp').trigger('change');
|
||
}, 300);
|
||
|
||
};
|
||
|
||
var Count = 1
|
||
|
||
function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||
{
|
||
console.log('appendGridtHtml function data', data);
|
||
console.log('appendGridtHtml ui_type', ui_type);
|
||
|
||
console.log('secondary', secondary)
|
||
console.log('typeof secondary', typeof secondary)
|
||
|
||
var html = '';
|
||
Count++;
|
||
|
||
var container = document.getElementById('grid_content_input');
|
||
// console.log('container', container);
|
||
|
||
if (secondary != false && secondary != 'false' && secondary != null && secondary != 'null') {
|
||
container_id = 'grid_content_input_' + secondary;
|
||
console.log('container', container_id);
|
||
container = document.getElementById(container_id);
|
||
console.log('container', container);
|
||
}
|
||
|
||
if (ui_type == '1') {
|
||
|
||
// console.log('step 1')
|
||
var currentTime = getCurrentTime();
|
||
// console.log(currentTime);
|
||
|
||
if ($("#si_or_bp").val() == 1 || data.si_or_bp == '1') {
|
||
|
||
// //console.log('step 2')
|
||
|
||
html = `<div class="form-row gpa_sum_insure_remove" style="width:101%" id="removeChild_${Count}">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit[]" id="gpa_unit1" required>
|
||
</div>
|
||
<div class="form-group col-md-3" id="">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si[]" id="gpa_sum_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_sum_premium[]" id="gpa_sum_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_premium_number_word' class="text-danger-2" ></div>
|
||
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml('1', '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if ($("#si_or_bp").val() == 3 || data.si_or_bp == '3') {
|
||
|
||
// //console.log('step 3')
|
||
|
||
html = `<div class="form-row gpa_band_remove" style="width:101%" id="removeChild_${Count}">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit[]" id="gpa_unit3" required>
|
||
</div>
|
||
|
||
<div class="form-group col-md-1" id="">
|
||
<label for="mobile">Grade<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.grade : '') : ''}" type="text" class="form-control" placeholder="Band" name="gpa_band[]" id="gpa_band" required>
|
||
</div>
|
||
|
||
<div class="form-group col-md-3" id="">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.si : '') : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_sum_si2[]" id="gpa_sum_si2" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '3' ? data.premium : '') : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_sum_premium2[]" id="gpa_sum_premium2" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_premium_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml('1', '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
}else if ($("#si_or_bp").val() == 2 || data.si_or_bp == '2') {
|
||
|
||
// console.log('step 3')
|
||
|
||
html = `
|
||
<div class="form-row gpa_basic_pay_remove" style="width:101%" id="removeChild_${Count}">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit[]" id="gpa_unit2" required>
|
||
</div>
|
||
|
||
<div class="form-col col-md-2">
|
||
<label for="mobile">Basic Pay<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.basic_pay : '') : ''}" type="text" class="form-control basic_pay" placeholder="Enter Basic Pay" name="basic_pay[]" id="basic_pay_${Count}" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this); basicPayMultiple(this)" required>
|
||
<div id='gpa_basic_pay_number_word' class="text-danger-2"></div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.si : '') : ''}" type="text" class="form-control gpa_basic_si" placeholder="Enter Sum Insured" name="gpa_basic_si[]" id="gpa_basic_si_${Count}" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)" required readonly>
|
||
<div id='basic_gpa_si_number_word' class="text-danger-2"></div>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '2' ? data.premium : '') : ''}" type="text" class="form-control basic_gpa_premium gpa_basic_premium" placeholder="Enter Premium" name="gpa_basic_premium[]" id="gpa_basic_premium_${Count}" onkeypress="return onlyNumbers(event)" onchange="formatNumber(this)" required readonly>
|
||
<div id='basic_gpa_premium_number_word' class="text-danger-2"></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml('1', '${secondary}')">+</button>
|
||
</div>
|
||
</div>
|
||
`;
|
||
|
||
}
|
||
|
||
console.log('step 4')
|
||
|
||
} else if (ui_type == '3') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="3_unit[]" id="3_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="3_si[]" id="3_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this);" required>
|
||
<div id='gpa_si_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="3_premium[]" id="3_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='gpa_premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(3, '${secondary}')">+</button>
|
||
</div>
|
||
</div>
|
||
`;
|
||
|
||
} else if (ui_type == '4') {
|
||
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="4_unit[]" id="4_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="4_age_from[]" id="4_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="4_age_to[]" id="4_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="4_premium[]" id="4_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(4, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (ui_type == '5') {
|
||
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="5_unit[]" id="5_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="5_unit[]" id="5_unit_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="5_age_from[]" id="5_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="5_age_to[]" id="5_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="5_premium[]" id="5_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(5, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (ui_type == '6') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="6_unit[]" id="6_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="6_age_from[]" id="6_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder=" Age" name="6_age_to[]" id="6_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="6_premium[]" id="6_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(6, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (ui_type == '7') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="7_unit[]" id="7_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="7_si[]" id="7_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="7_age_from[]" id="7_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="7_age_to[]" id="7_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="7_premium[]" id="7_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(7, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (ui_type == '8') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="8_unit[]" id="8_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="8_si[]" id="8_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Grade<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Band " name="8_grade[]" id="8_grade" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="8_premium[]" id="8_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(8, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (ui_type == '9') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="unit" id="9_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-4">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="9_premium[]" id="9_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (ui_type == '10') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="10_unit[]" id="10_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="10_si[]" id="10_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="10_age_from[]" id="10_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="10_age_to[]" id="10_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="10_premium[]" id="10_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(10, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
|
||
} else if (ui_type == '11') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="11_unit[]" id="11_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="11_si[]" id="11_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-1">
|
||
<label for="mobile">Grade<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control" placeholder="Enter Band " name="11_grade[]" id="11_grade" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="11_premium[]" id="11_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Max SI<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control" placeholder="Enter Max SI" name="11_max_si[]" id="11_max_si[]" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='max_si_number_word' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(11, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
} else if (ui_type == '12') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-3 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="12_unit[]" id="12_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="12_si[]" id="12_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Relationship<span class="text-danger">*</span></label>
|
||
<select class="form-control" name="12_relationship[]" id="12_relationship" required>
|
||
<option value="">Select</option>
|
||
<option value="self" ${data !== false && data !== undefined && data !== '' && data.relationship === 'self' ? 'selected' : ''}>Self</option>
|
||
<option value="spouse" ${data !== false && data !== undefined && data !== '' && data.relationship === 'spouse' ? 'selected' : ''}>Spouse</option>
|
||
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
|
||
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
|
||
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
|
||
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
|
||
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="12_premium[]" id="12_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(12, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
} else if (ui_type == '13') {
|
||
|
||
html = `
|
||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||
<div class="form-group col-md-4 unitDiv">
|
||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="13_unit[]" id="13_unit_${Count}" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="13_si[]" id="13_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="13_age_from[]" id="13_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="13_age_to[]" id="13_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||
</div>
|
||
<div class="form-group col-md-2">
|
||
<label for="mobile">Relationship<span class="text-danger">*</span></label>
|
||
<select class="form-control" name="13_relationship[]" id="13_relationship" required>
|
||
<option value="">Select</option>
|
||
<option value="self" ${data !== false && data !== undefined && data !== '' && data.relationship === 'self' ? 'selected' : ''}>Self</option>
|
||
<option value="spouse" ${data !== false && data !== undefined && data !== '' && data.relationship === 'spouse' ? 'selected' : ''}>Spouse</option>
|
||
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
|
||
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
|
||
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
|
||
<option value="mother-in-law" ${dappendGridtHtmlata !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
|
||
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
|
||
</select>
|
||
</div>
|
||
<div class="form-group col-md-3">
|
||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="13_premium[]" id="13_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||
</div>
|
||
<div class="form-group">
|
||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
|
||
<button style="margin-top: 44px;position: absolute;margin-left: 5px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(13, '${secondary}')">+</button>
|
||
</div>
|
||
</div>`;
|
||
}
|
||
|
||
console.log('container', container);
|
||
container.insertAdjacentHTML('beforeend', html);
|
||
|
||
// $('#gmc_add_more').hide();
|
||
// $('#gmc_add_more2').hide();
|
||
// $('#gmc_remove').show();
|
||
// Count--
|
||
// $('#gmc_add_more_' + Count).hide()
|
||
// Count++
|
||
|
||
if(unit_length == 1 || unit_length == 0){
|
||
|
||
$('.unitDiv').hide();
|
||
$('.unitDiv').find('input').removeAttr('required');
|
||
}else{
|
||
$('.unitDiv').show();
|
||
$('.unitDiv').find('input').attr('required', true);
|
||
}
|
||
|
||
|
||
// Number to word
|
||
$(document).keyup(function(event) {
|
||
if (event.target) {
|
||
var result = convertCommaNumberToWords(event.target.value);
|
||
var next = event.target.nextElementSibling;
|
||
if (next && next.tagName.toLowerCase() === 'div') {
|
||
next.textContent = result; // Set the content of the div
|
||
}
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
|
||
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();
|
||
$('#gmc_add_more2').show();
|
||
}
|
||
|
||
index--;
|
||
$('#gmc_add_more_' + index).show();
|
||
$('#gmc_add_more2_' + index).show();
|
||
}
|
||
|
||
}
|
||
|
||
function checkDuplicate(unique_id = null)
|
||
{
|
||
console.log('checkDuplicate unique_id', unique_id)
|
||
|
||
var id = $('#grid')[0];
|
||
var container = $('#grid_content_input');
|
||
|
||
console.log('checkDuplicate id 1', id);
|
||
console.log('checkDuplicate container 1', container);
|
||
|
||
if (unique_id) {
|
||
id = $('#grid_'+unique_id)[0];
|
||
container = $('#grid_content_input_'+unique_id);
|
||
|
||
console.log('checkDuplicate id 2', id);
|
||
console.log('checkDuplicate container 2', container);
|
||
}
|
||
|
||
console.log('checkDuplicate id 3', id);
|
||
console.log('checkDuplicate container 3', container);
|
||
|
||
if (id.value === '3') {
|
||
|
||
var siInputs = container.find('input[name="3_si[]"]');
|
||
var premiumInputs = container.find('input[name="3_premium[]"]');
|
||
|
||
var siValues = [];
|
||
var premiumValues = [];
|
||
var siDuplicates = false;
|
||
var premiumDuplicates = false;
|
||
|
||
// Extract values from input arrays
|
||
siInputs.each(function() {
|
||
siValues.push($(this).val());
|
||
});
|
||
|
||
premiumInputs.each(function() {
|
||
premiumValues.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < siValues.length; i++) {
|
||
for (var j = i + 1; j < siValues.length; j++) {
|
||
if (siValues[i] === siValues[j] && premiumValues[i] === premiumValues[j]) {
|
||
siDuplicates = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (siDuplicates || premiumDuplicates) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
} else if (id.value === '4') {
|
||
|
||
var ageFrom = container.find('input[name="4_age_from[]"]');
|
||
var ageTo = container.find('input[name="4_age_to[]"]');
|
||
|
||
var ageFromValues = [];
|
||
var ageToValues = [];
|
||
var ageDuplicates = false;
|
||
|
||
// Extract values from input arrays
|
||
ageFrom.each(function() {
|
||
ageFromValues.push($(this).val());
|
||
});
|
||
|
||
ageTo.each(function() {
|
||
ageToValues.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < ageFromValues.length; i++) {
|
||
for (var j = i + 1; j < ageFromValues.length; j++) {
|
||
// Check for duplicates between age_from[] and age_to[]
|
||
if (ageFromValues[i] === ageFromValues[j] && ageToValues[i] === ageToValues[j]) {
|
||
ageDuplicates = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (ageDuplicates) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
|
||
} else if (id.value === '5') {
|
||
var si = container.find('input[name="5_si[]"]');
|
||
var ageFrom = container.find('input[name="5_age_from[]"]');
|
||
var ageTo = container.find('input[name="5_age_to[]"]');
|
||
|
||
var si_array = [];
|
||
var ageFrom_array = [];
|
||
var ageTo_array = [];
|
||
var siDuplicates = false;
|
||
var ageDuplicates = false;
|
||
|
||
si.each(function() {
|
||
si_array.push($(this).val());
|
||
});
|
||
|
||
ageFrom.each(function() {
|
||
ageFrom_array.push($(this).val());
|
||
});
|
||
|
||
ageTo.each(function() {
|
||
ageTo_array.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < ageFrom_array.length; i++) {
|
||
for (var j = i + 1; j < ageFrom_array.length; j++) {
|
||
if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] ===
|
||
si_array[j]) {
|
||
ageDuplicates = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (siDuplicates || ageDuplicates) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
} else if (id.value === '6') {
|
||
var ageFrom = container.find('input[name="6_age_from[]"]');
|
||
var ageTo = container.find('input[name="6_age_to[]"]');
|
||
|
||
var ageFromValues = [];
|
||
var ageToValues = [];
|
||
var ageDuplicates = false;
|
||
|
||
// Extract values from input arrays
|
||
ageFrom.each(function() {
|
||
ageFromValues.push($(this).val());
|
||
});
|
||
|
||
ageTo.each(function() {
|
||
ageToValues.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < ageFromValues.length; i++) {
|
||
for (var j = i + 1; j < ageFromValues.length; j++) {
|
||
// Check for duplicates between age_from[] and age_to[]
|
||
if (ageFromValues[i] === ageFromValues[j] && ageToValues[i] === ageToValues[j]) {
|
||
ageDuplicates = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (ageDuplicates) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
} else if (id.value === '7') {
|
||
var si = container.find('input[name="7_si[]"]');
|
||
var ageFrom = container.find('input[name="7_age_from[]"]');
|
||
var ageTo = container.find('input[name="7_age_to[]"]');
|
||
|
||
var si_array = [];
|
||
var ageFrom_array = [];
|
||
var ageTo_array = [];
|
||
var siDuplicates = false;
|
||
var ageDuplicates = false;
|
||
|
||
si.each(function() {
|
||
si_array.push($(this).val());
|
||
});
|
||
|
||
ageFrom.each(function() {
|
||
ageFrom_array.push($(this).val());
|
||
});
|
||
|
||
ageTo.each(function() {
|
||
ageTo_array.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < ageFrom_array.length; i++) {
|
||
for (var j = i + 1; j < ageFrom_array.length; j++) {
|
||
if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] ===
|
||
si_array[j]) {
|
||
ageDuplicates = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (siDuplicates || ageDuplicates) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
} else if (id.value === '10') {
|
||
var si = container.find('input[name="10_si[]"]');
|
||
var ageFrom = container.find('input[name="10_age_from[]"]');
|
||
var ageTo = container.find('input[name="10_age_to[]"]');
|
||
|
||
var si_array = [];
|
||
var ageFrom_array = [];
|
||
var ageTo_array = [];
|
||
var siDuplicates = false;
|
||
var ageDuplicates = false;
|
||
|
||
si.each(function() {
|
||
si_array.push($(this).val());
|
||
});
|
||
|
||
ageFrom.each(function() {
|
||
ageFrom_array.push($(this).val());
|
||
});
|
||
|
||
ageTo.each(function() {
|
||
ageTo_array.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < ageFrom_array.length; i++) {
|
||
for (var j = i + 1; j < ageFrom_array.length; j++) {
|
||
if (ageFrom_array[i] === ageFrom_array[j] && ageTo_array[i] === ageTo_array[j] && si_array[i] ===
|
||
si_array[j]) {
|
||
ageDuplicates = true;
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
if (siDuplicates || ageDuplicates) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
} else if (id.value === '8') {
|
||
var siInputs = container.find('input[name="8_si[]"]');
|
||
var gradeInputs = container.find('input[name="8_grade[]"]');
|
||
|
||
var siValues = [];
|
||
var gradeValues = [];
|
||
var duplicatesFound = false;
|
||
|
||
// Extract values from input arrays
|
||
siInputs.each(function() {
|
||
siValues.push($(this).val());
|
||
});
|
||
|
||
gradeInputs.each(function() {
|
||
gradeValues.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < siValues.length; i++) {
|
||
for (var j = i + 1; j < siValues.length; j++) {
|
||
// Check for duplicates between si[] and grade[]
|
||
if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j]) {
|
||
duplicatesFound = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (duplicatesFound) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
} else if (id.value === '9') {
|
||
var siInputs = container.find('input[name="9_si[]"]');
|
||
var gradeInputs = container.find('input[name="9_grade[]"]');
|
||
|
||
var siValues = [];
|
||
var gradeValues = [];
|
||
var duplicatesFound = false;
|
||
|
||
// Extract values from input arrays
|
||
siInputs.each(function() {
|
||
siValues.push($(this).val());
|
||
});
|
||
|
||
gradeInputs.each(function() {
|
||
gradeValues.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < siValues.length; i++) {
|
||
for (var j = i + 1; j < siValues.length; j++) {
|
||
// Check for duplicates between si[] and grade[]
|
||
if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j]) {
|
||
duplicatesFound = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (duplicatesFound) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
} else if (id.value === '11') {
|
||
var siInputs = container.find('input[name="11_si[]"]');
|
||
var gradeInputs = container.find('input[name="11_grade[]"]');
|
||
var maxSiInputs = container.find('input[name="11_max_si[]"]');
|
||
|
||
var siValues = [];
|
||
var gradeValues = [];
|
||
var maxSiValues = [];
|
||
var duplicatesFound = false;
|
||
|
||
// Extract values from input arrays
|
||
siInputs.each(function() {
|
||
siValues.push($(this).val());
|
||
});
|
||
|
||
gradeInputs.each(function() {
|
||
gradeValues.push($(this).val());
|
||
});
|
||
|
||
maxSiInputs.each(function() {
|
||
maxSiValues.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < siValues.length; i++) {
|
||
for (var j = i + 1; j < siValues.length; j++) {
|
||
// //console.log(maxSiValues);
|
||
// //console.log("maxSiValues[i] ", maxSiValues[i] );
|
||
// //console.log("maxSiValues[j]", maxSiValues[j]);
|
||
if (siValues[i] === siValues[j] && gradeValues[i] === gradeValues[j] && maxSiValues[i] === maxSiValues[
|
||
j]) {
|
||
duplicatesFound = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (duplicatesFound) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
} else if (id.value === '1') {
|
||
var selectedValue = $('#si_or_bp').val();
|
||
|
||
if (selectedValue == 1) {
|
||
|
||
var siInputs = container.find('input[name="gpa_sum_si[]"]');
|
||
var premiumInputs = container.find('input[name="gpa_sum_premium[]"]');
|
||
|
||
var siValues = [];
|
||
var premiumValues = [];
|
||
var siDuplicates = false;
|
||
var premiumDuplicates = false;
|
||
|
||
// Extract values from input arrays
|
||
siInputs.each(function() {
|
||
siValues.push($(this).val());
|
||
});
|
||
|
||
premiumInputs.each(function() {
|
||
premiumValues.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < siValues.length; i++) {
|
||
for (var j = i + 1; j < siValues.length; j++) {
|
||
if (siValues[i] === siValues[j]) {
|
||
siDuplicates = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
// //console.log('siValues', siValues);
|
||
// //console.log('premiumValues', premiumValues);
|
||
// //console.log('siDuplicates', siDuplicates);
|
||
// //console.log('premiumDuplicates', premiumDuplicates);
|
||
|
||
if (siDuplicates || premiumDuplicates) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
|
||
} else if (selectedValue == 3) {
|
||
|
||
var siInputs = container.find('input[name="gpa_sum_si2[]"]');
|
||
var premiumInputs = container.find('input[name="gpa_sum_premium2[]"]');
|
||
var bandInputs = container.find('input[name="gpa_band[]"]');
|
||
|
||
var siValues = [];
|
||
var premiumValues = [];
|
||
var bandValues = [];
|
||
var siDuplicates = false;
|
||
var premiumDuplicates = false;
|
||
var bandDuplicates = false;
|
||
|
||
// Extract values from input arrays
|
||
siInputs.each(function() {
|
||
siValues.push($(this).val());
|
||
});
|
||
|
||
premiumInputs.each(function() {
|
||
premiumValues.push($(this).val());
|
||
});
|
||
|
||
bandInputs.each(function() {
|
||
bandValues.push($(this).val());
|
||
});
|
||
|
||
for (var i = 0; i < siValues.length; i++) {
|
||
for (var j = i + 1; j < siValues.length; j++) {
|
||
if (siValues[i] === siValues[j]) {
|
||
siDuplicates = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
for (var i = 0; i < bandValues.length; i++) {
|
||
for (var j = i + 1; j < bandValues.length; j++) {
|
||
if (bandValues[i] === bandValues[j]) {
|
||
bandDuplicates = true;
|
||
}
|
||
}
|
||
}
|
||
|
||
// //console.log('siValues', siValues);
|
||
// //console.log('premiumValues', premiumValues);
|
||
// //console.log('bandValues', bandValues);
|
||
// //console.log('siDuplicates', siDuplicates);
|
||
// //console.log('premiumDuplicates', premiumDuplicates);
|
||
// //console.log('bandDuplicates', bandDuplicates);
|
||
|
||
if (siDuplicates || bandDuplicates || premiumDuplicates) {
|
||
toastr.warning('Duplicates found!', 'warning');
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
function basicPayMultiple(input)
|
||
{
|
||
|
||
console.log('basicPayMultiple function called')
|
||
|
||
var inputId = input.id;
|
||
var inputValue = input.value.replace(/,/g, '');
|
||
var count = inputId.split('_')[2];
|
||
console.log('count :', count)
|
||
console.log('input :', input);
|
||
console.log('input_id :', input.id);
|
||
console.log('input_class :', input.className);
|
||
|
||
if (input.className.includes('basic_pay')) {
|
||
|
||
if(!count){
|
||
count = 'first'
|
||
}
|
||
|
||
// Sum insured
|
||
var basicMultiplier = $('#basic_multiplier').val().replace(/,/g, '');
|
||
var multi = basicMultiplier * inputValue;
|
||
console.log('multi', multi);
|
||
$('#gpa_basic_si_' + count).val(multi).trigger('keyup');
|
||
|
||
// Premium
|
||
var gpaBasicSiValue = multi; // We just calculated this value
|
||
var premiumMultiplier = $('#premium_multiplier').val().replace(/,/g, '');
|
||
var multi_2 = gpaBasicSiValue * premiumMultiplier / 1000;
|
||
console.log('multi_2', multi_2);
|
||
$('#gpa_basic_premium_' + count).val(multi_2).trigger('keyup');
|
||
|
||
}
|
||
}
|
||
|
||
function basicMultiplierAndPremiumMultipiler(input)
|
||
{
|
||
|
||
console.log('basicPayMultipleforfirstone function called')
|
||
|
||
var inputId = input.id;
|
||
var inputValue = input.value.replace(/,/g, '');
|
||
|
||
console.log('input', input);
|
||
console.log('input id ', input.id);
|
||
console.log('input class ', input.className);
|
||
console.log('inputValue', inputValue);
|
||
|
||
if (input.className.includes('basic_multiplier')) {
|
||
|
||
console.log('basic_multiplier called')
|
||
|
||
var basic_pay = $('input[name="basic_pay[]"]');
|
||
var basic_multiplier = input.value;
|
||
var premium_multiplier = $('#premium_multiplier').val();
|
||
|
||
var sum_insured = $('input[name="gpa_basic_si[]"]');
|
||
var premium = $('input[name="gpa_basic_premium[]"]');
|
||
|
||
|
||
basic_pay.each(function(index) {
|
||
|
||
var basic_pay_amount = $(this).val().replace(/,/g, '');
|
||
console.log('basic_pay_amount', basic_pay_amount)
|
||
|
||
var sum_insured_amount = basic_pay_amount * basic_multiplier;
|
||
console.log('sum_insured_amount', sum_insured_amount);
|
||
$(sum_insured[index]).val(sum_insured_amount);
|
||
$(sum_insured[index]).trigger('keyup');
|
||
|
||
var premium_amount = (sum_insured_amount / 1000) * premium_multiplier;
|
||
console.log('premium_amount', premium_amount);
|
||
$(premium[index]).val(premium_amount);
|
||
$(premium[index]).trigger('keyup');
|
||
|
||
});
|
||
|
||
|
||
} else if (input.className.includes('premium_multiplier')) {
|
||
|
||
console.log('premium_multiplier called')
|
||
|
||
var premium_multiplier = input.value;
|
||
var sum_insured = $('input[name="gpa_basic_si[]"]');
|
||
var premium = $('input[name="gpa_basic_premium[]"]');
|
||
|
||
|
||
sum_insured.each(function(index) {
|
||
|
||
var sum_insured_amount = $(this).val().replace(/,/g, '');
|
||
console.log('sum_insured_amount', sum_insured_amount)
|
||
|
||
var premium_amount = (sum_insured_amount / 1000) * premium_multiplier;
|
||
console.log('premium_amount', premium_amount);
|
||
$(premium[index]).val(premium_amount);
|
||
$(premium[index]).trigger('keyup');
|
||
|
||
});
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function gpaSumInsureMultiplier(element)
|
||
{
|
||
|
||
// //console.log(element);
|
||
|
||
var element = $('#gpa_sum_multiplier')[0];
|
||
var sumInsured = $('input[name="gpa_sum_si[]"]');
|
||
|
||
if ($('#si_or_bp').val() == 3) {
|
||
|
||
var element = $('#gpa_sum_multiplier2')[0]
|
||
var sumInsured = $('input[name="gpa_sum_si2[]"]')
|
||
}
|
||
|
||
// //console.log('sumInsured', sumInsured);
|
||
|
||
if ($('#si_or_bp').val() == 2) {
|
||
var premium = $('input[name="premium[]"]');
|
||
} else if ($('#si_or_bp').val() == 3) {
|
||
var premium = $('input[name="gpa_sum_premium2[]"]');
|
||
} else {
|
||
var premium = $('input[name="gpa_sum_premium[]"]');
|
||
}
|
||
|
||
// //console.log(premium);
|
||
|
||
sumInsured.each(function(index) {
|
||
|
||
var siValue = $(this).val().replace(/,/g, '');
|
||
// //console.log('siValue', siValue);
|
||
|
||
var premiumValue = (siValue / 1000) * element.value;
|
||
// //console.log('premiumValue', premiumValue);
|
||
|
||
var premiumValuedata = premium[index];
|
||
// //console.log('premiumValuedata', premiumValuedata);
|
||
|
||
|
||
if (premiumValuedata) {
|
||
premiumValuedata.value = Math.floor(premiumValue);
|
||
}
|
||
// premium[index].value = Math.floor(premiumValue);
|
||
$(premium[index]).trigger('keyup');
|
||
// premium.eq(index).val(Math.floor(premiumValue));
|
||
|
||
});
|
||
}
|
||
|
||
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();
|
||
$('.gpa_band_remove').hide();
|
||
$('.gpa_basic_pay_remove').show();
|
||
|
||
$('#si_or_bp_full_div').css({
|
||
'display': '',
|
||
});
|
||
$('#si_or_bp_sum_insure').css({
|
||
'display': 'none'
|
||
});
|
||
$('#si_or_bp_basic_pay').css({
|
||
'display': ''
|
||
});
|
||
$('#si_or_bp_grade').css({
|
||
'display': 'none'
|
||
});
|
||
|
||
$('#gpa_sum_multiplier').removeAttr('required', false);
|
||
$('#gpa_sum_si').removeAttr('required', false);
|
||
$('#gpa_sum_premium').removeAttr('required', false);
|
||
|
||
$('#gpa_sum_multiplier2').removeAttr('required', false);
|
||
$('#gpa_sum_si2').removeAttr('required', false);
|
||
$('#gpa_band').removeAttr('required', false);
|
||
$('#gpa_sum_premium2').removeAttr('required', false);
|
||
|
||
|
||
|
||
$('#basic_multiplier').attr('required', true);
|
||
$('#premium_multiplier').attr('required', true);
|
||
$('#basic_pay').attr('required', true);
|
||
$('#gpa_basic_si').attr('required', true);
|
||
$('#gpa_basic_premium').attr('required', true);
|
||
|
||
|
||
var gridContentInput = $('#grid_content_input');
|
||
|
||
var elementsToHide = gridContentInput.find('.gpa_sum_insure_remove');
|
||
|
||
elementsToHide.hide();
|
||
|
||
|
||
} else if (selectedValue == 1) {
|
||
|
||
$('.gpa_sum_insure_remove').show();
|
||
$('.gpa_band_remove').hide();
|
||
$('.gpa_basic_pay_remove').hide();
|
||
|
||
var count = $("div.form-row.gpa_sum_insure_remove").length;
|
||
|
||
if (count == 0) {
|
||
$('#gmc_add_more').show();
|
||
} else {
|
||
$('#gmc_add_more').hide();
|
||
}
|
||
|
||
// //console.log('gmcBandInput', count)
|
||
|
||
|
||
var gpaBandRemoveElements = $("#grid_1").nextAll("div").find(".gpa_band_remove").length;
|
||
//console.log("Elements with class 'gpa_band_remove' within next div siblings:", gpaBandRemoveElements);
|
||
|
||
var gmcBandInput = $("#grid_1").find('input[name="gmc_band[]"]').length
|
||
//console.log('gmcBandInput', gmcBandInput)
|
||
|
||
|
||
$('#si_or_bp_full_div').css({
|
||
'display': '',
|
||
});
|
||
$('#si_or_bp_sum_insure').css({
|
||
'display': ''
|
||
});
|
||
$('#si_or_bp_basic_pay').css({
|
||
'display': 'none'
|
||
});
|
||
$('#si_or_bp_grade').css({
|
||
'display': 'none'
|
||
});
|
||
|
||
|
||
$('#basic_multiplier').removeAttr('required', false);
|
||
$('#premium_multiplier').removeAttr('required', false);
|
||
$('#basic_pay').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);
|
||
$('#gpa_band').removeAttr('required', false);
|
||
$('#gpa_sum_premium2').removeAttr('required', false);
|
||
|
||
|
||
$('#gpa_sum_multiplier').attr('required', true);
|
||
$('#gpa_sum_si').attr('required', true);
|
||
$('#gpa_sum_premium').attr('required', true);
|
||
|
||
var gridContentInput = $('#grid_content_input');
|
||
|
||
var elementsToUnhide = gridContentInput.find('.gpa_sum_insure_remove');
|
||
|
||
elementsToUnhide.show();
|
||
|
||
} else if (selectedValue == 3) {
|
||
|
||
$('.gpa_sum_insure_remove').hide();
|
||
$('.gpa_band_remove').show();
|
||
$('.gpa_basic_pay_remove').hide();
|
||
|
||
var count = $("div.form-row.gpa_band_remove").length;
|
||
|
||
if (count == 0) {
|
||
$('#gmc_add_more2').show();
|
||
} else {
|
||
$('#gmc_add_more2').hide();
|
||
}
|
||
|
||
// //console.log('gmcBandInput', count)
|
||
|
||
$('#si_or_bp_full_div').css({
|
||
'display': '',
|
||
});
|
||
$('#si_or_bp_grade').css({
|
||
'display': ''
|
||
});
|
||
$('#si_or_bp_basic_pay').css({
|
||
'display': 'none'
|
||
});
|
||
$('#si_or_bp_sum_insure').css({
|
||
'display': 'none'
|
||
});
|
||
|
||
|
||
$('#basic_multiplier').removeAttr('required', false);
|
||
$('#premium_multiplier').removeAttr('required', false);
|
||
$('#basic_pay').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');
|
||
$('#gpa_sum_premium').attr('required');
|
||
|
||
$('#gpa_sum_multiplier2').removeAttr('required', true);
|
||
$('#gpa_sum_si2').removeAttr('required', true);
|
||
$('#gpa_band').removeAttr('required', true);
|
||
$('#gpa_sum_premium2').removeAttr('required', true);
|
||
|
||
var gridContentInput = $('#grid_content_input');
|
||
|
||
var elementsToUnhide = gridContentInput.find('.gpa_sum_insure_remove');
|
||
|
||
// elementsToUnhide.show();
|
||
|
||
} else {
|
||
$('#si_or_bp_full_div').css({
|
||
'display': 'none',
|
||
});
|
||
$('#si_or_bp_sum_insure').css({
|
||
'display': ''
|
||
});
|
||
$('#si_or_bp_basic_pay').css({
|
||
'display': ''
|
||
});
|
||
$('#si_or_bp_grade').css({
|
||
'display': ''
|
||
});
|
||
}
|
||
|
||
|
||
}
|
||
|
||
function getCurrentTime()
|
||
{
|
||
var now = new Date();
|
||
var hours = now.getHours();
|
||
var minutes = now.getMinutes();
|
||
var ampm = hours >= 12 ? 'PM' : 'AM';
|
||
hours = hours % 12;
|
||
hours = hours ? hours : 12; // 0 should be considered as 12
|
||
minutes = minutes < 10 ? '0' + minutes : minutes; // Add leading zero if minutes < 10
|
||
var timeString = hours + ':' + minutes + ' ' + ampm;
|
||
return timeString;
|
||
}
|
||
|
||
function createCheckboxes(obj, additional_relationship = [], unique_id = null, policy_type = null)
|
||
{
|
||
console.log('object', obj);
|
||
console.log('additional_relationship', additional_relationship);
|
||
|
||
if (typeof additional_relationship === 'string') {
|
||
additional_relationship = JSON.parse(additional_relationship);
|
||
} else if (!Array.isArray(additional_relationship)) {
|
||
additional_relationship = [];
|
||
}
|
||
|
||
if (obj['either-parents-pil'] && obj['either-parents-pil'] > 0) {
|
||
obj['parents'] = 1;
|
||
obj['parents-in-law'] = 1;
|
||
}
|
||
|
||
let $relationshipElement = $('#relationship');
|
||
|
||
if(unique_id){
|
||
$relationshipElement = $('#relationship_' + unique_id);
|
||
}
|
||
|
||
$relationshipElement.empty();
|
||
let html = `
|
||
<div class="form-row">
|
||
<div class="form-col">
|
||
<label>Choose applicable family members</label>`;
|
||
|
||
if (obj['self'] > 0) {
|
||
let selfValue = additional_relationship['self'] || 'NA';
|
||
console.log('selfValue', selfValue);
|
||
|
||
html += `
|
||
<div class="radio-group">
|
||
<label class="col-lg-1">Self:</label>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="self" id="self-yes" value="1" ${selfValue == '1' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="self-yes">Yes</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="self" id="self-no" value="0" ${selfValue == '0' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="self-no">No</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="self" id="self-any" value="any" ${selfValue == 'any' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="self-any">Maybe</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="self" id="self-na" value="NA" ${selfValue == 'NA' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="self-any">NA</label>
|
||
</div>
|
||
</div>`;
|
||
}
|
||
|
||
if (obj['spouse'] > 0) {
|
||
let spouseValue = additional_relationship['spouse'] || 'NA';
|
||
|
||
html += `
|
||
<div class="radio-group">
|
||
<label class="col-lg-1">Spouse:</label>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="spouse" id="spouse-yes" value="1" ${spouseValue == '1' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="spouse-yes">Yes</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="spouse" id="spouse-no" value="0" ${spouseValue == '0' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="spouse-no">No</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="spouse" id="spouse-any" value="any" ${spouseValue == 'any' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="spouse-any">Maybe</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="spouse" id="spouse-na" value="NA" ${spouseValue == 'NA' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="spouse-any">NA</label>
|
||
</div>
|
||
</div>`;
|
||
}
|
||
|
||
if (obj['childrens'] > 0) {
|
||
let childrensValue = additional_relationship['childrens'] || 'NA';
|
||
|
||
html += `
|
||
<div class="radio-group">
|
||
<label class="col-lg-1">Children:</label>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="childrens" id="children-all" value="4" ${childrensValue === '4' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="children-4">4</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="childrens" id="children-3" value="3" ${childrensValue === '3' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="children-3">3</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="childrens" id="children-2" value="2" ${childrensValue === '2' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="children-2">2</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="childrens" id="children-1" value="1" ${childrensValue === '1' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="children-1">1</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="childrens" id="children-any" value="any" ${childrensValue === 'any' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="children-any">Any</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="childrens" id="children-no" value="0" ${childrensValue === '0' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="children-unset">No</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="childrens" id="children-unset" value="NA" ${childrensValue === 'NA' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="children-unset">NA</label>
|
||
</div>
|
||
</div>`;
|
||
}
|
||
|
||
if (obj['parents'] > 0) {
|
||
let parentsValue = additional_relationship['parents'] || 'NA';
|
||
|
||
html += `
|
||
<div class="radio-group">
|
||
<label class="col-lg-1">Parents:</label>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents" id="parents-single" value="1" ${parentsValue === '1' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-single">1</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents" id="parents-double" value="2" ${parentsValue === '2' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-double">2</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents" id="parents-any" value="any" ${parentsValue === 'any' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-any">Any</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents" id="parents-no" value="0" ${parentsValue === '0' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-no">No</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents" id="parents-unset" value="NA" ${parentsValue === 'NA' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-unset">NA</label>
|
||
</div>
|
||
</div>`;
|
||
}
|
||
|
||
if (obj['parents-in-law'] > 0) {
|
||
let parentsInLawValue = additional_relationship['parents-in-law'] || 'NA';
|
||
html += `
|
||
<div class="radio-group">
|
||
<label class="col-lg-1">Parents-in-law:</label>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-single" value="1" ${parentsInLawValue === '1' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-in-law-single">1</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-double" value="2" ${parentsInLawValue === '2' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-in-law-double">2</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-any" value="any" ${parentsInLawValue === 'any' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-in-law-any">Any</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-no" value="0" ${parentsInLawValue === '0' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-in-law-no">No</label>
|
||
</div>
|
||
<div class="form-check col-lg-1">
|
||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-unset" value="NA" ${parentsInLawValue === 'NA' ? 'checked' : ''}>
|
||
<label class="form-check-label radioalign" for="parents-in-law-unset">NA</label>
|
||
</div>
|
||
</div>`;
|
||
}
|
||
|
||
html += `
|
||
</div>
|
||
</div>`;
|
||
|
||
$relationshipElement.append(html);
|
||
|
||
if(policy_type == 1 || policy_type == 6 || policy_type == 7){
|
||
|
||
$('.radio-group .form-check').css('margin-right', '-50px');
|
||
}
|
||
}
|
||
|
||
|
||
function formatString(str)
|
||
{
|
||
return str.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
||
}
|
||
|
||
$('#del_btn').click(function()
|
||
{
|
||
//console.log('delete btn clicked');
|
||
|
||
Swal.fire({
|
||
title: "Are you sure?",
|
||
text: "You need to Delete this!",
|
||
icon: "warning",
|
||
showCancelButton: true,
|
||
confirmButtonColor: "#3085d6",
|
||
confirmButtonText: "Yes",
|
||
}).then((result) => {
|
||
//console.log('after then entered');
|
||
|
||
if (result.isConfirmed) {
|
||
//console.log('isConfirmed entered');
|
||
|
||
var client_policy_id = $('#client_policy_id_2').val();
|
||
//console.log('client_policy_id', client_policy_id)
|
||
|
||
var rack_rate_type = $('#rack_rate_type_2').val();
|
||
//console.log('rack_rate_type', rack_rate_type)
|
||
|
||
var client_id = $('#Client_id_2').val();
|
||
//console.log('client_id', client_id)
|
||
|
||
|
||
$('.loader').fadeIn();
|
||
$('.loader-mask').fadeIn();
|
||
|
||
$.ajax({
|
||
url: '<?php echo base_url('util/delete-additional-rack-rate/'); ?>' + client_id + '/' + client_policy_id + '/' + rack_rate_type,
|
||
type: 'GET',
|
||
success: function(res) {
|
||
|
||
//console.log('ajax success entered');
|
||
//console.log(res);
|
||
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
|
||
if (res.status === true) {
|
||
|
||
$('#additional_grid_content_input').empty();
|
||
$('#additional_grid').val('');
|
||
$('#individual_2').prop('checked', true)
|
||
$('#single_2').prop('checked', false)
|
||
$('input[type="checkbox"]').prop('checked', false);
|
||
|
||
|
||
toastr.success(res.message, 'Success');
|
||
|
||
} else if (res.status === false) {
|
||
toastr.warning(res.message, 'Warning');
|
||
return;
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
//console.log('ajax error entered');
|
||
console.error(xhr.responseText);
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}
|
||
});
|
||
|
||
// Removed the duplicated loader hiding code here
|
||
}
|
||
|
||
//console.log('after then entered end or cancel');
|
||
});
|
||
|
||
//console.log('delete btn clicked end');
|
||
});
|
||
|
||
function checkCheckboxes()
|
||
{
|
||
|
||
var checkboxes = $('input.relation_checkbox');
|
||
var checkedCount = checkboxes.filter(':checked').length;
|
||
var uncheckedCount = checkboxes.not(':checked').length;
|
||
|
||
//console.log('Checked count:', checkedCount); // Debugging
|
||
//console.log('unchecked Count', uncheckedCount);
|
||
|
||
if (checkedCount < 1) {
|
||
toastr.warning('You must select at least one checkbox.', 'Warning');
|
||
return false;
|
||
} else if (checkedCount == uncheckedCount) {
|
||
toastr.warning('You can not select all of the checkboxes', 'Waraning');
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
function checkTermsSISameAsRackRateSI(input)
|
||
{
|
||
|
||
console.log('checkTermsSISameAsRackRateSI testing..........');
|
||
console.log(input);
|
||
|
||
var client_policy_id = $('#client_policy_id').val();
|
||
console.log('client_policy_id', client_policy_id)
|
||
|
||
var inputValue = input.value.replace(/,/g, '');
|
||
inputValue = parseFloat(inputValue);
|
||
console.log(inputValue);
|
||
|
||
var url = '<?php echo base_url('util/getPolicyTerms/') ?>' + client_policy_id;
|
||
|
||
$.get(url, function(response) {
|
||
console.log(response);
|
||
console.log(response.data);
|
||
|
||
var policyTerms = response.data;
|
||
var valueExists = false;
|
||
|
||
for (var i = 0; i < policyTerms.length; i++) {
|
||
if (parseFloat(policyTerms[i]) === inputValue) {
|
||
valueExists = true;
|
||
break;
|
||
}
|
||
}
|
||
|
||
if (!valueExists) {
|
||
input.value = "";
|
||
toastr.warning(`Value does not exist in the Policy Terms.`);
|
||
}
|
||
|
||
}).fail(function(xhr, status, error) {
|
||
console.error(xhr.responseText);
|
||
console.error(status, error);
|
||
toastr.error(`Failed to retrieve Policy Terms. Error: ${error}`);
|
||
});
|
||
}
|
||
|
||
function checkPolicyTermsSI(unique_id = null)
|
||
{
|
||
console.log(unique_id)
|
||
console.log('checkPolicyTermsSI function called');
|
||
|
||
var id = $('#grid')[0];
|
||
var container = $('#grid_content_input');
|
||
|
||
var val = 0;
|
||
|
||
if (unique_id) {
|
||
id = $('#grid_'+unique_id)[0];
|
||
container = $('#grid_content_input_'+unique_id);
|
||
}
|
||
|
||
console.log(id);
|
||
console.log(container);
|
||
|
||
var siInputs = $();
|
||
|
||
switch (id.value) {
|
||
case '1':
|
||
var selectedValue = $('#si_or_bp').val();
|
||
if (selectedValue == 1) {
|
||
siInputs = container.find('input[name="gpa_sum_si[]"]');
|
||
} else if (selectedValue == 3) {
|
||
siInputs = container.find('input[name="gpa_sum_si2[]"]');
|
||
}
|
||
break;
|
||
case '2':
|
||
siInputs = container.find('input[name="gpa_si"]');
|
||
break;
|
||
case '3':
|
||
siInputs = container.find('input[name="3_si[]"]');
|
||
break;
|
||
case '4':
|
||
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"]');
|
||
break;
|
||
case '7':
|
||
siInputs = container.find('input[name="7_si[]"]');
|
||
break;
|
||
case '8':
|
||
siInputs = container.find('input[name="8_si[]"]');
|
||
break;
|
||
case '9':
|
||
siInputs = container.find('input[name="gpa_si"]');
|
||
break;
|
||
case '10':
|
||
siInputs = container.find('input[name="10_si[]"]');
|
||
break;
|
||
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 = $();
|
||
}
|
||
|
||
console.log('siInputs', siInputs);
|
||
|
||
var client_policy_id = $('#client_policy_id').val();
|
||
console.log('client_policy_id', client_policy_id);
|
||
|
||
var policy_terms_si = terms_si_amount_array;
|
||
var rack_rate_si = [];
|
||
|
||
if(siInputs != null) {
|
||
siInputs.each(function() {
|
||
var input = $(this).val();
|
||
console.log('input value', input);
|
||
rack_rate_si.push(input.replace(/,/g, ''));
|
||
});
|
||
}
|
||
|
||
console.log('policy_terms_si', policy_terms_si);
|
||
console.log('rack_rate_si', rack_rate_si);
|
||
|
||
let new_array = [];
|
||
|
||
rack_rate_si.forEach(element => {
|
||
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) {
|
||
return true;callback
|
||
} else {
|
||
return false;
|
||
}
|
||
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------------------------------------
|
||
|
||
function appendNewTab(tabNameData = null, data = null)
|
||
{
|
||
console.log('appendNewTab function called');
|
||
let tabName = tabNameData;
|
||
|
||
if(tabNameData == null){
|
||
tabName = prompt("Enter rack rate name:");
|
||
}
|
||
|
||
const myTabs = document.getElementById('nav_pills');
|
||
const tabContent = document.getElementById('tab_content');
|
||
|
||
// Unique ID and name for the new tab
|
||
if (tabName) {
|
||
let tabId = tabName.replace(/\s+/g, "-").toLowerCase();
|
||
// Ensure the tab ID is unique
|
||
let uniqueId = tabId;
|
||
let counter = 1;
|
||
while (document.getElementById(uniqueId)) {
|
||
uniqueId = `${tabId}-${counter}`;
|
||
counter++;
|
||
}
|
||
tabId = uniqueId;
|
||
|
||
let newSpan = document.createElement('span');
|
||
newSpan.classList.add('d-none', 'd-sm-inline-block');
|
||
newSpan.setAttribute('id', `tabname_${tabId}`);
|
||
newSpan.textContent = tabName;
|
||
|
||
// Create tab link
|
||
let newTabLink = document.createElement('a');
|
||
newTabLink.classList.add('nav-link', 'nav-link', 'px-3', 'py-2');
|
||
newTabLink.setAttribute('data-toggle', 'tab');
|
||
newTabLink.setAttribute('href', `#${tabId}`);
|
||
// newTabLink.textContent = tabName;
|
||
newTabLink.appendChild(newSpan);
|
||
|
||
// Create tab list item
|
||
let newTabListItem = document.createElement('li');
|
||
newTabListItem.classList.add('nav-item');
|
||
newTabListItem.setAttribute('id', 'list_'+tabId);
|
||
newTabListItem.appendChild(newTabLink);
|
||
myTabs.appendChild(newTabListItem);
|
||
|
||
// Create tab pane
|
||
let newTabPane = document.createElement('div');
|
||
newTabPane.classList.add('tab-pane', 'fade');
|
||
newTabPane.setAttribute('id', tabId);
|
||
newTabPane.innerHTML = `
|
||
<form role="form" class="parsley-examples" method="post" id="GridForm_${tabId}"
|
||
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_${tabId}" value="`+client_policy_for_additional_rack_rate+`"/>
|
||
<input type="hidden" name="rack_rate_name" value="${tabName}">
|
||
<input type="hidden" id="grid_emp_count" />
|
||
<div class="form-group">
|
||
|
||
<div class="form-row" id="rac_rate_dropdown_${tabId}">
|
||
<div class="form-group col-md-6">
|
||
<label for="emp_code">Policy Premium Type<span
|
||
class="text-danger">*</span></label>
|
||
<select class="form-control" id="grid_${tabId}" name="policy_grid_id"
|
||
onchange="addGridHTML(this, false, false, false, '${tabId}')" required>
|
||
</select>
|
||
</div>
|
||
|
||
<div class="form-group col-md-4"
|
||
style="position: relative; left: 45px; display:none" id="premium_type_${tabId}">
|
||
<label for="css"> Premium Calculation </label>
|
||
<div style="display: flex; align-items: center;">
|
||
<input type="radio" id="individual_${tabId}" name="premium_type" value="2">
|
||
<label for="individual" style="position: relative;top: 5px;left: 5px;">
|
||
Individual </label>
|
||
<input type="radio" id="single_${tabId}" name="premium_type" value="1">
|
||
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-row" id="relationship_${tabId}" class="relationship" >
|
||
</div>
|
||
|
||
<a href="#" id="copyfromexcel_${tabId}" onclick="copyFromExcel(this, '${tabId}')">Copy from excel</a>
|
||
<hr>
|
||
|
||
<div class="form-row" id="grid_content_input_${tabId}" style="display: true;">
|
||
</div>
|
||
|
||
|
||
<div class="form-row" id="grid_content_from_excel_${tabId}" style="display: none;">
|
||
<p>Paste excel data here: <a href="#" type="button" onclick="copyHeaders('${tabId}')">Copy Excel Headers</a></p>
|
||
<textarea class="form-control excel_textarea" id="copied_excel_data_${tabId}" name="copied_excel_data" style="width:100%;height:200px;" oninput="generateTable('${tabId}')"></textarea><br>
|
||
<hr>
|
||
<div class="excel_table_class" id="excel_table_${tabId}" style="display: none;"></div>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="form-group text-right m-b-0" id="hide_smbt_btn_${tabId}">
|
||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2_${tabId}">Submit</button>
|
||
<a class="btn btn-danger waves-effect waves-light mr-1" id="btnGridremove_2_${tabId}" onclick="removeTab(this)">Delete</a>
|
||
<a class="btn btn-secondary waves-effect waves-light mr-1" id="btnGridrename_${tabId}" onclick="renameRackRateTab(this)">Rename</a>
|
||
</div>
|
||
</form>`;
|
||
tabContent.appendChild(newTabPane);
|
||
|
||
|
||
var policy_grid_id = null;
|
||
var additional_relationship = [];
|
||
var premium_type = null;
|
||
if(data){
|
||
|
||
addGridHTML(false, data[0], data[0].policy_grid_id, false, tabId);
|
||
// data.shift();
|
||
$.each(data, function(index, item) {
|
||
// console.log(item)
|
||
policy_grid_id = item.policy_grid_id
|
||
additional_relationship = item.additional_relationship;
|
||
premium_type = item.premium_type;
|
||
appendGridtHtml(item.policy_grid_id, tabId, item);
|
||
});
|
||
}
|
||
|
||
appendGridData(rack_rate_array, policy_grid_id, tabId);
|
||
hideShowPolicyPremium(policy_type_string, tabId);
|
||
createCheckboxes(family_floter_obj, additional_relationship, tabId);
|
||
hideShowSubmitButton(employee_count, tabId);
|
||
editPolicyPremiumCalculationSetValue(premium_type, tabId);
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function appendGridData(data, policy_grid_id_value = null, unique_id = null)
|
||
{
|
||
console.log('policy_grid_id_value', policy_grid_id_value)
|
||
console.log(data)
|
||
|
||
var rack_rate_id = $('#grid');
|
||
|
||
if(unique_id){
|
||
rack_rate_id = $('#grid_'+unique_id)
|
||
}
|
||
|
||
rack_rate_id.empty();
|
||
|
||
rack_rate_id.append($('<option>', {
|
||
value: '',
|
||
text: 'Select Premium Type',
|
||
selected: true
|
||
}));
|
||
|
||
$.each(data, function(index, item) {
|
||
|
||
var option = $('<option>', {
|
||
value: item.id,
|
||
text:item.policy_grid_type,
|
||
'data-id' : item.ui_type
|
||
});
|
||
if (policy_grid_id_value == item.id) {
|
||
option.attr('selected', true);
|
||
}
|
||
rack_rate_id.append(option);
|
||
});
|
||
|
||
}
|
||
|
||
function hideShowPolicyPremium(policy_type_string, unique_id = null)
|
||
{
|
||
var premium_type = $('#premium_type');
|
||
var individual = $('#individual');
|
||
if(unique_id){
|
||
premium_type = $('#premium_type_' + unique_id);
|
||
individual = $('#individual_' + unique_id);
|
||
}
|
||
|
||
if (policy_type_string == 'GMC') {
|
||
premium_type.show();
|
||
individual.prop('checked', true)
|
||
} else {
|
||
premium_type.hide();
|
||
individual.prop('checked', true)
|
||
}
|
||
|
||
}
|
||
|
||
function hideShowSubmitButton(emp_count, unique_id = null)
|
||
{
|
||
var hide_smbt_btn = $("#hide_smbt_btn");
|
||
if(unique_id){
|
||
hide_smbt_btn = $("#hide_smbt_btn_"+unique_id);
|
||
}
|
||
|
||
if (emp_count > 0) {
|
||
hide_smbt_btn.hide();
|
||
} else {
|
||
hide_smbt_btn.show();
|
||
}
|
||
|
||
}
|
||
|
||
function removeTab(input)
|
||
{
|
||
console.log(input)
|
||
secondaryValue = ''
|
||
if(input.id){
|
||
var unique_id = input.id.split('_');
|
||
if (unique_id.length > 1) {
|
||
secondaryValue = unique_id[2];
|
||
}
|
||
}
|
||
Swal.fire({
|
||
title: "Are you sure?",
|
||
text: "You need to remove this Tab.",
|
||
icon: "info",
|
||
showCancelButton: true,
|
||
confirmButtonColor: "#3085d6",
|
||
confirmButtonText: "Yes",
|
||
}).then((result) => {
|
||
|
||
if (result.isConfirmed) {
|
||
|
||
$('#'+secondaryValue).remove();
|
||
$('#list_'+secondaryValue).remove();
|
||
$('#rack_rate_one').click();
|
||
}
|
||
|
||
});
|
||
}
|
||
|
||
function copyFromExcel(input, unique_id = null)
|
||
{
|
||
|
||
console.log('called');
|
||
console.log('input', input);
|
||
|
||
var grid_content_input = $('#grid_content_input');
|
||
var grid_content_from_excel = $('#grid_content_from_excel');
|
||
|
||
if(unique_id){
|
||
grid_content_input = $('#grid_content_input_'+unique_id);
|
||
grid_content_from_excel = $('#grid_content_from_excel_'+unique_id);
|
||
}
|
||
|
||
if ($(input).text() == "Copy from excel") {
|
||
$(input).text("Manual entry")
|
||
|
||
} else {
|
||
$(input).text("Copy from excel");
|
||
}
|
||
|
||
grid_content_input.toggle();
|
||
grid_content_from_excel.toggle();
|
||
|
||
}
|
||
|
||
function renameRackRateTab(input)
|
||
{
|
||
console.log(input)
|
||
console.log(input.id)
|
||
var newTabName = prompt('Enter the tab name')
|
||
console.log(newTabName)
|
||
secondaryValue = '';
|
||
if(input.id){
|
||
var unique_id = input.id.split('_');
|
||
if (unique_id.length > 1) {
|
||
secondaryValue = unique_id[1];
|
||
}
|
||
}
|
||
console.log(secondaryValue)
|
||
var tabid = 'tabname_' + secondaryValue;
|
||
console.log(tabid)
|
||
|
||
$('#'+tabid).text(newTabName)
|
||
}
|
||
|
||
function groupByRackRateName(data)
|
||
{
|
||
var acc = {};
|
||
|
||
$.each(data, function(index, item) {
|
||
var rackRateName = item.rack_rate_name;
|
||
|
||
if (!acc[rackRateName]) {
|
||
acc[rackRateName] = [];
|
||
}
|
||
|
||
acc[rackRateName].push(item);
|
||
});
|
||
|
||
return acc;
|
||
}
|
||
|
||
function editPolicyPremiumCalculationSetValue(premium_type, unique_id = null)
|
||
{
|
||
console.log('editPolicyPremiumCalculationSetValue unique id', unique_id);
|
||
console.log('editPolicyPremiumCalculationSetValue premium_type', premium_type);
|
||
|
||
if(unique_id){
|
||
|
||
// console.log('editPolicyPremiumCalculationSetValue step 1');
|
||
|
||
|
||
if (premium_type === '2') {
|
||
// console.log('editPolicyPremiumCalculationSetValue step 2');
|
||
|
||
$('#individual_'+unique_id).prop('checked', true);
|
||
$('#single_'+unique_id).prop('checked', false);
|
||
} else if (premium_type === '1') {
|
||
// console.log('editPolicyPremiumCalculationSetValue step 3');
|
||
|
||
$('#single_'+unique_id).prop('checked', true);
|
||
$('#individual_'+unique_id).prop('checked', false);
|
||
} else {
|
||
// console.log('editPolicyPremiumCalculationSetValue step 4');
|
||
|
||
$('#single_'+unique_id).prop('checked', false);
|
||
$('#individual_'+unique_id).prop('checked', true);
|
||
}
|
||
}else{
|
||
|
||
// console.log('editPolicyPremiumCalculationSetValue step 5');
|
||
|
||
if (premium_type === '2') {
|
||
// console.log('editPolicyPremiumCalculationSetValue step 6');
|
||
|
||
$('#individual').prop('checked', true);
|
||
$('#single').prop('checked', false);
|
||
} else if (premium_type === '1') {
|
||
// console.log('editPolicyPremiumCalculationSetValue step 7');
|
||
|
||
$('#single').prop('checked', true);
|
||
$('#individual').prop('checked', false);
|
||
} else {
|
||
// console.log('editPolicyPremiumCalculationSetValue step 8');
|
||
|
||
$('#single').prop('checked', false);
|
||
$('#individual').prop('checked', true);
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function hideUnitFieldInABranchHaveSingleUnit()
|
||
{
|
||
$('input[name="11_max_si[]"]').each(function() {
|
||
$(this)
|
||
});
|
||
}
|
||
|
||
function checkFamiliFloatersKeysDuplicate(rarc_rate_json_array, formObject)
|
||
{
|
||
|
||
console.log('rarc_rate_json_array length', rarc_rate_json_array.length);
|
||
console.log('formObject type', typeof formObject);
|
||
|
||
let isEqualto = false;
|
||
|
||
if (rarc_rate_json_array.length > 0) {
|
||
console.log('rarc_rate_json_array length', rarc_rate_json_array.length);
|
||
$.each(rarc_rate_json_array, function(index, item){
|
||
|
||
item = JSON.parse(item);
|
||
if(formObject['self'] == item['self'] && formObject['spouse'] == item['spouse'] && formObject['childrens'] == item['childrens'] && formObject['parents'] == item['parents'] && formObject['parents-in-law'] == item['parents-in-law']){
|
||
console.log('true');
|
||
isEqualto = true;
|
||
return false;
|
||
}else{
|
||
console.log('false');
|
||
isEqualto = false;
|
||
}
|
||
});
|
||
}
|
||
|
||
return isEqualto;
|
||
|
||
}
|
||
|
||
</script>
|