CHANGES_ HR api Hr access control change : GWM
This commit is contained in:
parent
c127b088f6
commit
8b6bab2d4a
@ -466,6 +466,7 @@ $routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationContr
|
||||
$routes->post("/employeeRest/verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail");
|
||||
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||
$routes->post("/employeeRest/updateHROTP", "RestAuthenticationController::updateHROTP");
|
||||
$routes->get("/employeeRest/getHRAccessData", "RestAuthenticationController::getHRAccessData");
|
||||
|
||||
// Test initiate Claim
|
||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||
@ -486,9 +487,6 @@ $routes->post("employeeRest/saveMpin", "RestAuthenticationController::saveMpin")
|
||||
$routes->post("employeeRest/updateMpin", "RestAuthenticationController::updateMpin");
|
||||
|
||||
|
||||
|
||||
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
@ -517,13 +515,6 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
$routes->get("exportDataByClientPolicyId", "EmployeeRestController::exportDataByClientPolicyId");
|
||||
|
||||
$routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPolicyLevelEmployeeSummaryData");
|
||||
$routes->get("cdSummaryData", "EmployeeRestController::cdSummaryData");
|
||||
$routes->get("cdTransactionData", "EmployeeRestController::cdTransactionData");
|
||||
$routes->match( ['get', 'post'], 'claimsSearch','EmployeeRestController::claimsSearch');
|
||||
$routes->get("claimView", "EmployeeRestController::claimView");
|
||||
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
|
||||
|
||||
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
||||
|
||||
$routes->post("calculatePremium", "EmployeeRestController::calculatePremium");
|
||||
@ -535,6 +526,15 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->get("getWellnessURL", "EmployeeRestController::getWellnessURL");
|
||||
//$routes->post('postDataForTicket',"EmployeeRestController::postDataForTicket");
|
||||
|
||||
|
||||
//hr api's
|
||||
$routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPolicyLevelEmployeeSummaryData");
|
||||
$routes->get("cdSummaryData", "EmployeeRestController::cdSummaryData");
|
||||
$routes->get("cdTransactionData", "EmployeeRestController::cdTransactionData");
|
||||
$routes->match( ['get', 'post'], 'claimsSearch','EmployeeRestController::claimsSearch');
|
||||
$routes->get("claimView", "EmployeeRestController::claimView");
|
||||
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
|
||||
|
||||
});
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification");
|
||||
|
||||
@ -618,12 +618,14 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
// In your controller
|
||||
public function deposit($id = null , $requestFrom = null )
|
||||
public function deposit($id = null , $requestFrom = null , $policyId = null)
|
||||
{
|
||||
|
||||
$headerData['page_name'] = 'Client Deposit';
|
||||
|
||||
|
||||
$data['clientName'] = $this->clientModel->where('id', $id)->find();
|
||||
$data['clientData'] = $this->clientPolicyModel->getinsurerswithclientid($id);
|
||||
$data['clientData'] = $this->clientPolicyModel->getinsurerswithclientid($id,$policyId);
|
||||
|
||||
$data['depositsummary'] = $this->clientPolicyModel->getDepositlistsummary($id);
|
||||
|
||||
// Fetch associated insurer names and balances
|
||||
|
||||
@ -32,6 +32,7 @@ use App\Models\AuditHistoryModel;
|
||||
use App\Models\TicketClaimStatusModel;
|
||||
use App\Models\TicketMasterModel;
|
||||
use App\Models\TicketMessageModel;
|
||||
use App\Models\HRAccessControlModel;
|
||||
|
||||
|
||||
|
||||
@ -83,6 +84,7 @@ class EmployeeRestController extends AdminController
|
||||
protected $ticketMessage;
|
||||
|
||||
protected $ticketController;
|
||||
protected $hrAccessControlModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -112,6 +114,7 @@ class EmployeeRestController extends AdminController
|
||||
$this->ticketMessage = new TicketMessageModel();
|
||||
|
||||
$this->ticketController = new TicketController();
|
||||
$this->hrAccessControlModel = new HRAccessControlModel();
|
||||
|
||||
}
|
||||
|
||||
@ -2276,16 +2279,45 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getHRAccessData( $hr_id = null , $request_for = 'post_enrollment')
|
||||
{
|
||||
$hr_id = $this->request->getGet('hr_id') ?? $hr_id;
|
||||
$request_for = $this->request->getGet('request_for') ?? $request_for;
|
||||
|
||||
if($request_for == 'pre_enrollment'){ $idField = 'pre_hr_id'; }else{ $idField = 'post_hr_id'; }
|
||||
|
||||
$data = $this->hrAccessControlModel->where($idField , $hr_id)->where('is_active' , 1)->first();
|
||||
|
||||
if($request_for == 'post_enrollment'){ return $data ?? []; }
|
||||
|
||||
return $this->respond(['status' => (($data) ? 'success' : 'failed'),'code' => (($data) ? 200 : 404),'data' => $data ], 200);
|
||||
}
|
||||
|
||||
public function getPolicyLevelEmployeeSummaryData()
|
||||
{
|
||||
|
||||
$hr_id = $this->request->getGet('hr_id');
|
||||
$HRAccessData = $this->getHRAccessData($hr_id,'post_enrollment');
|
||||
|
||||
if(isset($HRAccessData['allowed_active_policies']))
|
||||
{
|
||||
$policyId = json_decode($HRAccessData['allowed_active_policies'],true);
|
||||
}else{
|
||||
$policyId = [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', $this->request->getGet('policy_status'))
|
||||
->whereIn('client_policy.id', $policyId)
|
||||
->findAll();
|
||||
|
||||
|
||||
$result = [];
|
||||
// dd( $ClientPolicyData);
|
||||
foreach ($ClientPolicyData as $key => $value)
|
||||
@ -2331,13 +2363,24 @@ class EmployeeRestController extends AdminController
|
||||
public function cdSummaryData()
|
||||
{
|
||||
|
||||
$hr_id = $this->request->getGet('hr_id');
|
||||
$HRAccessData = $this->getHRAccessData($hr_id,'post_enrollment');
|
||||
|
||||
if(isset($HRAccessData['allowed_active_policies']))
|
||||
{
|
||||
$policyId = json_decode($HRAccessData['allowed_active_policies'],true);
|
||||
}else{
|
||||
$policyId = [];
|
||||
}
|
||||
|
||||
$clientId = $this->request->getGet('client_id');
|
||||
|
||||
$clientController = new ClientController;
|
||||
$result = $clientController->deposit($clientId , $requestFrom = 'rest');
|
||||
$result = $clientController->deposit($clientId , $requestFrom = 'rest' , $policyId);
|
||||
|
||||
$data = [];
|
||||
|
||||
|
||||
foreach ($result['clientData'] as $key => $value)
|
||||
{
|
||||
$temp['client_id'] = $value->client_id;
|
||||
@ -2539,9 +2582,6 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function exportCashDepositData()
|
||||
{
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ use CodeIgniter\API\ResponseTrait;
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\AuthHistoryModel;
|
||||
use App\Models\LevelContactModel;
|
||||
use App\Models\HRAccessControlModel;
|
||||
|
||||
use Firebase\JWT\JWT;
|
||||
// require_once('../vendor/autoload.php');
|
||||
@ -35,6 +36,7 @@ class RestAuthenticationController extends AdminController
|
||||
protected $employeeModel;
|
||||
protected $authHistoryModel;
|
||||
protected $hrModel;
|
||||
protected $hrAccessControlModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -45,6 +47,7 @@ class RestAuthenticationController extends AdminController
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->authHistoryModel = new AuthHistoryModel();
|
||||
$this->hrModel = new LevelContactModel();
|
||||
$this->hrAccessControlModel = new HRAccessControlModel();
|
||||
|
||||
}
|
||||
|
||||
@ -441,6 +444,11 @@ class RestAuthenticationController extends AdminController
|
||||
->find();
|
||||
}
|
||||
|
||||
$HRAccessData = $this->getHRAccessData( $hrData['0']['id'] , 'post_enrollment');
|
||||
|
||||
if(isset($HRAccessData['allowed_modules'])){ $hrData['0']['allowed_modules'] = json_decode($HRAccessData['allowed_modules'],true)['post']; }else{ $hrData['0']['allowed_modules'] = []; }
|
||||
|
||||
|
||||
$result = JWTToken::encode($hrData['0']);
|
||||
|
||||
|
||||
@ -457,6 +465,21 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function getHRAccessData( $hr_id = null , $request_for = 'post_enrollment')
|
||||
{
|
||||
$hr_id = $this->request->getGet('hr_id') ?? $hr_id;
|
||||
$request_for = $this->request->getGet('request_for') ?? $request_for;
|
||||
|
||||
if($request_for == 'pre_enrollment'){ $idField = 'pre_hr_id'; }else{ $idField = 'post_hr_id'; }
|
||||
|
||||
$data = $this->hrAccessControlModel->where($idField , $hr_id)->where('is_active' , 1)->first();
|
||||
|
||||
if($request_for == 'post_enrollment'){ return $data ?? []; }
|
||||
|
||||
return $this->respond(['status' => (($data) ? 'success' : 'failed'),'code' => (($data) ? 200 : 404),'data' => $data ], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getUserIdFromToken()
|
||||
{
|
||||
|
||||
@ -168,25 +168,48 @@ class ClientPolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getinsurerswithclientid($id)
|
||||
public function getinsurerswithclientid($id, $policyId = null)
|
||||
{
|
||||
// dd($policyId);
|
||||
|
||||
return $this->db->table('client_policy')
|
||||
->select('client_policy.*, cd_master.cd_ac_no as cd_master_account_no')
|
||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
->select('clients.client_name as client_name')
|
||||
->join('clients', 'clients.id=client_policy.client_id')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
|
||||
->where('client_policy.client_id', $id)
|
||||
->where('cd_master.id = client_policy.cd_ac_pk')
|
||||
->where('cd_master.is_active', 1)
|
||||
->groupBy('client_policy.client_id', $id) // Group by insurer_id
|
||||
->groupBy('client_policy.insurer_id')
|
||||
->groupBy('client_policy.cd_ac_pk')
|
||||
->get()
|
||||
->getResult();
|
||||
$builder = $this->db->table('client_policy')
|
||||
->select('client_policy.*, cd_master.cd_ac_no as cd_master_account_no')
|
||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
->select('clients.client_name as client_name')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
|
||||
->where('client_policy.client_id', $id)
|
||||
->where('cd_master.id = client_policy.cd_ac_pk')
|
||||
->where('cd_master.is_active', 1)
|
||||
->groupBy('client_policy.client_id')
|
||||
->groupBy('client_policy.insurer_id')
|
||||
->groupBy('client_policy.cd_ac_pk');
|
||||
|
||||
if ($policyId != null) {
|
||||
$builder->whereIn('client_policy.id', $policyId);
|
||||
}
|
||||
|
||||
return $builder->get()->getResult();
|
||||
|
||||
|
||||
|
||||
// return $this->db->table('client_policy')
|
||||
// ->select('client_policy.*, cd_master.cd_ac_no as cd_master_account_no')
|
||||
// ->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
// ->select('clients.client_name as client_name')
|
||||
// ->join('clients', 'clients.id=client_policy.client_id')
|
||||
// ->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
// ->join('cd_master', 'cd_master.insurer_id = insurers.id AND cd_master.client_id = client_policy.client_id')
|
||||
// ->where('client_policy.client_id', $id)
|
||||
// ->where('cd_master.id = client_policy.cd_ac_pk')
|
||||
// ->where('cd_master.is_active', 1)
|
||||
// ->groupBy('client_policy.client_id', $id) // Group by insurer_id
|
||||
// ->groupBy('client_policy.insurer_id')
|
||||
// ->groupBy('client_policy.cd_ac_pk')
|
||||
// ->get()
|
||||
// ->getResult();
|
||||
|
||||
// return $this->db->table('client_policy')
|
||||
// ->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
// ->select('clients.client_name as client_name')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user