CODE_MERGE : AADHAVAN
This commit is contained in:
commit
b7dc303d61
@ -195,9 +195,12 @@ $routes->cli('processjob', 'JobWorker::processJob');
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// $routes->get("/api", "RestAuthenticationController::index");
|
//Employee login api's
|
||||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||||
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||||
|
//HR login api's
|
||||||
|
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||||
|
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||||
|
|
||||||
$routes->group("/api", ["filter" => "authJWT"], function($routes){
|
$routes->group("/api", ["filter" => "authJWT"], function($routes){
|
||||||
$routes->post("logined", "RestAuthenticationController::logined");
|
$routes->post("logined", "RestAuthenticationController::logined");
|
||||||
@ -208,7 +211,7 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){
|
|||||||
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
||||||
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
||||||
|
|
||||||
$routes->get("/getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
|
||||||
$routes->post("/employeeUpload", "EmployeeRestController::employeeUpload");
|
$routes->post("/employeeUpload", "EmployeeRestController::employeeUpload");
|
||||||
|
|
||||||
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");
|
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");
|
||||||
@ -218,6 +221,11 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
|||||||
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");
|
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");
|
||||||
$routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence");
|
$routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence");
|
||||||
$routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence");
|
$routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence");
|
||||||
|
|
||||||
|
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||||
|
$routes->post("createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount");
|
||||||
|
$routes->get("deleteDependence", "EmployeeRestController::deleteDependence");
|
||||||
|
$routes->get("getEmployeeAndDependenceByClientId", "EmployeeRestController::getEmployeeAndDependenceByClientId");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class EmployeeRestController extends AdminController
|
|||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function editEmployeeProfile()
|
public function editEmployeeProfile()
|
||||||
@ -190,30 +190,117 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteDependence()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete();
|
||||||
|
|
||||||
|
if ($delete) {
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getEmployeeAndDependenceByClientId()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$empData = $this->employeeModel
|
||||||
|
->where('client_id', $this->request->getGet('client_id'))
|
||||||
|
->where('relationship', 'self')
|
||||||
|
->orderBy('id')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
|
||||||
|
foreach ($empData as $employee) {
|
||||||
|
$employeeDependence = $this->employeeModel
|
||||||
|
->where('emp_code', $employee['emp_code'])
|
||||||
|
->where('relationship !=', 'self')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
// Use object notation to access properties and set 'dependence'
|
||||||
|
$employee['dependence'] = $employeeDependence ?: [];
|
||||||
|
|
||||||
|
$result[] = $employee;
|
||||||
|
}
|
||||||
|
|
||||||
|
// You probably meant to check $result, not $data
|
||||||
|
if ($result) {
|
||||||
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEmployeePolicy()
|
public function getEmployeePolicy()
|
||||||
{
|
{
|
||||||
// $id= 4;
|
|
||||||
try {
|
try {
|
||||||
$id = $this->request->getGet('id');
|
$id = $this->request->getGet('id');
|
||||||
$keysToRemove = ["sum_insured","family_floater","corporatebuffer","family_floaters"];
|
$keysToRemove = ["removable_keys"];
|
||||||
|
|
||||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||||
|
// dd($empPolicy);
|
||||||
if ($empPolicy) {
|
if ($empPolicy) {
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($empPolicy as $array) {
|
foreach ($empPolicy as $array) {
|
||||||
|
|
||||||
$decodedArray = json_decode($array->Policy_Terms);
|
$decodedArray = json_decode($array->Policy_Terms);
|
||||||
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||||
|
|
||||||
// $client_id =$array->ClientId;
|
|
||||||
// $policy_id =$array->PolicyId;
|
|
||||||
|
|
||||||
// $rackRate = $this->policesModel->getPolicySlabRatesForEmpOnboard($policy_id, $client_id);
|
|
||||||
|
|
||||||
// $array->Policy_Terms = json_encode($refusingData);
|
|
||||||
$array->Policy_Terms = $refusingData;
|
$array->Policy_Terms = $refusingData;
|
||||||
|
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
||||||
|
$array->SlabRates = $getSlabAndGridData['slab_rates'];
|
||||||
|
$array->GridMaster = $getSlabAndGridData['grid_master'];
|
||||||
|
|
||||||
|
if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
||||||
|
$default_si = $array->Policy_Terms->sumInsured2;
|
||||||
|
$index = -1;
|
||||||
|
foreach ($array->SlabRates as $key => $value) {
|
||||||
|
if ($value['si'] == $default_si) {
|
||||||
|
$index = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($index >= 0) {
|
||||||
|
$element =$array->SlabRates[$index];
|
||||||
|
array_splice($array->SlabRates, $index, 1);
|
||||||
|
array_unshift($array->SlabRates, $element);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
||||||
|
|
||||||
|
// re-arranging order of si
|
||||||
|
$default_si = $array->Policy_Terms->sum_insured;
|
||||||
|
$index = -1;
|
||||||
|
foreach ($array->SlabRates as $key => $value) {
|
||||||
|
if ($value['si'] == $default_si) {
|
||||||
|
$index = $key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($index >= 0) {
|
||||||
|
$element =$array->SlabRates[$index];
|
||||||
|
array_splice($array->SlabRates, $index, 1);
|
||||||
|
array_unshift($array->SlabRates, $element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result[] = $array;
|
$result[] = $array;
|
||||||
}
|
}
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||||
@ -226,6 +313,39 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the RelationShip list
|
// Get the RelationShip list
|
||||||
|
|
||||||
|
public function createOrUpdateEmployeePolicySiAmount()
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
$requestData = $this->request->getJSON();
|
||||||
|
|
||||||
|
|
||||||
|
$checkIfExist = $this->employeePolicyModel->where('employee_id', $requestData['employee_id'])
|
||||||
|
->where('client_policy_id', $requestData['client_policy_id'])
|
||||||
|
->findAll();
|
||||||
|
// dd($checkIfExist);
|
||||||
|
if ($checkIfExist) {
|
||||||
|
|
||||||
|
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($requestData['client_policy_id'], $requestData['employee_id'], $requestData['basic_cover_si']);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$data['employee_id']= $requestData['employee_id'];
|
||||||
|
$data['client_policy_id']= $requestData['client_policy_id'];
|
||||||
|
$data['basic_cover_si']= $requestData['basic_cover_si'];
|
||||||
|
|
||||||
|
$this->employeePolicyModel->insert($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function relationshipList()
|
public function relationshipList()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -20,6 +20,7 @@ use CodeIgniter\API\ResponseTrait;
|
|||||||
|
|
||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
use App\Models\AuthHistoryModel;
|
use App\Models\AuthHistoryModel;
|
||||||
|
use App\Models\LevelContactModel;
|
||||||
|
|
||||||
use Firebase\JWT\JWT;
|
use Firebase\JWT\JWT;
|
||||||
// require_once('../vendor/autoload.php');
|
// require_once('../vendor/autoload.php');
|
||||||
@ -33,6 +34,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
protected $myLogger;
|
protected $myLogger;
|
||||||
protected $employeeModel;
|
protected $employeeModel;
|
||||||
protected $authHistoryModel;
|
protected $authHistoryModel;
|
||||||
|
protected $hrModel;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -42,6 +44,7 @@ class RestAuthenticationController extends AdminController
|
|||||||
|
|
||||||
$this->employeeModel = new EmployeeModel();
|
$this->employeeModel = new EmployeeModel();
|
||||||
$this->authHistoryModel = new AuthHistoryModel();
|
$this->authHistoryModel = new AuthHistoryModel();
|
||||||
|
$this->hrModel = new LevelContactModel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,6 +124,68 @@ class RestAuthenticationController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function verifyHrWithMobileNumber()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
|
$randomNumber = rand(100000, 999999);
|
||||||
|
|
||||||
|
$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 , 'otp'=>$randomNumber];
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
|
} else {
|
||||||
|
$result = ['user_verification' => false];
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getVerifiedHrData()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||||
|
$otp = $this->request->getJSON()->otp;
|
||||||
|
|
||||||
|
$hrData = $this->hrModel->where('mobile', $mobile_number)->first();
|
||||||
|
if ($hrData && $otp == $hrData["otp"]) {
|
||||||
|
$auth = HttpRequestHelper::getRequestInfo();
|
||||||
|
if ($auth) {
|
||||||
|
$data = [
|
||||||
|
'user_id' => $hrData['id'],
|
||||||
|
'user_type' => 'hr',
|
||||||
|
'ip' => $auth['ip'],
|
||||||
|
'platform' => $auth['platform'],
|
||||||
|
'broswer' => $auth['browser'],
|
||||||
|
];
|
||||||
|
|
||||||
|
$authdata= $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')
|
||||||
|
->where('level_contacts.mobile', $mobile_number )
|
||||||
|
->find();
|
||||||
|
|
||||||
|
$result = JWTToken::encode($hrData);
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||||
|
} else {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => "No data"],404);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function employeeLogout()
|
public function employeeLogout()
|
||||||
|
|||||||
@ -37,7 +37,7 @@ class EmployeeModel extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
return $this->db->table('employee_polices')
|
return $this->db->table('employee_polices')
|
||||||
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables
|
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables
|
||||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
->where('employee_polices.employee_id', $id)
|
->where('employee_polices.employee_id', $id)
|
||||||
|
|||||||
@ -189,5 +189,18 @@ class EmployeePolicyModel extends Model
|
|||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function updateSiAndPremium( $client_policy_id, $employee_id,$basic_cover_si)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
$query = "UPDATE employee_polices
|
||||||
|
SET employee_polices.basic_cover_si = '{$basic_cover_si}'
|
||||||
|
WHERE employee_polices.employee_id = '{$employee_id}'
|
||||||
|
AND employee_polices.client_policy_id = '{$client_policy_id}'";
|
||||||
|
|
||||||
|
$this->query($query);
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,7 @@ class LevelContactModel extends Model
|
|||||||
"designation",
|
"designation",
|
||||||
"created_by",
|
"created_by",
|
||||||
"updated_by",
|
"updated_by",
|
||||||
|
"otp",
|
||||||
"is_active",
|
"is_active",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
use App\Models\PolicyPremium1Model;
|
||||||
|
use App\Models\PolicyPremium2Model;
|
||||||
|
use App\Models\PolicyGridModel;
|
||||||
use CodeIgniter\Model;
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
class PolicesModel extends Model
|
class PolicesModel extends Model
|
||||||
@ -35,16 +37,17 @@ class PolicesModel extends Model
|
|||||||
{
|
{
|
||||||
|
|
||||||
$premium_slab_data = null;
|
$premium_slab_data = null;
|
||||||
$policyPremium1Model = new policyPremium1Model();
|
$policyPremium1Model = new PolicyPremium1Model();
|
||||||
|
|
||||||
$premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
$premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||||
if((isset($premium_slab_data)))
|
|
||||||
|
if((!count($premium_slab_data)))
|
||||||
{
|
{
|
||||||
$policyPremium2Model = new policyPremium2Model();
|
$policyPremium2Model = new PolicyPremium2Model();
|
||||||
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
$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'];
|
$grid_id = $premium_slab_data[0]['policy_grid_id'];
|
||||||
$policyGridModel = new policyGridModel();
|
$policyGridModel = new PolicyGridModel();
|
||||||
$results = $policyGridModel->find($grid_id);
|
$results = $policyGridModel->find($grid_id);
|
||||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
|
return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user