Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
sriramv 2024-04-17 10:37:53 +05:30
commit 9bc413ea49
4 changed files with 150 additions and 36 deletions

View File

@ -610,7 +610,23 @@ class ClientController extends AdminController
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
$data['policy_terms'] = $policy_terms['policy_terms'];
if ($this->request->getPost('is_addon') == 3) {
$policyTerm = $policy_terms['policy_terms'];
$decoded_policyTerm = json_decode($policyTerm, true);
$decoded_policyTerm['family_floater'] =0;
$decoded_policyTerm['family_floaters']['self'] =0;
$decoded_policyTerm['family_floaters']['spouse'] =0;
$decoded_policyTerm['family_floaters']['childrens'] =0;
$decoded_policyTerm['family_floaters']['parents'] =0;
$decoded_policyTerm['family_floaters']['parents-in-law'] =0;
$decoded_policyTerm['family_floaters']['either-parents-pil'] =0;
$data['policy_terms'] = json_encode($decoded_policyTerm);
}else{
$data['policy_terms'] = $policy_terms['policy_terms'];
}
}
@ -679,7 +695,23 @@ class ClientController extends AdminController
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
$data['policy_terms'] = $policy_terms['policy_terms'];
if ($this->request->getPost('is_addon') == 3) {
$policyTerm = $policy_terms['policy_terms'];
$decoded_policyTerm = json_decode($policyTerm, true);
$decoded_policyTerm['family_floater'] =0;
$decoded_policyTerm['family_floaters']['self'] =0;
$decoded_policyTerm['family_floaters']['spouse'] =0;
$decoded_policyTerm['family_floaters']['childrens'] =0;
$decoded_policyTerm['family_floaters']['parents'] =0;
$decoded_policyTerm['family_floaters']['parents-in-law'] =0;
$decoded_policyTerm['family_floaters']['either-parents-pil'] =0;
$data['policy_terms'] = json_encode($decoded_policyTerm);
} else {
$data['policy_terms'] = $policy_terms['policy_terms'];
}
}
// dd($data);
@ -1259,6 +1291,7 @@ class ClientController extends AdminController
->where("employees.emp_status",'active')
->countAllResults();
$emp_count_by_policy = $this->employeePolicyModel->where('client_policy_id',$client_policy_id)->where('is_active',1)->countAllResults();
if($emp_count == 0){
$emp_count = true;
}else{
@ -1266,7 +1299,7 @@ class ClientController extends AdminController
}
if ($record) {
return $this->respond(['Status' => true,'code' => 200,'data' => $record['policy_terms'], 'count' => $emp_count, 'policy_name' => $policy_name], 200);
return $this->respond(['Status' => true,'code' => 200,'data' => $record['policy_terms'], 'count' => $emp_count, 'policy_name' => $policy_name,'policy_addon' => $record['is_addon'], 'emp_count_by_policy'=>$emp_count_by_policy], 200);
} else {
return $this->respond(['Status' => false,'code' => 200,'message' => 'Record not found.', 'count' => $emp_count, 'policy_name' => $policy_name], 200);
}

View File

@ -1308,7 +1308,7 @@ public function calculatePremium()//family level
//get policy slab rates
$slab_details = $this->policesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['active'],policy_status:['active']);
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_code: $emp_code,emp_status:['draft','enrolled'],policy_status:['draft','enrolled']);
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
// dd($this->employeeModel->getLastQuery());

View File

