FEAT_POLICY_GPA_TERMS : RV

This commit is contained in:
VENKATESHWARAN 2024-03-01 12:34:33 +05:30
parent 2e5a8c558e
commit 8b5e914bf2
15 changed files with 971 additions and 644 deletions

View File

@ -49,7 +49,8 @@ $routes->group("/client", ["filter" => "authMVC"], function($routes){
$routes->group("relation", ["filter" => "authMVC"], function($routes){
$routes->post("create", "ClientController::createClientRelation");
$routes->post("edit", "ClientController::editClientRelation");
});
});
$routes->group("policy", ["filter" => "authMVC"], function($routes){
$routes->post("create", "ClientController::createClientPolicy");
$routes->post("edit", "ClientController::editClientPolicy");
@ -57,16 +58,24 @@ $routes->group("/client", ["filter" => "authMVC"], function($routes){
$routes->post("jsonPost", "ClientController::jsonPost");
$routes->get("getjson", "ClientController::getjson");
});
$routes->group("kyc", ["filter" => "authMVC"], function($routes){
$routes->post("create", "ClientController::createClientKYCInfo");
$routes->post("edit", "ClientController::editClientKYCInfo");
$routes->get("list/(:any)", "ClientController::getKycDocsById/$1");
$routes->get("delete/(:any)", "ClientController::deleteClientKycDocs/$1");
});
$routes->group("premimum", ["filter" => "authMVC"], function($routes){
$routes->post("create", "ClientController::createClientPolicyPremium");
$routes->post("edit", "ClientController::editClientPolicyPremium");
});
$routes->group("terms", ["filter" => "authMVC"], function($routes){
$routes->post("gpa_create", "ClientController::policyGPATerms");
$routes->post("edit", "ClientController::editClientPolicyPremium");
});
});

View File

