MERGE_DATA_VALIDATE_ISSUE_FIX
This commit is contained in:
commit
4101532010
@ -228,6 +228,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("id-card", "EmployeeController::viewECard/$1");
|
||||
$routes->get("preview-card/(:any)", "EmployeeController::previewTemplate/$1");
|
||||
$routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1");
|
||||
$routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1");
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
@ -284,6 +285,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
||||
|
||||
$routes->get("getEmployeeOldPolicy", "EmployeeRestController::getEmployeeOldPolicy");
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
});
|
||||
|
||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||
|
||||
@ -11,6 +11,7 @@ use Psr\Log\LoggerInterface;
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\PolicesModel;
|
||||
use App\Models\FileModel;
|
||||
use App\Models\BatchListModel;
|
||||
use App\Models\BatchFileModel;
|
||||
@ -49,6 +50,7 @@ class EmployeeController extends AdminController
|
||||
protected $empEndorsementModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $TPAModel;
|
||||
protected $policiesModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -64,6 +66,7 @@ class EmployeeController extends AdminController
|
||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->TPAModel = new TPAModel();
|
||||
$this->policiesModel = new PolicesModel();
|
||||
}
|
||||
|
||||
public function list()
|
||||
@ -1147,4 +1150,29 @@ class EmployeeController extends AdminController
|
||||
echo view('export_import_error_list', $excelErrorData);
|
||||
}
|
||||
|
||||
public function hasPolicyConfigCompleted()
|
||||
{
|
||||
$client_policy_id = $this->request->uri->getSegment(3);
|
||||
$policy_details = $this->clientPolicyModel->find($client_policy_id);
|
||||
// print_r($policy_details);die();
|
||||
$policy_terms = isset($policy_details['policy_terms']) ? true : false;
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']);
|
||||
|
||||
$message = null;
|
||||
|
||||
if (!isset($policy_terms)) {
|
||||
$message .= 'Policy terms';
|
||||
}
|
||||
|
||||
if($slab_details['slab_rates'] == null && $slab_details['grid_master'] == null)
|
||||
{
|
||||
$message = isset($message) ? ($message . ' and rack rates ') : ($message . ' Rack rates');
|
||||
}
|
||||
$message = isset($message) ? ($message . ' not defined for choosed policy') : null;
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message], 200);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -2048,6 +2048,83 @@ function getEmployeeOldPolicy()
|
||||
|
||||
}
|
||||
|
||||
function getEmployeeActiveOrInactivePolicy()
|
||||
{
|
||||
|
||||
if($this->request->getGet('type') == 'Active'){ $value = 1; }else{ $value = 0; }
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', $value)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
->findAll();
|
||||
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('is_active', 1 )->findAll();
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
|
||||
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
|
||||
{
|
||||
$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')
|
||||
->whereIn('employee_polices.employee_id',$whereArrayForId)
|
||||
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
$si_value = 0;
|
||||
$si_premium_value = 0;
|
||||
$si_gst_value = 0;
|
||||
foreach ($employee_policy as $key => $value) {
|
||||
if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
|
||||
if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
|
||||
if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
|
||||
}
|
||||
|
||||
$data['si_value'] = $si_value;
|
||||
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
|
||||
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
|
||||
|
||||
$data['EmployeePolicy'] = $employee_policy;
|
||||
array_push($result, $data);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function convertDateFormatDisplay($dateString)
|
||||
{
|
||||
|
||||
@ -8,6 +8,8 @@ class SubJob extends PublicController
|
||||
{
|
||||
public function handle($payload)
|
||||
{
|
||||
$log = \Config\Services::mylogger();
|
||||
$log->logme('error', 'handle called');
|
||||
return $payload['a'] - $payload['b'];
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ class PolicesModel extends Model
|
||||
{
|
||||
|
||||
$premium_slab_data = null;
|
||||
$grid_type = null;
|
||||
|
||||
$policyPremium1Model = new PolicyPremium1Model();
|
||||
$premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
@ -50,9 +51,13 @@ class PolicesModel extends Model
|
||||
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
}
|
||||
|
||||
$grid_id = $premium_slab_data[0]['policy_grid_id'];
|
||||
$policyGridModel = new PolicyGridModel();
|
||||
$results = $policyGridModel->find($grid_id);
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
|
||||
if(isset($premium_slab_data[0]['policy_grid_id']))
|
||||
{
|
||||
$grid_id = $premium_slab_data[0]['policy_grid_id'];
|
||||
$policyGridModel = new PolicyGridModel();
|
||||
$grid_type = $policyGridModel->find($grid_id);
|
||||
}
|
||||
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $grid_type];
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ option:disabled {
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="policy_id" class="form-control" id="policy_id">
|
||||
<select name="policy_id" class="form-control" id="policy_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -727,10 +727,70 @@ $(document).ready(function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
{
|
||||
console.log(event.target.id);
|
||||
var policy_id = (event.target.value);
|
||||
console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/has_policy_config_completed/' + policy_id;
|
||||
console.log(apiURL);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
console.log('check policy responce', response);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.message !== null) {
|
||||
toastr.error(response.message, 'Error');
|
||||
$('#emp_form_submit_button').prop('disabled', true);
|
||||
return false;
|
||||
}
|
||||
else if(response.code === 200 && response.dataStatus === true && response.message == null)
|
||||
{
|
||||
// toastr.error('Policy Terms or rack rate not defined!', 'Error');
|
||||
$('#emp_form_submit_button').prop('disabled', false);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
toastr.error('Policy Terms or rack rate not defined!', 'Error');
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
toastr.error('Something went wrong! Try Later', 'Error');
|
||||
console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -142,7 +142,7 @@
|
||||
<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 > 0) ? $spouse_min_age : '18'; ?>" style="width: 25%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></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 > 0) ? $spouse_min_age : '18'; ?>" style="width: 25%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="this.value = Math.max(this.value.replace(/\D/g, '').substring(0, 2),18)"></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: 25%;;" type="number" name="spouse_max_age" id="spouse_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
@ -1040,8 +1040,8 @@
|
||||
|
||||
if ($('#spouse').prop('checked')) {
|
||||
$('.spouse-age').css('display','');
|
||||
$('#spouse_min_age').val(18);
|
||||
$('#spouse_max_age').val(60);
|
||||
// $('#spouse_min_age').val(18);
|
||||
// $('#spouse_max_age').val(60);
|
||||
|
||||
} else {
|
||||
$('.spouse-age').css('display','none');
|
||||
@ -1256,10 +1256,10 @@
|
||||
$('#spouse').change(function () {
|
||||
if ($(this).prop('checked')) {
|
||||
$('.spouse-age').css('display','');
|
||||
if($('#spouse_min_age').val() < 0 || $('#spouse_min_age').val() == '' ){
|
||||
if($('#spouse_min_age').val() < 17 || $('#spouse_min_age').val() == '' ){
|
||||
$('#spouse_min_age').val(18);
|
||||
}
|
||||
if($('#spouse_max_age').val() < 0 || $('#spouse_max_age').val() == '' ){
|
||||
if($('#spouse_max_age').val() < 17 || $('#spouse_max_age').val() == '' ){
|
||||
$('#spouse_max_age').val(60);
|
||||
}
|
||||
}else{
|
||||
@ -1275,7 +1275,7 @@
|
||||
if($('#child_min_age').val() < 0 || $('#child_min_age').val() == '' ){
|
||||
$('#child_min_age').val(0);
|
||||
}
|
||||
if($('#child_max_age').val() < 0 || $('#child_max_age').val() == '' ){
|
||||
if($('#child_max_age').val() < 24 || $('#child_max_age').val() == '' ){
|
||||
$('#child_max_age').val(25);
|
||||
}
|
||||
}else{
|
||||
@ -1289,6 +1289,13 @@
|
||||
var family_floaters = $(this).val();
|
||||
if($('#family_floaters').val() != 0){
|
||||
$('.other-member-age').css('display','');
|
||||
if($('#other_member_min_age').val() < 17 || $('#other_member_min_age').val() == '' ){
|
||||
$('#other_member_min_age').val(18);
|
||||
}
|
||||
if($('#other_member_max_age').val() < 79 || $('#other_member_max_age').val() == '' ){
|
||||
$('#other_member_max_age').val(60);
|
||||
}
|
||||
|
||||
}else{
|
||||
$('.other-member-age').css('display','none');
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user