FIX_RACK_RATE_ISSUE : RV
This commit is contained in:
parent
26f27ccc47
commit
d36b0b05ed
@ -368,37 +368,8 @@ $('body').on('click', '.btnPolicyModel', function()
|
|||||||
var premium_type_for_primary_rr = [];
|
var premium_type_for_primary_rr = [];
|
||||||
var first = 0;
|
var first = 0;
|
||||||
|
|
||||||
premiumData = [];
|
var premiumData = groupedData.Primary ?? [];
|
||||||
|
console.log('----- premiumData for primary rack rate -----', premiumData);
|
||||||
try {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('An error occurred:', error);
|
|
||||||
console.error('Error Name:', error.name);
|
|
||||||
console.error('Error Message:', error.message);
|
|
||||||
console.error('Error Stack:', error.stack);
|
|
||||||
|
|
||||||
// Optional: handle the error in a user-friendly way
|
|
||||||
console.error('An error occurred while processing the data. Please try again.');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
console.log('premiumData for primary rack rate', premiumData);
|
|
||||||
|
|
||||||
|
|
||||||
if (premiumData.length > 0 && premiumData != 'undefined') {
|
if (premiumData.length > 0 && premiumData != 'undefined') {
|
||||||
$.each(premiumData, function(index, item) {
|
$.each(premiumData, function(index, item) {
|
||||||
@ -416,6 +387,7 @@ $('body').on('click', '.btnPolicyModel', function()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('premiumData for primary rack rate', premiumData);
|
console.log('premiumData for primary rack rate', premiumData);
|
||||||
console.log('additional_relationship for primary rack rate', additional_relationship);
|
console.log('additional_relationship for primary rack rate', additional_relationship);
|
||||||
|
|
||||||
@ -465,6 +437,24 @@ $('body').on('click', '.btnPolicyModel', function()
|
|||||||
console.log("res.premiumData is undefined, null, or empty.");
|
console.log("res.premiumData is undefined, null, or empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (policy_type_string == 'GMC') {
|
||||||
|
$.each(groupedData, function(index, item) {
|
||||||
|
if (index !== 'Primary') {
|
||||||
|
appendNewTab(index, item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('An error occurred:', error);
|
||||||
|
console.error('Error Name:', error.name);
|
||||||
|
console.error('Error Message:', error.message);
|
||||||
|
console.error('Error Stack:', error.stack);
|
||||||
|
|
||||||
|
// Optional: handle the error in a user-friendly way
|
||||||
|
console.error('An error occurred while processing the data. Please try again.');
|
||||||
|
}
|
||||||
|
|
||||||
$('#bs-example-modal-lg').modal('show');
|
$('#bs-example-modal-lg').modal('show');
|
||||||
$("#gpa_si").trigger("keyup");
|
$("#gpa_si").trigger("keyup");
|
||||||
$("#gpa_si_9").trigger("keyup");
|
$("#gpa_si_9").trigger("keyup");
|
||||||
@ -3089,6 +3079,17 @@ function appendNewTab(tabNameData = null, data = null)
|
|||||||
|
|
||||||
console.log('appendNewTab function first index data', data[0])
|
console.log('appendNewTab function first index data', data[0])
|
||||||
console.log('appendNewTab function first index data[0].policy_grid_id', data[0].policy_grid_id)
|
console.log('appendNewTab function first index data[0].policy_grid_id', data[0].policy_grid_id)
|
||||||
|
|
||||||
|
if (data[0].policy_grid_id == 4 || data[0].policy_grid_id == 6) {
|
||||||
|
|
||||||
|
appendFourthAndSixthRackRate(data[0], tabId);
|
||||||
|
policy_grid_id = data[0].policy_grid_id
|
||||||
|
additional_relationship = data[0].additional_relationship;
|
||||||
|
premium_type = data[0].premium_type;
|
||||||
|
|
||||||
|
data.shift();
|
||||||
|
}
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
console.log('appendNewTab function index', index)
|
console.log('appendNewTab function index', index)
|
||||||
@ -3096,12 +3097,6 @@ function appendNewTab(tabNameData = null, data = null)
|
|||||||
additional_relationship = item.additional_relationship;
|
additional_relationship = item.additional_relationship;
|
||||||
premium_type = item.premium_type;
|
premium_type = item.premium_type;
|
||||||
|
|
||||||
// if(index == 0){
|
|
||||||
// addGridHTML(false, item, item.policy_grid_id, si_or_bp_value, tabId);
|
|
||||||
// }else{
|
|
||||||
// appendGridtHtml(item.policy_grid_id, tabId, item);
|
|
||||||
// }
|
|
||||||
|
|
||||||
appendGridtHtml(item.policy_grid_id, tabId, item);
|
appendGridtHtml(item.policy_grid_id, tabId, item);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -3409,4 +3404,58 @@ function checkFamiliFloatersKeysDuplicate(rarc_rate_json_array, formObject)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function appendFourthAndSixthRackRate(data = null, uniqueId = null)
|
||||||
|
{
|
||||||
|
console.log('appendFourthAndSixthRackRate function called');
|
||||||
|
console.log('appendFourthAndSixthRackRate function uniqueId', uniqueId);
|
||||||
|
console.log('appendFourthAndSixthRackRate function data', data);
|
||||||
|
|
||||||
|
|
||||||
|
grid_html = `
|
||||||
|
<div class="form-row" id="grid_4">
|
||||||
|
<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, '${uniqueId}')">+</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
grid_container_id = 'grid_content_input_for_additional_' + uniqueId;
|
||||||
|
console.log('appendFourthAndSixthRackRate function', grid_container_id);
|
||||||
|
grid_container = document.getElementById(grid_container_id);
|
||||||
|
console.log('appendFourthAndSixthRackRate function', grid_container);
|
||||||
|
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||||
|
|
||||||
|
if(unit_length == 1 || unit_length == 0){
|
||||||
|
$('.unitDiv').hide();
|
||||||
|
$('.unitDiv').find('input').removeAttr('required');
|
||||||
|
}else{
|
||||||
|
$('.unitDiv').show();
|
||||||
|
$('.unitDiv').find('input').attr('required', true);
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user