605 lines
26 KiB
PHP
605 lines
26 KiB
PHP
<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="policyGPATermsForm" style="display:none">
|
||
<span id="policyGPATermsClose" 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="nameOfThePolicyInGPA"></span></label></h5>
|
||
<form role="form" class="parsley-examples" method="post" id="policyGPATerms" 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="gpa_client_policy_id" />
|
||
<input type="hidden" name="policy_id" id="gpa_policy_id"/>
|
||
<input type="hidden" id="emp_count"/>
|
||
<div class="form-group">
|
||
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="sumInsured">Sum Insured</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input class="form-control" type="text" name="sumInsured2" id="sumInsured2" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)" style="width: 100% !important;">
|
||
</div>
|
||
<div class="col-md-6">
|
||
</div>
|
||
<div class="col-md-6">
|
||
<div id='numberToWordSumInsured' class="text-danger-2" ></div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Total Sum Insured</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" style="width: 100% !important;" class="form-control" name="totalSumInsured" id="totalSumInsured" 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;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Accidental Death Benefit</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="accidentalDeathBenefit" value="1"> Yes
|
||
<input type="radio" name="accidentalDeathBenefit" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Permanent Total Disablement</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement" class="form-control">
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Permanent Partial Disablement</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement" class="form-control">
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Temporary Total Disablement benefit</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit" class="form-control">
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Accidental Hospitalization Expenses</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<select name="accidentalHospitalizationExpenses" id="accidentalHospitalizationExpenses" class="form-control">
|
||
<option value="">Select an option</option>
|
||
<option value="No">No</option>
|
||
<option value="10%-40%">Covered upto 10% of SI or 40% of actual which ever is less</option>
|
||
<option value="20%-50%">Covered upto 20% of SI or 50% of actual which ever is less</option>
|
||
<option value="50K-500k">INR 50K, to vary in multiples of 25K till 5 Lacs</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Children Education Welfare Fund</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<select name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control">
|
||
<option value="">Select an option</option>
|
||
<option value="No">No</option>
|
||
<option value="10000">Covered upto 10,000/ per child ( Restricted to 2 children)</option>
|
||
<option value="5000">Covered upto 5,000/ per child ( Restricted to 2 children)</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Compassionate Visit Expenses</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="compassionateVisitExpenses" value="1"> Yes
|
||
<input type="radio" name="compassionateVisitExpenses" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Compassionate Visit Expenses Data</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" name="compassionateVisitExpensesData" id="compassionateVisitExpensesData" class="form-control">
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Broken Bone Expenses</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="brokenBoneExpenses" value="1"> Yes
|
||
<input type="radio" name="brokenBoneExpenses" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Broken Bone Expenses Data</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" name="brokenBoneExpensesData" id="brokenBoneExpensesData" class="form-control">
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured"> Ambulance charges</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="ambulanceCharges" value="1"> Yes
|
||
<input type="radio" name="ambulanceCharges" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Ambulance charges Data</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" name="ambulanceChargesData" id="ambulanceChargesData" class="form-control">
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured"> Burn Expenses</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="burnExpenses" value="1"> Yes
|
||
<input type="radio" name="burnExpenses" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Burn Expenses Data</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" name="burnExpensesData" id="burnExpensesData" class="form-control">
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Carriage of Dead Body</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="carriageOfDeadBody" value="1"> Yes
|
||
<input type="radio" name="carriageOfDeadBody" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;display:none;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Carriage of Dead Body Data</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="text" name="carriageOfDeadBodyData" id="carriageOfDeadBodyData" class="form-control">
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Animal/Snake/Insect bite</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="animalSnakeInsectBite" value="1"> Yes
|
||
<input type="radio" name="animalSnakeInsectBite" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Terrorism</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="terrorism" value="1"> Yes
|
||
<input type="radio" name="terrorism" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
<div class="row" style="margin-bottom: 10px;">
|
||
<div class="col-md-6">
|
||
<label for="totalSumInsured">Worldwide Cover</label>
|
||
</div>
|
||
<div class="col-md-6">
|
||
<input type="radio" name="worldwideCover" value="1"> Yes
|
||
<input type="radio" name="worldwideCover" value="0" style="margin-left:10px" checked> No
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<br>
|
||
<div class="form-group text-right m-b-0" style="margin-top: -49px;">
|
||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGPATermsSubmit" style="margin-top: 100px;">Submit</button>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</form>
|
||
</div>
|
||
|
||
|
||
<script>
|
||
var policy_grid_id = $('#client_id').val();
|
||
var grid_html = '';
|
||
|
||
$('.close').click(function(){
|
||
|
||
});
|
||
|
||
|
||
$('input[name="burnExpenses"]').change(function() {
|
||
|
||
console.log($(this).val());
|
||
|
||
if ($(this).val() == '1') {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
|
||
} else {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "none");
|
||
}
|
||
});
|
||
|
||
$('input[name="compassionateVisitExpenses"]').change(function() {
|
||
|
||
console.log($(this).val());
|
||
|
||
if ($(this).val() == '1') {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
|
||
} else {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "none");
|
||
}
|
||
});
|
||
|
||
$('input[name="carriageOfDeadBody"]').change(function() {
|
||
|
||
console.log($(this).val());
|
||
|
||
if ($(this).val() == '1') {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
|
||
} else {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "none");
|
||
}
|
||
});
|
||
|
||
$('input[name="ambulanceCharges"]').change(function() {
|
||
|
||
console.log($(this).val());
|
||
|
||
if ($(this).val() == '1') {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
|
||
} else {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "none");
|
||
}
|
||
});
|
||
|
||
$('input[name="brokenBoneExpenses"]').change(function() {
|
||
|
||
console.log($(this).val());
|
||
|
||
if ($(this).val() == '1') {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
|
||
} else {
|
||
var element = $(this).parent().parent().next()[0];
|
||
$(element).css("display", "none");
|
||
}
|
||
});
|
||
|
||
|
||
$("#policyGPATerms").submit(function(event) {
|
||
|
||
event.preventDefault();
|
||
var isValid = $('#policyGPATerms').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($('#policyGPATerms')[0]);
|
||
var policy_form_action = '<?= base_url("client/terms/gpa_create") ?>';
|
||
|
||
$.ajax({
|
||
data: formData,
|
||
url: policy_form_action,
|
||
type: "POST",
|
||
dataType: 'json',
|
||
processData: false,
|
||
contentType: false,
|
||
success: function(res) {
|
||
$('#policyGPATerms')[0].reset();
|
||
$('.text-danger-2').html('');
|
||
console.log(res);
|
||
|
||
if (res.status === false) {
|
||
toastr.error('Policy Dose Not Create', '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');
|
||
$('#policyGPATermsForm').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');
|
||
// console.log('client_policy_id :' ,client_policy_id);
|
||
|
||
$('#gpa_client_policy_id').val(client_policy_id);
|
||
|
||
var gpa_policy_type_id = $(this).attr('id');
|
||
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||
|
||
if(gpa_policy_type_id == 'GPA'){
|
||
|
||
$('#policyGPATermsForm').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(res);
|
||
console.log('count', res.count);
|
||
setTimeout(function() {
|
||
$('.loader').fadeOut();
|
||
$('.loader-mask').delay(350).fadeOut('slow');
|
||
}, 1000);
|
||
$('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name);
|
||
|
||
|
||
$('#emp_count').val(res.count)
|
||
if(res.count === false){
|
||
$("#btnGPATermsSubmit").hide();
|
||
}else{
|
||
$("#btnGPATermsSubmit").show();
|
||
}
|
||
|
||
|
||
if (res) {
|
||
|
||
let jsonObject = JSON.parse(res.data);
|
||
$("#numberToWordSumInsured").text(convertCommaNumberToWords(jsonObject.sumInsured2));
|
||
$("#numberToWordTotalSumInsured").text(convertCommaNumberToWords(jsonObject.totalSumInsured));
|
||
if(jsonObject.compassionateVisitExpenses == '1'){
|
||
var element = $('input[name="compassionateVisitExpenses"]').parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
}
|
||
if(jsonObject.brokenBoneExpenses == '1'){
|
||
var element = $('input[name="brokenBoneExpenses"]').parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
}
|
||
if(jsonObject.ambulanceCharges == '1'){
|
||
var element = $('input[name="ambulanceCharges"]').parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
}
|
||
if(jsonObject.burnExpenses == '1'){
|
||
var element = $('input[name="burnExpenses"]').parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
}
|
||
if(jsonObject.carriageOfDeadBody == '1'){
|
||
var element = $('input[name="carriageOfDeadBody"]').parent().parent().next()[0];
|
||
$(element).css("display", "");
|
||
}
|
||
|
||
|
||
Object.keys(jsonObject).forEach(function(key) {
|
||
|
||
let elements = document.getElementsByName(key);
|
||
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 {
|
||
element.value = jsonObject[key];
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
}
|
||
$("#sumInsured2").trigger("keyup");
|
||
$("#totalSumInsured").trigger("keyup");
|
||
|
||
|
||
},
|
||
|
||
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);
|
||
}
|
||
});
|
||
|
||
}else if(gpa_policy_type_id != 'GPA' && gpa_policy_type_id != 'GMC'){
|
||
toastr.warning("This policy has no policy terms.", 'warning');
|
||
}
|
||
|
||
});
|
||
|
||
</script>
|
||
|
||
|
||
<script>
|
||
|
||
$(document).on('click', '#policyGPATermsClose', function() {
|
||
$('#policyGPATermsForm').css('display', 'none');
|
||
$('#police-tab').css('display', '');
|
||
$('.nav.nav-pills.navtab-bg').css('display','');
|
||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||
$('#policyGPATerms')[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 formatNumber(input) {
|
||
// Remove non-numeric characters
|
||
// let value = input.value.replace(/\D/g, '');
|
||
|
||
// Add commas
|
||
// value = Number(value).toLocaleString('en-IN');
|
||
|
||
// Update the input value
|
||
// input.value = value;
|
||
// }
|
||
</script> |