@ -424,10 +424,26 @@ $(document).ready(function() {
// console.log(res)
var OptionsHTML = '';
OptionsHTML += '<option value="" selected>Select Policy</option>';
$policy_type_value = $('#policy_type').val();
$.each(res.data, function(index, item) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
if ($policy_type_value == 3) {
if (item.policy_type_id == 5 || item.policy_type_id == 3) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
}
}else if($policy_type_value == 2){
if (item.policy_type_id == 4 ) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
}
}else{
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
}
});
$('#policy').html(OptionsHTML);
@ -989,6 +1005,10 @@ $('#policy_type').change(function() {
$('#end_date').val('');
$('#base_policy').val('0');
if($(this).val() == 3){
toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'warning');
}
if ($(this).val() != '1' && $(this).val() != '0') {
$('#base_policy_id').show();
@ -1011,7 +1031,6 @@ $('#policy_type').change(function() {
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
}
})
@ -1074,8 +1093,8 @@ $(document).ready(function(){
const queryString = objectToQueryString(queryParams);
// var uri = '<?= base_url('util/fetch-policy-for-policy-type')?>?' + queryString
var uri = '<?= base_url('client/policy/list/')?>' + client_policy_id
console.log('uri', uri)
console.log('queryString', queryString)
// console.log('uri', uri)
// console.log('queryString', queryString)
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
@ -1102,11 +1121,19 @@ $(document).ready(function(){
var policeOptionHTML = '';
$policy_type_value = $('#policy_type').val();
$.each(res.policy, function(index, item) {
console.log(item)
policeOptionHTML += '<option data-id="' + item.policy_type_id +
// if ($policy_type_value == 3) {
// if (item.policy_type_id == 5) {
console.log(item);
policeOptionHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
'selected="selected"' : '') + '>' + item.name + '</option>';
// }
// }
});
$('#policy').html(policeOptionHTML);

View File

@ -105,8 +105,8 @@
<label for="totalSumInsured">Family Floater</label>
</div>
<div class="col-md-6">
<input type="radio" name="family_floater" value="1"> Yes
<input type="radio" name="family_floater" value="0" style="margin-left:10px"> No
<input type="radio" name="family_floater" class="family_floater" value="1"> Yes
<input type="radio" name="family_floater" class="family_floater" value="0" style="margin-left:10px"> No
</div>
<div class="col-md-6">
</div>
@ -159,8 +159,8 @@
<label for="totalSumInsured">Waiver of Pre-existing Diseases</label>
</div>
<div class="col-md-6">
<input type="radio" name="waiverofpreexistingdiseases" value="1"> Yes, waived off
<input type="radio" name="waiverofpreexistingdiseases" value="0" style="margin-left:10px"> No
<input type="radio" name="waiverofpreexistingdiseases" class="waiverofpreexistingdiseases" value="1"> Yes, waived off
<input type="radio" name="waiverofpreexistingdiseases" class="waiverofpreexistingdiseases" value="0" style="margin-left:10px"> No
</div>
</div>
@ -206,8 +206,8 @@
<label for="totalSumInsured">9-month waiting Period waived</label>
</div>
<div class="col-md-6">
<input type="radio" name="9monthwaitingperiodwaived" value="1"> Yes, waived off
<input type="radio" name="9monthwaitingperiodwaived" value="0" style="margin-left:10px"> No </div>
<input type="radio" name="9monthwaitingperiodwaived" class="9monthwaitingperiodwaived" value="1"> Yes, waived off
<input type="radio" name="9monthwaitingperiodwaived" class="9monthwaitingperiodwaived" value="0" style="margin-left:10px"> No </div>
</div>
<div class="row" style="margin-bottom: 10px;">
@ -224,8 +224,8 @@
<label for="totalSumInsured">Waiver of 1, 2, 3 & 4th year Exclusions</label>
</div>
<div class="col-md-6">
<input type="radio" name="waiverof1,2,3&4thyearexclusions" value="1"> Yes, waived off
<input type="radio" name="waiverof1,2,3&4thyearexclusions" value="0" style="margin-left:10px"> No
<input type="radio" name="waiverof1,2,3&4thyearexclusions" class="waiverof1234thyearexclusions" value="1"> Yes, waived off
<input type="radio" name="waiverof1,2,3&4thyearexclusions" class="waiverof1234thyearexclusions" value="0" style="margin-left:10px"> No
</div>
</div>
@ -235,8 +235,8 @@
<label for="totalSumInsured">Waiver of 30 days waiting period</label>
</div>
<div class="col-md-6">
<input type="radio" name="waiverof30dayswaitingperiod" value="1"> Yes, waived off
<input type="radio" name="waiverof30dayswaitingperiod" value="0" style="margin-left:10px"> No
<input type="radio" name="waiverof30dayswaitingperiod" class="waiverof30dayswaitingperiod" value="1"> Yes, waived off
<input type="radio" name="waiverof30dayswaitingperiod" class="waiverof30dayswaitingperiod" value="0" style="margin-left:10px"> No
</div>
</div>
@ -254,8 +254,8 @@
<label for="totalSumInsured">Congenital Diseases - Internal</label>
</div>
<div class="col-md-6">
<input type="radio" name="congenitaldiseasesinternal" value="internal"> Internal Covered
<input type="radio" name="congenitaldiseasesinternal" value="no" style="margin-left:10px"> No </div>
<input type="radio" name="congenitaldiseasesinternal" class="congenitaldiseasesinternal" value="internal"> Internal Covered
<input type="radio" name="congenitaldiseasesinternal" class="congenitaldiseasesinternal" value="no" style="margin-left:10px"> No </div>
</div>
<div class="row" style="margin-bottom: 10px;">
@ -324,8 +324,8 @@
<label for="totalSumInsured">Ailment capping</label>
</div>
<div class="col-md-6">
<input type="radio" name="ailmentcapping" value="1"> Yes
<input type="radio" name="ailmentcapping" value="0" style="margin-left:10px"> No
<input type="radio" name="ailmentcapping" class="ailmentcapping" value="1"> Yes
<input type="radio" name="ailmentcapping" class="ailmentcapping" value="0" style="margin-left:10px"> No
</div>
</div>
@ -361,8 +361,8 @@
<label for="totalSumInsured">Reasonable and Customary Charges</label>
</div>
<div class="col-md-6">
<input type="radio" name="reasonableandcustomarycharges" value="1">Applicable
<input type="radio" name="reasonableandcustomarycharges" value="0" style="margin-left:10px">Not Applicable </div>
<input type="radio" name="reasonableandcustomarycharges" class="reasonableandcustomarycharges" value="1">Applicable
<input type="radio" name="reasonableandcustomarycharges" class="reasonableandcustomarycharges" value="0" style="margin-left:10px">Not Applicable </div>
</div>
<div class="row" style="margin-bottom: 10px;">
@ -370,8 +370,8 @@
<label for="totalSumInsured">Day Care Treatment</label>
</div>
<div class="col-md-6">
<input type="radio" name="daycaretreatment" value="1"> Yes
<input type="radio" name="daycaretreatment" value="0" style="margin-left:10px"> No </div>
<input type="radio" name="daycaretreatment" class="daycaretreatment" value="1"> Yes
<input type="radio" name="daycaretreatment" class="daycaretreatment" value="0" style="margin-left:10px"> No </div>
</div>
<div class="row" style="margin-bottom: 10px;">
@ -379,8 +379,8 @@
<label for="totalSumInsured">AYUSH treatment cover</label>
</div>
<div class="col-md-6">
<input type="radio" name="ayudhtreatmentcover" value="1"> Yes
<input type="radio" name="ayudhtreatmentcover" value="0" style="margin-left:10px"> No
<input type="radio" name="ayudhtreatmentcover" class="ayudhtreatmentcover" value="1"> Yes
<input type="radio" name="ayudhtreatmentcover" class="ayudhtreatmentcover" value="0" style="margin-left:10px"> No
</div>
</div>
@ -398,8 +398,8 @@
<label for="totalSumInsured">Sum Insured enhancement</label>
</div>
<div class="col-md-6">
<input type="radio" name="suminsuredenhancement" value="1"> Yes
<input type="radio" name="suminsuredenhancement" value="0" style="margin-left:10px"> No
<input type="radio" name="suminsuredenhancement" class="suminsuredenhancement" value="1"> Yes
<input type="radio" name="suminsuredenhancement" class="suminsuredenhancement" value="0" style="margin-left:10px"> No
</div>
</div>
@ -640,7 +640,7 @@ var grid_html = '';
var gmc_policy_type_id = $(this).attr('id');
console.log(gmc_policy_type_id)
// console.log(gmc_policy_type_id)
if(gmc_policy_type_id == 'GMC'){
@ -657,7 +657,9 @@ var grid_html = '';
data: {client_policy_id: client_policy_id},
success: function(response) {
console.log('response',response);
console.log('count', response.count);
// console.log('count', response.count);
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
@ -684,6 +686,11 @@ var grid_html = '';
if (response) {
if ( response.emp_count_by_policy != 0) {
$('#btnGridSubmit1').hide();
$('#myButtonSpecialCondition').hide();
}
let jsonObject = JSON.parse(response.data);
Object.keys(jsonObject).forEach(function(key) {
if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
@ -737,6 +744,53 @@ var grid_html = '';
}
}
if(response.policy_addon == '3'){
$('.jodit-container').prop('disabled', true);
$('.waiverofpreexistingdiseases').prop('disabled', true);
$('#maternitycoverage').prop('disabled', true);
$('#twindelivery').prop('disabled', true);
$('#preandpostnatal').prop('disabled', true);
$('#babyday1cover').prop('disabled', true);
$('.9monthwaitingperiodwaived').prop('disabled', true);
$('#coverfromthedateofjoining').prop('disabled', true);
$('.waiverof1234thyearexclusions').prop('disabled', true);
$('.waiverof30dayswaitingperiod').prop('disabled', true);
$('#prehospitalizationcover').prop('disabled', true);
$('.congenitaldiseasesinternal').prop('disabled', true);
$('#copayzonewisecopay').prop('disabled', true);
$('#bioabsorbablestenttoriclensmultifocallens').prop('disabled', true);
$('#roomrentlimit').prop('disabled', true);
$('#proportionatedeductionclause').prop('disabled', true);
$('#nursingallowance').prop('disabled', true);
$('.ailmentcapping').prop('disabled', true);
$('#ambulancecharges').prop('disabled', true);
$('#airambulance').prop('disabled', true);
$('#familytransportationbenefit').prop('disabled', true);
$('.reasonableandcustomarycharges').prop('disabled', true);
$('.daycaretreatment').prop('disabled', true);
$('.ayudhtreatmentcover').prop('disabled', true);
$('#armdcovered').prop('disabled', true);
$('.suminsuredenhancement').prop('disabled', true);
$('#automaticsuminsuredreinstatement').prop('disabled', true);
$('#lasiksurgery').prop('disabled', true);
$('#midterminclusion').prop('disabled', true);
$('#capd').prop('disabled', true);
$('#organdonorexpenses').prop('disabled', true);
$('#moderntreatmentsasperirdai').prop('disabled', true);
$('#days_of_discharge').prop('disabled', true);
$('#days_from_dod').prop('disabled', true);
setTimeout(function() {
var editor1 = new Jodit('#additionalsicknessbenefit');
var editor2 = new Jodit('#Wellness');
editor1.setReadOnly(true);
editor2.setReadOnly(true);
}, 3000);
}
}