@ -499,7 +499,6 @@ class ClientController extends AdminController
}
}
public function createClientPolicyPremium()
{
$policy_type = $this->request->getPost('policy_type');
@ -642,9 +641,6 @@ class ClientController extends AdminController
$policy_id = $this->request->getGet('policy_id');
$client_id = $this->request->getGet('client_id');
echo $policy_id;
echo $client_id;
$data = $this->policesModel->getPolicyPremium($policy_id);
$pattern = '/gmc/i';
$subject = $data[0]->policy_type;
@ -656,17 +652,11 @@ class ClientController extends AdminController
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
if($search_term === 'GPA'){
$premiumData = $this->policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
}else{
$premiumData = $this->policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
}
// echo '<pre>';
// print_r($results);
// print_r($data[0]->policy_type); die;
echo json_encode(array("status" => true , 'data' => $results, 'premiumData' => $premiumData));
}
@ -734,10 +724,6 @@ class ClientController extends AdminController
$data['specialConditionLabel'] = $this->request->getPost("specialConditionLabel") ?? [];
$data['specialConditionInput'] = $this->request->getPost("specialConditionInput") ?? [];
// print_r($data);
// print_r($this->request->getPost());
// die();
$jsonData = json_encode($data);
$dataa = array(
@ -745,7 +731,9 @@ class ClientController extends AdminController
'client_id' => $client_id,
'policy_id' => $policy_id
);
$record = $this->clientPolicyModel->where(['client_id' => $client_id, 'policy_id' => $policy_id])->first();
if ($record) {
$update = $this->clientPolicyModel->update($record['id'], $dataa);
if ($update) {
@ -762,6 +750,118 @@ class ClientController extends AdminController
}
}
} catch (\Exception $e) {
echo "Failed to insert data: " . $e->getMessage();
// Log the error
log_message('error', 'Failed to insert data: ' . $e->getMessage());
}
}
public function getjson()
{
$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();
if ($record) {
echo $record['policy_terms'];
} else {
echo "Record not found.";
}
}
public function policyGPATerms()
{
try {
$this->myLogger->logme('error','Policy GPA Terms CREATE function called');
// print_r($this->request->getPost());
$client_id = $this->request->getPost("client_id");
$policy_id = $this->request->getPost("policy_id");
$data['sumInsured2'] =$this->request->getPost("sumInsured2");
$data['totalSumInsured'] =$this->request->getPost("totalSumInsured");
$data['accidentalDeathBenefit'] =$this->request->getPost("accidentalDeathBenefit");
$data['permanentTotalDisablement'] =$this->request->getPost("permanentTotalDisablement");
$data['permanentPartialDisablement'] =$this->request->getPost("permanentPartialDisablement");
$data['temporaryTotalDisablementBenefit'] =$this->request->getPost("temporaryTotalDisablementBenefit");
$data['accidentalHospitalizationExpenses'] =$this->request->getPost("accidentalHospitalizationExpenses");
$data['childrenEducationWelfareFund'] =$this->request->getPost("childrenEducationWelfareFund");
$data['compassionateVisitExpenses'] =$this->request->getPost("compassionateVisitExpenses");
if ($data['compassionateVisitExpenses'] == 1) {
$data['compassionateVisitExpensesData'] =$this->request->getPost("compassionateVisitExpensesData");
}else{
$data['compassionateVisitExpensesData'] ="";
}
$data['brokenBoneExpenses'] = $this->request->getPost("brokenBoneExpenses");
if ($data['brokenBoneExpenses'] == 1) {
$data['brokenBoneExpensesData'] = $this->request->getPost("brokenBoneExpensesData");
}else{
$data['brokenBoneExpensesData'] ="";
}
$data['ambulanceCharges'] =$this->request->getPost("ambulanceCharges");
if ($data['ambulanceCharges'] == 1) {
$data['ambulanceChargesData'] =$this->request->getPost("ambulanceChargesData");
}else{
$data['ambulanceChargesData'] ="";
}
$data['burnExpenses'] = $this->request->getPost("burnExpenses");
if ($data['burnExpenses'] == 1) {
$data['burnExpensesData'] = $this->request->getPost("burnExpensesData");
}else{
$data['burnExpensesData'] = "";
}
$data['carriageOfDeadBody'] = $this->request->getPost("carriageOfDeadBody");
if ($data['carriageOfDeadBody'] == 1) {
$data['carriageOfDeadBodyData'] = $this->request->getPost("carriageOfDeadBodyData");
}else{
$data['carriageOfDeadBodyData'] = "";
}
$data['animalSnakeInsectBite'] = $this->request->getPost("animalSnakeInsectBite");
$data['terrorism'] = $this->request->getPost("terrorism");
$data['worldwideCover'] = $this->request->getPost("worldwideCover");
print_r($data);
// print_r($this->request->getPost());
// die();
$jsonData = json_encode($data);
$dataa = array(
'policy_terms' => $jsonData,
'client_id' => $client_id,
'policy_id' => $policy_id
);
$record = $this->clientPolicyModel->where(['client_id' => $client_id, 'policy_id' => $policy_id])->first();
if ($record) {
$update = $this->clientPolicyModel->update($record['id'], $dataa);
if ($update) {
$response = array('message' => 'Data updated successfully');
header('Content-Type: application/json');
echo json_encode($response);
} else {
echo json_encode(array('message' => 'Failed to update data'));
}
}else{
$insert = $this->clientPolicyModel->insert($dataa);
if ($insert) {
echo json_encode(array('message' => 'Data stored successfully'));
} else {
echo json_encode(array('message' => 'Failed to store data'));
}
}
} catch (\Exception $e) {
// Handle the exception
echo "Failed to insert data: " . $e->getMessage();
// Log the error
@ -770,16 +870,14 @@ class ClientController extends AdminController
}
public function getPolicyGPATerms(){
public function getjson()
{
$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();
if ($record) {
echo $record['json'];
echo $record['policy_terms'];
} else {
echo "Record not found.";

View File

@ -35,7 +35,7 @@ class ClientPolicyModel extends Model
"earned_premium_amount",
"claims_incurred_amount",
"json",
"policy_terms",
"created_by",
"updated_by",
"Is_active",

View File

@ -139,6 +139,9 @@ $(document).ready(function () {
form_action = '<?= base_url("client/general/edit"); ?>';
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var formData = new FormData($('#general_form')[0]);
var OptionsHTML1 = ''
@ -150,8 +153,19 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
if(res){
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$('#kyc_tab').click();
var message = (PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
toastr.success(message, 'Success');
}, 1000);
}
console.log(res);
$('#client_id').val(res.data.id);
$('#client_id_relation').val(res.data.id);
$('#client_id_branch').val(res.data.id);
@ -160,10 +174,6 @@ $(document).ready(function () {
$('#policy_PrimaryKey').val(res.data.id);
$('#client_id_kyc').val(res.data.id);
$('#entity_type').val(res.data.entity_type_id);
$('#kyc_tab').click();
var message = (PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
toastr.success(message, 'Success');
$.ajax({
url: '<?= base_url("client/kyc/list/"); ?>' + res.data.entity_type_id,

View File

@ -237,6 +237,9 @@ $(document).ready(function () {
if (isValid) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var formData = new FormData($('#branch_form')[0]);
$.ajax({
@ -247,9 +250,21 @@ $(document).ready(function () {
processData: false,
contentType: false,
success: function(res) {
console.log(res);
var message = (branch_PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
toastr.success(message, 'Success');
if(res){
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
var message = (branch_PrimaryKey === '') ? 'Client Branch Created successfully' : 'Client Branch Updated successfully';
toastr.success(message, 'Success');
}, 1000);
}
$('#branch_list tr').remove();
var branchTableInsert = ''
$.each(res.data, function(index, item) {
@ -262,10 +277,7 @@ $(document).ready(function () {
`;
});
$('#branch_list').append(branchTableInsert);
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
},
error: function (xhr, status, error) {
console.error(xhr.responseText);

View File

@ -168,8 +168,6 @@
});
});
;
if(kycPrimaryKey !== ''){
$.ajax({
@ -203,8 +201,10 @@
}
});
var table = '';
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
console.log(data)
$('#other_docs tr').remove();
$.each(data, function(index, item) {
@ -221,14 +221,15 @@
});
$('#other_docs').append(table);
$.each(data, function(index, item) {
// console.log(item.kyc_doc_type_id);
// console.log('name_' + item.kyc_doc_type_id);
// console.log(document.getElementById('name_' + item.kyc_doc_type_id));
setTimeout(function() {
$('#name_'+item.kyc_doc_type_id).show();
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
$('#form_'+item.kyc_doc_type_id).hide();
$('#name_'+item.id).show();
$('#name_'+item.id).html(item.file_name);
$('#form_'+item.id).hide();
}, 1000);
});

View File

@ -36,12 +36,15 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Client Onboarding</h4>
<h4 class="header-title" style="position: relative;">Client Onboarding <?php if(isset($client)) {echo ' - ' . $client['client_name']; } ?></h4>
</div>
<div class="col-6" style="text-align: right;">
<!-- <a href="<?= base_url("client/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a> -->
</div>
</div>
<br>
<ul class="nav nav-pills navtab-bg">
<li class="nav-item">
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"

View File

@ -1,6 +1,3 @@
<?php include('policy_grid.php'); ?>
<?php include('policy_gmc_terms.php'); ?>
<div class="tab-pane fade" id="police-tab">
@ -102,97 +99,101 @@
</div>
<!-- end -->
<?php include('policy_grid.php'); ?>
<?php include('policy_gmc_terms.php'); ?>
<?php include('policy_gpa_terms.php'); ?>
<script>
var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val();
var policy_PrimaryKey = $('#client_id_policy').val();
var policy_client = $('#policy_PrimaryKey').val();
$(document).ready(function () {
$(document).ready(function () {
// Get today's date
var today = new Date();
// Get today's date
var today = new Date();
// Initialize Flatpickr for the start date with today's date
var startDatePicker = flatpickr("#start_date", {
dateFormat: "d-m-Y",
defaultDate: today,
allowInput: false,
onChange: function(selectedDates, dateStr, instance) {
var endDate = new Date(selectedDates[0]);
endDate.setFullYear(endDate.getFullYear() + 1);
endDatePicker.setDate(endDate);
}
});
// Calculate the end date (today + 1 year)
var endDate = new Date(today);
endDate.setFullYear(endDate.getFullYear() + 1);
// Initialize Flatpickr for the end date with the calculated end date
var endDatePicker = flatpickr("#end_date", {
dateFormat: "d-m-Y",
defaultDate: endDate,
allowInput: false
});
$('#add_form').hide();
$('.btnBack').hide();
$('.btnAdd').click(function(){
$('#add_form').show();
$('#table_list').hide();
$('.btnBack').show();
$('.btnAdd').hide();
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
})
$('.btnBack').click(function(){
$('#GMC').remove();
$('#GPA').remove();
$('#add_form').hide();
$('#table_list').show();
$('.btnBack').hide();
$('.btnAdd').show();
$('#insurer').val('');
$('#tpa').val('');
$('#start_date').val('');
$('#end_date').val('');
$('#policy').html('<option value="" selected>Select Policy</option>');
})
if (policy_PrimaryKey !== '') {
var policyTable = '';
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
data.forEach(function(item) {
policyTable += `
<tr>
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
<td>${item.policy_name}</td>
<td>${item.tpa_short} - ${item.tpa_branch_code}</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="#bs-example-modal-sm" style="font-size:18px; margin-left: 7px;"></a>
</td>
</tr>
`;
// Initialize Flatpickr for the start date with today's date
var startDatePicker = flatpickr("#start_date", {
dateFormat: "d-m-Y",
defaultDate: today,
allowInput: false,
onChange: function(selectedDates, dateStr, instance) {
var endDate = new Date(selectedDates[0]);
endDate.setFullYear(endDate.getFullYear() + 1);
endDatePicker.setDate(endDate);
}
});
$('#policy_table').append(policyTable);
}
// Calculate the end date (today + 1 year)
var endDate = new Date(today);
endDate.setFullYear(endDate.getFullYear() + 1);
// Initialize Flatpickr for the end date with the calculated end date
var endDatePicker = flatpickr("#end_date", {
dateFormat: "d-m-Y",
defaultDate: endDate,
allowInput: false
});
});
$('#add_form').hide();
$('.btnBack').hide();
$('.btnAdd').click(function(){
$('#add_form').show();
$('#table_list').hide();
$('.btnBack').show();
$('.btnAdd').hide();
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
})
$('.btnBack').click(function(){
$('#GMC').remove();
$('#GPA').remove();
$('#add_form').hide();
$('#table_list').show();
$('.btnBack').hide();
$('.btnAdd').show();
$('#insurer').val('');
$('#tpa').val('');
$('#start_date').val('');
$('#end_date').val('');
$('#policy').html('<option value="" selected>Select Policy</option>');
})
if (policy_PrimaryKey !== '') {
var policyTable = '';
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
data.forEach(function(item) {
policyTable += `
<tr>
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
<td>${item.policy_name}</td>
<td>${item.tpa_short} - ${item.tpa_branch_code}</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>
</td>
</tr>
`;
});
$('#policy_table').append(policyTable);
}
});
//for form submit using AJAX
$("#policy_form").submit(function(event) {
@ -216,6 +217,9 @@ $(document).ready(function () {
return ;
}
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
var formData = new FormData($('#policy_form')[0]);
var policy_form_action = $('#policy_form_action').val();
@ -233,9 +237,20 @@ $(document).ready(function () {
return;
}
console.log(res);
var message = (policy_PrimaryKey === '') ? 'Policy Created successfully' : 'Policy Updated Successfully';
toastr.success(message, 'Success');
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);
}
$('#policy_table tr').remove();
var policyTable = '';
@ -248,15 +263,12 @@ $(document).ready(function () {
<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>
</td>
</tr>
`;
});
$('#policy_table').append(policyTable);
$('#add_form').hide();
$('#table_list').show();
$('.btnBack').hide();
$('.btnAdd').show();
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
@ -266,7 +278,7 @@ $(document).ready(function () {
});
//To get th POLICY base on Insurer
/********* To get th POLICY base on Insurer *******/
$('#insurer').change(function() {
var id = $(this).val();
var parts = id.split('-');
@ -321,7 +333,7 @@ $(document).ready(function () {
dataType: 'json',
success: function (res) {
console.log(res);
console.log('clientPolicy : ', res);
$('#policy_form_action').val('<?= base_url("client/policy/edit"); ?>');
@ -363,6 +375,7 @@ $(document).ready(function () {
});
});
function appendPolicyFormFields(policy_type, data = false){
var html = '';

View File

@ -115,6 +115,9 @@ $(document).ready(function(){
if (isValid) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
if(relation_PrimaryKey === ''){
form_action = '<?= base_url("client/relation/create"); ?>';
}else{
@ -132,9 +135,18 @@ $(document).ready(function(){
contentType: false,
success: function(res) {
console.log(res);
var message = (relation_PrimaryKey === '') ? 'Client Relation Created successfully' : 'Client Relation Updated successfully';
toastr.success(message, 'Success');
$('#branch_tab').click();
if(res){
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
var message = (relation_PrimaryKey === '') ? 'Client Relation Created successfully' : 'Client Relation Updated successfully';
toastr.success(message, 'Success');
$('#branch_tab').click();
}, 1000);
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);

View File

@ -36,7 +36,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Insurer Onboarding</h4>
<h4 class="header-title" style="position: relative;">Insurer</h4>
</div>
<!-- <div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/insurer/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>

View File

@ -36,7 +36,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">KYC Entity Type Onboarding</h4>
<h4 class="header-title" style="position: relative;">KYC Entity Type</h4>
</div>
<!-- <div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/kyc/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>

View File

@ -98,7 +98,7 @@
<input type="radio" name="family_floater" value="1"> Yes
<input type="radio" name="family_floater" value="0" style="margin-left:10px"> No
</div>
<div style="display:none; margin-top: 27px;margin-bottom: 7px; margin-left: 31px;">
<div style="display:none; margin-top: 27px;margin-bottom: 7px; margin-left: 31px;">
<input type="checkbox" name="family_floaters[]" value="Self" id="Self"> Self
<input type="checkbox" name="family_floaters[]" value="Spouse" id="Spouse"> Spouse
<input type="checkbox" name="family_floaters[]" value="Child1" id="Child1"> Child 1
@ -319,10 +319,8 @@
</div>
</div>
</div>
<!-- <hr> -->
<!-- <div class="form-row" id="grid_content_input">
@ -344,22 +342,19 @@
var policy_grid_id = $('#client_id').val();
var grid_html = '';
$('#gmc_remove').hide();
$('#btnGridSubmit').hide();
$('.close').click(function(){
$('#sumInsured').val("");
$('#familyfloater').val("");
$('#waiverofpreexistingdiseases').prop('checked', false);
$('#maternitycoverage').val("");
for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove();
}
});
$('#gmc_remove').hide();
$('#btnGridSubmit').hide();
$('.close').click(function(){
$('#sumInsured').val("");
$('#familyfloater').val("");
$('#waiverofpreexistingdiseases').prop('checked', false);
$('#maternitycoverage').val("");
for (var i = 1; i <= 11; i++) {
$('#grid_' + i).remove();
}
});
$('input[name="family_floater"]').change(function() {
@ -377,6 +372,7 @@ $('.close').click(function(){
}
});
$(document).ready(function() {
if ($('input[name="waiverofpreexistingdiseases"]').val() == '1') {
@ -411,7 +407,8 @@ $('.close').click(function(){
var element2 = $('input[name="family_floater"]').parent().parent().parent().next()[0];
$(element2).css("display", "none");
}
});
});
$('input[name="waiverofpreexistingdiseases"]').change(function() {
console.log("test 739 line.....");
@ -438,517 +435,182 @@ $('.close').click(function(){
});
$("#policyJsonForm").submit(function(event) {
event.preventDefault();
var isValid = $('#policyJsonForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return ;
}
var formData = new FormData($('#policyJsonForm')[0]);
var policy_form_action = '<?= base_url("client/policy/jsonPost") ?>';
$.ajax({
data: formData,
url: policy_form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
if (res.status === false) {
toastr.error('Policy Dose Not Create', 'Error');
return;
}
document.querySelectorAll('.specialConditionLabel\\[\\]').forEach(element => {
element.parentNode.remove();
});
console.log(res);
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' : 'Policy Premium Added Successfully';
toastr.success(message, 'Success');
$('.close').click();
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$("#policyJsonForm").submit(function(event) {
event.preventDefault();
var isValid = $('#policyJsonForm').parsley().validate();
if (!isValid) {
console.log('Form is Empty', 'Warning');
return ;
}
});
});
$('body').on('click', '.btnPolicyMaster', function () {
var policy_id = $(this).data('id');
// console.log('policy_id :' ,policy_id);
$('#policy_id').val(policy_id);
var client_id = $('#Client_id').val();
$('#client_policy_id').val(policy_id);
// console.log('client_id :' ,client_id);
$.ajax({
url: '<?= base_url("client/policy/getjson") ?>',
method: 'GET',
data: { policy_id : policy_id , client_id: client_id},
// dataType: 'json',
success: function(response) {
console.log(response);
// let jsonString = response.substring(response.indexOf('{'), response.lastIndexOf('}') + 1);
// console.log(jsonString);
if (response) {
let jsonObject = JSON.parse(response);
// console.log(jsonObject);
Object.keys(jsonObject).forEach(function(key) {
if (key.includes("specialConditionLabel") || key.includes("specialConditionInput")) {
if (key.includes("specialConditionLabel")) {
for (let index = 0; index < jsonObject[key].length; index++) {
specialCondition();
}
var formData = new FormData($('#policyJsonForm')[0]);
var policy_form_action = '<?= base_url("client/policy/jsonPost") ?>';
$.ajax({
data: formData,
url: policy_form_action,
type: "POST",
dataType: 'json',
processData: false,
contentType: false,
success: function(res) {
if (res.status === false) {
toastr.error('Policy Dose Not Create', 'Error');
return;
}
let elements = document.getElementsByName(`${key}[]`);
document.querySelectorAll('.specialConditionLabel\\[\\]').forEach(element => {
element.parentNode.remove();
});
if (elements) {
elements.forEach((element,index) => {
element.value = jsonObject[key][index];
console.log(res);
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' : 'Policy Premium Added Successfully';
toastr.success(message, 'Success');
$('.close').click();
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
});
$('body').on('click', '.btnPolicyMaster', function () {
var policy_id = $(this).data('id');
// console.log('policy_id :' ,policy_id);
$('#policy_id').val(policy_id);
var client_id = $('#Client_id').val();
$('#client_policy_id').val(policy_id);
// console.log('client_id :' ,client_id);
$.ajax({
url: '<?= base_url("client/policy/getjson") ?>',
method: 'GET',
data: { policy_id : policy_id , client_id: client_id},
// dataType: 'json',
success: function(response) {
console.log(response);
// let jsonString = response.substring(response.indexOf('{'), response.lastIndexOf('}') + 1);
// console.log(jsonString);
if (response) {
let jsonObject = JSON.parse(response);
// console.log(jsonObject);
Object.keys(jsonObject).forEach(function(key) {
if (key.includes("specialConditionLabel") || key.includes("specialConditionInput")) {
if (key.includes("specialConditionLabel")) {
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}[]"]`);
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') {
element.checked = element.value === jsonObject[key];
}
}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];
}
}
});
}
}
},
if (key.includes("family_floaters")) {
let checkboxes = document.querySelectorAll(`input[name="${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') {
element.checked = element.value === jsonObject[key];
}
}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];
}
error: function(xhr, status, error) {
console.error('Error:', status, error);
}
});
}
},
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>
<!-- Jodit RTE -->
<script>
$(document).ready(function() {
var editor = new Jodit('#additionalsicknessbenefit', {
buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
});
var editor = new Jodit('#Wellness', {
buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
});
});
</script>
<script>
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
event.preventDefault();
specialCondition();
buttons: 'bold,italic,underline,|,align',
});
var editor = new Jodit('#Wellness', {
buttons: 'bold,italic,underline,|,align',
});
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);
});
}
else{
});
}
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);
});
}
else{
}
}
$(document).on('click', '.specialConditionClose', function() {
$(this)[0].parentNode.parentNode.remove();
});
$(document).on('click', '.specialConditionClose', function() {
$(this)[0].parentNode.parentNode.remove();
});
</script>
</script>

View File

@ -0,0 +1,507 @@
<!-- Modal content for the Large example -->
<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;
}
.jodit-container{
width: 690px !important;
margin-top: 3px;
margin-bottom: 3px;
margin-left: 30px;
/* height: 0px !important; */
/* min-height: 100px !important; */
}
.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 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 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="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 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="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="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 -->
<script>
var policy_grid_id = $('#client_id').val();
var grid_html = '';
$('#gmc_remove').hide();
$('#btnGridSubmit').hide();
$('.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 (!isValid) {
console.log('Form is Empty', 'Warning');
return ;
}
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) {
console.log(res);
if (res.status === false) {
toastr.error('Policy Dose Not Create', 'Error');
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);
}
});
});
$('body').on('click', '.btnPolicyMaster', function () {
var policy_id = $(this).data('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);
$.ajax({
url: '<?= base_url("client/policy/getjson") ?>',
method: 'GET',
data: { policy_id : policy_id , client_id: client_id},
success: function(response) {
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];
}
}
});
}
},
error: function(xhr, status, error) {
console.error('Error:', status, error);
}
});
});
</script>
<script>
$(document).ready(function() {
var editor = new Jodit('#additionalsicknessbenefit', {
buttons: 'bold,italic,underline,|,align',
});
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);
});
}
else{
}
}
$(document).on('click', '.specialConditionClose', function() {
$(this)[0].parentNode.parentNode.remove();
});
</script>

View File

@ -36,7 +36,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Policy Type Onboarding</h4>
<h4 class="header-title" style="position: relative;">Policy Type</h4>
</div>
<!-- <div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/policy/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>

View File

@ -36,7 +36,7 @@ body {
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">TPA Onboarding</h4>
<h4 class="header-title" style="position: relative;">TPA</h4>
</div>
<!-- <div class="col-6" style="text-align: right;">
<a href="<?= base_url("master/tpa/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>