CHANGE_ in getEmployeePolicy GMC api : Premium and gst value : GWM
This commit is contained in:
parent
ac1fe778ae
commit
2e15df607a
@ -1168,6 +1168,9 @@ class EmployeeRestController extends AdminController
|
||||
$floters = $this->FloterConvertion($familyFloates);
|
||||
|
||||
$data = [];
|
||||
$dependent_and_si_value = 0;
|
||||
$dependent_and_si_premium_value = 0;
|
||||
$dependent_and_si_gst_value = 0;
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
|
||||
@ -1175,6 +1178,9 @@ class EmployeeRestController extends AdminController
|
||||
foreach ($empData as $key => $value) {
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
@ -1230,7 +1236,6 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Add family floter buttons placement data for FE validation
|
||||
if(count($floters)){
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
@ -1251,6 +1256,9 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$array->mapped_family_floaters = $data;
|
||||
$array->type = "GMC";
|
||||
$array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0;
|
||||
$array->family_floaters_of_dependent_and_si_premium_value = $dependent_and_si_premium_value > 0 ? $dependent_and_si_premium_value : 0;
|
||||
$array->family_floaters_of_dependent_and_gst_value = $dependent_and_si_gst_value > 0 ? $dependent_and_si_gst_value : 0;
|
||||
|
||||
$checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
@ -1363,15 +1371,20 @@ class EmployeeRestController extends AdminController
|
||||
$floters = $this->FloterConvertion($familyFloates);
|
||||
|
||||
$data = [];
|
||||
$dependent_and_si_value = 0;
|
||||
$dependent_and_si_premium_value = 0;
|
||||
$dependent_and_si_gst_value = 0;
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
|
||||
|
||||
if(count($empData)){
|
||||
foreach ($empData as $key => $value) {
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||
// dd( $employee_policy);
|
||||
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp['data']['employee_id'] = $value['id'];
|
||||
@ -1440,6 +1453,9 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$array->mapped_family_floaters = $data;
|
||||
$array->type = "GMC - Parents";
|
||||
$array->family_floaters_of_dependent_and_si_value = $dependent_and_si_value > 0 ? $dependent_and_si_value : 0;
|
||||
$array->family_floaters_of_dependent_and_si_premium_value = $dependent_and_si_premium_value > 0 ? $dependent_and_si_premium_value : 0;
|
||||
$array->family_floaters_of_dependent_and_gst_value = $dependent_and_si_gst_value > 0 ? $dependent_and_si_gst_value : 0;
|
||||
|
||||
return $array;
|
||||
|
||||
@ -2616,17 +2632,24 @@ class EmployeeRestController extends AdminController
|
||||
public function storeFireBase()
|
||||
{
|
||||
try {
|
||||
$json = $this->request->getJSON();
|
||||
$firebase_token = $json->firebase_token;
|
||||
$mobile = $json->mobile;
|
||||
|
||||
$firebase_token = isset($this->request->getJSON()->firebase_token) ? $this->request->getJSON()->firebase_token : null;
|
||||
$mobile = isset($this->request->getJSON()->mobile) ? $this->request->getJSON()->mobile : null;
|
||||
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
|
||||
|
||||
// Ensure the mobile number is provided
|
||||
if (empty($mobile)) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Mobile number is required'], 400);
|
||||
}
|
||||
|
||||
// Fetch employee by mobile number
|
||||
$employee = $this->employeeModel->where('mobile', $mobile)->first();
|
||||
// Fetch employee
|
||||
if (isset($mobile))
|
||||
{
|
||||
$employee = $this->employeeModel->where('mobile', $mobile)->where('relationship', 'self')->where('is_active', 1)->first();
|
||||
} else {
|
||||
$employee = $this->employeeModel->where('email_corporate', $email_id)->where('relationship', 'self')->where('is_active', 1)->first();
|
||||
}
|
||||
|
||||
|
||||
if ($employee) {
|
||||
// Check if firebase_token is provided
|
||||
|
||||
@ -112,16 +112,16 @@ class RestAuthenticationController extends AdminController
|
||||
{
|
||||
|
||||
$common = [
|
||||
'client_id' => $employeeData->client_id,
|
||||
'client_branch_id' => $employeeData->client_branch_id,
|
||||
'client_id' => $employeeData['client_id'],
|
||||
'client_branch_id' => $employeeData['client_branch_id'],
|
||||
'client_policy_id' => null,
|
||||
'employee_policy_id' => null,
|
||||
'employee_id' => $employeeData->id,
|
||||
'employee_id' => $employeeData['id'],
|
||||
'mail_type' => 'otp_mail',
|
||||
];
|
||||
$subject = 'Nhance user verification - OTP';
|
||||
$mail_content = $otp.' is your verification code for Nhance.';
|
||||
$res = MailHelper::send_email(['mail' => $employeeData->email_corporate, 'subject' => $subject ,'common'=>$common ,'message' => $mail_content]);
|
||||
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject ,'common'=>$common ,'message' => $mail_content]);
|
||||
$this->myLogger->logme("info", $res);
|
||||
|
||||
if(json_decode($res)->status == 'success')
|
||||
@ -195,7 +195,7 @@ class RestAuthenticationController extends AdminController
|
||||
if(isset($this->request->getJSON()->otp)){
|
||||
$this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->set(['otp'=>null])->update();
|
||||
}
|
||||
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user