CHANGES_CLIENT_POLICY_TERM : RV

This commit is contained in:
VENKATESHWARAN 2024-03-02 10:50:24 +05:30
parent d5befa4529
commit c5850f3f83
4 changed files with 496 additions and 706 deletions

View File

@ -26,6 +26,7 @@ use App\Models\StateModel;
use App\Models\PolicyGridModel;
use App\Models\PolicyPremium1Model;
use App\Models\PolicyPremium2Model;
use App\Models\EmployeeModel;
class ClientController extends AdminController
{
@ -50,6 +51,7 @@ class ClientController extends AdminController
protected $policyGridModel;
protected $policyPremium1Model;
protected $policyPremium2Model;
protected $employeeModel;
public function __construct()
{
@ -72,7 +74,9 @@ class ClientController extends AdminController
$this->tpaModel = new TPAModel();
$this->stateModel = new StateModel();
$this->policyGridModel = new PolicyGridModel();
$this->policyPremium1Model = new PolicyPremium1Model();
$this->policyPremium1Model = new PolicyPremium1Model();
$this->policyPremium2Model = new PolicyPremium2Model();
$this->employeeModel = new EmployeeModel();
}
@ -760,17 +764,26 @@ class ClientController extends AdminController
}
public function getjson()
public function getterms()
{
$client_id = $this->request->getVar('client_id');
$policy_id = $this->request->getVar('policy_id');
$record = $this->clientPolicyModel->where(['client_id' => $client_id, 'policy_id' => $policy_id])->first();
$record = $this->clientPolicyModel->where(['client_id' => $client_id, 'policy_id' => $policy_id])->first();
$emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id")
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
->where("employees.client_id",$client_id)
->where("employees.emp_status",'active')
->countAllResults();
if($emp_count = 0){
$emp_count = true;
}else{
$emp_count = false;
}
if ($record) {
echo $record['policy_terms'];
return $this->respond(['Status' => true,'code' => 200,'data' => $record['policy_terms'], 'count' => $emp_count], 200);
} else {
echo "Record not found.";
return $this->respond(['Status' => false,'code' => 200,'message' => 'Record not found.', 'count' => $emp_count], 200);
}
}

View File

