FEAT_OTHER_POLICY_TERMS : RV
This commit is contained in:
parent
b38ccd6698
commit
ec5ae23497
@ -114,6 +114,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->group("terms", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("gpa_create", "ClientController::policyGPATerms");
|
||||
$routes->post("edit", "ClientController::editClientPolicyPremium");
|
||||
$routes->post("other_terms", "ClientController::otherPolicyTermsFormSubmit");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -2157,4 +2157,28 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function otherPolicyTermsFormSubmit()
|
||||
{
|
||||
|
||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||
$policy_terms = $this->request->getPost("policy_terms");
|
||||
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
if ($record) {
|
||||
|
||||
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
|
||||
|
||||
if ($update) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Data updated successfully', 'client_policy_id' => $client_policy_id], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -157,6 +157,7 @@
|
||||
<?php include('policy_grid.php'); ?>
|
||||
<?php include('policy_gmc_terms.php'); ?>
|
||||
<?php include('policy_gpa_terms.php'); ?>
|
||||
<?php include('other_policy_terms.php'); ?>
|
||||
|
||||
<script>
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
@ -217,6 +218,8 @@
|
||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
var subject = item.policy_type_name;
|
||||
|
||||
console.log('search terms subject', subject);
|
||||
|
||||
if (patternGMC.test(subject)) {
|
||||
search_term = 'GMC';
|
||||
} else if (patternGPA.test(subject)) {
|
||||
@ -224,7 +227,7 @@
|
||||
} else {
|
||||
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||
}
|
||||
// console.log('search_term :', search_term)
|
||||
console.log('search_term :', search_term)
|
||||
|
||||
var enrollmentStatus = '';
|
||||
if (item.inception_type == 1) {
|
||||
@ -269,8 +272,8 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -339,7 +342,6 @@
|
||||
|
||||
})
|
||||
|
||||
|
||||
/******** for form submit using AJAX *******/
|
||||
$("#policy_form").submit(function(event) {
|
||||
|
||||
@ -491,8 +493,8 @@
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -540,12 +542,12 @@
|
||||
|
||||
var selectedOption = $('#base_policy').find(':selected');
|
||||
var base_policy_data_id = selectedOption.data('id');
|
||||
console.log('base_policy_data_id', base_policy_data_id);
|
||||
// console.log('base_policy_data_id', base_policy_data_id);
|
||||
|
||||
|
||||
$.get(url, function(res) {
|
||||
// res = JSON.parse(res)//
|
||||
// console.log(res)
|
||||
console.log('polices', res)
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||
$policy_type_value = $('#policy_type').val();
|
||||
@ -587,13 +589,14 @@
|
||||
}
|
||||
} else if ($policy_type_value == 1) {
|
||||
|
||||
if (item.policy_type_id == 1 || item.policy_type_id == 2 || item
|
||||
.policy_type_id == 3) {
|
||||
// const policyTypeId = Number(item.policy_type_id);
|
||||
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
// if ([1, 2, 3, 6, 7,].includes(policyTypeId))
|
||||
if (item.policy_type_id == 1 || item.policy_type_id == 2 || item
|
||||
.policy_type_id == 3 || item.policy_type_id == 7 || item.policy_type_id == 6){
|
||||
|
||||
console.log(item.policy_type_id)
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -1388,7 +1391,7 @@
|
||||
|
||||
$('#base_policy').change(function() {
|
||||
|
||||
var client_policy_id = $(this).val()
|
||||
var client_policy_id = $(this).val() ? $(this).val() : 0;
|
||||
var policy_type = $('#policy_type').val()
|
||||
// console.log(client_policy_id);
|
||||
|
||||
|
||||
593
app/Views/other_policy_terms.php
Normal file
593
app/Views/other_policy_terms.php
Normal file
@ -0,0 +1,593 @@
|
||||
<style>
|
||||
.button-like {
|
||||
display: inline-block;
|
||||
padding: 8px 15px;
|
||||
background-color: #02a8b5;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
margin-right: -85px;
|
||||
}
|
||||
|
||||
.radiobuttondiv {
|
||||
margin-left: 32px;
|
||||
}
|
||||
|
||||
.form-control-client-policy-master {
|
||||
width: 62% !important;
|
||||
margin-left: 30px;
|
||||
margin-top: 3px
|
||||
}
|
||||
|
||||
/* .form-group.col-md-6 */
|
||||
.form-group-client-policy-master {
|
||||
display: -webkit-box;
|
||||
max-width: 100% !important;
|
||||
/* border:1px solid; */
|
||||
/* background-color: #0001; */
|
||||
}
|
||||
|
||||
.form-group-client-policy-masters {
|
||||
display: -webkit-box;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
.flex-container {
|
||||
display: block;
|
||||
/* flex-wrap: wrap; */
|
||||
/* align-items: center; Align items vertically center */
|
||||
}
|
||||
|
||||
.flex-container>div {
|
||||
flex: 1;
|
||||
/* Each div takes equal space */
|
||||
}
|
||||
|
||||
label {
|
||||
padding-top: 7px;
|
||||
width: 400px;
|
||||
/* background-color: #0001; */
|
||||
height: 36px;
|
||||
/* text-align: center; */
|
||||
}
|
||||
|
||||
.jodit-status-bar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.input-group {
|
||||
width: 64.5% !important;
|
||||
}
|
||||
|
||||
.input-group-append-client-policy-master {
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.jodit-wysiwyg {
|
||||
margin-bottom: 162px;
|
||||
}
|
||||
|
||||
.form-control-client-policy-masters {
|
||||
margin-left: 30px;
|
||||
width: 689px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="OtherPolicyTermsForm" style="display:none">
|
||||
|
||||
<span id="otherPolicyTermsClose"
|
||||
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||
<h5><label for="gpaTerms" style="margin-bottom: 20px;">Policy Terms <span id="nameOfThePolicyOnOther"></span></label>
|
||||
</h5>
|
||||
<form role="form" class="parsley-examples" method="post" id="otherPolicyTerms" 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="other_client_policy_id" />
|
||||
<input type="hidden" name="policy_id" id="gpa_policy_id" />
|
||||
<input type="hidden" id="emp_count" />
|
||||
|
||||
<div id="append_html_for_other_policy_terms" ></div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="other_special_condition">
|
||||
</div>
|
||||
|
||||
<br>
|
||||
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
||||
<a href="#" class="button-like" id="otherButtonSpecialCondition" title="Special Condition">Special
|
||||
Condition</a>
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnOtherTermsSubmit"
|
||||
style="margin-top: 100px;">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
$("#otherPolicyTerms").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var isValid = $('#otherPolicyTerms').parsley().validate();
|
||||
console.log('isvalid', isValid);
|
||||
|
||||
if ($('#emp_count').val() == true) {
|
||||
toastr.warning('Client has active employees', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var formData = new FormData($('#otherPolicyTerms')[0]);
|
||||
var policy_form_action = '<?= base_url("client/terms/other_terms") ?>';
|
||||
|
||||
// Convert the FormData object to a JSON object
|
||||
const formObject = {};
|
||||
formData.forEach((value, key) => {
|
||||
if(key != 'csrf_test_name' && key != 'client_policy_id' && key != 'policy_id' && key != 'client_id'){
|
||||
if (key.endsWith('[]')) {
|
||||
const baseKey = key.slice(0, -2);
|
||||
if (!formObject[baseKey]) {
|
||||
formObject[baseKey] = [];
|
||||
}
|
||||
formObject[baseKey].push(value);
|
||||
} else {
|
||||
formObject[key] = value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(formObject);
|
||||
|
||||
|
||||
const jsonString = JSON.stringify(formObject);
|
||||
console.log(jsonString);
|
||||
|
||||
// Append the JSON string to the FormData object
|
||||
formData.append('policy_terms', jsonString);
|
||||
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: policy_form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('#otherPolicyTerms')[0].reset();
|
||||
$('.text-danger-2').html('');
|
||||
console.log(res);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.message, 'Error');
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$('#OtherPolicyTermsForm').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display', '');
|
||||
var message = 'Policy Terms Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnPolicyMaster', function() {
|
||||
|
||||
var client_policy_id = $(this).data('id');
|
||||
var policy_type_id = $(this).data('typeid');
|
||||
console.log('policy_type_id', policy_type_id);
|
||||
console.log('client_policy_id :' ,client_policy_id);
|
||||
|
||||
$('#other_client_policy_id').val(client_policy_id);
|
||||
|
||||
appendPolicyTermsHTML(policy_type_id);
|
||||
|
||||
var gpa_policy_type_id = $(this).attr('id');
|
||||
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||||
|
||||
if (policy_type_id > 5) {
|
||||
|
||||
$('#OtherPolicyTermsForm').css('display', '');
|
||||
$('#police-tab').css('display', 'none');
|
||||
$('.nav.nav-pills.navtab-bg').css('display', 'none');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display', 'none');
|
||||
$('.removeDom').remove()
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/getterms") ?>',
|
||||
method: 'GET',
|
||||
data: {
|
||||
client_policy_id: client_policy_id
|
||||
},
|
||||
success: function(res) {
|
||||
|
||||
console.log('response of the other policy terms', res);
|
||||
console.log('employee count', res.emp_count_by_policy);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
|
||||
$('#nameOfThePolicyOnOther').html(' - ' + res.policy_name.name);
|
||||
|
||||
|
||||
$('#emp_count').val(res.count)
|
||||
if (res.emp_count_by_policy != 0) {
|
||||
$("#btnOtherTermsSubmit").hide();
|
||||
$("#otherButtonSpecialCondition").hide();
|
||||
} else {
|
||||
$("#btnOtherTermsSubmit").show();
|
||||
$("#otherButtonSpecialCondition").show();
|
||||
}
|
||||
|
||||
|
||||
if (res) {
|
||||
|
||||
//special conditions fields
|
||||
let gpaJsonObjectForSpecialCondition = JSON.parse(res.data);
|
||||
Object.keys(gpaJsonObjectForSpecialCondition).forEach(function(key) {
|
||||
if (key.includes("other_special_condition_label") || key.includes(
|
||||
"other_special_condition_input")) {
|
||||
if (key.includes("other_special_condition_label")) {
|
||||
for (let index = 0; index <
|
||||
gpaJsonObjectForSpecialCondition[key].length; index++) {
|
||||
specialConditionForOthers();
|
||||
}
|
||||
}
|
||||
let elements = document.getElementsByName(`${key}[]`);
|
||||
|
||||
if (elements) {
|
||||
elements.forEach((element, index) => {
|
||||
|
||||
if (gpaJsonObjectForSpecialCondition[key][
|
||||
index
|
||||
] == undefined) {
|
||||
element.value = " ";
|
||||
} else {
|
||||
element.value =
|
||||
gpaJsonObjectForSpecialCondition[key][
|
||||
index
|
||||
];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//normal terms fields
|
||||
let jsonObject = JSON.parse(res.data);
|
||||
Object.keys(jsonObject).forEach(function(key) {
|
||||
|
||||
let elements = document.getElementsByName(key);
|
||||
|
||||
// console.log(elements)
|
||||
|
||||
if (elements && elements.length > 0) {
|
||||
let element = elements[0];
|
||||
|
||||
if (element.tagName === 'INPUT' && (element.type ===
|
||||
'checkbox' || element.type === 'radio')) {
|
||||
|
||||
if (element.type === 'checkbox') {
|
||||
element.checked = jsonObject[key] === '1';
|
||||
} else if (element.type === 'radio') {
|
||||
element.checked = element.value === jsonObject[key];
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (jsonObject[key] == undefined) {
|
||||
element.value = " ";
|
||||
} else {
|
||||
element.value = jsonObject[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
|
||||
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');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
document.getElementById('otherButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
|
||||
console.log('specialConditionForOthers callback clicked')
|
||||
event.preventDefault();
|
||||
specialConditionForOthers();
|
||||
|
||||
});
|
||||
|
||||
|
||||
function specialConditionForOthers(count = 0) {
|
||||
|
||||
console.log('specialConditionForOthers function called')
|
||||
|
||||
console.log('before if count', count)
|
||||
|
||||
if (count === 0) {
|
||||
|
||||
console.log('after if count', count)
|
||||
|
||||
var index = $('.modifyclassinput').length;
|
||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||
|
||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 450px;position: relative;bottom: 6px;">
|
||||
<input class="form-control" name="other_special_condition_label[]" id="other_special_condition_label[]" style="position: relative;right: 15px;">
|
||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||
</label>
|
||||
|
||||
<input type="text" name="other_special_condition_input[]" id="other_special_condition_input[]" class="form-control s special_condition_input[]">
|
||||
</div>`;
|
||||
console.log($(this));
|
||||
$('.other_special_condition').each(function() {
|
||||
$(this).append(appendElement);
|
||||
});
|
||||
} else {
|
||||
|
||||
console.log('else')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '#otherPolicyTermsClose', function() {
|
||||
$('#OtherPolicyTermsForm').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display', '');
|
||||
$('#otherPolicyTerms')[0].reset();
|
||||
$('.text-danger-2').html('');
|
||||
});
|
||||
|
||||
|
||||
$("#sumInsured2").on("keyup", function() {
|
||||
var inputNumber = $(this).val();
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
$("#numberToWordSumInsured").text(result);
|
||||
} else {
|
||||
$("#numberToWordSumInsured").text("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#totalSumInsured").on("keyup", function() {
|
||||
var inputNumber = $(this).val();
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
$("#numberToWordTotalSumInsured").text(result);
|
||||
} else {
|
||||
$("#numberToWordTotalSumInsured").text("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
function appendPolicyTermsHTML(policy_type) {
|
||||
|
||||
var termsHTML = ""
|
||||
$('#append_html_for_other_policy_terms').empty();
|
||||
|
||||
if (policy_type == 7) {
|
||||
|
||||
termsHTML = `
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Policy Type</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="policy_type" id="policy_type" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Existing Insurer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="existing_insurer" id="existing_insurer" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="renewal_lives">Renewal Lives</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="renewal_lives" id="renewal_lives" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Assured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" style="width: 100% !important;" class="form-control" name="total_sum_insured"
|
||||
id="total_sum_insured" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordTotalSumInsured' class="text-danger-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="lives_at_inception">Lives at Inception</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="lives_at_inception" id="lives_at_inception" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Insured at Inception</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="total_sum_insured_at_inception" id="total_sum_insured_at_inception"
|
||||
class="form-control" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Premium at Inception (Excl GST)</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="premium_at_inception" id="premium_at_inception" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="coverage">Coverage</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="coverage " id="coverage" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="free_cover_limit">Free Cover Limit</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="free_cover_limit" id="free_cover_limit" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
`
|
||||
|
||||
} else if (policy_type == 6) {
|
||||
|
||||
termsHTML = `
|
||||
|
||||
<div class="form-group EDLI">
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Existing Insurer</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="existing_insurer" id="existing_insurer" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="renewal_lives">Renewal Lives</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="renewal_lives" id="renewal_lives" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="lives_at_inception">Lives at Inception</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="lives_at_inception" id="lives_at_inception" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="totalSumInsured">Total Sum Insured at Inception</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="total_sum_insured_at_inception" id="total_sum_insured_at_inception"
|
||||
class="form-control" onkeypress="return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="coverage">Coverage</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="coverage " id="coverage" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom: 10px;display:true;">
|
||||
<div class="col-md-6">
|
||||
<label for="free_cover_limit">Free Cover Limit for Base Cover</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="free_cover_limit_for_base_cover" id="free_cover_limit_for_base_cover" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
$('#append_html_for_other_policy_terms').append(termsHTML);
|
||||
}
|
||||
</script>
|
||||
@ -615,7 +615,7 @@
|
||||
|
||||
|
||||
// $('input[name="family_floater"]').change(function() {
|
||||
// console.log($(this).val());
|
||||
// //console.log($(this).val());
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().next()[0];
|
||||
// $(element).css("display", "block");
|
||||
@ -631,7 +631,7 @@
|
||||
|
||||
$('input[name="ayudhtreatmentcover"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
////console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
@ -645,7 +645,7 @@
|
||||
|
||||
$('input[name="cataract"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
//console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
@ -715,7 +715,7 @@
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
//console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -751,7 +751,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
@ -773,14 +773,14 @@
|
||||
$('body').on('click', '.btnPolicyMaster', function() {
|
||||
|
||||
var client_policy_id = $(this).data('id');
|
||||
console.log('gmc_client_policy_id :', client_policy_id);
|
||||
//console.log('gmc_client_policy_id :', client_policy_id);
|
||||
|
||||
$('#gmc_client_policy_id').val(client_policy_id)
|
||||
|
||||
$('.removeDom').remove();
|
||||
|
||||
var gmc_policy_type_id = $(this).attr('id');
|
||||
// console.log(gmc_policy_type_id)
|
||||
// //console.log(gmc_policy_type_id)
|
||||
|
||||
if (gmc_policy_type_id == 'GMC') {
|
||||
|
||||
@ -798,10 +798,10 @@
|
||||
client_policy_id: client_policy_id
|
||||
},
|
||||
success: function(response) {
|
||||
console.log('response', response);
|
||||
//console.log('response', response);
|
||||
|
||||
|
||||
// console.log('count', response.count);
|
||||
// //console.log('count', response.count);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -809,18 +809,18 @@
|
||||
$('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
||||
$('gmc_emp_count').val(response.count);
|
||||
|
||||
// console.log('count--1', response.count);
|
||||
// //console.log('count--1', response.count);
|
||||
// $('emp_count').val(response.count)
|
||||
// if (response && response.hasOwnProperty('count')) {
|
||||
// if (response.count === false) {
|
||||
// console.log('count -- 2', response.count);
|
||||
// console.log(document.getElementById('btnGridSubmit1'))
|
||||
// //console.log('count -- 2', response.count);
|
||||
// //console.log(document.getElementById('btnGridSubmit1'))
|
||||
// $("#btnGridSubmit1").hide();
|
||||
// $("#myButtonSpecialCondition").hide();
|
||||
// } else {
|
||||
// $("#btnGridSubmit1").show();
|
||||
// $("#myButtonSpecialCondition").show();
|
||||
// console.log('count -- ', response.count);
|
||||
// //console.log('count -- ', response.count);
|
||||
// }
|
||||
// } else {
|
||||
// console.error('Response object does not have a "count" property or is invalid.');
|
||||
@ -849,13 +849,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
console.log('key', key)
|
||||
//console.log('key', key)
|
||||
let elements = document.getElementsByName(`${key}[]`);
|
||||
console.log(elements)
|
||||
//console.log(elements)
|
||||
|
||||
if (elements) {
|
||||
elements.forEach((element, index) => {
|
||||
console.log()
|
||||
//console.log()
|
||||
if(jsonObject[key][index] == undefined){
|
||||
element.value = " ";
|
||||
}else{
|
||||
@ -869,8 +869,8 @@
|
||||
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
|
||||
if (jsonObject[key]) {
|
||||
|
||||
console.log(jsonObject[key]);
|
||||
// console.log(jsonObject[key]);
|
||||
//console.log(jsonObject[key]);
|
||||
// //console.log(jsonObject[key]);
|
||||
if (jsonObject[key].childrens) {
|
||||
$('#children').val(jsonObject[key].childrens);
|
||||
}
|
||||
@ -998,7 +998,7 @@
|
||||
pTag.innerHTML = jsonObject[key]; // Add your new content inside the <p> tag
|
||||
}
|
||||
}
|
||||
// console.log(jsonObject[key]);
|
||||
// //console.log(jsonObject[key]);
|
||||
} else {
|
||||
|
||||
if(jsonObject[key] == undefined){
|
||||
@ -1047,8 +1047,8 @@
|
||||
$('.spouse-age').css('display','none');
|
||||
}
|
||||
|
||||
console.log("child ");
|
||||
console.log($('#children').val());
|
||||
//console.log("child ");
|
||||
//console.log($('#children').val());
|
||||
|
||||
if($('#children').val() != 0){
|
||||
$('.child-age').css('display','');
|
||||
@ -1087,7 +1087,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
//console.log('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
@ -1109,8 +1109,8 @@
|
||||
$('.spouse-age').css('display','none');
|
||||
}
|
||||
|
||||
console.log("child ");
|
||||
console.log($('#children').val());
|
||||
//console.log("child ");
|
||||
//console.log($('#children').val());
|
||||
|
||||
if($('#children').val() != 0){
|
||||
$('.child-age').css('display','');
|
||||
@ -1179,7 +1179,7 @@
|
||||
<script>
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
|
||||
console.log('specialCondition callback clicked')
|
||||
//console.log('specialCondition callback clicked')
|
||||
event.preventDefault();
|
||||
specialCondition();
|
||||
|
||||
@ -1188,13 +1188,13 @@
|
||||
|
||||
function specialCondition(count = 0) {
|
||||
|
||||
console.log('specialCondition function called')
|
||||
//console.log('specialCondition function called')
|
||||
|
||||
console.log('before if count', count)
|
||||
//console.log('before if count', count)
|
||||
|
||||
if (count === 0) {
|
||||
|
||||
console.log('after if count', count)
|
||||
//console.log('after if count', count)
|
||||
|
||||
var index = $('.modifyclassinput').length;
|
||||
var appendElement = `<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||
@ -1204,13 +1204,13 @@
|
||||
</label>
|
||||
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control s special_condition_input[]">
|
||||
</div>`;
|
||||
console.log($(this));
|
||||
//console.log($(this));
|
||||
$('.form-column').each(function() {
|
||||
$(this).append(appendElement);
|
||||
});
|
||||
} else {
|
||||
|
||||
console.log('else')
|
||||
//console.log('else')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -651,7 +651,7 @@
|
||||
});
|
||||
|
||||
} else if (gpa_policy_type_id != 'GPA' && gpa_policy_type_id != 'GMC') {
|
||||
toastr.warning("This policy has no policy terms.", 'warning');
|
||||
// toastr.warning("This policy has no policy terms.", 'warning');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user