Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2024-05-08 15:15:15 +05:30
commit 196ff61470
5 changed files with 348 additions and 17 deletions

View File

@ -1174,7 +1174,8 @@ class ClientController extends AdminController
public function policyGMCTerms()
{
try {
// print_r($this->request->getPost('family_floaters'));die;
// echo "<pre>";
// print_r($this->request->getPost());die;
$this->myLogger->logme('error','Terms CREATE function called');
/*** Client Policy Table Primary Key(ID) ***/
@ -1183,7 +1184,19 @@ class ClientController extends AdminController
$data['sum_insured'] =str_replace(',', '',$this->request->getPost("sum_insured"));
$data['family_floater'] =$this->request->getPost("family_floater");
$data['corporatebuffer'] = $this->request->getPost("corporatebuffer");
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
// print_r($this->request->getPost());die;
$data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age");
$data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
$data['age_ratio']['spouse']['min'] = $this->request->getPost("spouse_min_age");
$data['age_ratio']['spouse']['max'] = $this->request->getPost("spouse_max_age");
$data['age_ratio']['child']['min'] = $this->request->getPost("child_min_age");
$data['age_ratio']['child']['max'] = $this->request->getPost("child_max_age");
$data['age_ratio']['elders']['min'] = $this->request->getPost("other_member_min_age");
$data['age_ratio']['elders']['max'] = $this->request->getPost("other_member_max_age");
// if (!in_array("self", $data['family_floaters'])) {
// array_unshift($data['family_floaters'], "self");
@ -1254,7 +1267,8 @@ class ClientController extends AdminController
$data['family_floaters']['either-parents-pil'] =0;
}
}
$data['family_floaters']['elders_count'] =$this->request->getPost("member_count");
$data['waiverofpreexistingdiseases'] =$this->request->getPost("waiverofpreexistingdiseases");
if ($data['waiverofpreexistingdiseases'] == 1) {
@ -1371,6 +1385,8 @@ class ClientController extends AdminController
$data['sumInsured2'] =str_replace(',', '', $this->request->getPost("sumInsured2"));
$data['totalSumInsured'] =str_replace(',', '',$this->request->getPost("totalSumInsured"));
$data['age_ratio']['self']['min'] = $this->request->getPost("self_min_age");
$data['age_ratio']['self']['max'] = $this->request->getPost("self_max_age");
$data['accidentalDeathBenefit'] =str_replace(',', '',$this->request->getPost("accidentalDeathBenefit"));
$data['permanentTotalDisablement'] =str_replace(',', '',$this->request->getPost("permanentTotalDisablement"));
$data['permanentPartialDisablement'] =$this->request->getPost("permanentPartialDisablement");

View File

@ -1894,11 +1894,27 @@ function getEmployeeOldPolicy()
$result = [];
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
$terms = json_decode($ClientPolicyValue['policy_terms']);
// dd($terms);
$data['client_id'] = $ClientPolicyValue['client_id'];
$data['client_policy_id'] = $ClientPolicyValue['id'];
$data['policy_name'] = $ClientPolicyValue['policy_name'];
$data['policy_type'] = $ClientPolicyValue['policy_type'];
$data['policy_type'] = $ClientPolicyValue['policy_type'];
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
if($ClientPolicyValue['policy_type_id'] == 1){ $data['floter_text_heading'] = 'Sum Insured'; }
else
{
if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
}
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
@ -1930,4 +1946,17 @@ function getEmployeeOldPolicy()
}
private function convertDateFormatDisplay($dateString)
{
// Attempt to create a DateTime object from the provided date string
$dateTime = \DateTime::createFromFormat('Y-m-d', $dateString);
if ($dateTime instanceof \DateTime) {
return $dateTime->format('d-M-Y');
} else {
return null;
}
}
}

View File