@ -1,3 +1,13 @@
<style>
th {
text-align: center;
}
td{
text-align: center;
}
</style>
<div class="tab-pane fade" id="police-tab">
@ -13,6 +23,8 @@
<th>Insurer</th>
<th>Policy</th>
<th>TPA</th>
<th>Date</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
@ -71,13 +83,17 @@
</div>
<div class="form-row">
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="policy_start_date">Policy Start Date<span class="text-danger">*</span></label>
<input value="" type="date" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
<input value="" type="text" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
<input value="" type="date" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
<input value="" type="text" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
</div>
<div class="form-group col-md-4">
<label for="policy_status">Policy Status</label>
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
</div>
</div>
@ -179,10 +195,12 @@
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
<td>${item.policy_name}</td>
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
<a data-id="${item.id}" class="btnPolicyEdit mdi mdi-lead-pencil" href="#" style="font-size:18px;"></a>&nbsp;&nbsp;
<a data-id="${item.policy_id}" class="btnPolicyModel mdi mdi-book-open" href="#" data-toggle="modal" data-target="#bs-example-modal-lg" style="font-size:18px;"></a>
<a data-id="${item.policy_id}" class="btnPolicyMaster mdi mdi-wrench" href="#" data-toggle="modal" data-target="${item.policy_type_id >= 2 ? '#bs-example-modal-sm' : '#bs-example-modal-sm_2'}" style="font-size:18px; margin-left: 7px;"></a>
<a data-id="${item.policy_id}" class="btnPolicyMaster mdi mdi-wrench" href="#" data-toggle="modal" id="${item.policy_type_id}" style="font-size:18px;"></a>
<a data-id="${item.policy_id}" class="btnPolicyModel mdi mdi-book-open" href="#" data-toggle="modal" data-target="#bs-example-modal-lg" style="font-size:18px; margin-left: 7px;"></a>
</td>
</tr>
`;
@ -195,7 +213,7 @@
});
//for form submit using AJAX
/******** for form submit using AJAX *******/
$("#policy_form").submit(function(event) {
event.preventDefault();
@ -238,18 +256,18 @@
}
if(res){
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$('#add_form').hide();
$('#table_list').show();
$('.btnBack').hide();
$('.btnAdd').show();
var message = (policy_PrimaryKey === '') ? 'Policy Created successfully' : 'Policy Updated Successfully';
toastr.success(message, 'Success');
}, 1000);
}
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$('#add_form').hide();
$('#table_list').show();
$('.btnBack').hide();
$('.btnAdd').show();
var message = (policy_PrimaryKey === '') ? 'Policy Created successfully' : 'Policy Updated Successfully';
toastr.success(message, 'Success');
}, 1000);
}
$('#policy_table tr').remove();
@ -260,10 +278,12 @@
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
<td>${item.policy_name}</td>
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
<td>${checkDateStatus(item.policy_end_date)}</td>
<td>
<a data-id="${item.id}" class="btnPolicyEdit mdi mdi-lead-pencil" href="#" style="font-size:18px;"></a>&nbsp;&nbsp;
<a data-id="${item.policy_id}" class="btnPolicyMaster mdi mdi-wrench" href="#" data-toggle="modal" data-target="${item.policy_type_id}" style="font-size:18px; margin-left: 7px;"></a>
<a data-id="${item.policy_id}" class="btnPolicyModel mdi mdi-book-open" href="#" data-toggle="modal" data-target="#bs-example-modal-lg" style="font-size:18px;"></a>
<a data-id="${item.policy_id}" class="btnPolicyMaster mdi mdi-wrench" href="#" data-toggle="modal" data-target="${item.policy_type_id >= 2 ? '#bs-example-modal-sm' : '#bs-example-modal-sm_2'}" style="font-size:18px; margin-left: 7px;"></a>
</td>
</tr>
`;
@ -308,13 +328,13 @@
var dataId = $(this).children('option:selected').attr('data-id');
console.log('dataId', dataId)
$('#policy_type_id').val(dataId);
if(dataId == 1){
appendPolicyFormFields(1);
}else if (dataId >= 1){
appendPolicyFormFields(2);
}
console.log('second', $('#policy_type_id').val());
// if(dataId == 1){
// appendPolicyFormFields(1);
// }else if (dataId >= 1){
// appendPolicyFormFields(2);
// }
});
@ -354,6 +374,7 @@
$('#policy_PrimaryKey').val(res.data.id);
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
if(res.data.policy_type_id == 1){
appendPolicyFormFields(1, res.data);
@ -529,4 +550,78 @@
}
}
function checkDateStatus(inputDate, bg = false) {
var givenDate = new Date(inputDate);
var currentDate = new Date();
if(bg != false){
if (givenDate < currentDate) {
return `<span class="badge badge-danger">Expired</span>`;
} else {
return `<span class="badge badge-success">Active</span>`;
}
}else{
if (givenDate < currentDate) {
return `Expired`;
} else {
return `Active`;
}
}
}
// Function to convert numbers into Indian numbering system
function convertToIndianNumberingSystem(number) {
// Define Indian numbering system
var suffixes = ["", "Thousand", "Lakh", "Crore"];
// Split the number into groups of 3 digits each
var numberChunks = [];
while (number > 0) {
numberChunks.push(number % 1000);
number = Math.floor(number / 1000);
}
// Convert each chunk into words
var result = "";
for (var i = 0; i < numberChunks.length; i++) {
if (numberChunks[i] !== 0) {
result = convertThreeDigitNumberToWords(numberChunks[i]) + " " + suffixes[i] + " " + result;
}
}
return result.trim();
}
// Function to convert a three-digit number into words
function convertThreeDigitNumberToWords(num) {
var ones = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"];
var tens = ["", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"];
var teens = ["", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"];
var words = "";
// Convert hundreds place
if (Math.floor(num / 100) > 0) {
words += ones[Math.floor(num / 100)] + " Hundred ";
num %= 100;
}
// Convert tens and ones place
if (num >= 20) {
words += tens[Math.floor(num / 10)] + " ";
num %= 10;
} else if (num >= 11 && num <= 19) {
words += teens[num - 10] + " ";
num = 0;
}
if (num > 0) {
words += ones[num] + " ";
}
return words.trim();
}
</script>

View File

@ -95,7 +95,7 @@
</div>
<div style="display:none; margin-top: 27px;margin-bottom: 7px; margin-left: 31px;">
<div>
<input type="checkbox" name="family_floaters[]" value="Self" id="Self"> Self
<input type="checkbox" name="family_floaters[]" value="Self" id="Self" checked disabled> Self
<input type="checkbox" name="family_floaters[]" value="Spouse" id="Spouse"> Spouse
<input type="checkbox" name="family_floaters[]" value="Child1" id="Child1"> Child 1
<input type="checkbox" name="family_floaters[]" value="Child2" id="Child2"> Child 2
@ -351,17 +351,12 @@
var policy_grid_id = $('#client_id').val();
var grid_html = '';
$('#gmc_remove').hide();
$('#btnGridSubmit').hide();
$('.close').click(function(){
$('#sum_insured').val("");
$('#familyfloater').val("");
$('#waiverofpreexistingdiseases').prop('checked', false);
$('#maternitycoverage').val("");
for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove();
}
});
@ -501,438 +496,123 @@ $('body').on('click', '.btnPolicyMaster', function () {
var client_id = $('#Client_id').val();
$('#client_policy_id').val(policy_id);
var policy_type_id = $(this).attr('id');
console.log('policy_type_id', typeof policy_type_id)
$('#policyGMCTerms').css('display', '');
$('#police-tab').css('display', 'none');
$('.nav.nav-pills.navtab-bg').css('display','none');
$('.nav.nav-pills.navtab-bg').prev().css('display','none');
if(policy_type_id >= '2'){
$('#policyGMCTerms').css('display', '');
$('#police-tab').css('display', 'none');
$('.nav.nav-pills.navtab-bg').css('display','none');
$('.nav.nav-pills.navtab-bg').prev().css('display','none');
$.ajax({
url: '<?= base_url("client/policy/getterms") ?>',
method: 'GET',
data: { policy_id : policy_id , client_id: client_id},
success: function(response) {
if (response) {
let jsonObject = JSON.parse(response);
Object.keys(jsonObject).forEach(function(key) {
if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
if (key.includes("special_condition_label")) {
for (let index = 0; index < jsonObject[key].length; index++) {
specialCondition();
}
}
let elements = document.getElementsByName(`${key}[]`);
if (elements) {
elements.forEach((element,index) => {
element.value = jsonObject[key][index];
});
}
}
if (key.includes("family_floaters")) {
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
if (jsonObject[key]) {
jsonObject[key].forEach(element => {
let checkbox = $(`#${element}`);
if (checkbox.is(":checkbox")) {
checkbox.prop("checked", true);
}
});
}
}
let elements = document.getElementsByName(key);
if (elements && elements.length > 0) {
let element = elements[0]; // Assuming you want to update the first element with the name
if (element.tagName === 'INPUT' && (element.type === 'checkbox' || element.type === 'radio')) {
if (element.type === 'checkbox') {
element.checked = jsonObject[key] === '1'; // Assuming jsonObject[key] is '1' or '0' for checkbox
} else if (element.type === 'radio') {
if (element.value === jsonObject[key]) {
element.checked = element.value === jsonObject[key];
if(element.name === "family_floater") {
element.parentElement.nextElementSibling.style.display='';
element.parentElement.parentElement.parentElement.nextElementSibling.style.display='';
}else if(element.name === "waiverofpreexistingdiseases"){
element.parentElement.parentElement.nextElementSibling.style.display='';
element.parentElement.parentElement.nextElementSibling.nextElementSibling.style.display='';
element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.style.display='';
element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.style.display='';
$.ajax({
url: '<?= base_url("client/policy/getterms") ?>',
method: 'GET',
data: { policy_id : policy_id , client_id: client_id},
success: function(response) {
if (response) {
let jsonObject = JSON.parse(response);
Object.keys(jsonObject).forEach(function(key) {
if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
if (key.includes("special_condition_label")) {
for (let index = 0; index < jsonObject[key].length; index++) {
specialCondition();
}
}
let elements = document.getElementsByName(`${key}[]`);
} else {
element.nextElementSibling.checked = element.value ;
if (elements) {
elements.forEach((element,index) => {
element.value = jsonObject[key][index];
});
}
}
}else if(key === "Wellness" || key === "additionalsicknessbenefit"){
let wysiwygElement = element.previousElementSibling.querySelector('.jodit-wysiwyg');
if (key.includes("family_floaters")) {
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
if (jsonObject[key]) {
jsonObject[key].forEach(element => {
let checkbox = $(`#${element}`);
if (checkbox.is(":checkbox")) {
checkbox.prop("checked", true);
}
});
}
}
if (wysiwygElement) {
let pTag = wysiwygElement.querySelector('p'); // Find the <p> tag inside the wysiwyg element
if (pTag) {
// pTag.innerHTML = ''; // Clear the content inside the <p> tag
pTag.innerHTML = jsonObject[key]; // Add your new content inside the <p> tag
let elements = document.getElementsByName(key);
if (elements && elements.length > 0) {
let element = elements[0]; // Assuming you want to update the first element with the name
if (element.tagName === 'INPUT' && (element.type === 'checkbox' || element.type === 'radio')) {
if (element.type === 'checkbox') {
element.checked = jsonObject[key] === '1'; // Assuming jsonObject[key] is '1' or '0' for checkbox
} else if (element.type === 'radio') {
if (element.value === jsonObject[key]) {
element.checked = element.value === jsonObject[key];
if(element.name === "family_floater") {
element.parentElement.nextElementSibling.style.display='';
element.parentElement.parentElement.parentElement.nextElementSibling.style.display='';
}else if(element.name === "waiverofpreexistingdiseases"){
element.parentElement.parentElement.nextElementSibling.style.display='';
element.parentElement.parentElement.nextElementSibling.nextElementSibling.style.display='';
element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.style.display='';
element.parentElement.parentElement.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.style.display='';
}
} else {
element.nextElementSibling.checked = element.value ;
}
}
}else if(key === "Wellness" || key === "additionalsicknessbenefit"){
let wysiwygElement = element.previousElementSibling.querySelector('.jodit-wysiwyg');
if (wysiwygElement) {
let pTag = wysiwygElement.querySelector('p'); // Find the <p> tag inside the wysiwyg element
if (pTag) {
// pTag.innerHTML = ''; // Clear the content inside the <p> tag
pTag.innerHTML = jsonObject[key]; // Add your new content inside the <p> tag
}
}
// console.log(jsonObject[key]);
}else {
element.value = jsonObject[key];
}
}
// console.log(jsonObject[key]);
}else {
element.value = jsonObject[key];
}
});
}
$('.jodit-wysiwyg').each(function() {
$(this).click();
});
},
error: function(xhr, status, error) {
console.error('Error:', status, error);
}
});
}
$('.jodit-wysiwyg').each(function() {
$(this).click();
});
},
error: function(xhr, status, error) {
console.error('Error:', status, error);
}
});
// $.ajax({
// url: '<?= base_url("util/policy-premium") ?>' ,
// type: "GET",
// data: { policy_id: policy_id, client_id: client_id },
// dataType: 'json',
// success: function (res) {
// console.log('responce :', res);
// if (res.status === false) {
// toastr.error(res.status);
// return;
// }
// var policy_grid_id_value = '';
// if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) {
// policy_grid_id_value = res.premiumData[0].policy_grid_id;
// }
// $('#grid_content_input').empty();
// var policeGridOptionHTML = '';
// policeGridOptionHTML += ` <option value="">Select Premium Type</option>`;
// $.each(res.data, function(index, item) {
// policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>';
// });
// $('#grid').html(policeGridOptionHTML);
// console.log('Length', res.premiumData.length)
// if (res.premiumData && res.premiumData.length > 0) {
// addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id);
// res.premiumData.shift();
// console.log(res.premiumData)
// $.each(res.premiumData, function(index, item){
// console.log('premiumData index :',index)
// appendGridtHtml(item.policy_grid_id, item);
// });
// } else {
// console.log("res.premiumData is undefined, null, or empty.");
// }
// $('#bs-example-modal-sm').modal('show');
// },
// error: function (xhr, status, error) {
// console.error(xhr.responseText);
// console.error(status, error);
// }
// });
});
var Count = 1
function appendGridtHtml(ui_type = false, data = false,) {
var html = '';
console.log('appendGridtHtml function called ');
// console.log('Grid Content',data)
console.log('UI TYPE :', ui_type);
Count++;
var container = document.getElementById('grid_content_input');
if(ui_type == '3'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-5">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="gpa_si" required>
</div>
<div class="form-group col-md-5">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="gpa_premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(3)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>
`;
}else if(ui_type == '4'){
html =`
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(4)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '5'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml(5)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '6'){
html =`
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-4">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(6)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>
</div>`;
}else if(ui_type == '7'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(7)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '8'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Grade/Band</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(8)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '9'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Grade/Band</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(9)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '10'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-3">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">From Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter From Age" name="age_from[]" id="age_from" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">To Age</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter TO Age" name="age_to[]" id="age_to" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(10)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}else if(ui_type == '11'){
html = `
<div class="form-row" id="removeChild_${Count}">
<div class="form-group col-md-2">
<label for="mobile">Sum Insured</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Sum Insured" name="si[]" id="sum_insured" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Grade/Band</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.grade : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Grade/Band " name="grade[]" id="grade" required>
</div>
<div class="form-group col-md-3">
<label for="mobile">Premium</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Premium" name="premium[]" id="premium" required>
</div>
<div class="form-group col-md-2">
<label for="mobile">Max SI</label>
<input value="${data !== false && data !== undefined && data !== '' ? data.max_si : ''}" type="text" class="form-control form-control-client-policy-master" placeholder="Enter Max SI" name="max_si" id="max_si[]" required>
</div>
<div class="form-group">
<button style="margin-top: 29px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(11)">+</button>
<button style="margin-top: 29px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(${Count})">x</button>
</div>
</div>`;
}
container.insertAdjacentHTML('beforeend', html);
$('#gmc_add_more').hide()
$('#gmc_remove').show()
// console.log('count 1',Count)
Count--
// console.log('count 2',Count)
$('#gmc_add_more_'+Count).hide()
Count++
// console.log('count 3',Count)
}
function removebutton(index, type) {
if(index == 0){
var inputs = document.querySelectorAll('#grid_'+ type +' input');
inputs.forEach(function(input) {
input.value = '';
});
}else{
var element = document.getElementById('removeChild_'+ index);
var gridContentDiv = document.getElementById('grid_content_input');
var count = gridContentDiv.childElementCount;
if (element) {
element.remove();
}
if(count == 2){
$('#gmc_add_more').show();
}
index--;
$('#gmc_add_more_'+index).show();
}
}
</script>

View File

@ -1,4 +1,3 @@
<!-- Modal content for the Large example -->
<style>
.button-like {
display: inline-block;
@ -76,189 +75,181 @@
}
</style>
<div class="modal fade" id="bs-example-modal-sm_2" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal-dialog modal-full-width">
<div class="modal-content" style="border-radius: 10px;">
<div class="modal-header" style="background-color: #02a8b5; border-top-right-radius: 10px;border-top-left-radius: 10px;">
<h4 class="modal-title" id="myLargeModalLabel" style="color: white;">Client Policy Terms</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<form role="form" class="parsley-examples" method="post" id="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="client_policy_id" />
<input type="hidden" name="policy_id" id="gpa_policy_id"/>
<div class="form-group">
<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 GMC Terms</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="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="form-column">
<div class="form-column">
<div class="form-group col-md-6 form-group-client-policy-master">
<label for="sumInsured" class=" " style="width: 400px;">Sum Insured</label>
<input type="text" name="sumInsured2" id="sumInsured" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label for="sumInsured" class=" " style="width: 400px;">Sum Insured</label>
<input type="text" name="sumInsured2" id="sumInsured2" class="form-control form-control-client-policy-master"> <br>
</div>
<div id='numberToWord' class="text-danger"></div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label for="totalSumInsured" class=" " style="width: 400px;">Total Sum Insured</label>
<input type="text" name="totalSumInsured" id="totalSumInsured" class="form-control form-control-client-policy-master">
<div class="form-group col-md-6 form-group-client-policy-master">
<label for="totalSumInsured" class=" " style="width: 400px;">Total Sum Insured</label>
<input type="text" name="totalSumInsured" id="totalSumInsured" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label class="form-check-label " for="corporatebuffer" style="width: 400px;">Accidental Death Benefit</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label class="form-check-label " for="corporatebuffer" style="width: 400px;">Accidental Death Benefit</label>
<div class="radiobuttondiv">
<input type="radio" name="accidentalDeathBenefit" value="1"> Yes
<input type="radio" name="accidentalDeathBenefit" value="0" style="margin-left:10px" checked> No
</div>
<div class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="permanentTotalDisablement" class=" " style="width: 400px;">Permanent Total Disablement</label>
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="permanentPartialDisablement" class=" " style="width: 400px;">Permanent Partial Disablement</label>
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="temporaryTotalDisablementBenefit" class=" " style="width: 400px;">Temporary Total Disablement benefit</label>
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label for="accidentalHospitalizationExpenses" class=" " style="width: 400px;">Accidental Hospitalization Expenses</label>
<select name="accidentalHospitalizationExpenses" id="accidentalHospitalizationExpenses" class="form-control form-control-client-policy-master">
<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 class="form-group col-md-6 form-group-client-policy-master">
<label for="childrenEducationWelfareFund" class=" " style="width: 400px;">Children Education Welfare Fund</label>
<select name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control form-control-client-policy-master">
<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 class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="compassionateVisitExpenses" style="width: 400px;">Compassionate Visit Expenses</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="permanentTotalDisablement" class=" " style="width: 400px;">Permanent Total Disablement</label>
<input type="text" name="permanentTotalDisablement" id="permanentTotalDisablement" class="form-control form-control-client-policy-master">
<div class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="compassionateVisitExpensesData" class=" " style="width: 400px; ">Compassionate Visit Expenses Data</label>
<input type="text" name="compassionateVisitExpensesData" id="compassionateVisitExpensesData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="brokenBoneExpenses" style="width: 400px;">Broken Bone Expenses</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="permanentPartialDisablement" class=" " style="width: 400px;">Permanent Partial Disablement</label>
<input type="text" name="permanentPartialDisablement" id="permanentPartialDisablement" class="form-control form-control-client-policy-master">
<div class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="brokenBoneExpensesData" class=" " style="width: 400px; ">Broken Bone Expenses Data</label>
<input type="text" name="brokenBoneExpensesData" id="brokenBoneExpensesData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="ambulanceCharges" style="width: 400px;">Ambulance charges</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="temporaryTotalDisablementBenefit" class=" " style="width: 400px;">Temporary Total Disablement benefit</label>
<input type="text" name="temporaryTotalDisablementBenefit" id="temporaryTotalDisablementBenefit" class="form-control form-control-client-policy-master">
<div class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="ambulanceChargesData" class=" " style="width: 400px; ">Ambulance charges Data</label>
<input type="text" name="ambulanceChargesData" id="ambulanceChargesData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="burnExpenses" style="width: 400px;">Burn Expenses</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master">
<label for="accidentalHospitalizationExpenses" class=" " style="width: 400px;">Accidental Hospitalization Expenses</label>
<select name="accidentalHospitalizationExpenses" id="accidentalHospitalizationExpenses" class="form-control form-control-client-policy-master">
<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 class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="burnExpensesData" class=" " style="width: 400px; ">Burn Expenses Data</label>
<input type="text" name="burnExpensesData" id="burnExpensesData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="carriageOfDeadBody" style="width: 400px;">Carriage of Dead Body</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master">
<label for="childrenEducationWelfareFund" class=" " style="width: 400px;">Children Education Welfare Fund</label>
<select name="childrenEducationWelfareFund" id="childrenEducationWelfareFund" class="form-control form-control-client-policy-master">
<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 class="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="carriageOfDeadBodyData" class=" " style="width: 400px; ">Carriage of Dead Body Data</label>
<input type="text" name="carriageOfDeadBodyData" id="carriageOfDeadBodyData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="animalSnakeInsectBite" style="width: 400px;">Animal/Snake/Insect bite</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="compassionateVisitExpenses" style="width: 400px;">Compassionate Visit Expenses</label>
<div class="radiobuttondiv">
<input type="radio" name="compassionateVisitExpenses" value="1"> Yes
<input type="radio" name="compassionateVisitExpenses" value="0" style="margin-left:10px" checked> No
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label" for="terrorism" style="width: 400px;">Terrorism</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="compassionateVisitExpensesData" class=" " style="width: 400px; ">Compassionate Visit Expenses Data</label>
<input type="text" name="compassionateVisitExpensesData" id="compassionateVisitExpensesData" class="form-control form-control-client-policy-master">
<div class="form-group col-md-6 form-group-client-policy-master">
<label for="worldwideCover" class=" " style="width: 400px;">Worldwide Cover</label>
<div class="radiobuttondiv">
<input type="radio" name="worldwideCover" value="1"> Yes
<input type="radio" name="worldwideCover" value="0" style="margin-left:10px" checked> No
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="brokenBoneExpenses" style="width: 400px;">Broken Bone Expenses</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="brokenBoneExpensesData" class=" " style="width: 400px; ">Broken Bone Expenses Data</label>
<input type="text" name="brokenBoneExpensesData" id="brokenBoneExpensesData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="ambulanceCharges" style="width: 400px;">Ambulance charges</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="ambulanceChargesData" class=" " style="width: 400px; ">Ambulance charges Data</label>
<input type="text" name="ambulanceChargesData" id="ambulanceChargesData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="burnExpenses" style="width: 400px;">Burn Expenses</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="burnExpensesData" class=" " style="width: 400px; ">Burn Expenses Data</label>
<input type="text" name="burnExpensesData" id="burnExpensesData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="carriageOfDeadBody" style="width: 400px;">Carriage of Dead Body</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master" style="display:none;">
<label for="carriageOfDeadBodyData" class=" " style="width: 400px; ">Carriage of Dead Body Data</label>
<input type="text" name="carriageOfDeadBodyData" id="carriageOfDeadBodyData" class="form-control form-control-client-policy-master">
</div>
<div class="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label " for="animalSnakeInsectBite" style="width: 400px;">Animal/Snake/Insect bite</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master">
<label class="form-check-label" for="terrorism" style="width: 400px;">Terrorism</label>
<div class="radiobuttondiv">
<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="form-group col-md-6 form-group-client-policy-master">
<label for="worldwideCover" class=" " style="width: 400px;">Worldwide Cover</label>
<div class="radiobuttondiv">
<input type="radio" name="worldwideCover" value="1"> Yes
<input type="radio" name="worldwideCover" value="0" style="margin-left:10px" checked> No
</div>
</div>
</div>
</div>
<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="btnGridSubmit" style="margin-top: 100px;">Submit</button>
</div>
</form>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<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>
</form>
</div>
<script>
var policy_grid_id = $('#client_id').val();
var grid_html = '';
$('#gmc_remove').hide();
$('#btnGridSubmit').hide();
$('.close').click(function(){
});
@ -341,11 +332,19 @@
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") ?>';
@ -365,97 +364,123 @@
return;
}
var message = (policy_PrimaryKey === '') ? 'Policy Terms Added successfully' : 'Policy Terms Updated Successfully';
toastr.success(res.message, 'Success');
$('.close').click();
},
error: function(xhr, status, error) {
$('.close').click();
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 policy_id = $(this).data('id');
// console.log('policy_id :' ,policy_id);
console.log('policy_id :' ,policy_id);
$('#gpa_policy_id').val(policy_id);
var client_id = $('#Client_id').val();
$('#client_policy_id').val(policy_id);
console.log('client_id :' ,client_id);
$('#client_policy_id').val(client_id);
var policy_type_id = $(this).attr('id');
console.log('policy_type_id', policy_type_id)
if(policy_type_id == '1'){
$('#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');
$.ajax({
url: '<?= base_url("client/policy/getjson") ?>',
url: '<?= base_url("client/policy/getterms") ?>',
method: 'GET',
data: { policy_id : policy_id , client_id: client_id},
success: function(response) {
success: function(res) {
console.log(response);
if (response) {
let jsonObject = JSON.parse(response);
if(jsonObject.compassionateVisitExpenses == '1'){
console.log(true)
var element = $('input[name="compassionateVisitExpenses"]').parent().parent().next()[0];
console.log(element)
$(element).css("display", "");
}
if(jsonObject.brokenBoneExpenses == '1'){
var element = $('input[name="brokenBoneExpenses"]').parent().parent().next()[0];
console.log(element)
$(element).css("display", "");
}
if(jsonObject.ambulanceCharges == '1'){
var element = $('input[name="ambulanceCharges"]').parent().parent().next()[0];
console.log(element)
$(element).css("display", "");
}
if(jsonObject.burnExpenses == '1'){
var element = $('input[name="burnExpenses"]').parent().parent().next()[0];
console.log(element)
$(element).css("display", "");
}
if(jsonObject.carriageOfDeadBody == '1'){
var element = $('input[name="carriageOfDeadBody"]').parent().parent().next()[0];
console.log(element)
$(element).css("display", "");
}
Object.keys(jsonObject).forEach(function(key) {
console.log(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];
}
if(res.count){
$('emp_count').val(res.count)
if(res.count === false){
$("#btnGPATermsSubmit").prop("disabled", true);
}else{
$("#btnGPATermsSubmit").prop("disabled", false);
}
});
}
if (res) {
let jsonObject = JSON.parse(res.data);
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];
}
}
});
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
},
});
error: function(xhr, status, error) {
console.error('Error:', status, error);
}
});
}
});
@ -464,44 +489,21 @@
<script>
$(document).ready(function() {
var editor = new Jodit('#additionalsicknessbenefit', {
buttons: 'bold,italic,underline,|,align',
$(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','');
});
var editor = new Jodit('#Wellness', {
buttons: 'bold,italic,underline,|,align',
});
});
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
event.preventDefault();
specialCondition();
});
function specialCondition(count =0) {
if (count === 0) {
var index =$('.modifyclassinput').length;
var appendElement =`<div class="form-group col-md-6 form-group-client-policy-masters">
<label for="specialconditionlabel" class="specialConditionLabel[]" style="width: 400px;"><input name="specialConditionLabel[]" id="specialConditionLabel[]"><span class="specialConditionClose" style="color: red;margin-left: 20px;">X</span></label>
<input type="text" name="specialConditionInput[]" id="specialConditionInput[]" class="form-control form-control-client-policy-masters specialConditionInput[]">
</div>`;
$('.form-column').each(function() {
$(this).append(appendElement);
});
$("#sumInsured2").on("keyup", function() {
var inputNumber = parseInt($(this).val());
if (!isNaN(inputNumber)) {
var result = convertToIndianNumberingSystem(inputNumber);
$("#numberToWord").text(result);
} else {
$("#numberToWord").text("");
}
else{
}
}
$(document).on('click', '.specialConditionClose', function() {
$(this)[0].parentNode.parentNode.remove();
});
</script>