Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
98cb198203
@ -463,7 +463,9 @@ $routes->post("/employeeRest/updateEmpMPIN", "RestAuthenticationController::upda
|
|||||||
|
|
||||||
//HR login api's
|
//HR login api's
|
||||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||||
|
$routes->post("/employeeRest/verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail");
|
||||||
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||||
|
$routes->post("/employeeRest/updateHROTP", "RestAuthenticationController::updateHROTP");
|
||||||
|
|
||||||
// Test initiate Claim
|
// Test initiate Claim
|
||||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||||
|
|||||||
@ -1879,7 +1879,8 @@ class LeadsController extends BaseController
|
|||||||
public function getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index)
|
public function getDemographyData($members, $age_band_data, $members_heading, $available_col, $col_index)
|
||||||
{
|
{
|
||||||
$first_loop = 0;
|
$first_loop = 0;
|
||||||
$col_index_si = array_search('si enhancement', array_map('strtolower', $members_heading));
|
// $col_index_si = array_search('si enhancement', array_map('strtolower', $members_heading));
|
||||||
|
$col_index_si = array_search('si', array_map('strtolower', $members_heading));
|
||||||
$col_index_relationship = array_search('relationship', array_map('strtolower', $members_heading));
|
$col_index_relationship = array_search('relationship', array_map('strtolower', $members_heading));
|
||||||
$relations = [];
|
$relations = [];
|
||||||
$si_amt = ['general']; // Initialize with 'general' as per first loop condition
|
$si_amt = ['general']; // Initialize with 'general' as per first loop condition
|
||||||
|
|||||||
@ -65,6 +65,12 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function verifyEmployeeWithMobileNumber()
|
public function verifyEmployeeWithMobileNumber()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -272,6 +278,13 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function verifyHrWithMobileNumber()
|
public function verifyHrWithMobileNumber()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -296,15 +309,104 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function verifyHrWithEmail()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$data = $this->request->getJSON();
|
||||||
|
|
||||||
|
$email = $data->email;
|
||||||
|
|
||||||
|
$HrData = $this->hrModel->where('email', $email)
|
||||||
|
->where('contact_type', 'client')
|
||||||
|
->where('is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($HrData) {
|
||||||
|
|
||||||
|
$otp = random_int(100000, 999999);
|
||||||
|
|
||||||
|
$sql = "
|
||||||
|
UPDATE level_contacts
|
||||||
|
SET otp = ?
|
||||||
|
WHERE email = ?
|
||||||
|
AND contact_type = 'client'
|
||||||
|
AND is_active = 1
|
||||||
|
";
|
||||||
|
|
||||||
|
$db = db_connect();
|
||||||
|
$update = $db->query($sql, [$otp, $email]);
|
||||||
|
|
||||||
|
if($update)
|
||||||
|
{
|
||||||
|
$data->otp = $otp;
|
||||||
|
|
||||||
|
$common = [
|
||||||
|
'login_type' => 'HR login',
|
||||||
|
'login_email' => $email,
|
||||||
|
'mail_type' => 'otp_mail'
|
||||||
|
];
|
||||||
|
$subject = 'Nhance user verification - OTP';
|
||||||
|
$mail_content = $otp . ' is your verification code for Nhance.';
|
||||||
|
$res = MailHelper::send_email(['mail' => $email, 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
||||||
|
$this->myLogger->logme("info", $res);
|
||||||
|
|
||||||
|
if (json_decode($res)->status == 'success') {
|
||||||
|
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
||||||
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||||
|
} else {
|
||||||
|
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$result = ['user_verification' => false, 'message' => "User not found"];
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||||
|
}
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateHROTP()
|
||||||
|
{
|
||||||
|
|
||||||
|
$email = $this->request->getJSON()->email;
|
||||||
|
$otp = $this->request->getJSON()->otp;
|
||||||
|
|
||||||
|
$this->hrModel->where('email', $email) ->where('contact_type', 'client')
|
||||||
|
->where('is_active', 1)->set(array('otp' => $otp))
|
||||||
|
->update();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function getVerifiedHrData()
|
public function getVerifiedHrData()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
// mobile number
|
||||||
$otp_verification = $this->request->getJSON()->otp_verification;
|
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
|
||||||
|
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
|
||||||
|
// email id
|
||||||
|
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
||||||
|
$email = isset($this->request->getJSON()->email) ? $this->request->getJSON()->email : null;
|
||||||
|
|
||||||
|
if (isset($mobile_number))
|
||||||
|
{
|
||||||
|
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
|
||||||
|
}else{
|
||||||
|
$hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('otp', $otp)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($hrData && $otp_verification == true || $hrData && isset($this->request->getJSON()->otp) )
|
||||||
|
{
|
||||||
|
|
||||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->first();
|
|
||||||
if ($hrData && $otp_verification == true) {
|
|
||||||
$auth = HttpRequestHelper::getRequestInfo();
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
if ($auth) {
|
if ($auth) {
|
||||||
$data = [
|
$data = [
|
||||||
@ -320,14 +422,33 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($this->request->getJSON()->mobile_number)){
|
||||||
|
|
||||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||||
->where('level_contacts.mobile', $mobile_number )
|
->where('level_contacts.mobile', $mobile_number )
|
||||||
|
->where('level_contacts.contact_type', 'client')
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
|
}else if(isset($this->request->getJSON()->otp)){
|
||||||
|
|
||||||
|
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->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')
|
||||||
|
->where('level_contacts.email', $email )
|
||||||
|
->where('level_contacts.contact_type', 'client')
|
||||||
|
->find();
|
||||||
|
}
|
||||||
|
|
||||||
$result = JWTToken::encode($hrData['0']);
|
$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 {
|
} else {
|
||||||
|
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" ],200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" ],200);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -1090,7 +1090,7 @@ class EmployeePolicyModel extends Model
|
|||||||
employee_polices.basic_cover_si,
|
employee_polices.basic_cover_si,
|
||||||
employee_polices.uhid as uhid,
|
employee_polices.uhid as uhid,
|
||||||
employee_polices.rata_premimum,
|
employee_polices.rata_premimum,
|
||||||
employee_polices.premium,
|
ROUND(employee_polices.premium,2) as premium,
|
||||||
employee_polices.claim_status,
|
employee_polices.claim_status,
|
||||||
employee_polices.age_band,
|
employee_polices.age_band,
|
||||||
employee_polices.tpa_id,
|
employee_polices.tpa_id,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user