@ -34,6 +34,7 @@ body {
</style>
<div class="row" id="client_add">
<div class="col-12">
<div class="card">
@ -95,8 +96,8 @@ body {
</div>
<script>
<script>
// $(document).ready(function(){
// var tabid = localStorage.getItem('tabId');
// console.log(tabid)
@ -210,3 +211,4 @@ body {
});
</script>

View File

@ -1,5 +1,13 @@
<!-- Modal content for the Large example -->
<style>
.underline-input {
border: none;
border-bottom: 1px solid grey; /* Underline style */
outline: none; /* Remove default focus outline */
padding: 2px 5px; /* Adjust padding (top/bottom right/left) */
font-size: 16px; /* Adjust font size */
}
.button-like {
display: inline-block;
padding: 8px 15px;
@ -111,21 +119,41 @@
<div class="col-md-6">
</div>
<div class="col-md-6" style="margin-bottom:10px">
<table>
<tbody>
<tr>
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 18%;" type="number" name="self_min_age" id="self_min_age"></div></td>
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 18%;" type="number" name="self_max_age" id="self_max_age"></div></td>
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
<tr>
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 18%;" type="number" name="spouse_min_age" id="spouse_min_age"></div></td>
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 18%;" type="number" name="spouse_max_age" id="spouse_max_age"></div></td>
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
<tr>
<td style="width: 11%;"><span for="children">Children:</span></td>
<td style="width: 11%;"><select name="family_floaters[]" id="children">
<option value="0">None</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</td>
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($child_min_age) ? $child_min_age : '0'; ?>" style="width: 18%;" type="number" name="child_min_age" id="child_min_age"></div></td>
<td style="width: 28%;" ><div class="child-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($child_max_age) ? $child_max_age : '25'; ?>" style="width: 18%;" type="number" name="child_max_age" id="child_max_age"></div></td>
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
</tbody>
</table>
<div style="margin-top:10px">
<span style="margin-right: 20px;">Self:</span>
<input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked>
<span style="margin-right: 20px;">Spouse:</span>
<input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse">
</div>
<div style="margin-top:10px">
<span for="children">Children:</span>
<select name="family_floaters[]" id="children" style="margin-left: 109px;">
<option value="0">None</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
<div style="margin-top:10px">
<span for="family_floaters">Select Other Members:</span>
@ -140,9 +168,23 @@
<option value="4EPORPIL">Parents + PIL (Father + Mother + MIL + FIL)</option>
</select>
</div>
<div style="margin-top:10px">
<table>
<tbody>
<tr>
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 18%;" type="number" name="member_count" disabled id="member_count"></div></td>
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 18%;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age"></div></td>
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 18%;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age"></div></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<hr>
<div class="row" style="margin-bottom: 10px;display:none;">
<div class="col-md-6">
@ -511,6 +553,7 @@
<script>
var policy_grid_id = $('#client_id').val();
var grid_html = '';
@ -566,6 +609,28 @@ var grid_html = '';
$("#policyJsonForm").submit(function(event) {
if (!$('#self').prop('checked')) {
$('#self_min_age').removeAttr('name')
$('#self_max_age').removeAttr('name')
}
if (!$('#spouse').prop('checked')) {
$('#spouse_min_age').removeAttr('name');
$('#spouse_max_age').removeAttr('name');
}
if ($('#children').val() == 0) {
$('#child_min_age').removeAttr('name');
$('#child_min_age').removeAttr('name');
}
if ($('#family_floaters').val() == 0) {
$('#member_count').removeAttr('name');
$('#other_member_min_age').removeAttr('name');
$('#other_member_max_age').removeAttr('name');
}
event.preventDefault();
var isValid = $('#policyJsonForm').parsley().validate();
@ -693,6 +758,7 @@ var grid_html = '';
}
let jsonObject = JSON.parse(response.data);
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++) {
@ -711,7 +777,7 @@ var grid_html = '';
if (key.includes("family_floaters")) {
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
if (jsonObject[key]) {
console.log(jsonObject[key]);
// console.log(jsonObject[key]);
if (jsonObject[key].childrens) {
$('#children').val(jsonObject[key].childrens);
}
@ -840,6 +906,22 @@ var grid_html = '';
element.value = jsonObject[key];
}
}
if (key.includes("age_ratio")) {
$('#self_min_age').val(jsonObject[key].self.min);
$('#self_max_age').val(jsonObject[key].self.max);
$('#spouse_min_age').val(jsonObject[key].spouse.min);
$('#spouse_max_age').val(jsonObject[key].spouse.max);
$('#child_min_age').val(jsonObject[key].child.min);
$('#child_max_age').val(jsonObject[key].child.max);
$('#other_member_min_age').val(jsonObject[key].elders.min);
$('#other_member_max_age').val(jsonObject[key].elders.max);
}
});
}
$("#sum_insured").trigger("keyup");
@ -848,6 +930,51 @@ var grid_html = '';
$(this).click();
});
if ($('#self').prop('checked')) {
$('.self-age').css('display','');
} else {
$('.self-age').css('display','none');
}
if ($('#spouse').prop('checked')) {
$('.spouse-age').css('display','');
} else {
$('.spouse-age').css('display','none');
}
console.log("child ");
console.log($('#children').val());
if($('#children').val() != 0){
$('.child-age').css('display','');
}else{
$('.child-age').css('display','none');
}
var family_floaters = $('#family_floaters').val();
if(family_floaters != 0){
$('.other-member-age').css('display','');
}else{
$('.other-member-age').css('display','none');
}
if (family_floaters == '1P') {
$('#member_count').val(1);
}else if(family_floaters == '2P'){
$('#member_count').val(2);
}else if(family_floaters == '1PIL'){
$('#member_count').val(1);
}else if(family_floaters == '2PIL'){
$('#member_count').val(2);
}else if(family_floaters == '2EPORPIL'){
$('#member_count').val(2);
}else if(family_floaters == 'EPORPIL'){
$('#member_count').val(2);
}else if(family_floaters == '4EPORPIL'){
$('#member_count').val(4);
}
},
error: function(xhr, status, error) {
@ -864,6 +991,53 @@ var grid_html = '';
// toastr.warning('The terms has no data ', 'warning');
}
$(document).ready(function() {
if ($('#self').prop('checked')) {
$('.self-age').css('display','');
} else {
$('.self-age').css('display','none');
}
if ($('#spouse').prop('checked')) {
$('.spouse-age').css('display','');
} else {
$('.spouse-age').css('display','none');
}
console.log("child ");
console.log($('#children').val());
if($('#children').val() != 0){
$('.child-age').css('display','');
}else{
$('.child-age').css('display','none');
}
var family_floaters = $('#family_floaters').val();
if(family_floaters != 0){
$('.other-member-age').css('display','');
}else{
$('.other-member-age').css('display','none');
}
if (family_floaters == '1P') {
$('#member_count').val(1);
}else if(family_floaters == '2P'){
$('#member_count').val(2);
}else if(family_floaters == '1PIL'){
$('#member_count').val(1);
}else if(family_floaters == '2PIL'){
$('#member_count').val(2);
}else if(family_floaters == '2EPORPIL'){
$('#member_count').val(2);
}else if(family_floaters == 'EPORPIL'){
$('#member_count').val(2);
}else if(family_floaters == '4EPORPIL'){
$('#member_count').val(4);
}
})
});
$("#sum_insured").on("keyup", function() {
@ -948,4 +1122,60 @@ var grid_html = '';
// input.value = value;
// }
$('#self').change(function () {
if ($(this).prop('checked')) {
$('.self-age').css('display','');
}else{
$('.self-age').css('display','none');
}
})
$('#spouse').change(function () {
if ($(this).prop('checked')) {
$('.spouse-age').css('display','');
}else{
$('.spouse-age').css('display','none');
}
})
$('#children').change(function () {
if ($(this).val() != 0) {
$('.child-age').css('display','');
}else{
$('.child-age').css('display','none');
}
})
$('#family_floaters').change(function () {
var family_floaters = $(this).val();
if($('#family_floaters').val() != 0){
$('.other-member-age').css('display','');
}else{
$('.other-member-age').css('display','none');
}
if (family_floaters == '1P') {
$('#member_count').val(1);
}else if(family_floaters == '2P'){
$('#member_count').val(2);
}else if(family_floaters == '1PIL'){
$('#member_count').val(1);
}else if(family_floaters == '2PIL'){
$('#member_count').val(2);
}else if(family_floaters == '2EPORPIL'){
$('#member_count').val(2);
}else if(family_floaters == 'EPORPIL'){
$('#member_count').val(2);
}else if(family_floaters == '4EPORPIL'){
$('#member_count').val(4);
}
})
</script>

View File

@ -105,6 +105,45 @@
<div id='numberToWordTotalSumInsured' class="text-danger-2" ></div>
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for=""></label>
</div>
<div class="col-md-6">
<table>
<tbody>
<tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
<tr>
<td style="width: 5%;">
<span style="margin-right: 20px;">Self:</span>
</td>
<td style="width: 11%;">
<input disabled type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked>
</td>
<td style="width: 20%;">
<div class="self-age">
<span style="margin-right: 20px;">Min Age:</span>
<input class="underline-input min_age" value="<?php echo isset($self_min_age) ? $self_min_age : '18'; ?>" style="width: 35%;" type="number" name="self_min_age" id="self_min_age_gpa">
</div>
</td>
<td style="width: 20%;">
<div class="self-age">
<span style="margin-right: 20px;">Max Age:</span>
<input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 35%;" type="number" name="self_max_age" id="self_max_age_gpa">
</div>
</td>
<td ></td>
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
</tbody>
</table>
</div>
<div class="col-md-6">
</div>
<div class="col-md-6">
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<label for="totalSumInsured">Accidental Death Benefit</label>
@ -371,6 +410,12 @@
$("#policyGPATerms").submit(function(event) {
if (!$('#self').prop('checked')) {
$('#self_min_age_gpa').removeAttr('name')
$('#self_max_age_gpa').removeAttr('name')
}
event.preventDefault();
var isValid = $('#policyGPATerms').parsley().validate();
@ -526,6 +571,15 @@
}
}
if (key.includes("age_ratio")) {
console.log("-------------------------");
console.log(jsonObject[key]);
console.log(jsonObject[key].self);
console.log(jsonObject[key].self.min);
$('#self_min_age_gpa').val(jsonObject[key].self.min);
$('#self_max_age_gpa').val(jsonObject[key].self.max);
}
});
}