code_merge : RV
This commit is contained in:
commit
482ed4ef0f
@ -160,9 +160,11 @@ class ClientController extends AdminController
|
||||
$insert = $this->clientModel->insert($data);
|
||||
if($insert){
|
||||
$client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
echo json_encode(array("status" => true , 'data' => $client_data));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $client_data], 200);
|
||||
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,9 +176,9 @@ class ClientController extends AdminController
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->clientModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,9 +197,9 @@ class ClientController extends AdminController
|
||||
if($insert){
|
||||
|
||||
$kycDocs = $this->clientKYCDocsModel->where('client_id',$this->request->getPost('client_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $kycDocs, 'file_name' => $File));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $kycDocs, 'file_name' => $File], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,9 +218,10 @@ class ClientController extends AdminController
|
||||
$insert = $this->clientKYCDocsModel->insert($data);
|
||||
if($insert){
|
||||
$kycDocs = $this->clientKYCDocsModel->getKycDocsName($id);
|
||||
echo json_encode(array("status" => true , 'data' => $kycDocs));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $kycDocs], 200);
|
||||
}else{
|
||||
echo json_encode(array());
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,9 +230,9 @@ class ClientController extends AdminController
|
||||
|
||||
$delete = $this->clientKYCDocsModel->where('kyc_doc_type_id', $id)->delete();
|
||||
if($delete){
|
||||
echo json_encode(array("status" => true, 'id' => $id ));
|
||||
return $this->respond(['status' => true,'code' => 200,'id' => $id], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,9 +241,9 @@ class ClientController extends AdminController
|
||||
|
||||
$delete = $this->clientKYCDocsModel->where('id', $id)->delete();
|
||||
if($delete){
|
||||
echo json_encode(array("status" => true, 'id' => $id ));
|
||||
return $this->respond(['status' => true,'code' => 200,'id' => $id], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,9 +277,9 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
if ($inserted) {
|
||||
echo json_encode(array("status" => true, 'data' => $this->request->getPost()));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $this->request->getPost()], 200);
|
||||
} else {
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,9 +329,9 @@ class ClientController extends AdminController
|
||||
$lastQuery = $this->clientRMModel->getLastQuery();
|
||||
|
||||
if ($inserted) {
|
||||
echo json_encode(array("status" => true, 'data' => $this->request->getPost(), "place" => 'edit'));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $this->request->getPost(), "place" => 'edit'], 200);
|
||||
} else {
|
||||
echo json_encode(array("status" => false, "place" => 'edit'));
|
||||
return $this->respond(['status' => false,'code' => 404,"place" => 'edit', 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,9 +361,9 @@ class ClientController extends AdminController
|
||||
|
||||
if($insert){
|
||||
$branchData = $this->clientBranchModel->where('client_id', $this->request->getPost('client_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $branchData], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -395,9 +398,9 @@ class ClientController extends AdminController
|
||||
|
||||
if($insert){
|
||||
$branchData = $this->clientBranchModel->where('client_id', $client_id)->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $branchData], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,9 +448,9 @@ class ClientController extends AdminController
|
||||
$insert = $this->clientPolicyModel->insert($data);
|
||||
if($insert){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
|
||||
echo json_encode(array("status" => true , 'data' => $clientPoliceData, 'method' => 'CERATE'));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -497,9 +500,9 @@ class ClientController extends AdminController
|
||||
|
||||
if($insert){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
|
||||
echo json_encode(array("status" => true , 'data' => $clientPoliceData , 'method' => 'EDIT'));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'EDIT'], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,9 +577,10 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
if($insert){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false , 'data' => $data));
|
||||
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -592,11 +596,11 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme('error','getKycDocsById function called');
|
||||
if($id){
|
||||
$kyc_docs_data = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $kyc_docs_data));
|
||||
$this->myLogger->logme('error','getKycDocs status TRUE');
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $kyc_docs_data], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
$this->myLogger->logme('error','getKycDocs status FALSE');
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -605,9 +609,9 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme('error','getPolicesByInsurerId function called');
|
||||
if($id){
|
||||
$police_data = $this->policesModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $police_data));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $police_data], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -618,9 +622,9 @@ class ClientController extends AdminController
|
||||
if($id){
|
||||
$branch_data = $this->clientBranchModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$branch_contact_data = $this->levelContactModel->where(['ref_id' => $id, 'contact_type'=>'client', 'is_active' => 1])->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branch_data, 'contact' => $branch_contact_data));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $branch_data, 'contact' => $branch_contact_data], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
|
||||
}
|
||||
@ -632,9 +636,9 @@ class ClientController extends AdminController
|
||||
$client_policy_data = $this->clientPolicyModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$insurer_id = $client_policy_data['insurer_id'];
|
||||
$polices = $this->policesModel->where(['insurer_id' => $insurer_id, 'is_active' => 1])->findAll();
|
||||
echo json_encode(array("insurer_id" => $client_policy_data['insurer_id'], "status" => true , 'data' => $client_policy_data, 'policy' => $polices));
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
|
||||
}
|
||||
@ -645,6 +649,7 @@ class ClientController extends AdminController
|
||||
$policy_id = $this->request->getGet('policy_id');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
|
||||
|
||||
$data = $this->policesModel->getPolicyPremium($policy_id);
|
||||
$pattern = '/gmc/i';
|
||||
$subject = $data[0]->policy_type;
|
||||
@ -660,8 +665,11 @@ class ClientController extends AdminController
|
||||
}else{
|
||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
}
|
||||
|
||||
echo json_encode(array("status" => true , 'data' => $results, 'premiumData' => $premiumData));
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($results);
|
||||
// print_r($data[0]->policy_type); die;
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => $premiumData], 200);
|
||||
|
||||
}
|
||||
|
||||
@ -743,16 +751,16 @@ class ClientController extends AdminController
|
||||
if ($record) {
|
||||
$update = $this->clientPolicyModel->update($record['id'], $dataa);
|
||||
if ($update) {
|
||||
echo json_encode(array('message' => 'Data updated successfully'));
|
||||
return $this->respond(['status' => true,'code' => 200,'message' => 'Data updated successfully'], 200);
|
||||
} else {
|
||||
echo json_encode(array('message' => 'Failed to update data'));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'Failed to update data'], 200);
|
||||
}
|
||||
}else{
|
||||
$insert = $this->clientPolicyModel->insert($dataa);
|
||||
if ($insert) {
|
||||
echo json_encode(array('message' => 'Data stored successfully'));
|
||||
return $this->respond(['status' => true,'code' => 200,'message' => 'Data stored successfully'], 200);
|
||||
} else {
|
||||
echo json_encode(array('message' => 'Failed to store data'));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'Failed to store data'], 200);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@ -862,18 +870,16 @@ class ClientController extends AdminController
|
||||
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);
|
||||
return $this->respond(['status' => true,'code' => 200,'message' => 'Data updated successfully'], 200);
|
||||
} else {
|
||||
echo json_encode(array('message' => 'Failed to update data'));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'Failed to update data'], 200);
|
||||
}
|
||||
}else{
|
||||
$insert = $this->clientPolicyModel->insert($dataa);
|
||||
if ($insert) {
|
||||
echo json_encode(array('message' => 'Data stored successfully'));
|
||||
return $this->respond(['status' => true,'code' => 200,'message' => 'Data stored successfully'], 200);
|
||||
} else {
|
||||
echo json_encode(array('message' => 'Failed to store data'));
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'Failed to store data'], 200);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -168,11 +168,13 @@ $(document).ready(function () {
|
||||
|
||||
$('#client_id').val(res.data.id);
|
||||
$('#client_id_relation').val(res.data.id);
|
||||
$('#relation_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_branch').val(res.data.id);
|
||||
$('#branch_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_policy').val(res.data.id);
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_kyc').val(res.data.id);
|
||||
$('#kyc_PrimaryKey').val(res.data.id);
|
||||
$('#entity_type').val(res.data.entity_type_id);
|
||||
|
||||
$.ajax({
|
||||
|
||||
@ -105,7 +105,9 @@
|
||||
$(document).on('click', '.submit', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
// kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
kycPrimaryKey = $('#client_id_kyc').val();
|
||||
|
||||
|
||||
var form = $(this).closest('form');
|
||||
var formData = new FormData(form[0]);
|
||||
@ -149,8 +151,8 @@
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
res = JSON.parse(res)
|
||||
console.log(res);
|
||||
// res = JSON.parse(res)
|
||||
// console.log(res);
|
||||
form.trigger('reset')
|
||||
$.each(res.data, function (index, item) {
|
||||
|
||||
|
||||
@ -306,7 +306,7 @@
|
||||
var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart;
|
||||
|
||||
$.get(url, function(res) {
|
||||
res = JSON.parse(res)
|
||||
// res = JSON.parse(res)//
|
||||
console.log(res)
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||
|
||||
@ -95,18 +95,18 @@
|
||||
</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" 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
|
||||
<input type="checkbox" name="family_floaters[]" value="Child3" id="Child3"> Child 3
|
||||
<input type="checkbox" name="family_floaters[]" value="Child4" id="Child4"> Child 4
|
||||
<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
|
||||
<input type="checkbox" name="family_floaters[]" value="child2" id="child2"> Child 2
|
||||
<input type="checkbox" name="family_floaters[]" value="child3" id="child3"> Child 3
|
||||
<input type="checkbox" name="family_floaters[]" value="child4" id="child4"> Child 4
|
||||
</div>
|
||||
<div style="margin-top:10px">
|
||||
<input type="checkbox" name="family_floaters[]" value="Parent1" id="Parent1"> Parent 1
|
||||
<input type="checkbox" name="family_floaters[]" value="Parent2" id="Parent2"> Parent 2
|
||||
<input type="checkbox" name="family_floaters[]" value="Parent_In_Law1" id="Parent_In_Law1"> Parent-In-Law 1
|
||||
<input type="checkbox" name="family_floaters[]" value="Parent_In_Law2" id="Parent_In_Law2"> Parent-In-Law 2
|
||||
<input type="checkbox" name="family_floaters[]" value="parent1" id="parent1"> Parent 1
|
||||
<input type="checkbox" name="family_floaters[]" value="parent2" id="parent2"> Parent 2
|
||||
<input type="checkbox" name="family_floaters[]" value="parent_in_law1" id="parent_in_law1"> Parent-In-Law 1
|
||||
<input type="checkbox" name="family_floaters[]" value="parent_in_law2" id="parent_in_law2"> Parent-In-Law 2
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -351,17 +351,14 @@
|
||||
var policy_grid_id = $('#client_id').val();
|
||||
var grid_html = '';
|
||||
|
||||
$('.close').click(function(){
|
||||
|
||||
$('#sum_insured').val("");
|
||||
$('#familyfloater').val("");
|
||||
$('#waiverofpreexistingdiseases').prop('checked', false);
|
||||
$('#maternitycoverage').val("");
|
||||
|
||||
});
|
||||
|
||||
$('.close').click(function(){
|
||||
|
||||
$('#sum_insured').val("");
|
||||
$('#familyfloater').val("");
|
||||
$('#waiverofpreexistingdiseases').prop('checked', false);
|
||||
$('#maternitycoverage').val("");
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('input[name="family_floater"]').change(function() {
|
||||
@ -379,42 +376,6 @@ $('.close').click(function(){
|
||||
}
|
||||
});
|
||||
|
||||
// $(document).ready(function() {
|
||||
|
||||
// if ($('input[name="waiverofpreexistingdiseases"]').val() == '1') {
|
||||
// var element = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
// var element2 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next()[0];
|
||||
// $(element2).css("display", "");
|
||||
// var element3 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next()[0];
|
||||
// $(element3).css("display", "");
|
||||
// var element4 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next().next()[0];
|
||||
// $(element4).css("display", "");
|
||||
// } else {
|
||||
// var element = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// var element2 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next()[0];
|
||||
// $(element2).css("display", "none");
|
||||
// var element3 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next()[0];
|
||||
// $(element3).css("display", "none");
|
||||
// var element4 = $('input[name="waiverofpreexistingdiseases"]').parent().parent().next().next().next().next()[0];
|
||||
// $(element4).css("display", "none");
|
||||
// }
|
||||
|
||||
// console.log("Family_floater");
|
||||
// console.log($('input[name="family_floater"]').val());
|
||||
// if ($('input[name="family_floater"]').val() == '1') {
|
||||
// var element = $('input[name="family_floater"]').parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
// var element2 = $('input[name="family_floater"]').parent().parent().parent().next()[0];
|
||||
// $(element2).css("display", "");
|
||||
// } else {
|
||||
// var element = $('input[name="family_floater"]').parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// var element2 = $('input[name="family_floater"]').parent().parent().parent().next()[0];
|
||||
// $(element2).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="waiverofpreexistingdiseases"]').change(function() {
|
||||
if ($(this).val() == '1') {
|
||||
@ -439,179 +400,174 @@ $('.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/policyGMCTerms") ?>';
|
||||
|
||||
$.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('.special_condition_label\\[\\]').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 ;
|
||||
}
|
||||
});
|
||||
$('#policyGMCTerms').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display','');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnPolicyMaster', function () {
|
||||
|
||||
var policy_id = $(this).data('id');
|
||||
$('#policy_id').val(policy_id);
|
||||
|
||||
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)
|
||||
|
||||
|
||||
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');
|
||||
|
||||
|
||||
var formData = new FormData($('#policyJsonForm')[0]);
|
||||
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
|
||||
|
||||
$.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='';
|
||||
|
||||
}
|
||||
|
||||
|
||||
} 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];
|
||||
}
|
||||
}
|
||||
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('.special_condition_label\\[\\]').forEach(element => {
|
||||
element.parentNode.remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('.jodit-wysiwyg').each(function() {
|
||||
$(this).click();
|
||||
});
|
||||
|
||||
|
||||
|
||||
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('Error:', status, error);
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
$('#policyGMCTerms').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display','');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
$('body').on('click', '.btnPolicyMaster', function () {
|
||||
|
||||
var policy_id = $(this).data('id');
|
||||
$('#policy_id').val(policy_id);
|
||||
|
||||
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)
|
||||
|
||||
|
||||
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='';
|
||||
|
||||
}
|
||||
|
||||
|
||||
} 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];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('.jodit-wysiwyg').each(function() {
|
||||
$(this).click();
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error:', status, error);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@ -636,7 +592,7 @@ $('body').on('click', '.btnPolicyMaster', function () {
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Policy terms Add Special Condition -->
|
||||
<script>
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
@ -667,6 +623,8 @@ $('body').on('click', '.btnPolicyMaster', function () {
|
||||
|
||||
|
||||
|
||||
// Close the Policy terms
|
||||
|
||||
$(document).on('click', '#policyGMCTermsClose', function() {
|
||||
$('#policyGMCTerms').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user