CHANGES_in rest controller : GWM

This commit is contained in:
bitbucket 2024-07-26 17:35:14 +05:30
parent 9dc83717f4
commit ca7cb93d28
2 changed files with 18 additions and 13 deletions

View File

@ -1363,8 +1363,10 @@ class EmployeeRestController extends AdminController
$result = ' ';
foreach ($array as $key => $value) {
if ($value > 0) {
if($value != 0 && $key ==='either-parents-pil') {
if($value == 1 && $key ==='either-parents-pil') {
$result .= ' + Either 2 Parents or 2 Parents in law';
}if($value == 2 && $key ==='either-parents-pil') {
$result .= ' + Any 2 of Parents and Parents in law';
}else if($value != 0 && $key ==='spouse') {
$string = str_replace('-', ' ', $key);
$string = ucwords($string);
@ -1373,11 +1375,15 @@ class EmployeeRestController extends AdminController
$result = 'Can Add Self ';
}else if($value != 0 && $key ==='childrens') {
if($value > 1){ $result .= ' + '.$value.' Children'; }else{ $result .= ' + '.$value.' Child'; }
}else if($value != 0 && $key ==='elders_count') {
}else{
$string = str_replace('-', ' ', $key);
$string = ucwords($string);
$result .= ' + '.$value.' '.$string;
}
}
}
@ -1874,7 +1880,7 @@ class EmployeeRestController extends AdminController
{
$transformed_famility_details = transform_db_data_to_excel($family);
// print_r($transformed_famility_details);die();
$data = calculate_premimum($transformed_famility_details,$policy_terms,$slab_details,$file,$default_si);
$data = calculate_premium($transformed_famility_details,$policy_terms,$slab_details,$file,$default_si);
// dd($data);
$employee_data_group_by_family[$emp_id] = $data;
@ -2404,7 +2410,8 @@ class EmployeeRestController extends AdminController
$firebase->send($message);
return $this->response->setJSON(['status' => 'success']);
} catch (MessagingException $e) {
return $this->response->setJSON(['status' => 'error', 'message' => $e->getMessage()]);
//return $this->response->setJSON(['status' => 'error', 'message' => $e->getMessage()]);
log_message('error', $e->getMessage());
}
}

View File

@ -125,14 +125,12 @@ class RestAuthenticationController extends AdminController
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$randomNumber = rand(100000, 999999);
$randomNumber = 123456;
$HrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
if ($HrData) {
$id= $HrData["id"];
$otp = $this->hrModel->where('id', $id)->set('otp', $randomNumber)->update();
$result = ['user_verification' => true ,'message' => "Verified Successfully", 'otp'=>$randomNumber];
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
$result = ['user_verification' => false , 'message' => "User not found"];
@ -149,10 +147,10 @@ class RestAuthenticationController extends AdminController
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$otp = $this->request->getJSON()->otp;
$otp_verification = $this->request->getJSON()->otp_verification;
$hrData = $this->hrModel->where('mobile', $mobile_number)->first();
if ($hrData && $otp == $hrData["otp"]) {
if ($hrData && $otp_verification == true) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
$data = [
@ -163,10 +161,10 @@ class RestAuthenticationController extends AdminController
'broswer' => $auth['browser'],
];
$authdata= $this->authHistoryModel->insert($data);
$this->authHistoryModel->insert($data);
}
$otp_null = $this->hrModel->where('id', $hrData["id"])->set('otp', null)->update();
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
@ -174,7 +172,7 @@ class RestAuthenticationController extends AdminController
->find();
$result = JWTToken::encode($hrData['0']);
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
}