MERGE_EMPONBOARD_REST_FEATURES
This commit is contained in:
commit
9c1751737a
@ -99,5 +99,5 @@ class Autoload extends AutoloadConfig
|
||||
* @var string[]
|
||||
* @phpstan-var list<string>
|
||||
*/
|
||||
public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload'];
|
||||
public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload', 'excel_import_export', 'file'];
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ class Email extends BaseConfig
|
||||
/**
|
||||
* The mail sending protocol: mail, sendmail, smtp
|
||||
*/
|
||||
public string $protocol = 'mail';
|
||||
public string $protocol = 'smtp';
|
||||
|
||||
/**
|
||||
* The server path to Sendmail.
|
||||
@ -28,27 +28,27 @@ class Email extends BaseConfig
|
||||
/**
|
||||
* SMTP Server Hostname
|
||||
*/
|
||||
public string $SMTPHost = '';
|
||||
public string $SMTPHost = 'mail.venbait.in';
|
||||
|
||||
/**
|
||||
* SMTP Username
|
||||
*/
|
||||
public string $SMTPUser = '';
|
||||
public string $SMTPUser = 'bbone@venbait.in';
|
||||
|
||||
/**
|
||||
* SMTP Password
|
||||
*/
|
||||
public string $SMTPPass = '';
|
||||
public string $SMTPPass = 'xk!L(N_-R#};';
|
||||
|
||||
/**
|
||||
* SMTP Port
|
||||
*/
|
||||
public int $SMTPPort = 25;
|
||||
public int $SMTPPort = 465;
|
||||
|
||||
/**
|
||||
* SMTP Timeout (in seconds)
|
||||
*/
|
||||
public int $SMTPTimeout = 5;
|
||||
public int $SMTPTimeout = 1000;
|
||||
|
||||
/**
|
||||
* Enable persistent SMTP connections
|
||||
@ -62,7 +62,7 @@ class Email extends BaseConfig
|
||||
* to the server. 'ssl' means implicit SSL. Connection on port
|
||||
* 465 should set this to ''.
|
||||
*/
|
||||
public string $SMTPCrypto = 'tls';
|
||||
public string $SMTPCrypto = 'ssl';
|
||||
|
||||
/**
|
||||
* Enable word-wrap
|
||||
@ -77,7 +77,7 @@ class Email extends BaseConfig
|
||||
/**
|
||||
* Type of mail, either 'text' or 'html'
|
||||
*/
|
||||
public string $mailType = 'text';
|
||||
public string $mailType = 'html';
|
||||
|
||||
/**
|
||||
* Character set (utf-8, iso-8859-1, etc.)
|
||||
@ -118,4 +118,14 @@ class Email extends BaseConfig
|
||||
* Enable notify message from server
|
||||
*/
|
||||
public bool $DSN = false;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* SMTP Debugging level. Set to 0 to disable debugging.
|
||||
* Set to 1 to output server connection status only.
|
||||
* Set to 2 for more detailed debugging output.
|
||||
* Set to 3 for maximum debugging output.
|
||||
*/
|
||||
public int $SMTPDebug = 2;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ class Filters extends BaseConfig
|
||||
*/
|
||||
public array $globals = [
|
||||
'before' => [
|
||||
'HttpRequestLog' => ['except' => 'processjob'],
|
||||
'HttpRequestLog' => ['except' => 'cli/*'],
|
||||
// 'csrf',
|
||||
// 'invalidchars',
|
||||
],
|
||||
|
||||
@ -2,11 +2,16 @@
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
|
||||
/**
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
|
||||
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
|
||||
|
||||
// $routes->get('/', 'LoginController::index');
|
||||
$routes->get('/test', 'Home::test');
|
||||
$routes->get('/test', 'Home::index');
|
||||
$routes->get('/login', 'LoginController::index');///auth/google
|
||||
$routes->get('/logout', 'LoginController::logout');
|
||||
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
|
||||
@ -187,18 +192,48 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("kyc-other-docs-delete/(:any)", "ClientController::deleteClientKycOtherDocs/$1");
|
||||
$routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
|
||||
$routes->get("update-policy-status", "ClientController::updateClientPolicyStatus/$1");
|
||||
$routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
|
||||
$routes->post("import-export", "EmployeeController::importExport");
|
||||
});
|
||||
|
||||
$routes->cli('processjob', 'JobWorker::processJob');
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
|
||||
|
||||
|
||||
// $routes->get("/api", "RestAuthenticationController::index");
|
||||
$routes->post("/api/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("/api/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
//Employee login api's
|
||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$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->post("logined", "RestAuthenticationController::logined");
|
||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||
});
|
||||
|
||||
|
||||
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
||||
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
||||
|
||||
|
||||
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
||||
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
||||
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");
|
||||
$routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence");
|
||||
$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->get("getClientPolicy", "EmployeeRestController::getClientPolicy");
|
||||
});
|
||||
|
||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||
|
||||
|
||||
});
|
||||
@ -90,20 +90,11 @@ class ClientController extends AdminController
|
||||
public function index()
|
||||
{
|
||||
|
||||
// $token = $_SESSION;
|
||||
// $token = $request->getHeaderLine('Authorization');
|
||||
|
||||
|
||||
// print_r(JWTToken::getIdFromToken($token));
|
||||
|
||||
// die();
|
||||
|
||||
$this->myLogger->logme('error','Client list function called');
|
||||
$headerData['page_name'] = 'Client List';
|
||||
$data['clientList'] = $this->clientModel->getCreatedByUserName();
|
||||
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_list', $data);
|
||||
echo view('layout/footer');
|
||||
@ -138,18 +129,18 @@ class ClientController extends AdminController
|
||||
// In your controller
|
||||
public function deposit($id = null)
|
||||
{
|
||||
$headerData['page_name'] = 'Client Deposit';
|
||||
$headerData['page_name'] = 'Client Deposit';
|
||||
|
||||
$data['clientData'] = $this->clientPolicyModel->getinsurerswithclientid($id);
|
||||
$data['depositsummary'] = $this->clientPolicyModel->getDepositlistsummary($id);
|
||||
$data['clientData'] = $this->clientPolicyModel->getinsurerswithclientid($id);
|
||||
$data['depositsummary'] = $this->clientPolicyModel->getDepositlistsummary($id);
|
||||
|
||||
// Fetch associated insurer names and balances
|
||||
$balances = $this->clientPolicyModel->getBalances($id);
|
||||
$data['balances'] = $balances;
|
||||
// Fetch associated insurer names and balances
|
||||
$balances = $this->clientPolicyModel->getBalances($id);
|
||||
$data['balances'] = $balances;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_deposit_list', $data);
|
||||
echo view('layout/footer');
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_deposit_list', $data);
|
||||
echo view('layout/footer');
|
||||
}
|
||||
|
||||
public function view_Deposit($insurerId)
|
||||
@ -239,8 +230,10 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Client general info function called');
|
||||
$file_name = file_Upload($this->request->getFile('client_logo'));
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
$data['client_logo'] = $file_name;
|
||||
$insert = $this->clientModel->insert($data);
|
||||
if($insert){
|
||||
$client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
@ -255,9 +248,13 @@ class ClientController extends AdminController
|
||||
public function editClientGeneralInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','edit client general info function called');
|
||||
$file_name = file_Upload($this->request->getFile('client_logo'));
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
if(!empty($file_name)){
|
||||
$data['client_logo'] = $file_name;
|
||||
}
|
||||
$update = $this->clientModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||
@ -520,6 +517,8 @@ class ClientController extends AdminController
|
||||
$data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years');
|
||||
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
||||
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
||||
$data['is_addon'] = $this->request->getPost('is_addon');
|
||||
|
||||
|
||||
|
||||
|
||||
@ -574,6 +573,7 @@ class ClientController extends AdminController
|
||||
$data['claims_experience_for_last_3_years'] = $this->request->getPost('claims_experience_for_last_3_years');
|
||||
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
||||
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
||||
$data['is_addon'] = $this->request->getPost('is_addon');
|
||||
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$insert = $this->clientPolicyModel->update($id,$data);
|
||||
@ -592,80 +592,198 @@ class ClientController extends AdminController
|
||||
|
||||
public function createClientPolicyPremium()
|
||||
{
|
||||
$policy_type = $this->request->getPost('policy_type');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||
$policy_grid_id = $this->request->getPost('policy_grid_id');
|
||||
|
||||
if($policy_type !== null && $policy_type !== ''){
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
$this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
$insert = $this->policyPremium1Model->insert($data);
|
||||
|
||||
}else{
|
||||
|
||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
$premiumData = $this->request->getPost('premium');
|
||||
for ($i = 0; $i < count($premiumData); $i++) {
|
||||
|
||||
$data = [
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'policy_grid_id' => $policy_grid_id,
|
||||
'created_by' => get_session_userid(),
|
||||
|
||||
];
|
||||
|
||||
if(is_array($this->request->getPost('si'))){
|
||||
$si = isset($this->request->getPost('si')[$i]) ? $this->request->getPost('si')[$i] : null;
|
||||
}else{
|
||||
$si = $this->request->getPost('si');
|
||||
}
|
||||
$age_from = isset($this->request->getPost('age_from')[$i]) ? $this->request->getPost('age_from')[$i] : null;
|
||||
$age_to = isset($this->request->getPost('age_to')[$i]) ? $this->request->getPost('age_to')[$i] : null;
|
||||
$premium = isset($premiumData[$i]) ? $premiumData[$i] : null;
|
||||
$grade = isset($this->request->getPost('grade')[$i]) ? $this->request->getPost('grade')[$i] : null;
|
||||
$max_si = isset($this->request->getPost('max_si')[$i]) ? $this->request->getPost('max_si')[$i] : null;
|
||||
|
||||
if ($si !== null) {
|
||||
$data['si'] = $si;
|
||||
}
|
||||
|
||||
if ($age_from !== null) {
|
||||
$data['age_from'] = $age_from;
|
||||
}
|
||||
|
||||
if ($age_to !== null) {
|
||||
$data['age_to'] = $age_to;
|
||||
}
|
||||
|
||||
if ($premium !== null) {
|
||||
$data['premium'] = $premium;
|
||||
}
|
||||
|
||||
if ($max_si !== null) {
|
||||
$data['max_si'] = $max_si;
|
||||
}
|
||||
|
||||
if ($grade !== null) {
|
||||
$data['grade'] = $grade;
|
||||
}
|
||||
|
||||
$this->policyPremium2Model->insert($data);
|
||||
try {
|
||||
$policy_type = $this->request->getPost('policy_type');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||
if(!empty($client_id) && $client_id != null){
|
||||
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}
|
||||
$policy_grid_id = $this->request->getPost('policy_grid_id');
|
||||
$si_or_bp = $this->request->getPost('si_or_bp');
|
||||
$basic_multiplier = str_replace(',', '', $this->request->getPost('basic_multiplier'));
|
||||
$premium_multiplier = str_replace(',', '', $this->request->getPost('premium_multiplier'));
|
||||
$multiplier = str_replace(',', '', $this->request->getPost('multiplier'));
|
||||
$basic_pay = str_replace(',', '', $this->request->getPost('basic_pay'));
|
||||
|
||||
$data=[];
|
||||
$data['client_id'] = $client_id;
|
||||
$data['client_policy_id'] = $client_policy_id;
|
||||
$data['policy_grid_id'] = $policy_grid_id;
|
||||
|
||||
|
||||
if($insert){
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
||||
$premium = [];
|
||||
|
||||
}
|
||||
if ($policy_grid_id == '1' || $policy_grid_id == '2') {
|
||||
$this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
} else {
|
||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
}
|
||||
|
||||
|
||||
if($policy_grid_id == '1'){
|
||||
if ($si_or_bp == '1') {
|
||||
$premium=str_replace(',', '', $this->request->getPost('gpa_sum_premium[]'));
|
||||
$sum_insure=str_replace(',', '', $this->request->getPost('gpa_sum_si[]'));
|
||||
$multiplier=$this->request->getPost('gpa_sum_multiplier');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['si'] = $sum_insure[$i];
|
||||
$data['premium'] = $premium[$i];
|
||||
$data['multiplier'] = $multiplier;
|
||||
$data['si_or_bp'] = $this->request->getPost('si_or_bp');
|
||||
|
||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
||||
}
|
||||
} else {
|
||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_basic_premium'));
|
||||
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_basic_si'));
|
||||
$data['basic_multiplier'] = str_replace(',', '', $this->request->getPost('basic_multiplier'));
|
||||
$data['multiplier'] = $this->request->getPost('premium_multiplier');
|
||||
$data['basic_pay'] = str_replace(',', '', $this->request->getPost('basic_pay'));
|
||||
$data['si_or_bp'] = $this->request->getPost('si_or_bp');
|
||||
|
||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '2'){
|
||||
$data['premium'] = str_replace(',', '', $this->request->getPost('gpa_premium'));
|
||||
$data['si'] = str_replace(',', '', $this->request->getPost('gpa_si'));
|
||||
|
||||
$policyPremium= $this->policyPremium1Model->insert($data);
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '3'){
|
||||
$premium=$this->request->getPost('3_premium[]');
|
||||
$sum_insure =$this->request->getPost('3_si[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '4'){
|
||||
$premium=$this->request->getPost('4_premium[]');
|
||||
$sum_insure =$this->request->getPost('4_si');
|
||||
$age_from =$this->request->getPost('4_age_from[]');
|
||||
$age_to =$this->request->getPost('4_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '5'){
|
||||
$premium=$this->request->getPost('5_premium[]');
|
||||
$sum_insure =$this->request->getPost('5_si[]');
|
||||
$age_from =$this->request->getPost('5_age_from[]');
|
||||
$age_to =$this->request->getPost('5_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '6'){
|
||||
$premium=$this->request->getPost('6_premium[]');
|
||||
$sum_insure =$this->request->getPost('6_si[]');
|
||||
$age_from =$this->request->getPost('6_age_from[]');
|
||||
$age_to =$this->request->getPost('6_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '7'){
|
||||
$premium=$this->request->getPost('7_premium[]');
|
||||
$sum_insure =$this->request->getPost('7_si[]');
|
||||
$age_from =$this->request->getPost('7_age_from[]');
|
||||
$age_to =$this->request->getPost('7_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '8'){
|
||||
$premium=$this->request->getPost('8_premium[]');
|
||||
$sum_insure =$this->request->getPost('8_si[]');
|
||||
$grade =$this->request->getPost('8_grade[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['grade'] = $grade[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '9'){
|
||||
$premium=$this->request->getPost('9_premium[]');
|
||||
$sum_insure =$this->request->getPost('9_si[]');
|
||||
$grade =$this->request->getPost('9_grade[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['grade'] = $grade[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '10'){
|
||||
$premium=$this->request->getPost('10_premium[]');
|
||||
$sum_insure =$this->request->getPost('10_si[]');
|
||||
$age_from =$this->request->getPost('10_age_from[]');
|
||||
$age_to =$this->request->getPost('10_age_to[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['age_from'] = $age_from[$i];
|
||||
$data['age_to'] = $age_to[$i];
|
||||
$policyPremium= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}else if($policy_grid_id == '11'){
|
||||
$premium=$this->request->getPost('11_premium[]');
|
||||
$sum_insure =$this->request->getPost('11_si[]');
|
||||
$grade =$this->request->getPost('11_grade[]');
|
||||
$max_sum_insure =$this->request->getPost('11_max_si[]');
|
||||
for ($i=0; $i < count($premium) ; $i++) {
|
||||
$data['premium'] = str_replace(',', '',$premium[$i]);
|
||||
$data['si'] = str_replace(',', '', $sum_insure[$i]);
|
||||
$data['grade'] = $grade[$i];
|
||||
$data['max_si'] = $max_sum_insure[$i];
|
||||
$dataa= $this->policyPremium2Model->insert($data);
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
}
|
||||
|
||||
if($insert){
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
// Handle exceptions here
|
||||
echo 'Error: ' . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -728,6 +846,10 @@ class ClientController extends AdminController
|
||||
|
||||
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
$family_floater ='';
|
||||
if (isset(json_decode($record['policy_terms'])->family_floater)) {
|
||||
$family_floater=json_decode($record['policy_terms'])->family_floater;
|
||||
}
|
||||
|
||||
$emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
@ -752,82 +874,193 @@ class ClientController extends AdminController
|
||||
$search_term = 'GPA';
|
||||
}
|
||||
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
|
||||
|
||||
if($search_term === 'GPA'){
|
||||
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||
|
||||
}else{
|
||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||
}
|
||||
|
||||
|
||||
// echo $record['client_id'];
|
||||
// echo "-----";
|
||||
// echo $client_policy_id;
|
||||
// print_r($premiumData);die;
|
||||
// echo '<pre>';
|
||||
// print_r($results);
|
||||
// echo $family_floater;
|
||||
$resultss = [];
|
||||
if ($family_floater == 1) {
|
||||
|
||||
foreach ($results as $index => $record) {
|
||||
if ($index == '8' || $index == '7') {
|
||||
// Clearing the $results array
|
||||
$resultss[$index] = $record;
|
||||
}
|
||||
}
|
||||
}else if($family_floater == 0){
|
||||
foreach ($results as $index => $record) {
|
||||
if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6') {
|
||||
// Clearing the $results array
|
||||
$resultss[$index] = $record;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
foreach ($results as $index => $record) {
|
||||
$resultss[$index] = $record;
|
||||
}
|
||||
}
|
||||
$premiumDataa ='';
|
||||
if ($family_floater == 0) {
|
||||
// print_r($premiumData);die;
|
||||
if (count($premiumData) == 0) {
|
||||
$premiumDataa = $premiumData;
|
||||
}else if ($premiumData[0]['policy_grid_id'] == '3' || $premiumData[0]['policy_grid_id'] == '4' || $premiumData[0]['policy_grid_id'] == '5' || $premiumData[0]['policy_grid_id'] == '6' || $premiumData[0]['policy_grid_id'] == '7' || $premiumData[0]['policy_grid_id'] == '8' || $premiumData[0]['policy_grid_id'] == '9' ) {
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
}
|
||||
else if($family_floater == 1){
|
||||
if(count($premiumData) == 0){
|
||||
$premiumDataa = $premiumData;
|
||||
}else if ($premiumData[0]['policy_grid_id'] == '10' || $premiumData[0]['policy_grid_id'] == '11') {
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
}else{
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
|
||||
// print_r($premiumData);die;
|
||||
|
||||
// print_r($data[0]->policy_type); die;
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => $premiumData, 'count' => $emp_count, 'policy_name' => $policy_name], 200);
|
||||
// echo "hello";
|
||||
// return json_encode($premiumData);
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
|
||||
|
||||
}
|
||||
|
||||
public function policyGMCTerms()
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
// print_r($this->request->getPost('family_floaters'));die;
|
||||
$this->myLogger->logme('error','Terms CREATE function called');
|
||||
|
||||
/*** Client Policy Table Primary Key(ID) ***/
|
||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||
|
||||
$data['sum_insured'] =$this->request->getPost("sum_insured");
|
||||
$data['sum_insured'] =str_replace(',', '',$this->request->getPost("sum_insured"));
|
||||
$data['family_floater'] =$this->request->getPost("family_floater");
|
||||
$data['corporatebuffer'] = $this->request->getPost("corporatebuffer");
|
||||
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
|
||||
$data['corporatebuffer'] = $this->request->getPost("corporatebuffer");
|
||||
$data['family_floaters'] = $this->request->getPost("family_floaters") ?? [];
|
||||
|
||||
// if (!in_array("self", $data['family_floaters'])) {
|
||||
// array_unshift($data['family_floaters'], "self");
|
||||
// }
|
||||
$temp_family_floaters = $data['family_floaters'];
|
||||
$data['family_floaters'] =[];
|
||||
if (in_array("self",$temp_family_floaters) == 1) {
|
||||
$data['family_floaters']['self'] =1;
|
||||
}else{
|
||||
$data['family_floaters']['self'] =0;
|
||||
}
|
||||
|
||||
if (in_array("spouse",$temp_family_floaters) == 1) {
|
||||
$data['family_floaters']['spouse'] =1;
|
||||
}else{
|
||||
$data['family_floaters']['spouse'] =0;
|
||||
}
|
||||
|
||||
// $data['family_floaters']['either-parents-pil'] =0;
|
||||
|
||||
if (count($temp_family_floaters)) {
|
||||
$children_value = 0;
|
||||
$value = 0;
|
||||
|
||||
if(count($temp_family_floaters) == 2){
|
||||
$children_value = 0;
|
||||
$value = 1;
|
||||
}else if(count($temp_family_floaters) == 3){
|
||||
$children_value = 1;
|
||||
$value = 2;
|
||||
}else{
|
||||
$children_value = 2;
|
||||
$value = 3;
|
||||
}
|
||||
$data['family_floaters']['childrens'] =(int)$temp_family_floaters[$children_value];
|
||||
|
||||
if ($temp_family_floaters[$value] == '1P') {
|
||||
$data['family_floaters']['parents'] =1;
|
||||
$data['family_floaters']['parents-in-law'] =0;
|
||||
$data['family_floaters']['either-parents-pil'] =0;
|
||||
}else if($temp_family_floaters[$value] == '2P'){
|
||||
$data['family_floaters']['parents'] =2;
|
||||
$data['family_floaters']['parents-in-law'] =0;
|
||||
$data['family_floaters']['either-parents-pil'] =0;
|
||||
}else if($temp_family_floaters[$value] == '1PIL'){
|
||||
$data['family_floaters']['parents'] =0;
|
||||
$data['family_floaters']['parents-in-law'] =1;
|
||||
$data['family_floaters']['either-parents-pil'] =0;
|
||||
}else if($temp_family_floaters[$value] == '2PIL'){
|
||||
$data['family_floaters']['parents'] =0;
|
||||
$data['family_floaters']['parents-in-law'] =2;
|
||||
$data['family_floaters']['either-parents-pil'] =0;
|
||||
}else if($temp_family_floaters[$value] == '2EPORPIL'){
|
||||
$data['family_floaters']['parents'] =1;
|
||||
$data['family_floaters']['parents-in-law'] =1;
|
||||
$data['family_floaters']['either-parents-pil'] =0;
|
||||
}else if($temp_family_floaters[$value] == 'EPORPIL'){
|
||||
$data['family_floaters']['parents'] =0;
|
||||
$data['family_floaters']['parents-in-law'] =0;
|
||||
$data['family_floaters']['either-parents-pil'] =1;
|
||||
}else if($temp_family_floaters[$value] == '4EPORPIL'){
|
||||
$data['family_floaters']['parents'] =2;
|
||||
$data['family_floaters']['parents-in-law'] =2;
|
||||
$data['family_floaters']['either-parents-pil'] =0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data['waiverofpreexistingdiseases'] =$this->request->getPost("waiverofpreexistingdiseases");
|
||||
if ($data['waiverofpreexistingdiseases'] == 1) {
|
||||
$data['maternitycoverage'] =$this->request->getPost("maternitycoverage");
|
||||
$data['twindelivery'] =$this->request->getPost("twindelivery");
|
||||
$data['preandpostnatal'] =$this->request->getPost("preandpostnatal");
|
||||
$data['babyday1cover'] =$this->request->getPost("babyday1cover");
|
||||
$data['maternitycoverage'] =str_replace(',', '',$this->request->getPost("maternitycoverage"));
|
||||
$data['twindelivery'] =str_replace(',', '',$this->request->getPost("twindelivery"));
|
||||
$data['preandpostnatal'] =str_replace(',', '',$this->request->getPost("preandpostnatal"));
|
||||
$data['babyday1cover'] =str_replace(',', '',$this->request->getPost("babyday1cover"));
|
||||
}else{
|
||||
$data['maternitycoverage'] ="";
|
||||
$data['twindelivery'] ="";
|
||||
$data['preandpostnatal'] ="";
|
||||
$data['babyday1cover'] ="";
|
||||
}
|
||||
$data['9monthwaitingperiodwaived'] =$this->request->getPost("9monthwaitingperiodwaived");
|
||||
$data['coverfromthedateofjoining'] =$this->request->getPost("coverfromthedateofjoining");
|
||||
$data['9monthwaitingperiodwaived'] =str_replace(',', '',$this->request->getPost("9monthwaitingperiodwaived"));
|
||||
$data['coverfromthedateofjoining'] =str_replace(',', '',$this->request->getPost("coverfromthedateofjoining"));
|
||||
$data['waiverof1,2,3&4thyearexclusions'] =$this->request->getPost("waiverof1,2,3&4thyearexclusions");
|
||||
$data['waiverof30dayswaitingperiod'] =$this->request->getPost("waiverof30dayswaitingperiod");
|
||||
$data['prehospitalizationcover'] =$this->request->getPost("prehospitalizationcover");
|
||||
$data['prehospitalizationcover'] =str_replace(',', '',$this->request->getPost("prehospitalizationcover"));
|
||||
// $data['posthospitalizationcover'] =$this->request->getPost("posthospitalizationcover");
|
||||
$data['congenitaldiseasesinternal'] =$this->request->getPost("congenitaldiseasesinternal");
|
||||
$data['congenitaldiseasesinternal'] =str_replace(',', '',$this->request->getPost("congenitaldiseasesinternal"));
|
||||
// $data['congenitaldiseasesexternal'] =$this->request->getPost("congenitaldiseasesexternal");
|
||||
$data['copayzonewisecopay'] =$this->request->getPost("copayzonewisecopay");
|
||||
$data['bioabsorbablestenttoriclensmultifocallens'] =$this->request->getPost("bioabsorbablestenttoriclensmultifocallens");
|
||||
$data['roomrentlimit'] =$this->request->getPost("roomrentlimit");
|
||||
$data['proportionatedeductionclause'] =$this->request->getPost("proportionatedeductionclause");
|
||||
$data['nursingallowance'] =$this->request->getPost("nursingallowance");
|
||||
$data['ailmentcapping'] =$this->request->getPost("ailmentcapping");
|
||||
$data['ambulancecharges'] =$this->request->getPost("ambulancecharges");
|
||||
$data['airambulance'] =$this->request->getPost("airambulance");
|
||||
$data['familytransportationbenefit'] =$this->request->getPost("familytransportationbenefit");
|
||||
$data['reasonableandcustomarycharges'] =$this->request->getPost("reasonableandcustomarycharges");
|
||||
$data['ayudhtreatmentcover'] =$this->request->getPost("ayudhtreatmentcover");
|
||||
$data['armdcovered'] =$this->request->getPost("armdcovered");
|
||||
$data['suminsuredenhancement'] =$this->request->getPost("suminsuredenhancement");
|
||||
$data['automaticsuminsuredreinstatement'] =$this->request->getPost("automaticsuminsuredreinstatement");
|
||||
$data['additionalsicknessbenefit'] =$this->request->getPost("additionalsicknessbenefit");
|
||||
$data['lasiksurgery'] =$this->request->getPost("lasiksurgery");
|
||||
$data['midterminclusion'] =$this->request->getPost("midterminclusion");
|
||||
$data['capd'] =$this->request->getPost("capd");
|
||||
$data['organdonorexpenses'] =$this->request->getPost("organdonorexpenses");
|
||||
$data['moderntreatmentsasperirdai'] =$this->request->getPost("moderntreatmentsasperirdai");
|
||||
$data['Wellness'] =$this->request->getPost("Wellness");
|
||||
$data['days_of_discharge'] =$this->request->getPost("days_of_discharge");
|
||||
$data['days_from_dod'] =$this->request->getPost("days_from_dod");
|
||||
$data['special_condition_label'] = $this->request->getPost("special_condition_label") ?? [];
|
||||
$data['special_condition_input'] = $this->request->getPost("special_condition_input") ?? [];
|
||||
|
||||
$data['roomrentlimit'] =str_replace(',', '',$this->request->getPost("roomrentlimit"));
|
||||
$data['proportionatedeductionclause'] =str_replace(',', '',$this->request->getPost("proportionatedeductionclause"));
|
||||
$data['nursingallowance'] =str_replace(',', '',$this->request->getPost("nursingallowance"));
|
||||
$data['ailmentcapping'] =str_replace(',', '',$this->request->getPost("ailmentcapping"));
|
||||
$data['ambulancecharges'] =str_replace(',', '',$this->request->getPost("ambulancecharges"));
|
||||
$data['airambulance'] =str_replace(',', '',$this->request->getPost("airambulance"));
|
||||
$data['familytransportationbenefit'] =str_replace(',', '',$this->request->getPost("familytransportationbenefit"));
|
||||
$data['reasonableandcustomarycharges'] =str_replace(',', '',$this->request->getPost("reasonableandcustomarycharges"));
|
||||
$data['ayudhtreatmentcover'] =str_replace(',', '',$this->request->getPost("ayudhtreatmentcover"));
|
||||
$data['armdcovered'] =str_replace(',', '',$this->request->getPost("armdcovered"));
|
||||
$data['suminsuredenhancement'] =str_replace(',', '',$this->request->getPost("suminsuredenhancement"));
|
||||
$data['automaticsuminsuredreinstatement'] =str_replace(',', '',$this->request->getPost("automaticsuminsuredreinstatement"));
|
||||
$data['additionalsicknessbenefit'] =str_replace(',', '',$this->request->getPost("additionalsicknessbenefit"));
|
||||
$data['lasiksurgery'] =str_replace(',', '',$this->request->getPost("lasiksurgery"));
|
||||
$data['midterminclusion'] =str_replace(',', '',$this->request->getPost("midterminclusion"));
|
||||
$data['capd'] =str_replace(',', '',$this->request->getPost("capd"));
|
||||
$data['organdonorexpenses'] =str_replace(',', '',$this->request->getPost("organdonorexpenses"));
|
||||
$data['moderntreatmentsasperirdai'] =str_replace(',', '',$this->request->getPost("moderntreatmentsasperirdai"));
|
||||
$data['Wellness'] =str_replace(',', '',$this->request->getPost("Wellness"));
|
||||
$data['days_of_discharge'] =str_replace(',', '',$this->request->getPost("days_of_discharge"));
|
||||
$data['days_from_dod'] =str_replace(',', '',$this->request->getPost("days_from_dod"));
|
||||
$data['special_condition_label'] = str_replace(',', '',$this->request->getPost("special_condition_label")) ?? [];
|
||||
$data['special_condition_input'] = str_replace(',', '',$this->request->getPost("special_condition_input")) ?? [];
|
||||
|
||||
$jsonData = json_encode($data);
|
||||
$dataa = array(
|
||||
@ -836,6 +1069,7 @@ class ClientController extends AdminController
|
||||
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
// print_r($data);die;
|
||||
if ($record) {
|
||||
$update = $this->clientPolicyModel->update($client_policy_id, $dataa);
|
||||
if ($update) {
|
||||
@ -887,22 +1121,21 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
public function policyGPATerms()
|
||||
{
|
||||
|
||||
{
|
||||
try {
|
||||
$this->myLogger->logme('error','Policy GPA Terms CREATE function called');
|
||||
|
||||
/*** Client Policy Table Primary Key(ID) ***/
|
||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||
|
||||
$data['sumInsured2'] =$this->request->getPost("sumInsured2");
|
||||
$data['totalSumInsured'] =$this->request->getPost("totalSumInsured");
|
||||
$data['accidentalDeathBenefit'] =$this->request->getPost("accidentalDeathBenefit");
|
||||
$data['permanentTotalDisablement'] =$this->request->getPost("permanentTotalDisablement");
|
||||
$data['sumInsured2'] =str_replace(',', '', $this->request->getPost("sumInsured2"));
|
||||
$data['totalSumInsured'] =str_replace(',', '',$this->request->getPost("totalSumInsured"));
|
||||
$data['accidentalDeathBenefit'] =str_replace(',', '',$this->request->getPost("accidentalDeathBenefit"));
|
||||
$data['permanentTotalDisablement'] =str_replace(',', '',$this->request->getPost("permanentTotalDisablement"));
|
||||
$data['permanentPartialDisablement'] =$this->request->getPost("permanentPartialDisablement");
|
||||
$data['temporaryTotalDisablementBenefit'] =$this->request->getPost("temporaryTotalDisablementBenefit");
|
||||
$data['accidentalHospitalizationExpenses'] =$this->request->getPost("accidentalHospitalizationExpenses");
|
||||
$data['childrenEducationWelfareFund'] =$this->request->getPost("childrenEducationWelfareFund");
|
||||
$data['accidentalHospitalizationExpenses'] =str_replace(',', '',$this->request->getPost("accidentalHospitalizationExpenses"));
|
||||
$data['childrenEducationWelfareFund'] =str_replace(',', '',$this->request->getPost("childrenEducationWelfareFund"));
|
||||
|
||||
$data['compassionateVisitExpenses'] =$this->request->getPost("compassionateVisitExpenses");
|
||||
if ($data['compassionateVisitExpenses'] == 1) {
|
||||
@ -911,16 +1144,16 @@ class ClientController extends AdminController
|
||||
$data['compassionateVisitExpensesData'] ="";
|
||||
}
|
||||
|
||||
$data['brokenBoneExpenses'] = $this->request->getPost("brokenBoneExpenses");
|
||||
$data['brokenBoneExpenses'] = str_replace(',', '',$this->request->getPost("brokenBoneExpenses"));
|
||||
if ($data['brokenBoneExpenses'] == 1) {
|
||||
$data['brokenBoneExpensesData'] = $this->request->getPost("brokenBoneExpensesData");
|
||||
$data['brokenBoneExpensesData'] = str_replace(',', '',$this->request->getPost("brokenBoneExpensesData"));
|
||||
}else{
|
||||
$data['brokenBoneExpensesData'] ="";
|
||||
}
|
||||
|
||||
$data['ambulanceCharges'] =$this->request->getPost("ambulanceCharges");
|
||||
$data['ambulanceCharges'] =str_replace(',', '',$this->request->getPost("ambulanceCharges"));
|
||||
if ($data['ambulanceCharges'] == 1) {
|
||||
$data['ambulanceChargesData'] =$this->request->getPost("ambulanceChargesData");
|
||||
$data['ambulanceChargesData'] =str_replace(',', '',$this->request->getPost("ambulanceChargesData"));
|
||||
}else{
|
||||
$data['ambulanceChargesData'] ="";
|
||||
}
|
||||
|
||||
407
app/Controllers/EmpDataServiceController.php
Normal file
407
app/Controllers/EmpDataServiceController.php
Normal file
@ -0,0 +1,407 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\FileModel;
|
||||
use App\Models\BatchListModel;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\EmpEndorsementModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
|
||||
class EmpDataServiceController extends BaseController
|
||||
{
|
||||
protected $myLogger;
|
||||
protected $employeeModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $clientModel;
|
||||
protected $fileModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $batchListModel;
|
||||
protected $batchFileModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $clientDepositModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// helper('utility');
|
||||
set_session_context('EmployeeDataService Second Service');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->fileModel = new FileModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->batchListModel = new BatchListModel();
|
||||
$this->batchFileModel = new BatchFileModel();
|
||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||
$this->clientDepositModel = new ClientDepositModel();
|
||||
}
|
||||
|
||||
|
||||
public function batchFilesAndBatchListEntry($data, $objects){
|
||||
|
||||
$random_number_count = 4;
|
||||
$data['batch_code'] = generate_random_string($random_number_count);
|
||||
$data['created_by'] = get_session_userid();
|
||||
// $data['file_name'] = $filename;
|
||||
$insert = $this->batchFileModel->insert($data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
if($insert){
|
||||
foreach($objects as $value){
|
||||
$batch_list_data['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_list_data['emp_policy_id'] = $value->primaryKey ?? $value->employee_policy_id ?? '';
|
||||
$batch_list_data['created_by'] = get_session_userid();
|
||||
$this->batchListModel->insert($batch_list_data);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates an Excel file for Inception_Addititon_DependentAddititon, Correction, SI_Enhancement and Deletion events based on given export data.
|
||||
*
|
||||
* @param array $export_data An array containing export data such as
|
||||
* client_policy_id,
|
||||
* insurer_or_tpa,
|
||||
* event_type,
|
||||
* actions,
|
||||
* file_name.
|
||||
* @return bool True if the Excel file is successfully generated and exported, otherwise false.
|
||||
*/
|
||||
|
||||
public function generateExcelForAdditionandInception($export_data)
|
||||
{
|
||||
// Fetch employee data for export from the database
|
||||
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($export_data['client_policy_id'], $export_data['insurer_or_tpa'], $export_data['event_type'], $export_data['actions']);
|
||||
|
||||
// Log the count of exported data
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
$this->myLogger->logme('error', 'Inception export data count : {data}', ['data'=> $count ]);
|
||||
|
||||
// If no data is found for export, return false
|
||||
if($count == 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
// Log the export file name
|
||||
$this->myLogger->logme('error', 'Inception export file name : {data}', ['data'=> $export_data['file_name'] ]);
|
||||
|
||||
// Transform retrieved objects to an array suitable for export
|
||||
$data = transform_objects_to_array_for_inception($objects);
|
||||
|
||||
// Define headers for the Excel file
|
||||
$headers = [
|
||||
'S.No', 'NAME OF EMP/DEP', 'EMP ID', 'EMP/DEP TYPE', 'RELATION', 'DOB', 'GENDER', 'PRE EXISTING AILMENTS',
|
||||
'BASIC COVER SI', 'DATE OF COVERAGE', 'AGE', 'RELATIONSHIP', 'REMARKS', 'POLICY END DATE', 'NO OF DAYS', 'TPA ID', 'UHID',
|
||||
'PREMIUM', 'PR0 RATA PREMIUM', 'GST', 'TOTAL'
|
||||
];
|
||||
|
||||
// Generate Excel file
|
||||
$tempFile = tmpfile();
|
||||
$success = generate_excel($headers, $data, $tempFile, 1);
|
||||
|
||||
// If Excel generation is successful
|
||||
if ($success) {
|
||||
// Batch files and list entry
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
|
||||
// If batch operation is successful
|
||||
if ($return) {
|
||||
// Set headers for Excel file download
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// Output file contents
|
||||
rewind($tempFile);
|
||||
fpassthru($tempFile);
|
||||
|
||||
// Close and remove temporary file
|
||||
fclose($tempFile);
|
||||
|
||||
return true; // Excel file successfully generated and exported
|
||||
} else {
|
||||
return false; // Batch operation failed
|
||||
}
|
||||
}
|
||||
|
||||
return false; // Excel generation failed
|
||||
}
|
||||
|
||||
|
||||
public function generateExcelForCorrection($export_data)
|
||||
{
|
||||
|
||||
$objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data['client_id'], $export_data['client_policy_id'], $export_data['insurer_or_tpa']);
|
||||
// dd($objects);
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
$this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
|
||||
|
||||
if($count == 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error','Correction export file name : {data}', ['data'=> $export_data['file_name'] ]);
|
||||
|
||||
$correction_data = transform_objects_to_array_for_correction($objects);
|
||||
|
||||
$headers = [
|
||||
'Emp Code',
|
||||
'RISK ID',
|
||||
'NAME OF EMP/DEP',
|
||||
'EMP/DEP TYPE',
|
||||
'RELATION',
|
||||
'DOB',
|
||||
'GENDER',
|
||||
'Wrong Data',
|
||||
'Correct Data',
|
||||
'Remarks',
|
||||
'Endorsement_Id'
|
||||
];
|
||||
|
||||
|
||||
// Create a temporary file in memory
|
||||
$tempFile = tmpfile();
|
||||
|
||||
// Generate Excel file with the temporary file
|
||||
$value = generate_excel($headers, $correction_data, $tempFile);
|
||||
|
||||
if($value){
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if($return){
|
||||
|
||||
// Set the appropriate headers for Excel file download
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// Rewind the temporary file pointer
|
||||
rewind($tempFile);
|
||||
|
||||
// Output the contents of the temporary file to the browser
|
||||
fpassthru($tempFile);
|
||||
|
||||
// Close and remove the temporary file
|
||||
fclose($tempFile);
|
||||
|
||||
return true;
|
||||
|
||||
}else{
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function generateExcelForSIEnhancement($export_data)
|
||||
{
|
||||
|
||||
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data['client_id'], $export_data['client_policy_id'], $export_data['insurer_or_tpa']);
|
||||
|
||||
// dd($objects);
|
||||
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
|
||||
$this->myLogger->logme('error','SI_Enhancement export data count : {data}', ['data'=> $count ]);
|
||||
|
||||
if($count == 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error','SI_Enhancement export file name : {data}', ['data'=> $export_data['file_name'] ]);
|
||||
|
||||
$si_data = transform_objects_to_array_for_si_enhancement($objects);
|
||||
|
||||
$headers = [
|
||||
'S.No',
|
||||
'NAME OF EMP/DEP',
|
||||
'EMP ID',
|
||||
'EMP/DEP TYPE',
|
||||
'RELATION',
|
||||
'DOB',
|
||||
'GENDER',
|
||||
'PRE EXISTING AILMENTS',
|
||||
'BASIC COVER SI',
|
||||
'Old Sum Insured',
|
||||
'Date of Coverage',
|
||||
'Policy End Date',
|
||||
'No Of Days',
|
||||
'Old SI Premium',
|
||||
'New SI premium',
|
||||
'Difference premium',
|
||||
'Pro Rata Premium',
|
||||
'GST',
|
||||
'Total',
|
||||
'ENDORSEMENT_ID'
|
||||
];
|
||||
|
||||
|
||||
// Create a temporary file in memory
|
||||
$tempFile = tmpfile();
|
||||
|
||||
// Generate Excel file with the temporary file
|
||||
$value = generate_excel($headers, $si_data, $tempFile);
|
||||
|
||||
if($value){
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if($return){
|
||||
|
||||
// Set the appropriate headers for Excel file download
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// Rewind the temporary file pointer
|
||||
rewind($tempFile);
|
||||
|
||||
// Output the contents of the temporary file to the browser
|
||||
fpassthru($tempFile);
|
||||
|
||||
// Close and remove the temporary file
|
||||
fclose($tempFile);
|
||||
|
||||
return true;
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function generateExcelForDeletion($export_data)
|
||||
{
|
||||
|
||||
$objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($export_data['client_id'], $$export_data['client_policy_id'], $$export_data['insurer_or_tpa']);
|
||||
$count = count($objects);
|
||||
$export_data['count'] = $count;
|
||||
|
||||
$this->myLogger->logme('error','Deletion export data count : {data}', ['data'=> $count ]);
|
||||
|
||||
if($count == 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error','Deletion export file name : {data}', ['data'=> $export_data['file_name'] ]);
|
||||
|
||||
$si_data = transform_objects_to_array_for_deletion($objects);
|
||||
|
||||
// dd($si_data);
|
||||
|
||||
$headers = [
|
||||
'S.No',
|
||||
'EMP ID',
|
||||
'EMP NAME',
|
||||
'DOB',
|
||||
'GENDER',
|
||||
'RELATIONSHIP',
|
||||
'SUM INSURED',
|
||||
'Date of Leaving',
|
||||
'Policy End Date',
|
||||
'No Of Days',
|
||||
'Premium',
|
||||
'Pro Rata Premium',
|
||||
'GST',
|
||||
'Total',
|
||||
'Claim Status',
|
||||
'ENDORSEMENT_ID'
|
||||
];
|
||||
|
||||
|
||||
// Create a temporary file in memory
|
||||
$tempFile = tmpfile();
|
||||
|
||||
// Generate Excel file with the temporary file
|
||||
$value = generate_excel($headers, $si_data, $tempFile, 2);
|
||||
|
||||
if($value){
|
||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||
if( $return){
|
||||
|
||||
// Set the appropriate headers for Excel file download
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
// Rewind the temporary file pointer
|
||||
rewind($tempFile);
|
||||
|
||||
// Output the contents of the temporary file to the browser
|
||||
fpassthru($tempFile);
|
||||
|
||||
// Close and remove the temporary file
|
||||
fclose($tempFile);
|
||||
|
||||
return true;
|
||||
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function cashDepositCalculationForInception($arrayData = [])
|
||||
{
|
||||
if (!empty($arrayData)) {
|
||||
$query = $this->employeePolicyModel->query("
|
||||
SELECT SUM(rata_premimum + gst) AS total_sum
|
||||
FROM employee_polices
|
||||
WHERE id IN (" . implode(',', $arrayData) . ")
|
||||
");
|
||||
$row = $query->getRow();
|
||||
$
|
||||
$insert = $this->clientDepositModel->insert();
|
||||
$query = $this->clientDepositModel->orderBy('id', 'DESC')->limit(1)->get();
|
||||
$cashDepositLastEntry = $query->getRow();
|
||||
|
||||
print_r($cashDepositLastEntry); die;
|
||||
|
||||
|
||||
return $row ? $row->total_sum : 0;
|
||||
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function cashDepositCalculationForSIEnhancement($arrayData = [])
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function cashDepositCalculationForDeletion($arrayData)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
}
|
||||
@ -12,11 +12,16 @@ use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\FileModel;
|
||||
use App\Models\BatchListModel;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\EmpEndorsementModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
use App\Controllers\Jobs\SubJob;
|
||||
use App\Controllers\EmployeeServiceController;
|
||||
use App\Controllers\EmpDataServiceController;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
@ -32,6 +37,11 @@ class EmployeeController extends AdminController
|
||||
protected $employeePolicyModel;
|
||||
protected $clientModel;
|
||||
protected $fileModel;
|
||||
protected $batchListModel;
|
||||
protected $batchFileModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $clientPolicyModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// helper('utility');
|
||||
@ -41,6 +51,10 @@ class EmployeeController extends AdminController
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->fileModel = new FileModel();
|
||||
$this->batchListModel = new BatchListModel();
|
||||
$this->batchFileModel = new BatchFileModel();
|
||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
}
|
||||
|
||||
public function list()
|
||||
@ -192,7 +206,12 @@ class EmployeeController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)','addition' => 'Addition (Employee + Dependents)','dependent_addtion' => 'Dependent Addition (Only Dependents)','deletion' => 'Deletion','correction' =>'Correction','si_enhancement' =>'SI Enhancement'];
|
||||
$data['events'] = ['inception' => 'Inception + Addition','correction' =>'Correction', 'deletion'=>'Deletion' ,'si_enhancement' =>'SI Enhancement'];
|
||||
$data['import_or_export'] = ['import' => 'Import','export' =>'Export'];
|
||||
$data['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA'];
|
||||
|
||||
$data['fileList'] = $this->fileModel
|
||||
->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name'])
|
||||
->join('user_profiles up','files.created_by = up.id')
|
||||
@ -203,77 +222,507 @@ class EmployeeController extends AdminController
|
||||
// dd($data['fileList']);die();
|
||||
if($this->request->getMethod() == "get")
|
||||
{
|
||||
$this->loadLayout('employee_upload',$data);
|
||||
$this->loadLayout('import_export',$data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getExcelFileErrors()
|
||||
{
|
||||
$file_id = $this->request->uri->getSegment(3);
|
||||
$empServiceController = new EmployeeServiceController();
|
||||
|
||||
$file_id = $this->request->uri->getSegment(3);
|
||||
$file = $this->fileModel->find($file_id);
|
||||
$error_data = json_decode($file['reason']);
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
// Render views and capture output
|
||||
$result = $empServiceController->getExcelErrorData($file_id);
|
||||
|
||||
//check the file exist or not
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
$error_message = "File not found";
|
||||
$this->myLogger->logme('error',($error_message . ' for file id ' . $file_id));
|
||||
}
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
// echo '<pre>';
|
||||
// print_r($result); die;
|
||||
echo view('excel_errors', $result);
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
$data['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
$data['excel_data'] = $excel_data;
|
||||
|
||||
}
|
||||
|
||||
echo '<pre>';
|
||||
/**This downloadSampleExcelFile() function facilitates downloading various sample Excel files
|
||||
** based on user-selected actions, handling file retrieval and download processes. **/
|
||||
public function downloadSampleExcelFile($actionType = null)
|
||||
{
|
||||
// $actionType = $this->request->getGet();
|
||||
$filePath = '';
|
||||
// Path to your file
|
||||
if($actionType == 'inception'){
|
||||
$filePath = ROOTPATH . 'public/sample_excel/inception.xls';
|
||||
|
||||
// foreach ($error_data->error_data as $key => $value) {
|
||||
// print_r($excel_data[$key]);
|
||||
// foreach($value as $key2 => $value2){
|
||||
// // echo '<pre>';
|
||||
// // print_r($excel_data[$key][$value2->col_idx]);
|
||||
// }
|
||||
|
||||
// }
|
||||
$finalArray = [];
|
||||
foreach ($error_data->error_data as $key => $value) {
|
||||
foreach($value as $key2 => $value2){
|
||||
$error_data = $value2->error;
|
||||
}else if($actionType == 'correction'){
|
||||
$filePath = ROOTPATH . 'public/sample_excel/inception_1.xls';
|
||||
|
||||
echo '<pre>';
|
||||
// print_r([$value2->col_idx]);
|
||||
$excel_data[$key][$value2->col_idx] = $error_data;
|
||||
// print_r($excel_data[$key]);
|
||||
|
||||
}
|
||||
// print_r($excel_data[$key]);
|
||||
// array_push($finalArray, $excel_data);
|
||||
}
|
||||
}else if($actionType == 'si_enhancement'){
|
||||
$filePath = ROOTPATH . 'public/sample_excel/inception_2.xls';
|
||||
}
|
||||
|
||||
// Check if the file exists
|
||||
if (file_exists($filePath)) {
|
||||
|
||||
// Set the appropriate MIME type
|
||||
$mimeType = mime_content_type($filePath);
|
||||
|
||||
print_r($excel_data);
|
||||
|
||||
die;
|
||||
|
||||
|
||||
// echo '###################################################################### <br>';
|
||||
// print_r($excel_data);
|
||||
// echo '###################################################################### <br>';
|
||||
// print_r($error_data->error_data); die;
|
||||
|
||||
$headerData['page_name'] = 'Excel Error';
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('excel_errors', $data);
|
||||
echo view('layout/footer');
|
||||
// Send the file to the client for download
|
||||
return $this->response->download($filePath, null, $mimeType);
|
||||
} else {
|
||||
// File not found, show an error message or redirect
|
||||
return redirect()->back()->with('error', 'File not found.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function importExport()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','importExport function called');
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||
$insurer_or_tpa = $this->request->getPost('insurer_or_tpa');
|
||||
$event_type = $this->request->getPost('event_type');
|
||||
$actions = $this->request->getPost('action_type');
|
||||
|
||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
||||
$policy_name = $this->clientPolicyModel->select('policies.name')->join('policies', 'policies.id = client_policy.policy_id')->where('client_policy.id', $client_policy_id)->first();
|
||||
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']);
|
||||
|
||||
$batch_data = [
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'insurer_or_tpa' => $insurer_or_tpa,
|
||||
'event_type' => $event_type,
|
||||
'actions' => $actions,
|
||||
'file_name' => $file_name,
|
||||
];
|
||||
|
||||
if($actions == 'export'){
|
||||
|
||||
if($event_type == 'inception'){
|
||||
|
||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||
if(!$return){
|
||||
session()->setFlashdata('error', 'No data found about this action');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else{
|
||||
$this->myLogger->logme('error','Successfully exported Excel file in Inception/Addition/DependentAddition.');
|
||||
}
|
||||
|
||||
} else if($event_type == 'correction'){
|
||||
|
||||
$return = $empDataServiceController->generateExcelForCorrection($batch_data);
|
||||
if(!$return){
|
||||
session()->setFlashdata('error', 'No data found about this action');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else{
|
||||
$this->myLogger->logme('error','Successfully exported Excel file in Correction.');
|
||||
}
|
||||
|
||||
} else if($event_type == 'si_enhancement'){
|
||||
|
||||
$return = $empDataServiceController->generateExcelForSIEnhancement($batch_data);
|
||||
if(!$return){
|
||||
session()->setFlashdata('error', 'No data found about this action');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else{
|
||||
$this->myLogger->logme('error','Successfully exported Excel file in SI_Enhancement.');
|
||||
}
|
||||
|
||||
}else if($event_type == 'deletion'){
|
||||
|
||||
$return = $empDataServiceController->generateExcelForDeletion($batch_data);
|
||||
if(!$return){
|
||||
session()->setFlashdata('error', 'No data found about this action');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else{
|
||||
$this->myLogger->logme('error','Successfully exported Excel file in Deletion.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}else if($actions == 'import'){
|
||||
|
||||
if($event_type == 'inception'){
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
|
||||
$this->myLogger->logme('error','Inception Import file name : {data}', ['data'=> $filename ]);
|
||||
$random_number_count = 4;
|
||||
$batch_code = generate_random_string($random_number_count);
|
||||
|
||||
$this->myLogger->logme('error','Inception Import BATCH CODE : {data}', ['data'=> $batch_code ]);
|
||||
|
||||
$batch_data['batch_code'] = $batch_code;
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['file_name'] = $filename;
|
||||
// $insert = $this->batchFileModel->insert($batch_data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', 2)->first();
|
||||
|
||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
|
||||
|
||||
//check the file exist or not
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
// session()->setFlashdata('error', 'File not found');
|
||||
// return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$data = read_excel_file_to_array($file_name_with_path);
|
||||
unset($data[0]);
|
||||
array_pop($data);
|
||||
$count = count($data);
|
||||
// $this->batchFileModel->where('id', $insert)->set('count', $count)->update();
|
||||
// dd($data );
|
||||
$employeeIds = [];
|
||||
foreach ($data as $key => $value) {
|
||||
// Check if the array is not empty and has the necessary data
|
||||
if (!empty($value) && (isset($value[15]) || isset($value[16]))) {
|
||||
|
||||
// Extract the client_policy_id and tpa_id from the array
|
||||
$tpa_id = $value[15] != null ? $value[15] : '';
|
||||
$uhid = $value[16] != null ? $value[16] : '';
|
||||
$emp_code = $value[2];
|
||||
$name = $value[1];
|
||||
|
||||
$val = $this->employeePolicyModel
|
||||
->select('employee_polices.id')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.name', $name)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->first();
|
||||
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
|
||||
$this->batchListModel->insert($batch_code_for_batch_list);
|
||||
array_push($employeeIds, $val['id']);
|
||||
|
||||
$this->employeePolicyModel->updateTPAIDorUHID( $client_policy_id, $client_id, $name, $emp_code, $uhid, $tpa_id);
|
||||
|
||||
// $query = $this->employeePolicyModel->getLastQuery();
|
||||
// echo $query . "<br>";
|
||||
|
||||
}else{
|
||||
|
||||
// session()->setFlashdata('error', 'Something went wrong');
|
||||
// return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
}
|
||||
$action = ['action' => 'inception'];
|
||||
|
||||
// $depositeData = [
|
||||
// $employeeIds,
|
||||
// ];
|
||||
// print_r($employeeIds); die;
|
||||
$empDataServiceController->cashDepositCalculationForInception($employeeIds);
|
||||
// echo '<pre>';
|
||||
// print_r($depositeData); die;
|
||||
|
||||
// session()->setFlashdata('success', 'Data updated successfully');
|
||||
// return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($event_type == 'correction'){
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
|
||||
$this->myLogger->logme('error','Correction Import file name : {data}', ['data'=> $filename ]);
|
||||
$random_number_count = 4;
|
||||
$batch_code = generate_random_string($random_number_count);
|
||||
$this->myLogger->logme('error','Correction Import BATCH CODE : {data}', ['data'=> $batch_code ]);
|
||||
|
||||
|
||||
$batch_data['batch_code'] = $batch_code;
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['file_name'] = $filename;
|
||||
$insert = $this->batchFileModel->insert($batch_data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
|
||||
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$data = read_excel_file_to_array($file_name_with_path);
|
||||
unset($data[0]);
|
||||
$count = count($data);
|
||||
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
|
||||
// dd($data);
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
if (!empty($value) && isset($value[10])) {
|
||||
|
||||
$emp_code = $value[0];
|
||||
$uhid = $value[1];
|
||||
$endorsement_id = $value[10] != null ? $value[10] : '';
|
||||
|
||||
$val = $this->employeePolicyModel
|
||||
->select('employees.id')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employee_polices.uhid', $uhid)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employees.is_active', 1)
|
||||
->first();
|
||||
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
|
||||
$this->batchListModel->insert($batch_code_for_batch_list);
|
||||
|
||||
// $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id);
|
||||
|
||||
$queryData = $this->empEndorsementModel->select('emp_endorsement.*')
|
||||
->join('employees', 'employees.id = emp_endorsement.pk')
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.uhid', $uhid)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// dd($queryData);
|
||||
|
||||
foreach ($queryData as $endorsementData) {
|
||||
|
||||
$emp_endoresment_id = $endorsementData['id'];
|
||||
$emp_id = $endorsementData['emp_id'];
|
||||
$field_name = $endorsementData['field_name'];
|
||||
$new_value = $endorsementData['new_value'];
|
||||
$this->empEndorsementModel->where('id', $emp_endoresment_id)->set('endorsement_id', $endorsement_id)->update();
|
||||
$this->employeeModel->where('id', $emp_id)->set($field_name, $new_value)->update();
|
||||
}
|
||||
|
||||
// $query = $this->employeePolicyModel->getLastQuery();
|
||||
// echo $query . "<br>";
|
||||
}else{
|
||||
session()->setFlashdata('error', 'Something went wrong');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($event_type == 'si_enhancement'){
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
|
||||
$this->myLogger->logme('error','SI_Enhancement Import file name : {data}', ['data'=> $filename ]);
|
||||
$random_number_count = 4;
|
||||
$batch_code = generate_random_string($random_number_count);
|
||||
$this->myLogger->logme('error','SI_Enhancement Import BATCH CODE : {data}', ['data'=> $batch_code ]);
|
||||
|
||||
|
||||
$batch_data['batch_code'] = $batch_code;
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['file_name'] = $filename;
|
||||
$insert = $this->batchFileModel->insert($batch_data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
|
||||
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$data = read_excel_file_to_array($file_name_with_path);
|
||||
unset($data[0]);
|
||||
$count = count($data);
|
||||
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
|
||||
// dd($data);
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
if (!empty($value) && isset($value[19])) {
|
||||
|
||||
$emp_name = $value[1];
|
||||
$emp_code = $value[2];
|
||||
// echo $emp_name .'-'. $emp_code; die;
|
||||
$endorsement_id = $value[19] != null ? $value[19] : '';
|
||||
|
||||
$val = $this->employeePolicyModel
|
||||
->select('employee_polices.id')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.name', $emp_name)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->first();
|
||||
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
|
||||
$this->batchListModel->insert($batch_code_for_batch_list);
|
||||
|
||||
|
||||
$this->employeePolicyModel->updateEndoresmentIdForSIEnhancement($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id);
|
||||
|
||||
$queryData = $this->employeePolicyModel
|
||||
->select('employee_polices.*')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id')
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employees.name', $emp_name)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->first();
|
||||
|
||||
$queryData['is_active'] = 0;
|
||||
$this->employeePolicyModel->save($queryData);
|
||||
|
||||
unset($queryData['id']);
|
||||
unset($queryData['created_by']);
|
||||
unset($queryData['created_at']);
|
||||
unset($queryData['updated_by']);
|
||||
unset($queryData['updated_at']);
|
||||
unset($queryData['is_active']);
|
||||
|
||||
$queryData['basic_cover_si'] = $value[8];
|
||||
$queryData['premium'] = $value[14];
|
||||
$queryData['si_enhancement_date'] = $value[10];
|
||||
$queryData['rata_premimum'] = $value[16];
|
||||
$queryData['gst'] = $value[17];
|
||||
$queryData['created_by'] = get_session_userid();
|
||||
|
||||
//new insert
|
||||
$this->employeePolicyModel->save($queryData);
|
||||
|
||||
|
||||
// $query = $this->employeePolicyModel->getLastQuery();
|
||||
// echo $query . "<br>";
|
||||
}else{
|
||||
session()->setFlashdata('error', 'Something went wrong');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($event_type == 'deletion'){
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
|
||||
$this->myLogger->logme('error','Deletion Import file name : {data}', ['data'=> $filename ]);
|
||||
$random_number_count = 4;
|
||||
$batch_code = generate_random_string($random_number_count);
|
||||
$this->myLogger->logme('error','Deletion Import BATCH CODE : {data}', ['data'=> $batch_code ]);
|
||||
|
||||
|
||||
$batch_data['batch_code'] = $batch_code;
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['file_name'] = $filename;
|
||||
$insert = $this->batchFileModel->insert($batch_data);
|
||||
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||
|
||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
|
||||
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$data = read_excel_file_to_array($file_name_with_path);
|
||||
unset($data[0]);
|
||||
array_pop($data);
|
||||
|
||||
$count = count($data);
|
||||
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
if (!empty($value) && isset($value[15])) {
|
||||
|
||||
$emp_name = $value[2]; //employee name
|
||||
$emp_code = $value[1]; //employee code
|
||||
$date_of_exit = $value[7]; // date of releving
|
||||
|
||||
// echo $emp_name .'-'. $emp_code .'-'. $date_of_exit; die;
|
||||
$endorsement_id = $value[15] != null ? $value[15] : ''; //endorsement id
|
||||
|
||||
$val = $this->employeePolicyModel
|
||||
->select('employee_polices.id')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employees.name', $emp_name)
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->first();
|
||||
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
|
||||
$this->batchListModel->insert($batch_code_for_batch_list);
|
||||
|
||||
$this->employeePolicyModel->updateEndoresmentIdForDeletion($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id);
|
||||
|
||||
$deletionDataForEmployee = $this->empEndorsementModel
|
||||
->select('emp_endorsement.new_value, employees.id')
|
||||
->join('employees', 'emp_endorsement.emp_code = employees.emp_code')
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->where('emp_endorsement.emp_code', $emp_code)
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('emp_endorsement.name', $emp_name)
|
||||
->where('emp_endorsement.field_name', 'emp_status')
|
||||
->first();
|
||||
|
||||
$deletionDataForEmployee['updated_by'] = get_session_userid();
|
||||
$this->employeeModel->save($deletionDataForEmployee);
|
||||
|
||||
|
||||
$deletionDataForEmployeePolicy = $this->employeePolicyModel->fetchEmpEndorsementData($emp_code, $client_policy_id, $emp_name);
|
||||
$deletionDataForEmployeePolicy['updated_by'] = get_session_userid();
|
||||
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($deletionDataForEmployeePolicy); die;
|
||||
|
||||
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
|
||||
|
||||
// $query = $this->employeePolicyModel->getLastQuery();
|
||||
// echo $query . "<br>";
|
||||
}else{
|
||||
session()->setFlashdata('error', 'Something went wrong');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// -------------------------------------------------------------------------------------------
|
||||
}
|
||||
777
app/Controllers/EmployeeRestController.php
Normal file
777
app/Controllers/EmployeeRestController.php
Normal file
@ -0,0 +1,777 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Helpers\MailHelper;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\PolicesModel;
|
||||
use App\Models\RelationshipModel;
|
||||
use App\Models\FileModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class EmployeeRestController extends AdminController
|
||||
{
|
||||
|
||||
use ResponseTrait;
|
||||
|
||||
protected $myLogger;
|
||||
protected $employeeModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $clientModel;
|
||||
protected $fileModel;
|
||||
protected $policesModel;
|
||||
protected $relationshipModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $policyPremium1Model;
|
||||
protected $policyPremium2Model;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// helper('utility');
|
||||
set_session_context('Employee');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->policesModel = new PolicesModel();
|
||||
$this->relationshipModel = new RelationshipModel();
|
||||
$this->fileModel= new FileModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
}
|
||||
|
||||
|
||||
public function getEmployeeProfile()
|
||||
{
|
||||
try {
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
if ($emp_code) {
|
||||
$relationship = 'self';
|
||||
$employee = $this->employeeModel->where('emp_code', $emp_code)
|
||||
->where('relationship', $relationship)
|
||||
->first();
|
||||
$result = $employee;
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
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 editEmployeeProfile()
|
||||
{
|
||||
try {
|
||||
$data = $this->request->getJSON();
|
||||
if ($data) {
|
||||
$id = $data->id;
|
||||
$employee = $this->employeeModel->update($id, $data);
|
||||
|
||||
if ($employee) {
|
||||
$result = [];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
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 getEmployeeAndDependence()
|
||||
{
|
||||
try {
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
if ($emp_code) {
|
||||
$employee = $this->employeeModel->where('emp_code', $emp_code)->findAll();
|
||||
$dateConverter = function($item) {
|
||||
if ($item['dob'] !== '0000-00-00') {
|
||||
$dateTime = \DateTime::createFromFormat('Y-m-d', $item['dob']);
|
||||
$item['dob'] = $dateTime->format('d-m-Y');
|
||||
}
|
||||
return $item;
|
||||
};
|
||||
$employee = array_map($dateConverter, $employee);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $employee],200);
|
||||
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []],404);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function editEmployeeAndDependence()
|
||||
{
|
||||
try {
|
||||
$data = $this->request->getJSON();
|
||||
if ($data) {
|
||||
$updatedCount = 0;
|
||||
|
||||
foreach ($data as $item) {
|
||||
$id = $item->id;
|
||||
$item->dob = $this->convertDateFormat($item->dob);
|
||||
$employee = $this->employeeModel->update($id, (array)$item);
|
||||
if ($employee) {
|
||||
$updatedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($updatedCount > 0) {
|
||||
$result = [];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||
} else {
|
||||
$result = "No Matches";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e], 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function addEmployeeAndDependence()
|
||||
{
|
||||
try {
|
||||
$data = $this->request->getJSON();
|
||||
|
||||
if ($data) {
|
||||
$Count = 0;
|
||||
foreach ($data as $item) {
|
||||
if (isset($item->id)) {
|
||||
//update old data
|
||||
$id = $item->id;
|
||||
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
||||
$item->dob = $this->convertDateFormat($item->dob);
|
||||
$employee = $this->employeeModel->update($id, (array)$item);
|
||||
if ($employee) {
|
||||
$Count++;
|
||||
}
|
||||
}else{
|
||||
//create new data
|
||||
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
||||
$item->dob = $this->convertDateFormat($item->dob);
|
||||
$employee = $this->employeeModel->insert($item);
|
||||
if ($employee) {
|
||||
$Count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($Count > 0) {
|
||||
$result = [];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||
} else {
|
||||
$result = "No Matches";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function RelationshipMap($value){
|
||||
|
||||
if ($value === 'Mother' || $value === 'Father') {
|
||||
return 'parent';
|
||||
} else if($value === 'Son' || $value === 'Daughter'){
|
||||
return 'child';
|
||||
}else if($value === 'Father in Law' || $value === 'Mother in Law'){
|
||||
return 'parent_in_law';
|
||||
}else if($value === 'Spouse'){
|
||||
return 'spouse';
|
||||
}
|
||||
}
|
||||
|
||||
private function convertDateFormat($dateString)
|
||||
{
|
||||
// Attempt to create a DateTime object from the provided date string
|
||||
$dateTime = \DateTime::createFromFormat('d-m-Y', $dateString);
|
||||
|
||||
// Check if the conversion was successful and the date string is in the format dd-mm-yyyy
|
||||
if ($dateTime instanceof \DateTime) {
|
||||
// Format the date to yyyy-mm-dd
|
||||
return $dateTime->format('Y-m-d');
|
||||
} else {
|
||||
// If the date string is not in the format dd-mm-yyyy, return null
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public function deleteDependence()
|
||||
{
|
||||
try {
|
||||
print_r($this->rquest);die;
|
||||
if($this->request->getGet('id'))
|
||||
{
|
||||
$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);
|
||||
}
|
||||
}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->employeePolicyModel->getEmployeePolicy( $this->request->getGet('client_id'), $this->request->getGet('client_policy_id'));
|
||||
// $empData = $this->employeeModel->where('client_id', $this->request->getGet('client_id'))
|
||||
// ->where('relationship !=', null)
|
||||
|
||||
if ($empData) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 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 getClientPolicy()
|
||||
{
|
||||
try {
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name')
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->findAll();
|
||||
|
||||
$result[] = $ClientPolicyData[0];
|
||||
$result[] = $ClientPolicyData[2];
|
||||
// You probably meant to check $result, not $data
|
||||
if ($ClientPolicyData) {
|
||||
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()
|
||||
{
|
||||
try {
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
|
||||
$keysToRemove = ["removable_keys"];
|
||||
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
|
||||
$empData = $this->employeeModel->where('emp_code',$emp_code)->findAll();
|
||||
if ($empPolicy) {
|
||||
|
||||
$result = [];
|
||||
foreach ($empPolicy as $array) {
|
||||
|
||||
$decodedArray = json_decode($array->Policy_Terms);
|
||||
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$id)->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
||||
if($employee_policy){
|
||||
$gpaSI['family_floater_key'] = 'self';
|
||||
$gpaSI['label'] = 'Self';
|
||||
$gpaSI['employee_id'] = $employee_policy->employee_id;
|
||||
$gpaSI['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||
$gpaSI['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||
$gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
||||
|
||||
$array->mapped_family_floaters = $gpaSI;
|
||||
}else{
|
||||
$gpaSI['family_floater_key'] = 'self';
|
||||
$gpaSI['label'] = 'Self';
|
||||
$gpaSI['employee_id'] = $id;
|
||||
$gpaSI['basic_cover_si'] = null;
|
||||
$gpaSI['premium'] = null;
|
||||
$gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
||||
|
||||
$array->mapped_family_floaters = $gpaSI;
|
||||
}
|
||||
|
||||
}else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
||||
|
||||
// re-arranging order of si
|
||||
$default_si = $array->Policy_Terms->sum_insured;
|
||||
// Filter the array using the callback function
|
||||
$getPremium = array_filter($array->SlabRates , function ($value) use ($default_si) { return $value['si'] == $default_si; } );
|
||||
$default_premium = $getPremium[0]['premium'];
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
//map family floates array to employee and dependent
|
||||
$familyFloates = $array->Policy_Terms->family_floaters;
|
||||
$data = [];
|
||||
foreach ($familyFloates 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)->get()->getRow();
|
||||
$temp['family_floater_key'] = $familyFloatesValue;
|
||||
$temp['label'] = $value['relationship'];
|
||||
$temp['name'] = $value['name'];
|
||||
$temp['employee_id'] = $value['id'];
|
||||
$temp['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||
$temp['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||
$temp['client_policy_id'] = $array->ClientPolicyId;
|
||||
array_push($data,$temp);
|
||||
unset($empData[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$array->mapped_family_floaters = $data;
|
||||
|
||||
$temp2=[];
|
||||
foreach ($array->SlabRates as $key => $value) {
|
||||
$value['additional_premium'] = $value['premium'] - $default_premium;
|
||||
array_push($temp2,$value);
|
||||
}
|
||||
$array->SlabRates = $temp2;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
$result[] = $array;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the RelationShip list
|
||||
|
||||
public function createOrUpdateEmployeePolicySiAmount()
|
||||
{
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON();
|
||||
|
||||
foreach ($requestData as $key => $value) {
|
||||
|
||||
|
||||
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
||||
->where('client_policy_id', $value->client_policy_id)
|
||||
->findAll();
|
||||
// dd($checkIfExist);
|
||||
if ($checkIfExist) {
|
||||
|
||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si,$value->premium);
|
||||
|
||||
}else{
|
||||
|
||||
$data['employee_id']= $value->employee_id;
|
||||
$data['client_policy_id']= $value->client_policy_id;
|
||||
$data['basic_cover_si']= $value->basic_cover_si;
|
||||
$data['premium']= $value->premium;
|
||||
|
||||
$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()
|
||||
{
|
||||
try {
|
||||
|
||||
$relation_ships= $this->relationshipModel->findAll();
|
||||
|
||||
if(count($relation_ships) > 0){
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// Upload the Employee Detail in DB by Sheet Data
|
||||
public function employeeUpload()
|
||||
{
|
||||
try {
|
||||
$file = $this->request->getFile('file');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
// $client_id = $this->request->getJSON('client_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
// $policy_id = $this->request->getJSON('policy_id');
|
||||
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
||||
|
||||
if ($client_policy) {
|
||||
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
|
||||
$policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
|
||||
$policy_permium_2 = $this->policyPremium2Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
|
||||
$sum_insured_amount_for_check_employee_1 = $policy_permium_1['si'];
|
||||
$sum_insured_amount_for_check_employee_2 = $policy_permium_2['si'];
|
||||
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$filename;
|
||||
|
||||
//check the file exist or not
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
// Load the Excel file
|
||||
$spreadsheet = IOFactory::load($file_name_with_path);
|
||||
|
||||
// Get the active sheet
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
// Get the highest row and column numbers
|
||||
$highestRow = $sheet->getHighestRow();
|
||||
$highestColumn = $sheet->getHighestColumn();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
|
||||
$extractData['file_name']= $filename;
|
||||
$extractData['client_id']= $client_id;
|
||||
$extractData['status']= 'success';
|
||||
$extractData['policy_id']= $policy_id;
|
||||
$extractData['action']= 'enrollment';
|
||||
// $extractData['created_by']=set_session_context('Employee');
|
||||
|
||||
$file_data =$this->fileModel->insert($extractData);
|
||||
|
||||
$extra = [];
|
||||
if (count($data[0]) == 10) {
|
||||
$value = ['S.No','Emp Code','Name','DOJ','Gender','Relation','DOB','Mail','Mobile','SI'];
|
||||
$check_miss_match = [];
|
||||
for ($i=0; $i <count($value) ; $i++) {
|
||||
if ($data[0][$i] != $value[$i]) {
|
||||
$check_miss_match[]=$data[0][$i];
|
||||
}
|
||||
}
|
||||
|
||||
if (count($check_miss_match) > 0) {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Column Name's are miss Match's!", 'data'=> $check_miss_match], 404);
|
||||
}
|
||||
}
|
||||
|
||||
if(count($data[0]) != 10){
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 404);
|
||||
}
|
||||
|
||||
//this change the column name into index number
|
||||
for ($i = 0; $i < count($data[0]); $i++) {
|
||||
$data[0][$i] = $i;
|
||||
}
|
||||
for ($i = 0; $i < count($data); $i++) {
|
||||
if ($i == 0) {
|
||||
// Loop through the first row to extract keys
|
||||
for ($j = 0; $j < count($data[$i]); $j++) {
|
||||
$extra[$data[$i][$j]] = []; // Initialize keys with empty array
|
||||
}
|
||||
} else {
|
||||
// Loop through subsequent rows
|
||||
for ($j = 0; $j < count($data[$i]); $j++) {
|
||||
// Append values to corresponding keys in $extra
|
||||
if (isset($extra[$data[0][$j]])) {
|
||||
// Make sure the key exists in the $extra array
|
||||
$extra[$data[0][$j]][] = $data[$i][$j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$dataToInsert = [];
|
||||
$basic_cover_si= [];
|
||||
if ($extra[9]) {
|
||||
$new_array = [];
|
||||
for ($i=0; $i < count($extra[9]); $i++) {
|
||||
if ($sum_insured_amount_for_check_employee_2 != $extra[9][$i] || $sum_insured_amount_for_check_employee_1 != $extra[9][$i]) {
|
||||
$new_array[] = $i+1;
|
||||
}
|
||||
}
|
||||
if (count($new_array) > 0) {
|
||||
$count =count($new_array);
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "$count Employee Sum Insured is Not Match.. " , 'data' => $new_array], 404);
|
||||
}
|
||||
}
|
||||
foreach ($extra['0'] as $index => $id) {
|
||||
$relation ='';
|
||||
if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') {
|
||||
$relation = 'parent';
|
||||
} else if($extra['5'][$index] === 'Son' || $extra['5'][$index] === 'Daughter'){
|
||||
$relation = 'child';
|
||||
}else if($extra['5'][$index] === 'Father in Law' || $extra['5'][$index] === 'Mother in Law'){
|
||||
$relation = 'parent_in_law';
|
||||
}else if($extra['5'][$index] === 'Spouse'){
|
||||
$relation = 'spouse';
|
||||
}else{
|
||||
$relation = 'self';
|
||||
}
|
||||
// Simplified formatDate function
|
||||
|
||||
// Assigning formatted dates
|
||||
$doj = $extra['3'][$index] ;
|
||||
$dob = $extra['6'][$index] ;
|
||||
|
||||
// Change date format for $doj
|
||||
$doj_new_format = date('Y-m-d', strtotime($doj)); // $doj_new_format will be "2001-02-12"
|
||||
|
||||
// Change date format for $dob
|
||||
$dob_new_format = date('Y-m-d', strtotime($dob));
|
||||
|
||||
// Your existing code here
|
||||
$emp_code =isset($extra['1'][$index]) ? $extra['1'][$index] : 0;
|
||||
$name = $extra['2'][$index];
|
||||
|
||||
if($emp_code != 0 && $name != '' || $name != null){
|
||||
$record = [
|
||||
// 'id' => $id,
|
||||
'emp_code' => $emp_code,
|
||||
'name' => $name,
|
||||
// Check if the 'doj' key exists before accessing it
|
||||
'doj' => $doj_new_format,
|
||||
'gender' => $extra['4'][$index],
|
||||
'relationship' => ucfirst($extra['5'][$index]),
|
||||
'family_floater_key' => $relation,
|
||||
'dob' => $dob_new_format,
|
||||
'email_corporate' => $extra['7'][$index],
|
||||
'mobile'=> $extra['8'][$index],
|
||||
'client_id' => $client_id,
|
||||
'emp_status'=>'draft'
|
||||
|
||||
];
|
||||
$basic_cover_si_value = null;
|
||||
|
||||
//Grid id is 10 and 11 sum insure value add only for self other grid type self sum insure is for the dependence
|
||||
if ($policy_permium_2['policy_grid_id'] == 10 || $policy_permium_2['policy_grid_id'] == 11) {
|
||||
if (strtolower($extra['5'][$index]) == 'self') {
|
||||
$basic_cover_si_value = $extra['9'][$index];
|
||||
}else{
|
||||
$basic_cover_si_value = null;
|
||||
}
|
||||
}else{
|
||||
if (strtolower($extra['5'][$index]) == 'self') {
|
||||
$basic_cover_si_value = $extra['9'][$index];
|
||||
}else{
|
||||
for ($i=0; $i < count($extra['1']) ; $i++) {
|
||||
|
||||
if ($extra['1'][$i] == $extra['1'][$index]) {
|
||||
if (strtolower($extra['5'][$i]) == 'self') {
|
||||
$basic_cover_si_value = $extra['9'][$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$record2 = [
|
||||
'basic_cover_si' => $basic_cover_si_value,
|
||||
];
|
||||
$dataToInsert[] = $record;
|
||||
$basic_cover_si[]= $basic_cover_si_value;
|
||||
}
|
||||
}
|
||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||
{
|
||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||
$emp_id =0;
|
||||
|
||||
$data_after_gpa_or_gmc =[];
|
||||
if ($policy['policy_type_id'] == 1) {
|
||||
if (strtolower($dataToInsert[$a]['relationship']) == 'self') {
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
}else{
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
$current_timestamp = time();
|
||||
$formatted_date_time = date('Y-m-d H:i:s', $current_timestamp);
|
||||
|
||||
if ($employee) {
|
||||
|
||||
|
||||
$emp_id =$employee['id'];
|
||||
$id =$emp_id;
|
||||
$data_after_gpa_or_gmc['id'] = $id;
|
||||
$data_after_gpa_or_gmc['updated_at'] = $formatted_date_time;
|
||||
$result = $this->employeeModel->save($data_after_gpa_or_gmc);
|
||||
if ($result) {
|
||||
$log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
||||
$this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name']));
|
||||
}
|
||||
}else{
|
||||
if ($dataToInsert[$a]['emp_code'] != 0) {
|
||||
$result =false;
|
||||
if (count($data_after_gpa_or_gmc) != 0) {
|
||||
$result = $this->employeeModel->insert($data_after_gpa_or_gmc);
|
||||
}
|
||||
$emp_id =$result;
|
||||
if ($result) {
|
||||
$emp = $this->employeeModel->where('id', $result)->get()->getResult();
|
||||
|
||||
$policy_name = $this->employeePolicyModel->where('employee_id', $result)->get()->getResult();;
|
||||
|
||||
|
||||
$log_message = 'Insert Employee- '.$dataToInsert[$a]['name'] .'('.$dataToInsert[$a]['emp_code'] .') with PK ';
|
||||
$this->myLogger->logme('error',('Insert - ' . $dataToInsert[$a]['emp_code'] .' - '. $dataToInsert[$a]['name']));
|
||||
}
|
||||
}
|
||||
}
|
||||
$emp_policy_data =[
|
||||
'employee_id'=>$emp_id,
|
||||
'client_policy_id'=>$policy_id,
|
||||
'status'=> 'draft',
|
||||
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
||||
];
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]);
|
||||
if ($employee_policy) {
|
||||
foreach ($employee_policy as $existing_policy) {
|
||||
$emp_policy_data['id']= $existing_policy['id'];
|
||||
$emp_policy_data['updated_at'] = $formatted_date_time;
|
||||
$this->employeePolicyModel->save($emp_policy_data);
|
||||
}
|
||||
} else {
|
||||
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
||||
}
|
||||
|
||||
|
||||
//trigger
|
||||
$mail = $dataToInsert[$a]['email_corporate'];
|
||||
$subject = 'Welcome, Employee Benefit Program Enrolment';
|
||||
// $message = 'Dear ' . $dataToInsert[$a]['name'] . ",<br> We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer, <br><br><br> Click on the link below to review your personal and family details:<br><a href='https://venbait.in/nhance/app/dev'>Review Details</a>" ;
|
||||
$data['employee_name']=$dataToInsert[$a]['name'];
|
||||
$data['policy_name']=$policy['name'];
|
||||
|
||||
$message = view('mail_welcome', $data);
|
||||
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'send_email','payload' => ['mail' => $mail, 'subject' => $subject,'message'=> $message]]);
|
||||
// }
|
||||
|
||||
// print_r($r);//die();
|
||||
// $jobWorker = new JobWorker();
|
||||
//JobWorker::processJob($r);
|
||||
// $return_log = MailHelper::send_email($mail,$subject, $message);
|
||||
// $return_log = json_decode($return_log);
|
||||
// $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]);
|
||||
}
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -774,6 +774,7 @@ class EmployeeServiceController extends AdminController
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// insert or update in db for inception addition depent addition
|
||||
public function employeesOnboardProcess($params)
|
||||
{
|
||||
@ -891,5 +892,104 @@ class EmployeeServiceController extends AdminController
|
||||
}//function end
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
public function getExcelErrorData($file_id){
|
||||
|
||||
$file = $this->fileModel->find($file_id);
|
||||
$error_data = json_decode($file['reason']);
|
||||
|
||||
// return $error_data;
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
|
||||
//check the file exist or not
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
$error_message = "File not found";
|
||||
$this->myLogger->logme('error',($error_message . ' for file id ' . $file_id));
|
||||
}
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
// echo '<pre>';
|
||||
|
||||
if($error_data->error_type == 1){
|
||||
|
||||
$finalArray = [];
|
||||
foreach ($error_data->error_data as $key => $value) {
|
||||
|
||||
foreach ($value as $key2 => $value2) {
|
||||
$error_data = $value2->error;
|
||||
$data = ['value' => $excel_data[$key][$value2->col_idx], 'error'=>$error_data,];
|
||||
$excel_data[$key][$value2->col_idx] = $data;
|
||||
|
||||
}
|
||||
array_push($finalArray, $excel_data[$key]);
|
||||
}
|
||||
|
||||
foreach ($finalArray as $fkey => $value){
|
||||
foreach ($value as $vkey => $arrayData){
|
||||
if(!is_array($arrayData)){
|
||||
$data = ['value' => $arrayData];
|
||||
$finalArray[$fkey][$vkey] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$excelErrorData['excel_data'] = $finalArray;
|
||||
return $excelErrorData;
|
||||
|
||||
}else if($error_data->error_type == 2){
|
||||
|
||||
|
||||
$allErrors = [];
|
||||
$typeTowArray = [];
|
||||
|
||||
foreach ($error_data->error_data as $index => $item) {
|
||||
|
||||
foreach ($item as $field) {
|
||||
if (!isset($allErrors[$index])) {
|
||||
$allErrors[$index] = [];
|
||||
}
|
||||
$allErrors[$index] = array_merge($allErrors[$index], $field->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($allErrors as $key => $value){
|
||||
$data = ['value' => $excel_data[$key][1], 'error'=>$value,];
|
||||
$excel_data[$key][1] = $data;
|
||||
array_push($typeTowArray, $excel_data[$key]);
|
||||
}
|
||||
|
||||
foreach ($typeTowArray as $fkey => $value){
|
||||
foreach ($value as $vkey => $arrayData){
|
||||
if(!is_array($arrayData)){
|
||||
$data = ['value' => $arrayData];
|
||||
$typeTowArray[$fkey][$vkey] = $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$excelErrorData['excel_data'] = $typeTowArray;
|
||||
return $excelErrorData;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ class Home extends PublicController
|
||||
{
|
||||
public function index(): string
|
||||
{
|
||||
return view('welcome_message');
|
||||
return view('mail_welcome');
|
||||
}
|
||||
|
||||
public function test()
|
||||
|
||||
@ -14,7 +14,7 @@ class JobWorker extends AdminController
|
||||
* Constructs the class
|
||||
*/
|
||||
|
||||
private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController']];
|
||||
private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']];
|
||||
public function __construct()
|
||||
{
|
||||
// echo 'HiC';//die();
|
||||
@ -27,12 +27,39 @@ class JobWorker extends AdminController
|
||||
// }
|
||||
}
|
||||
|
||||
public static function processJobs(array $jobdata = [])
|
||||
{
|
||||
// echo 'listen';//die();
|
||||
$query = "
|
||||
SELECT id, name, payload, uuid
|
||||
FROM jobs
|
||||
WHERE status=?
|
||||
ORDER BY created_dt ASC";
|
||||
$where_condition = [self::STATUS_QUEUED];
|
||||
$db = \Config\Database::connect();
|
||||
$jobs = $db->query($query, $where_condition)->getResult();
|
||||
|
||||
if(count($jobs))
|
||||
{
|
||||
// echo count($jobs);
|
||||
// print_r($jobs);die;
|
||||
foreach($jobs as $key => $job)
|
||||
{
|
||||
// echo $job->id.' - '.$job->name;
|
||||
//sleep(1);
|
||||
|
||||
SELF::processjob(['id' => $job->id,'uuid' => $job->uuid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* process jobs
|
||||
*/
|
||||
public static function processJob(array $jobdata = [])
|
||||
{
|
||||
// echo 'listen';//die();
|
||||
// print_r($jobdata);
|
||||
// echo 'listen';
|
||||
// die();
|
||||
$query = "
|
||||
SELECT id, name, payload, uuid
|
||||
FROM jobs
|
||||
@ -61,7 +88,9 @@ class JobWorker extends AdminController
|
||||
|
||||
echo "\nProcessing job id - " . $job->id . "\n";
|
||||
echo "Job name - " . $job->name . "\n";
|
||||
|
||||
// print_r(SELF::$event_class_mapping);
|
||||
// echo array_key_exists($job->name,SELF::$event_class_mapping) ? 'mapped' : 'notmapped';
|
||||
// die();
|
||||
try
|
||||
{
|
||||
$start = microtime(true);
|
||||
@ -69,7 +98,7 @@ class JobWorker extends AdminController
|
||||
$job_status = self::STATUS_RUNNING;
|
||||
$db->query("UPDATE jobs SET status=? WHERE id=? AND uuid=?", [$job_status, $job->id,$job->uuid]);
|
||||
|
||||
if (!array_key_exists($job->name,SeLf::$event_class_mapping))
|
||||
if (!array_key_exists($job->name,SELF::$event_class_mapping))
|
||||
{
|
||||
throw new \RuntimeException('Job ' . $job->name . ' handler not registered');
|
||||
}
|
||||
@ -145,6 +174,7 @@ class JobWorker extends AdminController
|
||||
|
||||
// echo "Job $job->id $job_status. Response - $response \n";
|
||||
echo "Job $job->id $job_status \n";
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -15,8 +15,8 @@ class LoginController extends BaseController
|
||||
|
||||
public function index(){
|
||||
|
||||
// $session_data = ['isLoggedIn' => True ,'userid' => '4'];
|
||||
// set_session_data($session_data);
|
||||
$session_data = ['isLoggedIn' => True ,'userid' => '25'];
|
||||
set_session_data($session_data);
|
||||
// $isLoggedIn = check_session();
|
||||
$isLoggedIn = check_session();
|
||||
|
||||
@ -42,21 +42,23 @@ class LoginController extends BaseController
|
||||
if($user){
|
||||
if($user->is_active !== '0'){
|
||||
|
||||
$session_data = ['isLoggedIn' => True ,'userid' => $user->id];
|
||||
$session_data = ['isLoggedIn' => True ,'userid' => $user->id, 'userData' => $user];
|
||||
set_session_data($session_data);
|
||||
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
|
||||
log_message('error', 'User Login Sucessfully');
|
||||
$this->getUserDeviceInfo($user->id);
|
||||
|
||||
$this->getUserDeviceInfo($user->id, 'NhanceUser');
|
||||
return redirect()->to(base_url('/dashboard/view'));
|
||||
|
||||
}else{
|
||||
log_message('error', 'User Not Activate');
|
||||
session()->setFlashdata('error', 'User Not Activate');
|
||||
log_message('error', 'User Not Active');
|
||||
session()->setFlashdata('error', 'User Not Active');
|
||||
return redirect()->to(base_url('login'));
|
||||
}
|
||||
}else{
|
||||
log_message('error', 'User Not Found');
|
||||
session()->setFlashdata('error', 'User Not Found');
|
||||
|
||||
log_message('error', 'User Not Registered');
|
||||
session()->setFlashdata('error', 'User Not Registered');
|
||||
return redirect()->to(base_url('login'));
|
||||
}
|
||||
}
|
||||
@ -79,7 +81,7 @@ class LoginController extends BaseController
|
||||
}
|
||||
|
||||
|
||||
public function getUserDeviceInfo($userId){
|
||||
public function getUserDeviceInfo($userId, $type_of_user){
|
||||
|
||||
// Load the UserAgent library
|
||||
$userAgent = $this->request->getUserAgent();
|
||||
@ -93,16 +95,19 @@ class LoginController extends BaseController
|
||||
// Get the user's IP address
|
||||
$ipAddress = $this->request->getIPAddress();
|
||||
|
||||
|
||||
$datd = [
|
||||
'user_id' => $userId,
|
||||
'user_id' => $userId,
|
||||
'user_type' => $type_of_user,
|
||||
'ip' => $ipAddress,
|
||||
'platform' => $platform,
|
||||
'broswer' => $browser,
|
||||
];
|
||||
|
||||
// print_r($datd);
|
||||
// die();
|
||||
$AuthHistoryModel = new AuthHistoryModel;
|
||||
$insertAuthHistory = $AuthHistoryModel->insert($datd);
|
||||
|
||||
return $datd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -4,8 +4,12 @@
|
||||
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\LoginController;
|
||||
use App\Helpers\DepositHelper;
|
||||
use App\Helpers\JWTToken;
|
||||
use App\Helpers\HttpRequestHelper;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
@ -15,7 +19,8 @@ use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
use App\Models\AuthHistoryModel;
|
||||
use App\Models\LevelContactModel;
|
||||
|
||||
use Firebase\JWT\JWT;
|
||||
// require_once('../vendor/autoload.php');
|
||||
@ -28,6 +33,8 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
protected $myLogger;
|
||||
protected $employeeModel;
|
||||
protected $authHistoryModel;
|
||||
protected $hrModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -36,6 +43,8 @@ class RestAuthenticationController extends AdminController
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->authHistoryModel = new AuthHistoryModel();
|
||||
$this->hrModel = new LevelContactModel();
|
||||
|
||||
}
|
||||
|
||||
@ -60,17 +69,23 @@ class RestAuthenticationController extends AdminController
|
||||
{
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
|
||||
$randomNumber = rand(100000, 999999);
|
||||
$randomNumber = 123456;
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||
|
||||
if ($employeeData) {
|
||||
$result = ['user_verification' => true];
|
||||
return ['status' => 'success','code' => 200,'data' => $result];
|
||||
$id= $employeeData["id"];
|
||||
$otp = $this->employeeModel->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 ['status' => 'failed','code' => 404,'data' => $result];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return ['status' => 'failed','code' => 505,'data' => $th];
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,16 +94,95 @@ class RestAuthenticationController extends AdminController
|
||||
{
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$otp = $this->request->getJSON()->otp;
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->first();
|
||||
if ($employeeData) {
|
||||
if ($employeeData && $otp == $employeeData["otp"]) {
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$data = [
|
||||
'user_id' => $employeeData['id'],
|
||||
'user_type' => 'employee',
|
||||
'ip' => $auth['ip'],
|
||||
'platform' => $auth['platform'],
|
||||
'broswer' => $auth['browser'],
|
||||
];
|
||||
|
||||
$authdata= $this->authHistoryModel->insert($data);
|
||||
|
||||
}
|
||||
$otp_null = $this->employeeModel->where('id', $employeeData["id"])->set('otp', null)->update();
|
||||
|
||||
|
||||
|
||||
$result = JWTToken::encode($employeeData);
|
||||
return ['status' => 'success','code' => 200,'data' => $result];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
return ['status' => 'failed','code' => 404,'data' => "No data"];
|
||||
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 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 ['status' => 'failed','code' => 500,'data' => $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['0']);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
10
app/Controllers/SwaggerController.php
Normal file
10
app/Controllers/SwaggerController.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
class SwaggerController extends BaseController
|
||||
{
|
||||
public function index(){
|
||||
return view('swagger/index');
|
||||
}
|
||||
}
|
||||
@ -18,7 +18,15 @@ class AuthJWT implements FilterInterface
|
||||
{
|
||||
public function before(RequestInterface $request, $arguments = null)
|
||||
{
|
||||
$jwt = $request->getHeader('Authorization');
|
||||
|
||||
$jwt ='';
|
||||
|
||||
if($request->headers()['Auth']){
|
||||
$jwt = $request->headers()['Auth'];
|
||||
}else{
|
||||
$jwt = $request->getHeader('Authorization');
|
||||
}
|
||||
|
||||
|
||||
if ($jwt) {
|
||||
if (JWTToken::validateJWT($jwt)) {
|
||||
|
||||
@ -16,7 +16,6 @@ use ReflectionClass;
|
||||
|
||||
class JWTToken
|
||||
{
|
||||
|
||||
public static function encode($data =null)
|
||||
{
|
||||
$secret_Key="secret";
|
||||
@ -44,6 +43,7 @@ class JWTToken
|
||||
{
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
|
||||
// print_r($jwtParts);
|
||||
if (count($jwtParts) != 2 || $jwtParts[0] == 'Bearer') {
|
||||
return false;
|
||||
}
|
||||
|
||||
41
app/Helpers/MailHelper.php
Normal file
41
app/Helpers/MailHelper.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\SMTP;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
|
||||
class MailHelper
|
||||
{
|
||||
public static function send_email($params)
|
||||
{
|
||||
$emaill = $params['mail'];
|
||||
$subject = $params['subject'];
|
||||
$message = $params['message'];
|
||||
try {
|
||||
$email = \Config\Services::email();
|
||||
$email->setMailType('html');
|
||||
$email->setFrom('bbone@venbait.in', 'Nhance');
|
||||
|
||||
$email->setTo($emaill);
|
||||
|
||||
$email->setSubject($subject);
|
||||
$email->setMessage($message);
|
||||
|
||||
if ($email->send()) {
|
||||
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...','data' => $emaill,],200);
|
||||
} else {
|
||||
return json_encode(['status' => 'failed','code' => 404,'message'=>'Email Sent Failed...','data' => $emaill ],404);
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
387
app/Helpers/excel_import_export_helper.php
Normal file
387
app/Helpers/excel_import_export_helper.php
Normal file
@ -0,0 +1,387 @@
|
||||
<?php
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
|
||||
|
||||
if (!function_exists('generate_random_string')) {
|
||||
/**
|
||||
* Generate a random string of specified length and type.
|
||||
*
|
||||
* @param int $length The length of the random string.
|
||||
* @param string $type (optional) The type of characters to include in the random string.
|
||||
* Possible values: 'numeric', 'alphabetic', 'alphanumeric'.
|
||||
* Default is 'numeric'.
|
||||
*
|
||||
* @return string The generated random string.
|
||||
*/
|
||||
function generate_random_string($length, $type = 'numeric') {
|
||||
$characters = '';
|
||||
|
||||
// Define character sets based on the type
|
||||
switch ($type) {
|
||||
case 'numeric':
|
||||
$characters = '0123456789';
|
||||
break;
|
||||
case 'alphabetic':
|
||||
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
break;
|
||||
case 'alphanumeric':
|
||||
default:
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
break;
|
||||
}
|
||||
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
|
||||
// Generate random string
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
|
||||
return $randomString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('generate_excel')) {
|
||||
|
||||
/*
|
||||
This function generates an Excel file using the given headers and data and saves it with the specified filename.
|
||||
It utilizes the PhpSpreadsheet library to create and manipulate Excel files.
|
||||
|
||||
Parameters:
|
||||
- $headers: An array containing the column headers for the Excel sheet.
|
||||
- $data: An array containing the data to be inserted into the Excel sheet.
|
||||
- $filename: The name of the file to be saved.
|
||||
- $totals (optional): A flag indicating whether to include total calculations in the Excel sheet.
|
||||
*/
|
||||
|
||||
|
||||
function generate_excel($headers, $data, $filename, $totals = null)
|
||||
{
|
||||
// Create new Spreadsheet object
|
||||
$spreadsheet = new Spreadsheet();
|
||||
|
||||
// Set worksheet title
|
||||
$spreadsheet->getActiveSheet()->setTitle('Sheet 1');
|
||||
|
||||
// Set headers into the spreadsheet
|
||||
$spreadsheet->getActiveSheet()->fromArray([$headers], null, 'A1');
|
||||
|
||||
// Set data into the spreadsheet
|
||||
$spreadsheet->getActiveSheet()->fromArray($data, null, 'A2');
|
||||
|
||||
if($totals == 1){
|
||||
// Call the helper function for Calculate GST, Pro Rata Premium, and Total sums for inception
|
||||
add_totals_row($spreadsheet, $data);
|
||||
}else if($totals == 2){
|
||||
add_totals_for_deletion($spreadsheet, $data);
|
||||
}
|
||||
|
||||
// Create Excel writer
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
|
||||
try {
|
||||
// Save Excel file to the specified path
|
||||
$writer->save($filename);
|
||||
return true; // Return true if file was successfully saved
|
||||
} catch (\Exception $e) {
|
||||
// Log or handle the exception
|
||||
return false; // Return false if there was an error saving the file
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! function_exists('transform_objects_to_array_for_inception')) {
|
||||
function transform_objects_to_array_for_inception($objects) {
|
||||
|
||||
// Define an array to store the transformed data
|
||||
$data = [];
|
||||
$TPAID = "";
|
||||
$UHID = "";
|
||||
|
||||
// Initialize serial number
|
||||
$serialNumber = 1;
|
||||
|
||||
// Iterate through each object
|
||||
foreach ($objects as $obj) {
|
||||
// Extract all values for the object
|
||||
$rowData = [
|
||||
$serialNumber++, // Serial Number
|
||||
$obj->emp_name, // Employee Name
|
||||
$obj->emp_code, // Employee Code
|
||||
$obj->emp_type, // Employee Type
|
||||
$obj->emp_relationship_code, // Relationship Code
|
||||
$obj->emp_dob, // Date of Birth
|
||||
$obj->emp_gender, // Employee Gender
|
||||
$obj->pre_existing_alignments, // Pre-existing Alignments
|
||||
$obj->basic_cover_si, // Basic Cover SI
|
||||
$obj->date_coverage, // Date Coverage
|
||||
$obj->emp_age, // Employee Age
|
||||
$obj->emp_relationship, // Employee Relationship
|
||||
$obj->change_event, // Change Event
|
||||
$obj->policy_end_date, // Policy End Date
|
||||
$obj->days, // Days
|
||||
$TPAID, //EMPTY FIELD FOR TPA ID
|
||||
$UHID, //EMPTY FIELD FOR UHID
|
||||
$obj->premium, // Premium
|
||||
$obj->rata_premimum, // Rata Premium
|
||||
$obj->gst, // GST
|
||||
$obj->total // Total
|
||||
];
|
||||
|
||||
// Append the row data to the main data array
|
||||
$data[] = $rowData;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! function_exists('transform_objects_to_array_for_correction')) {
|
||||
function transform_objects_to_array_for_correction($objects) {
|
||||
|
||||
// Define an array to store the transformed data
|
||||
$data = [];
|
||||
$endorsement_id = "";
|
||||
|
||||
// Iterate through each object
|
||||
foreach ($objects as $obj) {
|
||||
// Extract all values for the object
|
||||
$rowData = [
|
||||
$obj->emp_code,
|
||||
$obj->uhid,
|
||||
$obj->emp_name,
|
||||
$obj->emp_type,
|
||||
$obj->relationship_code,
|
||||
$obj->emp_dob,
|
||||
$obj->emp_gender,
|
||||
$obj->old_value,
|
||||
$obj->new_value,
|
||||
$obj->remarks,
|
||||
$endorsement_id,
|
||||
];
|
||||
|
||||
// Append the row data to the main data array
|
||||
$data[] = $rowData;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! function_exists('transform_objects_to_array_for_si_enhancement')) {
|
||||
function transform_objects_to_array_for_si_enhancement($objects) {
|
||||
|
||||
// Define an array to store the transformed data
|
||||
$data = [];
|
||||
$endorsement_id = "";
|
||||
|
||||
// Initialize serial number
|
||||
$serialNumber = 1;
|
||||
|
||||
// Iterate through each object
|
||||
foreach ($objects as $obj) {
|
||||
// Extract all values for the object
|
||||
$rowData = [
|
||||
$serialNumber++,
|
||||
$obj->emp_name,
|
||||
$obj->emp_code,
|
||||
$obj->emp_type,
|
||||
$obj->emp_relationship_code,
|
||||
$obj->emp_dob,
|
||||
$obj->emp_gender,
|
||||
$obj->pre_existing_alignments,
|
||||
$obj->new_basic_cover_si,
|
||||
$obj->old_basic_cover_si,
|
||||
$obj->date_of_coverage,
|
||||
$obj->policy_end_date,
|
||||
$obj->no_of_days,
|
||||
$obj->old_si_premium,
|
||||
$obj->new_si_premium,
|
||||
$obj->difference_premium,
|
||||
$obj->pro_rata_premimum,
|
||||
$obj->gst,
|
||||
$obj->total ,
|
||||
$endorsement_id,
|
||||
];
|
||||
|
||||
// Append the row data to the main data array
|
||||
$data[] = $rowData;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! function_exists('transform_objects_to_array_for_deletion')) {
|
||||
function transform_objects_to_array_for_deletion($objects) {
|
||||
|
||||
// Define an array to store the transformed data
|
||||
$data = [];
|
||||
$claim_status = "";
|
||||
$endorsement_id = "";
|
||||
|
||||
// Initialize serial number
|
||||
$serialNumber = 1;
|
||||
|
||||
// Iterate through each object
|
||||
foreach ($objects as $obj) {
|
||||
// Extract all values for the object
|
||||
$rowData = [
|
||||
$serialNumber++,
|
||||
$obj->emp_code,
|
||||
$obj->emp_name,
|
||||
$obj->emp_dob,
|
||||
$obj->emp_gender,
|
||||
$obj->emp_relationship,
|
||||
$obj->basic_cover_si,
|
||||
$obj->dateofexit,
|
||||
$obj->policy_end_date,
|
||||
$obj->no_of_days,
|
||||
$obj->premium,
|
||||
$obj->pro_rata_premium,
|
||||
$obj->gst,
|
||||
$obj->total,
|
||||
$claim_status,
|
||||
$endorsement_id
|
||||
|
||||
];
|
||||
|
||||
// Append the row data to the main data array
|
||||
$data[] = $rowData;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('add_totals_row')) {
|
||||
function add_totals_row(Spreadsheet $spreadsheet, array $data)
|
||||
{
|
||||
// Calculate GST, Pro Rata Premium, and Total sums
|
||||
$gstSum = 0;
|
||||
$proRataPremiumSum = 0;
|
||||
$totalSum = 0;
|
||||
|
||||
foreach ($data as $row) {
|
||||
$gstSum += $row[18];
|
||||
$proRataPremiumSum += $row[19];
|
||||
$totalSum += $row[20];
|
||||
}
|
||||
|
||||
// Add a new row with sums
|
||||
$lastRow = count($data) + 1; // To get the last row number
|
||||
$spreadsheet->getActiveSheet()->setCellValue('R' . ($lastRow + 1), 'TOTALS');
|
||||
$spreadsheet->getActiveSheet()->setCellValue('S' . ($lastRow + 1), $gstSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('T' . ($lastRow + 1), $proRataPremiumSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('U' . ($lastRow + 1), $totalSum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('add_totals_for_deletion')) {
|
||||
function add_totals_for_deletion(Spreadsheet $spreadsheet, array $data)
|
||||
{
|
||||
// Calculate GST, Pro Rata Premium, and Total sums
|
||||
$gstSum = 0;
|
||||
$proRataPremiumSum = 0;
|
||||
$totalSum = 0;
|
||||
|
||||
foreach ($data as $row) {
|
||||
$proRataPremiumSum += $row[11];
|
||||
$gstSum += $row[12];
|
||||
$totalSum += $row[13];
|
||||
}
|
||||
|
||||
// Add a new row with sums
|
||||
$lastRow = count($data) + 1; // To get the last row number
|
||||
$spreadsheet->getActiveSheet()->setCellValue('K' . ($lastRow + 1), 'TOTALS');
|
||||
$spreadsheet->getActiveSheet()->setCellValue('L' . ($lastRow + 1), $proRataPremiumSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('M' . ($lastRow + 1), $gstSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('N' . ($lastRow + 1), $totalSum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('read_excel_file_to_array')) {
|
||||
function read_excel_file_to_array($file)
|
||||
{
|
||||
// Load the Excel file
|
||||
$spreadsheet = IOFactory::load($file);
|
||||
|
||||
// Get the active sheet
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
// Get the highest row and column numbers
|
||||
$highestRow = $sheet->getHighestRow();
|
||||
$highestColumn = $sheet->getHighestColumn();
|
||||
|
||||
$data = [];
|
||||
|
||||
// Iterate through each row
|
||||
for ($row = 1; $row <= $highestRow; $row++) {
|
||||
// Initialize the row data array
|
||||
$rowData = [];
|
||||
|
||||
// Iterate through each column in the row
|
||||
for ($col = 'A'; $col <= $highestColumn; $col++) {
|
||||
// Get the cell value
|
||||
$value = $sheet->getCell($col . $row)->getValue();
|
||||
|
||||
// Add the cell value to the row data array
|
||||
$rowData[] = $value;
|
||||
}
|
||||
|
||||
// Add the row data to the main data array
|
||||
$data[] = $rowData;
|
||||
}
|
||||
|
||||
// Return the array containing data from the Excel file
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// app/Helpers/filename_helper.php
|
||||
|
||||
if (! function_exists('generate_filename')) {
|
||||
function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name) {
|
||||
|
||||
$evenTypeLabel = '';
|
||||
if($event_type == 'inception'){
|
||||
$evenTypeLabel = 'I';
|
||||
}else if($event_type == 'deletion'){
|
||||
$evenTypeLabel = 'D';
|
||||
}else if($event_type == 'correction'){
|
||||
$evenTypeLabel = 'C';
|
||||
}else if($event_type == 'si_enhancement'){
|
||||
$evenTypeLabel = 'SI';
|
||||
}
|
||||
|
||||
$insurer_or_tpa_lable = "";
|
||||
if($insurer_or_tpa == 'insurer'){
|
||||
$insurer_or_tpa_lable = 'I';
|
||||
}else if($insurer_or_tpa == 'tpa'){
|
||||
$insurer_or_tpa_lable = 'T';
|
||||
}
|
||||
|
||||
$actions = 'E';
|
||||
$currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||
$formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s');
|
||||
$policy_name = str_replace(' ', '_', $policy_name);
|
||||
|
||||
// Generate file name
|
||||
$file_name = $client_short_name. '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx';
|
||||
return $file_name;
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,15 @@ if (!function_exists('get_session_userid')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_session_userdata')) {
|
||||
function get_session_userdata()
|
||||
{
|
||||
// $ci =& get_instance();
|
||||
$session = \Config\Services::session();
|
||||
return $session->get('userData');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_session_user')) {
|
||||
function get_session_user()
|
||||
{
|
||||
|
||||
@ -44,32 +44,53 @@ if (!function_exists('change_date_format')) {
|
||||
}
|
||||
|
||||
if (!function_exists('file_Upload')) {
|
||||
|
||||
function file_Upload($fileToUpload, $imageDetails = null)
|
||||
{
|
||||
$fileName = $fileToUpload->getClientName();
|
||||
if ($fileToUpload !== NULL && $fileName !== "") {
|
||||
// Retrieve the name of the file
|
||||
$fileName = $fileToUpload->getName();
|
||||
|
||||
// Check if the file is not null and has a name
|
||||
if ($fileToUpload !== null && $fileName !== "") {
|
||||
// Check if the file is valid and has not been moved already
|
||||
if ($fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
|
||||
// Check if the image exists in the upload folder
|
||||
$existingImagePath = ROOTPATH . 'public/uploads/' . $imageDetails; // Adjust filename field based on your database structure
|
||||
// Construct the path where the image should exist
|
||||
$existingImagePath = ROOTPATH . 'public/uploads/logo/' . $imageDetails;
|
||||
|
||||
// Check if imageDetails is not null and if the image exists in the upload folder
|
||||
if ($imageDetails !== null && file_exists($existingImagePath)) {
|
||||
// If the image exists, delete it
|
||||
unlink($existingImagePath);
|
||||
}
|
||||
|
||||
|
||||
// Move the new image to the upload folder
|
||||
$fileToUpload->move(ROOTPATH . 'public/uploads', $fileName);
|
||||
$fileToUpload->move(ROOTPATH . 'public/uploads/logo', $fileName);
|
||||
}
|
||||
} else {
|
||||
// Set fileName to empty string if file is null or doesn't have a name
|
||||
$fileName = "";
|
||||
}
|
||||
|
||||
// Return the file name
|
||||
return $fileName;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('compressImage')) {
|
||||
function compressImage($file, $destinationPath, $newWidth = 100, $newHeight = 100)
|
||||
{
|
||||
// Load the image manipulation library
|
||||
$image = \Config\Services::image();
|
||||
|
||||
// Resize and compress the image
|
||||
$image->withFile($file)
|
||||
->fit($newWidth, $newHeight, 'center')
|
||||
->save($destinationPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('fancy_date_time_format'))
|
||||
{
|
||||
function fancy_date_time_format($datetime,$return_type = 'fancy') {
|
||||
|
||||
@ -10,6 +10,7 @@ class AuthHistoryModel extends Model
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"user_id",
|
||||
"user_type",
|
||||
"ip",
|
||||
"platform",
|
||||
"broswer",
|
||||
|
||||
25
app/Models/BatchFileModel.php
Normal file
25
app/Models/BatchFileModel.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class BatchFileModel extends Model
|
||||
{
|
||||
protected $table = 'batch_files';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'client_id',
|
||||
'client_policy_id',
|
||||
'batch_code',
|
||||
'file_name',
|
||||
'insurer_or_tpa',
|
||||
'event_type',
|
||||
'actions',
|
||||
'count',
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
}
|
||||
20
app/Models/BatchListModel.php
Normal file
20
app/Models/BatchListModel.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class BatchListModel extends Model
|
||||
{
|
||||
protected $table = 'batch_list';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'emp_policy_id',
|
||||
'batch_code',
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
}
|
||||
@ -21,6 +21,8 @@ class ClientModel extends Model
|
||||
"city",
|
||||
"state",
|
||||
"pincode",
|
||||
"is_download_btn",
|
||||
"client_logo",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
|
||||
@ -32,6 +32,8 @@ class ClientPolicyModel extends Model
|
||||
"earned_premium_amount",
|
||||
"claims_incurred_amount",
|
||||
"policy_terms",
|
||||
"open_for_enrollment",
|
||||
"is_addon",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"Is_active",
|
||||
@ -228,5 +230,4 @@ public function getDepositlistsummary($id)
|
||||
->getResult();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -15,6 +15,9 @@ class EmployeeModel extends Model
|
||||
"change_event",
|
||||
"relationship",
|
||||
"relationship_code",
|
||||
"relationship_id",
|
||||
"relationship",
|
||||
"batch_id",
|
||||
"emp_code",
|
||||
"name",
|
||||
"email_personal",
|
||||
@ -25,14 +28,18 @@ class EmployeeModel extends Model
|
||||
"doj",
|
||||
"basic_pay",
|
||||
"band","designation",
|
||||
"otp",
|
||||
"family_floater_key",
|
||||
"emp_status",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"updated_at",
|
||||
"is_active",
|
||||
"file_id"
|
||||
];
|
||||
|
||||
|
||||
|
||||
// for emp onboard process do not change
|
||||
public function checkExistingEmp($arr)
|
||||
{
|
||||
@ -76,4 +83,24 @@ class EmployeeModel extends Model
|
||||
|
||||
return ($result);
|
||||
}
|
||||
|
||||
|
||||
public function getEmployeePolicy($id)
|
||||
{
|
||||
|
||||
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.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('policies', 'policies.id = client_policy.policy_id')
|
||||
->where('employee_polices.employee_id', $id)
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
// for EMP rest API process do not change
|
||||
public function checkExistingEmployee($arr)
|
||||
{
|
||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->where('client_id', $arr['client_id'])->first();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,17 +14,22 @@ class EmployeePolicyModel extends Model
|
||||
"client_policy_id",
|
||||
"tpa_id",
|
||||
"uhid",
|
||||
"batch_id",
|
||||
"status",
|
||||
"pre_existing_alignments",
|
||||
"date_of_exit",
|
||||
"reason_for_exit",
|
||||
"basic_cover_si",
|
||||
"date_coverage",
|
||||
"policy_end_date",
|
||||
"days",
|
||||
"premium",
|
||||
"rata_premimum",
|
||||
"si_enhancement_date",
|
||||
"gst",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"updated_at",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
@ -46,6 +51,7 @@ class EmployeePolicyModel extends Model
|
||||
return ($result);
|
||||
}
|
||||
|
||||
|
||||
//for emp onboard do not change
|
||||
public function checkExistingEmpPolicy($arr)
|
||||
{
|
||||
@ -53,4 +59,427 @@ class EmployeePolicyModel extends Model
|
||||
->where('client_policy_id',$arr['client_policy_id'])
|
||||
->find();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
public function getInceptionEmployeeDataForExportExcel($client_policy_id, $insurer_or_tpa, $event_type)
|
||||
{
|
||||
return $this->db->table('employee_polices')
|
||||
->select('employees.name AS emp_name,
|
||||
employees.emp_code AS emp_code,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.change_event AS change_event,
|
||||
employees.relationship AS emp_relationship,
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||
"Has Define" as emp_type,
|
||||
|
||||
employee_polices.id as primaryKey,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.date_coverage,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.days,
|
||||
employee_polices.premium,
|
||||
employee_polices.rata_premimum,
|
||||
employee_polices.gst,
|
||||
(employee_polices.rata_premimum + employee_polices.gst) AS total,
|
||||
batch_data.emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->join("(
|
||||
SELECT
|
||||
batch_list.emp_policy_id,
|
||||
batch_list.batch_code as bl,
|
||||
batch_files.batch_code as bf
|
||||
FROM batch_files
|
||||
LEFT JOIN batch_list ON batch_files.batch_code = batch_list.batch_code
|
||||
WHERE batch_files.event_type = 'inception'
|
||||
AND batch_files.actions = 'export'
|
||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}') as batch_data", 'employee_polices.id = batch_data.emp_policy_id', 'left')
|
||||
->where('batch_data.bf', null)
|
||||
->where('batch_data.bl', null)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
|
||||
public function getCorrectionEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa)
|
||||
{
|
||||
|
||||
$sql = "
|
||||
SELECT DISTINCT
|
||||
emp_endorsement.id,
|
||||
emp_endorsement.pk,
|
||||
emp_endorsement.emp_code,
|
||||
emp_endorsement.endorsement_id,
|
||||
emp_endorsement.old_value,
|
||||
emp_endorsement.new_value,
|
||||
emp_endorsement.field_name,
|
||||
emp_endorsement.remarks,
|
||||
emp_endorsement.actions,
|
||||
employees.id AS primaryKey,
|
||||
employees.name AS emp_name,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.client_id AS emp_client_id,
|
||||
'Has Define' AS emp_type,
|
||||
employee_polices.uhid,
|
||||
employees.relationship_code,
|
||||
batch_data.emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code
|
||||
|
||||
FROM
|
||||
emp_endorsement
|
||||
LEFT JOIN
|
||||
employees ON employees.id = emp_endorsement.pk
|
||||
LEFT JOIN
|
||||
employee_polices ON employees.id = employee_polices.employee_id
|
||||
LEFT JOIN (
|
||||
SELECT batch_list.emp_policy_id,
|
||||
batch_list.batch_code AS bl,
|
||||
batch_files.batch_code AS bf
|
||||
FROM
|
||||
batch_files
|
||||
LEFT JOIN
|
||||
batch_list ON batch_files.batch_code = batch_list.batch_code
|
||||
WHERE batch_files.event_type = 'correction'
|
||||
AND batch_files.actions = 'export'
|
||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||
) AS batch_data ON emp_endorsement.pk = batch_data.emp_policy_id
|
||||
|
||||
WHERE batch_data.bf IS NULL
|
||||
AND batch_data.bl IS NULL
|
||||
AND employees.client_id = '{$client_id}'
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND emp_endorsement.actions = 'c'
|
||||
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
||||
|
||||
// Execute the raw query
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
// Get the result set
|
||||
$result = $query->getResult();
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getSIEnhancementEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa){
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
employee_polices.id AS primaryKey,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code AS emp_code,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
'Has Define' AS emp_type,
|
||||
employee_polices.uhid AS risk_id,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.basic_cover_si as old_basic_cover_si,
|
||||
employee_polices.premium as old_si_premium,
|
||||
batch_data.emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code,
|
||||
sidata.new_basic_cover_si,
|
||||
sidata.new_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||
sidata.new_si_premium - employee_polices.premium AS difference_premium,
|
||||
ROUND((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
|
||||
ROUND(((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||
((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total
|
||||
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN
|
||||
employees ON employees.emp_code = a.emp_code
|
||||
LEFT JOIN
|
||||
employee_polices ON employees.id = employee_polices.employee_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
aa.emp_code,
|
||||
aa.new_value as 'new_basic_cover_si',
|
||||
bb.new_value as 'new_si_premium',
|
||||
cc.new_value as 'date_of_coverage'
|
||||
FROM (
|
||||
SELECT
|
||||
a1.emp_code,
|
||||
a1.field_name,
|
||||
a1.new_value
|
||||
FROM
|
||||
emp_endorsement as a1
|
||||
WHERE
|
||||
a1.field_name = 'basic_cover_si'
|
||||
) aa
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
b1.emp_code,
|
||||
b1.field_name,
|
||||
b1.new_value
|
||||
FROM
|
||||
emp_endorsement as b1
|
||||
WHERE
|
||||
b1.field_name = 'premium'
|
||||
) bb ON aa.emp_code = bb.emp_code
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
c1.emp_code,
|
||||
c1.field_name,
|
||||
c1.new_value
|
||||
FROM
|
||||
emp_endorsement as c1
|
||||
WHERE
|
||||
c1.field_name = 'si_enhancement_date'
|
||||
) cc ON aa.emp_code = cc.emp_code
|
||||
) as sidata ON a.emp_code = sidata.emp_code
|
||||
LEFT JOIN (
|
||||
SELECT DISTINCT
|
||||
batch_list.emp_policy_id,
|
||||
batch_list.batch_code AS bl,
|
||||
batch_files.batch_code AS bf
|
||||
FROM
|
||||
batch_files
|
||||
LEFT JOIN
|
||||
batch_list ON batch_files.batch_code = batch_list.batch_code
|
||||
WHERE
|
||||
batch_files.event_type = 'si_enhancement'
|
||||
AND batch_files.actions = 'export'
|
||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||
) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
WHERE
|
||||
batch_data.bf IS NULL
|
||||
AND batch_data.bl IS NULL
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employee_polices.is_active = '1'
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||
AND a.field_name = 'si_enhancement_date'
|
||||
");
|
||||
|
||||
// Get the result set
|
||||
$results = $query->getResult();
|
||||
return $results;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getDeletionEmployeeDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa){
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
employee_polices.id as primaryKey,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code AS emp_code,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.relationship AS emp_relationship,
|
||||
'Has Define' as emp_type,
|
||||
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.uhid as risk_id,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.premium,
|
||||
|
||||
batch_data.emp_policy_id AS emp_policy_id,
|
||||
batch_data.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code,
|
||||
|
||||
deletiondata.empstatus,
|
||||
deletiondata.changeevent,
|
||||
deletiondata.dateofexit,
|
||||
deletiondata.reasonforexit,
|
||||
deletiondata.status,
|
||||
|
||||
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) AS no_of_days,
|
||||
ROUND((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium,
|
||||
ROUND(((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst,
|
||||
ROUND(((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN
|
||||
employees ON a.emp_code = employees.emp_code
|
||||
LEFT JOIN
|
||||
employee_polices ON employees.id = employee_polices.employee_id
|
||||
|
||||
LEFT JOIN(
|
||||
|
||||
select aa.emp_code, aa.new_value as 'empstatus', bb.new_value as 'changeevent', cc.new_value as 'dateofexit', dd.new_value as 'reasonforexit', ee.new_value as 'status' from
|
||||
|
||||
( SELECT a1.emp_code, a1.field_name, a1.new_value from emp_endorsement as a1 where a1.field_name = 'emp_status') aa
|
||||
left join
|
||||
( SELECT b1.emp_code, b1.field_name, b1.new_value from emp_endorsement as b1 where b1.field_name = 'change_event') bb on aa.emp_code = bb.emp_code
|
||||
left join
|
||||
( SELECT c1.emp_code, c1.field_name, c1.new_value from emp_endorsement as c1 where c1.field_name = 'date_of_exit') cc on aa.emp_code = cc.emp_code
|
||||
left join
|
||||
( SELECT d1.emp_code, d1.field_name, d1.new_value from emp_endorsement as d1 where d1.field_name = 'reason_for_exit') dd on aa.emp_code = dd.emp_code
|
||||
left JOIN
|
||||
( SELECT e1.emp_code, e1.field_name, e1.new_value from emp_endorsement as e1 where e1.field_name = 'status') ee on aa.emp_code = ee.emp_code
|
||||
|
||||
) as deletiondata on a.emp_code = deletiondata.emp_code
|
||||
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
batch_list.emp_policy_id,
|
||||
batch_list.batch_code AS bl,
|
||||
batch_files.batch_code AS bf
|
||||
FROM
|
||||
batch_files
|
||||
LEFT JOIN
|
||||
batch_list ON batch_files.batch_code = batch_list.batch_code
|
||||
WHERE
|
||||
batch_files.event_type = 'deletion'
|
||||
AND batch_files.actions = 'export'
|
||||
AND batch_files.insurer_or_tpa = 'insurer'
|
||||
) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
WHERE
|
||||
batch_data.bf IS NULL
|
||||
AND batch_data.bl IS NULL
|
||||
AND employee_polices.client_policy_id = 12
|
||||
AND employee_polices.is_active = 1
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status'
|
||||
");
|
||||
|
||||
$result = $query->getResult();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updateTPAIDorUHID( $client_policy_id, $client_id, $name, $emp_code, $uhid, $tpa_id)
|
||||
{
|
||||
|
||||
// $this->table('employee_polices')
|
||||
// ->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
// ->set('employee_polices.tpa_id', $tpa_id)
|
||||
// ->set('employee_polices.uhid', $uhid)
|
||||
// ->where('employees.emp_code', $emp_code)
|
||||
// ->where('employees.name', $name)
|
||||
// ->where('employees.client_id', $client_id)
|
||||
// ->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
// ->update();
|
||||
|
||||
$query = "UPDATE employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
SET employee_polices.tpa_id = '{$tpa_id}',
|
||||
employee_polices.uhid = '{$uhid}'
|
||||
WHERE employees.emp_code = '{$emp_code}'
|
||||
AND employees.name = '{$name}'
|
||||
AND employees.client_id = '{$client_id}'
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'";
|
||||
|
||||
$this->query($query);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updateCorrectionData($emp_code, $uhid, $endorsement_id){
|
||||
|
||||
$sql = "
|
||||
UPDATE emp_endorsement
|
||||
JOIN employees ON employees.id = emp_endorsement.pk
|
||||
JOIN employee_polices ON employees.id = employee_polices.employee_id
|
||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
||||
WHERE employees.emp_code = '$emp_code'
|
||||
AND employee_polices.uhid = '$uhid'
|
||||
";
|
||||
$query = $this->query($sql);
|
||||
}
|
||||
|
||||
|
||||
public function updateEndoresmentIdForSIEnhancement($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id){
|
||||
|
||||
$sql = "
|
||||
UPDATE emp_endorsement
|
||||
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
||||
JOIN employees ON employee_polices.employee_id = employees.id
|
||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
||||
WHERE employees.emp_code = '$emp_code'
|
||||
AND employees.client_id = '$client_id'
|
||||
AND employee_polices.client_policy_id = '$client_policy_id'
|
||||
AND employees.name = '$emp_name'
|
||||
";
|
||||
$query = $this->query($sql);
|
||||
}
|
||||
|
||||
|
||||
public function updateEndoresmentIdForDeletion($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id){
|
||||
|
||||
$sql = "
|
||||
UPDATE emp_endorsement
|
||||
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
||||
JOIN employees ON employee_polices.employee_id = employees.id
|
||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
||||
WHERE employees.emp_code = '$emp_code'
|
||||
AND employees.client_id = '$client_id'
|
||||
AND employee_polices.client_policy_id = '$client_policy_id'
|
||||
AND employees.name = '$emp_name'
|
||||
";
|
||||
$query = $this->query($sql);
|
||||
}
|
||||
|
||||
|
||||
public function fetchEmpEndorsementData($emp_code, $client_policy_id, $emp_name)
|
||||
{
|
||||
// Your raw SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
ep.id,
|
||||
MAX(CASE WHEN ee.field_name = 'date_of_exit' THEN ee.new_value END) AS date_of_exit,
|
||||
MAX(CASE WHEN ee.field_name = 'reason_for_exit' THEN ee.new_value END) AS reason_for_exit,
|
||||
MAX(CASE WHEN ee.field_name = 'status' THEN ee.new_value END) AS status
|
||||
FROM
|
||||
emp_endorsement AS ee
|
||||
JOIN
|
||||
employee_polices AS ep ON ep.id = ee.pk
|
||||
WHERE
|
||||
ee.emp_code = '$emp_code'
|
||||
AND ep.client_policy_id = $client_policy_id
|
||||
AND ee.name = '$emp_name'
|
||||
AND ee.field_name IN ('date_of_exit', 'reason_for_exit', 'status')
|
||||
GROUP BY
|
||||
ee.emp_code, ee.name, ep.id";
|
||||
|
||||
// Execute the raw SQL query
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
// Fetch and return results
|
||||
return $row = $query->getRowArray();
|
||||
}
|
||||
|
||||
|
||||
// //for emp onboard do not change
|
||||
// public function checkExistingEmpPolicy($arr)
|
||||
// {
|
||||
// return $this->where('employee_id',$arr['employee_id'])
|
||||
// ->where('client_policy_id',$arr['client_policy_id'])
|
||||
// ->find();
|
||||
// }
|
||||
|
||||
|
||||
public function updateSiAndPremium( $client_policy_id, $employee_id,$basic_cover_si,$premium)
|
||||
{
|
||||
|
||||
|
||||
$query = "UPDATE employee_polices
|
||||
SET employee_polices.basic_cover_si = '{$basic_cover_si}'
|
||||
, employee_polices.premium = '{$premium}'
|
||||
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",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"otp",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\PolicyGridModel;
|
||||
use CodeIgniter\Model;
|
||||
use App\Models\PolicyGridModel;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
@ -33,22 +35,13 @@ class PolicesModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getPolicySlabRatesForEmpOnboard($policy_id,$client_id){
|
||||
|
||||
public function getPolicySlabRatesForEmpOnboard($policy_id,$client_id)
|
||||
|
||||
// $data = $this->getPolicyPremium($policy_id);
|
||||
// $pattern = '/gmc/i';
|
||||
// $subject = $data[0]->policy_type;
|
||||
// if (preg_match($pattern, $subject)) {
|
||||
// $search_term = 'GMC';
|
||||
// } else {
|
||||
// $search_term = 'GPA';
|
||||
// }
|
||||
{
|
||||
|
||||
|
||||
$premium_slab_data = null;
|
||||
// echo !isset($premium_slab_data);die();
|
||||
// if($search_term === 'GPA'){
|
||||
$premium_slab_data = null;
|
||||
|
||||
$policyPremium1Model = new PolicyPremium1Model();
|
||||
$premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
// dd($premium_slab_data);
|
||||
@ -58,17 +51,10 @@ class PolicesModel extends Model
|
||||
$policyPremium2Model = new PolicyPremium2Model();
|
||||
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
}
|
||||
// }else{
|
||||
;
|
||||
// }
|
||||
// dd($premium_slab_data);
|
||||
// dd($policyPremium1Model->getLastQuery());
|
||||
//get policy id
|
||||
$grid_id = $premium_slab_data[0]['policy_grid_id'];
|
||||
$policyGridModel = new PolicyGridModel();
|
||||
$results = $policyGridModel->find($grid_id);
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
|
||||
}
|
||||
|
||||
|
||||
$grid_id = $premium_slab_data[0]['policy_grid_id'];
|
||||
$policyGridModel = new PolicyGridModel();
|
||||
$results = $policyGridModel->find($grid_id);
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,10 @@ class PolicyPremium1Model extends Model
|
||||
'client_policy_id',
|
||||
'policy_grid_id',
|
||||
'si',
|
||||
'si_or_bp',
|
||||
'basic_multiplier',
|
||||
'premium_multiplier',
|
||||
'basic_pay',
|
||||
'premium',
|
||||
'multiplier',
|
||||
"created_by",
|
||||
|
||||
23
app/Models/RelationshipModel.php
Normal file
23
app/Models/RelationshipModel.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class RelationshipModel extends Model
|
||||
{
|
||||
protected $table = 'relationships';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"insurer_id",
|
||||
"relationship_name",
|
||||
"dependent",
|
||||
"is_multiple",
|
||||
"created_by",
|
||||
"created_at",
|
||||
"updated_by",
|
||||
"updated_at",
|
||||
"is_active",];
|
||||
|
||||
}
|
||||
@ -291,5 +291,13 @@ function onlyNumbers(event){
|
||||
return false;
|
||||
}
|
||||
|
||||
var form = document.getElementById("UserForm");
|
||||
|
||||
// Add submit event listener to the form
|
||||
form.addEventListener("submit", function(event) {
|
||||
// Disable the submit button to avoid multiple submissions
|
||||
document.getElementById("btnSubmit").disabled = true;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -103,6 +103,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="gst">Logo</label>
|
||||
<input type="file" name="client_logo" id="client_logo" onchange="PreviewImage();"><br>
|
||||
<span class="text-danger"> Image dimensions 100 x 100 pixels and size of 200KB. </span>
|
||||
</div>
|
||||
<div class="form-group col-md-6 float-right" style="position: relative;top: 20px;">
|
||||
<img src="<?= isset($client['client_logo']) && !empty($client['client_logo']) ? base_url() . "public/uploads/logo/" . $client['client_logo'] : 'http://ssl.gstatic.com/accounts/ui/avatar_2x.png' ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input value="1" type="checkbox" name="is_download_btn" <?= (isset($client['is_download_btn']) && $client['is_download_btn'] == 1) ? 'checked' : '' ?>>
|
||||
<label>Download Excel</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
@ -122,13 +137,24 @@
|
||||
var PrimaryKey = $('#general_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#client_logo').change(function() {
|
||||
validateFile(this);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#general_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
var $submitButton = $('#general_form').find('button[type="submit"]');
|
||||
$submitButton.prop('disabled', true); // Disable the submit button
|
||||
|
||||
var isValid = $('#general_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
$submitButton.prop('disabled', false);
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
@ -154,6 +180,8 @@ $(document).ready(function () {
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
|
||||
if(res){
|
||||
setTimeout(function() {
|
||||
|
||||
@ -162,7 +190,7 @@ $(document).ready(function () {
|
||||
$('#kyc_tab').click();
|
||||
var message = (PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
$submitButton.prop('disabled', false);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
@ -175,44 +203,62 @@ $(document).ready(function () {
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_kyc').val(res.data.id);
|
||||
$('#kyc_PrimaryKey').val(res.data.id);
|
||||
$('#Client_id').val(res.data.id);
|
||||
$('#entity_type').val(res.data.entity_type_id);
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/list/"); ?>' + res.data.entity_type_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
|
||||
console.log(res);
|
||||
var tbody = $('#tbody');
|
||||
tbody.empty();
|
||||
|
||||
$.each(res.data, function (index, item) {
|
||||
var row = `<tr>
|
||||
<td> ${item.file_name}</td>
|
||||
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
||||
<input type="hidden" name="client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<button class="btn btn-sm btn-primary submit" style="position: relative;right: 80px;">Submit</button></form></td>
|
||||
<td id="name_${item.id}" style="display:none;"></td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
||||
</tr>`;
|
||||
tbody.append(row);
|
||||
});
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
var client_id_for_file = res.data.id;
|
||||
console.log()
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/list/"); ?>' + res.data.entity_type_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
|
||||
console.log('kyc docs', res);
|
||||
var tbody = $('#tbody');
|
||||
tbody.empty();
|
||||
|
||||
$.each(res.data, function (index, item) {
|
||||
var row = `<tr>
|
||||
<td> ${item.file_name}</td>
|
||||
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
|
||||
<input type="hidden" name="client_id" value="${client_id_for_file}"/>
|
||||
<button class="btn btn-sm btn-primary submit" style="position: relative;right: 80px;">Submit</button></form></td>
|
||||
<td id="name_${item.id}" style="display:none;"></td>
|
||||
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>
|
||||
</tr>`;
|
||||
tbody.append(row);
|
||||
});
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$submitButton.prop('disabled', false);
|
||||
if (xhr.status === 404) {
|
||||
toastr.warning('Resource not found', 'Warning');
|
||||
} else if (xhr.status === 500) {
|
||||
toastr.warning('Internal server error', 'Warning');
|
||||
} else {
|
||||
toastr.warning('Unknown error occurred', 'Warning');
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -226,5 +272,71 @@ function onlyNumbers(event){
|
||||
return false;
|
||||
}
|
||||
|
||||
function PreviewImage() {
|
||||
var oFReader = new FileReader();
|
||||
oFReader.readAsDataURL(document.getElementById("client_logo").files[0]);
|
||||
|
||||
oFReader.onload = function (oFREvent) {
|
||||
document.getElementById("uploadPreview").src = oFREvent.target.result;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// function validateFile(input) {
|
||||
// const file = input.files[0];
|
||||
// const allowedExtensions = ["jpg", "jpeg", "png"];
|
||||
// const fileExtension = file.name.split(".").pop().toLowerCase();
|
||||
|
||||
// if (!allowedExtensions.includes(fileExtension)) {
|
||||
// toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.');
|
||||
// document.getElementById("uploadPreview").src = "http://ssl.gstatic.com/accounts/ui/avatar_2x.png";
|
||||
// input.value = "";
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
function validateFile(input) {
|
||||
const file = input.files[0];
|
||||
const allowedExtensions = ["jpg", "jpeg", "png"];
|
||||
const fileExtension = file.name.split(".").pop().toLowerCase();
|
||||
|
||||
// Check if the file extension is allowed
|
||||
if (!allowedExtensions.includes(fileExtension)) {
|
||||
toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.');
|
||||
document.getElementById("uploadPreview").src = "";
|
||||
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png");
|
||||
input.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// Check file size
|
||||
const fileSize = file.size / 1024; // in KB
|
||||
if (fileSize > 200) {
|
||||
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
|
||||
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png");
|
||||
input.value = "";
|
||||
return;
|
||||
}
|
||||
|
||||
// Check image dimensions
|
||||
const img = new Image();
|
||||
img.onload = function() {
|
||||
if (this.width !== 100 || this.height !== 100) {
|
||||
toastr.warning('Image dimensions should be 100x100 pixels.', 'Invalid image dimensions.');
|
||||
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png");
|
||||
input.value = "";
|
||||
return;
|
||||
}
|
||||
// If both size and dimensions are valid, you can proceed with your logic here
|
||||
// For example, you can display the image
|
||||
const reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
document.getElementById("uploadPreview").src = e.target.result;
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
};
|
||||
img.src = URL.createObjectURL(file);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -88,7 +88,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile ( starting with 6, 7, 8, or 9 only. )" name="mobile[]" id="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" pattern="^[6-9]\d{9}$" data-parsley-type-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." data-parsley-required-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." required>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="designation">Designation<span class="text-danger">*</span></label>
|
||||
@ -97,7 +97,7 @@
|
||||
</div>
|
||||
<div class="form-group" style="display: flex;">
|
||||
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="add">Add Contact</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="remove_btn">Remove</button>
|
||||
</div>
|
||||
|
||||
<div id="container"></div>
|
||||
@ -282,17 +282,24 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
|
||||
console.log(branch_form_action);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var branch_id = $(this).attr('data-id');
|
||||
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
|
||||
$.ajax({
|
||||
@ -301,6 +308,10 @@ $(document).ready(function () {
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res)
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
@ -329,12 +340,24 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
console.log(branch_form_action);
|
||||
});
|
||||
|
||||
|
||||
$("#remove_btn").click(function(){
|
||||
$("#name").val('');
|
||||
$("#email").val('');
|
||||
$("#mobile").val('');
|
||||
$("#designation").val('');
|
||||
})
|
||||
|
||||
// Initialize the contact count
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
@ -362,7 +385,7 @@ $(document).ready(function () {
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile ( starting with 6, 7, 8, or 9 only. )" name="mobile[]" id="${uniqueId}_mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" pattern="^[6-9]\d{9}$" data-parsley-type-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." data-parsley-required-message="Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9." required>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||
|
||||
@ -94,7 +94,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
var kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
var kycPrimaryKey = $('#client_id_kyc').val();
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
@ -144,6 +144,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/create"); ?>',
|
||||
type: 'POST',
|
||||
@ -151,8 +155,21 @@
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
// res = JSON.parse(res)
|
||||
// console.log(res);
|
||||
|
||||
if(res){
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('File Uloaded successfully', 'Success');
|
||||
}, 500);
|
||||
}
|
||||
|
||||
form.trigger('reset')
|
||||
$.each(res.data, function (index, item) {
|
||||
|
||||
@ -166,12 +183,21 @@
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if(kycPrimaryKey !== ''){
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/list/"); ?>' + '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
|
||||
type: "GET",
|
||||
@ -179,7 +205,11 @@
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
console.log(res);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
var tbody = $('#tbody');
|
||||
tbody.empty();
|
||||
|
||||
@ -200,6 +230,12 @@
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
@ -229,9 +265,9 @@
|
||||
// console.log('name_' + item.kyc_doc_type_id);
|
||||
// console.log(document.getElementById('name_' + item.kyc_doc_type_id));
|
||||
setTimeout(function() {
|
||||
$('#name_'+item.id).show();
|
||||
$('#name_'+item.id).html(item.file_name);
|
||||
$('#form_'+item.id).hide();
|
||||
$('#name_'+item.kyc_doc_type_id).show();
|
||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||
$('#form_'+item.kyc_doc_type_id).hide();
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
@ -248,6 +284,7 @@
|
||||
});
|
||||
|
||||
|
||||
/*** for Others documents form submit ***/
|
||||
$("#kyc_form").submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -263,6 +300,9 @@
|
||||
}
|
||||
var formData = new FormData($('#kyc_form')[0]);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: '<?= base_url("client/kyc/create"); ?>',
|
||||
@ -272,10 +312,20 @@
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
$('#kyc_form').trigger('reset')
|
||||
var message = (kycPrimaryKey === '') ? 'KYC Docs Uploaded successfully' : 'KYC Docs Uploaded successfully';
|
||||
toastr.success(message, 'Success');
|
||||
$('#kyc_form').trigger('reset');
|
||||
if(res){
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
var message = (kycPrimaryKey === '') ? 'KYC Other Docs Uploaded successfully' : 'KYC Other Docs Uploaded successfully';
|
||||
toastr.success(message, 'Success');
|
||||
}, 500);
|
||||
}
|
||||
|
||||
$('#other_docs tr').remove();
|
||||
$.each(res.data, function(index, item) {
|
||||
@ -296,6 +346,13 @@
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -1,13 +1,3 @@
|
||||
<style>
|
||||
th {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
td{
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="tab-pane fade" id="police-tab">
|
||||
|
||||
|
||||
@ -95,13 +85,18 @@
|
||||
<label for="policy_status">Policy Status</label>
|
||||
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
||||
</div>
|
||||
<div >
|
||||
<input value="1" type="checkbox" name="is_addon" id="is_addon">
|
||||
<label >Add On</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<!-- <hr> -->
|
||||
|
||||
<div id="policy_fields"></div>
|
||||
|
||||
<div id="policy_fields"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
id="btnSubmit">Submit</button>
|
||||
@ -165,6 +160,12 @@
|
||||
$('#table_list').hide();
|
||||
$('.btnBack').show();
|
||||
$('.btnAdd').hide();
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#start_date').val('');
|
||||
$('#end_date').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
$('#is_addon').prop('checked', false);
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||
|
||||
})
|
||||
@ -256,6 +257,8 @@
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
@ -291,10 +294,10 @@
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.policy_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal" id="${item.policy_type_id}"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.policy_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnPolicyMaster" data-toggle="modal" id="${item.policy_type_id}"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -302,6 +305,13 @@
|
||||
`;
|
||||
});
|
||||
$('#policy_table').append(policyTable);
|
||||
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#start_date').val('');
|
||||
$('#end_date').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
$('#is_addon').prop('checked', false);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -330,7 +340,7 @@
|
||||
|
||||
$.get(url, function(res) {
|
||||
// res = JSON.parse(res)//
|
||||
console.log(res)
|
||||
// console.log(res)
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||
$.each(res.data, function(index, item) {
|
||||
@ -348,7 +358,7 @@
|
||||
$('#policy').change(function(){
|
||||
|
||||
var dataId = $(this).children('option:selected').attr('data-id');
|
||||
console.log('dataId', dataId)
|
||||
// console.log('dataId', dataId)
|
||||
$('#policy_type_id').val(dataId);
|
||||
|
||||
// if(dataId == 1){
|
||||
@ -366,15 +376,22 @@
|
||||
// var policy_id = $(this).data('id');
|
||||
// console.log('1', policy_id)
|
||||
var policy_id = $(this).attr('data-id');
|
||||
console.log('2', policy_id)
|
||||
// console.log('2', policy_id)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/list/") ?>' + policy_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
console.log('clientPolicy : ', res);
|
||||
console.log(res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
// console.log('clientPolicy : ', res);
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/edit"); ?>');
|
||||
|
||||
if (res.status === false) {
|
||||
@ -397,6 +414,12 @@
|
||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||
$('#policy_status_field').show();
|
||||
|
||||
if (res.data.is_addon == 1) {
|
||||
$('#is_addon').prop('checked', true);
|
||||
} else {
|
||||
$('#is_addon').prop('checked', false);
|
||||
}
|
||||
|
||||
/** do not delete this comment condition
|
||||
|
||||
// if(res.data.policy_type_id == 1){
|
||||
@ -409,7 +432,7 @@
|
||||
|
||||
var policeOptionHTML = '';
|
||||
$.each(res.policy, function(index, item) {
|
||||
console.log(item)
|
||||
// console.log(item)
|
||||
policeOptionHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '" ' + (res.data.policy_id === item.id ? 'selected="selected"' : '') + '>' + item.name + '</option>';
|
||||
});
|
||||
$('#policy').html(policeOptionHTML);
|
||||
@ -417,6 +440,11 @@
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -428,7 +456,7 @@
|
||||
var client_id = $('#client_id_policy').val()
|
||||
|
||||
|
||||
console.log('client_policy_id', client_policy_id);
|
||||
// console.log('client_policy_id', client_policy_id);
|
||||
|
||||
if(client_policy_id){
|
||||
$('.loader').fadeIn();
|
||||
@ -442,7 +470,7 @@
|
||||
client_policy_id : client_policy_id,
|
||||
},
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
if(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
@ -654,31 +682,31 @@
|
||||
};
|
||||
|
||||
function convertNumberToWords(number) {
|
||||
if (number === 0) {
|
||||
return numberWords[number];
|
||||
}
|
||||
if (number === 0) {
|
||||
return numberWords[number];
|
||||
}
|
||||
|
||||
let word = '';
|
||||
let word = '';
|
||||
|
||||
if (number >= 10000000) {
|
||||
word += convertNumberToWords(Math.floor(number / 10000000)) + " Crore ";
|
||||
number %= 10000000;
|
||||
}
|
||||
if (number >= 10000000) {
|
||||
word += convertNumberToWords(Math.floor(number / 10000000)) + " Crore ";
|
||||
number %= 10000000;
|
||||
}
|
||||
|
||||
if (number >= 100000) {
|
||||
word += convertNumberToWords(Math.floor(number / 100000)) + " Lakh ";
|
||||
number %= 100000;
|
||||
}
|
||||
if (number >= 100000) {
|
||||
word += convertNumberToWords(Math.floor(number / 100000)) + " Lakh ";
|
||||
number %= 100000;
|
||||
}
|
||||
|
||||
if (number >= 1000) {
|
||||
word += convertNumberToWords(Math.floor(number / 1000)) + " Thousand ";
|
||||
number %= 1000;
|
||||
}
|
||||
if (number >= 1000) {
|
||||
word += convertNumberToWords(Math.floor(number / 1000)) + " Thousand ";
|
||||
number %= 1000;
|
||||
}
|
||||
|
||||
if (number >= 100) {
|
||||
word += convertNumberToWords(Math.floor(number / 100)) + " Hundred ";
|
||||
number %= 100;
|
||||
}
|
||||
if (number >= 100) {
|
||||
word += convertNumberToWords(Math.floor(number / 100)) + " Hundred ";
|
||||
number %= 100;
|
||||
}
|
||||
|
||||
if (number > 0) {
|
||||
if (word !== '') {
|
||||
@ -694,8 +722,21 @@
|
||||
}
|
||||
|
||||
function convertCommaNumberToWords(input) {
|
||||
const number = parseInt(input.replace(/,/g, ''), 10);
|
||||
return convertNumberToWords(number);
|
||||
let number;
|
||||
if (input instanceof HTMLElement) {
|
||||
const inputValue = input.value;
|
||||
number = parseInt(inputValue.replace(/,/g, ''), 10);
|
||||
var convert_word_value = convertNumberToWords(number);
|
||||
|
||||
if (input.nextElementSibling !== null) {
|
||||
input.nextElementSibling.textContent = convert_word_value;
|
||||
}
|
||||
} else {
|
||||
number = parseInt(input.replace(/,/g, ''), 10);
|
||||
}
|
||||
var convert_word_value = convertNumberToWords(number);
|
||||
|
||||
return convert_word_value;
|
||||
}
|
||||
|
||||
function onlyNumbers(event){
|
||||
@ -706,11 +747,74 @@
|
||||
}
|
||||
|
||||
|
||||
function formatNumber(input) {
|
||||
var value = input.value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
input.value = value;
|
||||
}
|
||||
function formatNumber(input, maxLength) {
|
||||
|
||||
// console.log("input", input);
|
||||
maxLength=16;
|
||||
let value = input.value.replace(/\D/g, ''); // Remove non-numeric characters
|
||||
|
||||
// Limit the number of digits
|
||||
value = value.slice(0, maxLength);
|
||||
|
||||
// Format the number with commas using Indian numbering system
|
||||
value = Number(value).toLocaleString('en-IN');
|
||||
input.value = value;
|
||||
|
||||
basicPayMultiple(input)
|
||||
if (input.id == 'gpa_si') {
|
||||
gpaSumInsureMultiplier();
|
||||
}
|
||||
convertCommaNumberToWords(input);
|
||||
|
||||
if (input.id == 'gpa_sum_si') {
|
||||
gpaSumInsureMultiplier(input);
|
||||
}
|
||||
|
||||
// if(input.id == 'basic_pay'){
|
||||
// var inputNumber = input.value;
|
||||
// if (inputNumber) {
|
||||
// var result = convertCommaNumberToWords(inputNumber);
|
||||
// $("#gpa_basic_pay_number_word").text(result);
|
||||
// } else {
|
||||
// $("#gpa_basic_pay_number_word").text("");
|
||||
// }
|
||||
// }else if(input.id == 'basic_gpa_si'){
|
||||
// var inputNumber = input.value;
|
||||
// if (inputNumber) {
|
||||
// var result = convertCommaNumberToWords(inputNumber);
|
||||
// $("#basic_gpa_si_number_word").text(result);
|
||||
// } else {
|
||||
// $("#basic_gpa_si_number_word").text("");
|
||||
// }
|
||||
// }else if(input.id == 'basic_gpa_premium'){
|
||||
// var inputNumber = input.value;
|
||||
// if (inputNumber) {
|
||||
// var result = convertCommaNumberToWords(inputNumber);
|
||||
// $("#basic_gpa_premium_number_word").text(result);
|
||||
// } else {
|
||||
// $("#basic_gpa_premium_number_word").text("");
|
||||
// }
|
||||
// }else if(input.id == 'gpa_si'){
|
||||
// var inputNumber = input.value;
|
||||
// if (inputNumber) {
|
||||
// var result = convertCommaNumberToWords(inputNumber);
|
||||
// $("#gpa_sum_si_number_word").text(result);
|
||||
// } else {
|
||||
// $("#gpa_sum_si_number_word").text("");
|
||||
// }
|
||||
// }else if(input.id == 'gpa_premium'){
|
||||
// var inputNumber = input.value;
|
||||
// if (inputNumber) {
|
||||
// var result = convertCommaNumberToWords(inputNumber);
|
||||
// $("#gpa_sum_premium_number_word").text(result);
|
||||
// } else {
|
||||
// $("#gpa_sum_premium_number_word").text("");
|
||||
// }
|
||||
// }
|
||||
|
||||
return ;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -69,6 +69,8 @@ $(document).ready(function(){
|
||||
|
||||
relation_PrimaryKey = $('#relation_PrimaryKey').val()
|
||||
|
||||
$('#client_rm_edit').hide()
|
||||
|
||||
$('#account_manager').multiselect({
|
||||
nonSelectedText: 'Select Account Manager',
|
||||
enableFiltering: false,
|
||||
@ -80,6 +82,7 @@ $(document).ready(function(){
|
||||
|
||||
var data = <?= isset($client_relation) ? json_encode($client_relation) : '[]' ?>;
|
||||
if (relation_PrimaryKey !== '') {
|
||||
$('#client_rm_edit').show()
|
||||
$('#client_rm_btnSubmit').hide();
|
||||
$.each(data, function(index, item) {
|
||||
$('#head option[value="' + item.user_id + '"]').prop('selected', true);
|
||||
@ -151,6 +154,11 @@ $(document).ready(function(){
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -4,144 +4,149 @@
|
||||
<!-- <?php echo fancy_date_time_format('2024-02-13 14:40:32');echo '<br>';?> -->
|
||||
<!-- <?php echo fancy_date_time_format('2024-02-13 14:58:00');echo '<br>';?> -->
|
||||
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form id="emp-upload-form" action="<?php echo base_url().'employee/upload'?>" method="post">
|
||||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Client</label> <br/>
|
||||
<select name="client_id" class="form-control" id="client_id" required>
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Policy</label> <br/>
|
||||
<select name="policy_id" class="form-control" id="policy_id">
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Action</label> <br/>
|
||||
<select name="upload-action-type" class="form-control" id="upload-action-type" required>
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
if(isset($actions) && count($actions))
|
||||
|
||||
<div class="tab-pane fade active show" id="general-q-tab">
|
||||
<div class="row" >
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form id="emp-upload-form" action="<?php echo base_url().'employee/upload'?>" method="post">
|
||||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Client</label> <br />
|
||||
<select name="client_id" class="form-control" id="client_id" required>
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br/>
|
||||
<select name="policy_id" class="form-control" id="policy_id">
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Event</label> <br />
|
||||
<select name="upload-action-type" class="form-control" id="upload-action-type" required>
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
if(isset($actions) && count($actions))
|
||||
{
|
||||
foreach($actions as $key => $action)
|
||||
{
|
||||
foreach($actions as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Choose file</label> <br/>
|
||||
<input type="file" name="emplist" id="emplist" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required>
|
||||
</div></div>
|
||||
|
||||
<div class="col-8" style="text-align: right;">
|
||||
<button id="emp_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- </div> -->
|
||||
<hr>
|
||||
|
||||
<div class="form-row" id="file_upload">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Upload file</label> [ <a id="excel_download" data-toggle="tooltip" data-placement="top" title="Download Sample Excel">Sample Excel</a> ]
|
||||
<input type="file" name="emplist" id="emplist" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet"
|
||||
required>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
|
||||
<div class="form-group col-md-11"> <!-- Adjusted the width to 11 columns -->
|
||||
<div class="col-md-3">
|
||||
<button id="emp_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"></h4>
|
||||
<div class="page-title-right">
|
||||
</form>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row" id="file_list">
|
||||
<?php include('file_list.php');?>
|
||||
|
||||
<!-- end page title -->
|
||||
<div class="row" id="file_list">
|
||||
<?php include('file_list.php');?>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">File Rejected Reason</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<!-- <div id="loader" class="loader" style="display:none;">SPINNER</div> -->
|
||||
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="file-err-modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">File Rejected Reason</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$( document ).ready(function() {
|
||||
console.log( "document loaded" );
|
||||
//fetchClientPolicies();
|
||||
//for modal pop up
|
||||
$('#file-err-modal').on('show.bs.modal', function (event) {
|
||||
// console.log(event.relatedTarget);
|
||||
var myVal = $(event.relatedTarget).data('err');
|
||||
console.log(myVal);
|
||||
var loader = '<div style="text-align: center;"><img src="<?php echo base_url()?>public/assets/images/simple_loader.gif" height="50px" width="50px" ></div>';
|
||||
$('#file-err-modal').find(".modal-body").html(loader);
|
||||
var model_data = fetchFileError(myVal);
|
||||
// console.log('data received.');
|
||||
// console.log(model_data);
|
||||
|
||||
});
|
||||
$('#file_upload').hide();
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
//for form submit
|
||||
$("#emp-upload-form").submit(function(event) {
|
||||
$(document).ready(function() {
|
||||
|
||||
console.log("document loaded");
|
||||
//fetchClientPolicies();
|
||||
//for modal pop up
|
||||
$('#file-err-modal').on('show.bs.modal', function(event) {
|
||||
// console.log(event.relatedTarget);
|
||||
var myVal = $(event.relatedTarget).data('err');
|
||||
console.log(myVal);
|
||||
var loader =
|
||||
'<div style="text-align: center;"><img src="<?php echo base_url()?>public/assets/images/simple_loader.gif" height="50px" width="50px" ></div>';
|
||||
$('#file-err-modal').find(".modal-body").html(loader);
|
||||
var model_data = fetchFileError(myVal);
|
||||
// console.log('data received.');
|
||||
// console.log(model_data);
|
||||
|
||||
});
|
||||
|
||||
//for form submit
|
||||
$("#emp-upload-form").submit(function(event) {
|
||||
event.preventDefault(); // Prevent default form submission
|
||||
console.log('submit called');
|
||||
|
||||
|
||||
var action_item = $('#upload-action-type').val();
|
||||
var policy_id = $('#policy_id').val();
|
||||
console.log('action_item - '+ action_item);
|
||||
if(action_item != 'correction' && policy_id == "")
|
||||
{
|
||||
console.log('action_item - ' + action_item);
|
||||
if (action_item != 'correction' && policy_id == "") {
|
||||
// $('#policy_id').attr('required', true);
|
||||
// $('#policy_id').prop('title', 'plz choose policy');
|
||||
// $('#policy_id').mouseover();
|
||||
console.log('required');
|
||||
alert('please choose policy for this uploaing event ');
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
|
||||
$('#policy_id').attr('required', false);
|
||||
console.log('not required');
|
||||
@ -150,11 +155,14 @@
|
||||
// Create FormData object
|
||||
var formData = new FormData($(this)[0]);
|
||||
for (var pair of formData.entries()) {
|
||||
console.log(pair[0]+ ', ' + pair[1]); }
|
||||
|
||||
console.log(pair[0] + ', ' + pair[1]);
|
||||
}
|
||||
|
||||
console.log(formData);
|
||||
$('#emp_form_submit_button').prop('disabled',true);
|
||||
$('#emp_form_submit_button').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...');
|
||||
$('#emp_form_submit_button').prop('disabled', true);
|
||||
$('#emp_form_submit_button').html(
|
||||
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...'
|
||||
);
|
||||
// return false;
|
||||
$.ajax({
|
||||
url: $(this).attr("action"),
|
||||
@ -164,29 +172,29 @@
|
||||
contentType: false, // Let jQuery handle the content type
|
||||
headers: {
|
||||
// "Content-Type":"multipart/form-data",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// Request successful, handle response
|
||||
$('#policy_id').attr('required', false);
|
||||
$('#policy_id').attr('required', false);
|
||||
console.log(response);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
toastr.success('File upload successs, Data validation is in-progress', 'success');
|
||||
window.location.reload(true);
|
||||
} else if(response.code === 404 && response.dataStatus === false){
|
||||
console.error('no data found', response);
|
||||
// alert(response.message);
|
||||
toastr.error(response.message, 'Failed');
|
||||
window.location.reload(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (response.code === 200 && response.dataStatus === true && response
|
||||
.data !== "") {
|
||||
toastr.success('File upload successs, Data validation is in-progress',
|
||||
'success');
|
||||
window.location.reload(true);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
// alert(response.message);
|
||||
toastr.error(response.message, 'Failed');
|
||||
window.location.reload(true);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
// alert('Something went wrong! Try later');
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
window.location.reload(true);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Request failed, handle error
|
||||
@ -195,64 +203,61 @@
|
||||
window.location.reload(true);
|
||||
}
|
||||
});
|
||||
});//end
|
||||
}); //end
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
$( window ).on( "load", function() {
|
||||
console.log( "window loaded" );
|
||||
fetchClientPolicies();
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on("load", function() {
|
||||
console.log("window loaded");
|
||||
fetchClientPolicies();
|
||||
|
||||
|
||||
function fetchClientPolicies() {
|
||||
|
||||
});
|
||||
|
||||
|
||||
function fetchClientPolicies() {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
console.log('fetchClientPolicies');
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
// console.log(clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
} catch (error)
|
||||
{
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if(response.code === 404 && response.dataStatus === false){
|
||||
console.error('no data found', response);
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
// console.log(clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function fetchFileError(file_id) {
|
||||
function fetchFileError(file_id) {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/get-file-error/' + file_id;
|
||||
console.log('fetchFileError');
|
||||
@ -264,11 +269,10 @@
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
|
||||
$(this).find(".modal-body").html("");
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "")
|
||||
{
|
||||
try {
|
||||
console.log((JSON.parse(response.data)));
|
||||
var file_error_data = (JSON.parse(response.data));
|
||||
@ -278,11 +282,6 @@
|
||||
console.log(key);
|
||||
var err_id = key;
|
||||
var err_count = file_error_data['error_summary'][key];
|
||||
// for (var ckey in col)
|
||||
// {
|
||||
|
||||
// file_error_html += (err_id == 1 ? "<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>"+err_count+"</span>" : (err_id == 2 ? "<strong>Values not in expected format</strong> <span class='badge badge-danger float-right'>"+err_count+"</span>" : (err_id == 3 ? "<strong>Field contains not allowed values</strong> <span class='badge badge-danger float-right'>"+err_count+"</span>" : (err_id == 4 ? "<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>"+err_count+"</span>" : (err_id == 5 ? "<strong>"+file_error_data['error_data']+"</strong>" : (err_id == 6 ? "<strong>"+file_error_data['error_data']+"</strong>" : ""))))));
|
||||
// var message;
|
||||
switch (err_id) {
|
||||
case 1:
|
||||
file_error_html += "<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
@ -336,64 +335,65 @@
|
||||
if(err_id != 5 && err_id != 6)
|
||||
{
|
||||
file_error_html += (file_error_html != "" ? "<a href ='<?php echo base_url()?>"+ "employee/excel_error/" + file_id + "' target=_blank>click here to more details...</a>":"");
|
||||
|
||||
}
|
||||
console.log(file_error_html);
|
||||
$('#file-err-modal').find(".modal-body").html(file_error_html);
|
||||
return file_error_html;
|
||||
} catch (error)
|
||||
{
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if(response.code === 404 && response.dataStatus === false){
|
||||
console.error('no data found', response);
|
||||
console.log(file_error_html);
|
||||
$('#file-err-modal').find(".modal-body").html(file_error_html);
|
||||
return file_error_html;
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function appendClients(data) {
|
||||
function appendClients(data) {
|
||||
$.each(data, function(index, item) {
|
||||
$('#client_id').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
$('#client_id').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function appendPolicies(data) {
|
||||
function appendPolicies(data) {
|
||||
$('#policy_id').empty();
|
||||
$('#policy_id').append($('<option>', { value: '',text: 'Select'}));
|
||||
$('#policy_id').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#policy_id').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
$('#policy_id').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('#client_id').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString(obj) {
|
||||
@ -402,25 +402,25 @@ function objectToQueryString(obj) {
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
|
||||
var client_id = $('#client_id').val();
|
||||
var policy_id = $('#policy_id').val();
|
||||
console.log(client_id+'-'+policy_id);
|
||||
if (client_id == '0' || policy_id == '0' ) {
|
||||
console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id
|
||||
};
|
||||
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href')+"?" + queryString;
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
|
||||
|
||||
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
|
||||
// console.log(apiURL);
|
||||
@ -439,5 +439,37 @@ function fetchEmpolyeeList(event) {
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
||||
$('#upload-action-type').change(function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
if(selectedValue !== ''){
|
||||
$('#file_upload').show();
|
||||
var fullURL = '<?= base_url("util/download-excel/"); ?>' + selectedValue;
|
||||
$('#excel_download').attr('href', fullURL);
|
||||
}else{
|
||||
$('#file_upload').hide();
|
||||
$('#excel_download').removeAttr('href');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/** This function verifies if the download link (#excel_download) has its href attribute set,
|
||||
** ensuring proper link configuration. **/
|
||||
|
||||
$('#excel_download').click(function() {
|
||||
|
||||
// Check if the element with ID "excel_download" has the href attribute set
|
||||
if (!$(this).attr('href')) {
|
||||
// If href attribute is not set, show an error message
|
||||
toastr.warning('Please select an Action to download a sample Excel.', 'Warning');
|
||||
} else {
|
||||
console.log('Download action triggered.');
|
||||
}
|
||||
});
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
</script>
|
||||
@ -1,34 +1,125 @@
|
||||
<div class="row" id="List-page">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Excel Error List</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<?php foreach ($excel_header as $header): ?>
|
||||
<th><?php echo $header; ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i = 1; $i < count($excel_data); $i++): ?>
|
||||
<tr>
|
||||
<?php foreach ($excel_data[$i] as $data): ?>
|
||||
<td><?php echo $data; ?></td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end col -->
|
||||
</div>
|
||||
<!-- Include DataTables CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
|
||||
<!-- Include DataTables Buttons CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/2.3.0/css/buttons.dataTables.min.css">
|
||||
<!-- Include Font Awesome CSS -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
|
||||
|
||||
<style>
|
||||
/* Table styles */
|
||||
.table {
|
||||
width: 100%;
|
||||
border: 2px solid #ddd;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table th, .table td {
|
||||
padding: 8px;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.table th {
|
||||
background-color: #f2f2f2;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.table tr:nth-child(even) {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.error-tooltip {
|
||||
display: none;
|
||||
/* Hide error message by default */
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
background-color: #000;
|
||||
color: #fff;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.error-icon {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.error-icon:hover+.error-tooltip {
|
||||
display: block;
|
||||
/* Show error message when hovering over the icon */
|
||||
}
|
||||
|
||||
/* .error-cell {
|
||||
border: 2px solid red !important;
|
||||
} */
|
||||
|
||||
/* .container{
|
||||
position: relative;
|
||||
bottom: 150px;
|
||||
} */
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<?php foreach ($excel_header as $header): ?>
|
||||
<th><?php echo $header; ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i = 0; $i < count($excel_data); $i++): ?>
|
||||
<tr>
|
||||
<?php foreach ($excel_data[$i] as $data): ?>
|
||||
<td <?php if (isset($data['error'])) echo 'class="error-cell"'; ?>>
|
||||
<?php
|
||||
if (isset($data['value'])) {
|
||||
echo $data['value'];
|
||||
}
|
||||
if (isset($data['error'])) {
|
||||
echo '<span class="error-icon"> <i class="fas fa-exclamation-circle" style="color: red;"></i></span>';
|
||||
echo '<span class="error-tooltip">' . implode("<br>", $data['error']) . '</span>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Include jQuery -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<!-- Include DataTables JavaScript -->
|
||||
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
|
||||
<!-- Include DataTables Buttons JavaScript -->
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.0/js/dataTables.buttons.min.js"></script>
|
||||
<!-- Include DataTables JSZip library -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
|
||||
<!-- Include DataTables Buttons HTML5 export extension -->
|
||||
<script src="https://cdn.datatables.net/buttons/2.3.0/js/buttons.html5.min.js"></script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#tickets-table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
{
|
||||
extend: 'excel',
|
||||
text: 'Excel', // Set the title for the Excel button
|
||||
title: 'ExcelErrorData', // Set your custom title here
|
||||
}
|
||||
],
|
||||
paging: false, // Disable pagination
|
||||
lengthMenu: [[-1], ["All"]] // Display all rows
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
32
app/Views/import_export.php
Normal file
32
app/Views/import_export.php
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
<div class="row" id="client_add" style="position: relative; bottom: 25px;">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
<a href="#general-q-tab" data-toggle="tab" aria-expanded="false"
|
||||
class="nav-link px-3 py-2 active" id="general_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Data From Client</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Insurer or TPA Data</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('employee_upload.php'); ?>
|
||||
<?php include('insurer_or_tpa_data.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -79,6 +79,10 @@ $(document).ready(function () {
|
||||
|
||||
var formData = new FormData($('#insurer_general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
@ -87,7 +91,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
$('#insurer_id').val(res.data.id);
|
||||
$('#insurer_id_branch').val(res.data.id);
|
||||
@ -108,6 +115,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -222,6 +222,8 @@ $(document).ready(function () {
|
||||
|
||||
var formData = new FormData($('#insurer_branch_form')[0]);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: insurer_branch_form_action,
|
||||
@ -230,6 +232,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
// $('#insurer_branch_list tr').remove();
|
||||
var insurerBranchTableInsert = ''
|
||||
@ -254,6 +260,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
@ -266,12 +278,19 @@ $(document).ready(function () {
|
||||
contactCount =1;
|
||||
var branch_id = $(this).attr('data-id');
|
||||
insurer_branch_form_action = '<?= base_url("master/insurer/branch/edit"); ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/insurer/branch/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
@ -300,6 +319,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -317,10 +342,17 @@ $(document).ready(function () {
|
||||
|
||||
var insurer_branch_action = base_url + insurer_Branch_PrimaryKey;
|
||||
if ($('#insurer_id_branch').val() != '') {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: insurer_branch_action,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
var branchTable = '';
|
||||
$.each(response.insuer_branch, function(index, item) {
|
||||
branchTable += `
|
||||
@ -336,6 +368,12 @@ $(document).ready(function () {
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
334
app/Views/insurer_or_tpa_data.php
Normal file
334
app/Views/insurer_or_tpa_data.php
Normal file
@ -0,0 +1,334 @@
|
||||
<div class="tab-pane fade" id="KYC-DOC-tab">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form class="parsley-examples" id="import_export_excel_form" action = "<?php echo base_url().'util/import-export'?>" method="post"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label>Client</label> <br />
|
||||
<select name="client_id" class="form-control" id="client" required>
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="client_policy_id" class="form-control" id="policy" required>
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Insurer/TPA Data</label> <br />
|
||||
<select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa" required>
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
if(isset($insurer_or_tpa) && count($insurer_or_tpa))
|
||||
{
|
||||
foreach($insurer_or_tpa as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Action</label> <br />
|
||||
<select name="action_type" class="form-control" id="action_type" required>
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
if(isset($import_or_export) && count($import_or_export))
|
||||
{
|
||||
foreach($import_or_export as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Event</label> <br />
|
||||
<select name="event_type" class="form-control" id="upload-action-type" required>
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
if(isset($events) && count($events))
|
||||
{
|
||||
foreach($events as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="form-row" id="import_excel_btn">
|
||||
<div class="form-group col-md-3">
|
||||
<label>Upload file</label>
|
||||
<input type="file" name="import_file_data" id="import_file" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required>
|
||||
</div>
|
||||
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
|
||||
<div class="form-group col-md-3">
|
||||
<button id="emp_form_submit_button" type="submit"
|
||||
class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="export_excel_btn">
|
||||
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
|
||||
<div class="form-group col-md-3">
|
||||
<button id="emp_form_submit_button_2" type="submit"
|
||||
class="btn btn-primary waves-effect waves-light justify-content-end">Download</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
<?php if (session()->has('error')): ?>
|
||||
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (session()->has('success')): ?>
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
|
||||
// for form submit
|
||||
$("#import_export_excel_forms").submit(function(event) {
|
||||
|
||||
var action = "<?php echo base_url().'util/import-export'?>"
|
||||
// var action = $(this).attr("action");
|
||||
event.preventDefault(); // Prevent default form submission
|
||||
console.log('submit called');
|
||||
|
||||
var isValid = $('#import_export_excel_form').parsley().validate();
|
||||
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
// Create FormData object
|
||||
var formData = new FormData($(this)[0]);
|
||||
for (var pair of formData.entries()) {
|
||||
console.log(pair[0] + ', ' + pair[1]);
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false, // Prevent jQuery from automatically processing the data
|
||||
contentType: false, // Let jQuery handle the content type
|
||||
success: function(response) {
|
||||
|
||||
console.log(response);
|
||||
if (response.code === 200 && response.status === true) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$$("#import_export_excel_form")[0].reset()
|
||||
toastr.success('File Download successs', 'success');
|
||||
|
||||
} else if (response.code === 404 && response.status === false) {
|
||||
|
||||
console.error('no data found', response);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$("#import_export_excel_form")[0].reset()
|
||||
toastr.error(response.message, 'Failed');
|
||||
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
// window.location.reload(true);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Request failed, handle error
|
||||
console.error("Request failed:", status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$("#import_export_excel_form")[0].reset()
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
// window.location.reload(true);
|
||||
}
|
||||
});
|
||||
}); //end
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(window).on("load", function() {
|
||||
fetchClientPolicies2();
|
||||
});
|
||||
|
||||
|
||||
function fetchClientPolicies2() {
|
||||
|
||||
$('#loader').show();
|
||||
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
console.log(clientPolicies);
|
||||
appendClients2(clientPolicies);
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function appendClients2(data) {
|
||||
$.each(data, function(index, item) {
|
||||
$('#client').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicies2(data) {
|
||||
$('#policy').empty();
|
||||
$('#policy').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#policy').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
$('#client').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies2(foundPolicies.policies);
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString2(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function fetchEmpolyeeList2(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var client_id = $('#client').val();
|
||||
var policy_id = $('#policy').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
}
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString2(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
$('#action_type').change(function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
console.log(selectedValue);
|
||||
|
||||
if (selectedValue == '') {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'import') {
|
||||
$('#import_file').prop('required', true);
|
||||
$('#import_file').attr('name', 'import_file_data');
|
||||
$('#import_excel_btn').show();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'export') {
|
||||
$('#import_file').removeAttr('name');
|
||||
$('#import_file').prop('required', false);
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').show();
|
||||
}
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -155,6 +155,8 @@ $(document).ready(function () {
|
||||
|
||||
var formData = new FormData($('#kyc_docs_form')[0]);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: kyc_docs_form_action,
|
||||
@ -163,6 +165,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
$('#insurer_branch_list tr').remove();
|
||||
var insurerBranchTableInsert = ''
|
||||
@ -183,6 +189,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -191,11 +203,17 @@ $(document).ready(function () {
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
var branch_id = $(this).attr('data-id');
|
||||
kyc_docs_form_action = '<?= base_url("master/kyc/kycdocs/edit"); ?>';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/kyc/kycdocs/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log("right.........");
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
@ -211,6 +229,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -228,6 +252,8 @@ $(document).ready(function () {
|
||||
var kyc_docs_action = base_url + kyc_Docs_PrimaryKey;
|
||||
console.log(kyc_docs_action);
|
||||
if (kyc_Docs_PrimaryKey != '') {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: kyc_docs_action,
|
||||
type: "GET",
|
||||
@ -235,6 +261,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
var insurerBranchTableInsert = '';
|
||||
$.each(res.kyc_docs, function(index, item) {
|
||||
insurerBranchTableInsert += `
|
||||
@ -249,6 +279,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -54,7 +54,9 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
var formData = new FormData($('#kyc_general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
var OptionsHTML1 = '';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
@ -63,6 +65,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
$('#kyc_type_id').val(res.data.PrimaryKey);
|
||||
$('#kyc_id_docs').val(res.data.PrimaryKey);
|
||||
@ -73,6 +79,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -43,10 +43,6 @@
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JQuery CDN -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
|
||||
@ -200,6 +196,22 @@
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.text-danger-2 {
|
||||
font-style: italic;
|
||||
color: black !important;
|
||||
/* color: #02a8b5 !important; */
|
||||
font-size: 12px;
|
||||
}
|
||||
.form-group {
|
||||
/* margin-bottom: -0.2rem !important; */
|
||||
}
|
||||
.form-row{
|
||||
/* width: 84%; */
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
@ -381,8 +393,8 @@
|
||||
<li class="dropdown notification-list topbar-dropdown">
|
||||
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/users/avatar-1.jpg" alt="user-image" class="rounded-circle">
|
||||
<span class="pro-user-name ml-1">
|
||||
Venkat
|
||||
<span class="pro-user-name ml-1" style="font-size: 16px;" >
|
||||
<?= (isset(get_session_userdata()->first_name) ? get_session_userdata()->first_name : 'NOT SET') ?>
|
||||
<!-- <i class="mdi mdi-chevron-down"></i> -->
|
||||
</span>
|
||||
</a>
|
||||
|
||||
23
app/Views/mail_welcome.php
Normal file
23
app/Views/mail_welcome.php
Normal file
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container" style="max-width: 500px; margin: 20px auto; border-radius: 4px; border: 1px solid rgba(0, 0, 0, .1); min-height: 100px; position: relative;">
|
||||
<div class="logo" style="display: flex; justify-content: center; align-items: center; margin: 30px auto 0;">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/Nhance-Logo-Final.png" alt="cc-logo" width="180" height="30" border="0" style="width: 180px;">
|
||||
</div>
|
||||
<div class="illustration" style="width: 100%; text-align: center; box-shadow: 0 10px 20px -5px rgba(0, 0, 0, .05); border-radius: 0 0 50% 50% / 1%; text-align: center;">
|
||||
<div class="hgroup" style="text-align: center; padding: 50px 30px 30px;">
|
||||
<span class="name" style="display: block; color: #0267C1; font-weight: 600; font-size: 1.1rem;">Dear, <?= isset($employee_name) ? $employee_name : '' ?></span>
|
||||
<p class="rad" style="margin: 0!important; text-align: center!important; font-size: 18px!important;">We are glad to welcome you to the employee benefit program, <?= isset($policy_name) ? $policy_name : '' ?> offered by your employer.</p>
|
||||
</div>
|
||||
<button class="explore" style="padding: 15px 25px; background: linear-gradient(to right, #0267C1, #0280EF); border-radius: 50px; border: 0; color: #fff; transition: all .2s ease-in-out; cursor: pointer; box-shadow: 0 5px 10px rgba(0, 0, 0, .1); margin-bottom: 15px;">
|
||||
<a href="https://venbait.in/nhance/app/dev" style="text-decoration: none; color: #fff;">Review Details</a>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -204,6 +204,8 @@ $(document).ready(function () {
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#tpa_branch_form')[0]);
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: tpa_branch_form_action,
|
||||
@ -212,6 +214,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
// console.log(res);
|
||||
// $('#policies_list tr').remove();s
|
||||
var tpaBranchTableInsert = ''
|
||||
@ -235,6 +241,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -243,11 +255,19 @@ $(document).ready(function () {
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
var branch_id = $(this).attr('data-id');
|
||||
tpa_branch_form_action = '<?= base_url("master/policy/policies/edit"); ?>';
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/policy/policies/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
@ -271,6 +291,11 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -303,10 +328,16 @@ $(document).ready(function () {
|
||||
|
||||
if ($('#policy_type_id').val() != '') {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: insurer_branch_action,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
var branchTable = '';
|
||||
$.each(response.policies, function(index, item) {
|
||||
console.log(item);
|
||||
@ -323,6 +354,12 @@ $(document).ready(function () {
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -90,12 +90,12 @@
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup="formatNumber(this)">
|
||||
<input type="text" name="sum_insured" id="sum_insured" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this)">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordGMC' class="text-danger" ></div>
|
||||
<div id='numberToWordGMC' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -109,20 +109,35 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div>
|
||||
<input type="checkbox" name="family_floaters[]" value="self" id="self" checked disabled> Self
|
||||
<input type="checkbox" name="family_floaters[]" value="spouse" id="spouse"> Spouse
|
||||
<input type="checkbox" name="family_floaters[]" value="child1" id="child1"> Child 1
|
||||
<input type="checkbox" name="family_floaters[]" value="child2" id="child2"> Child 2
|
||||
<input type="checkbox" name="family_floaters[]" value="child3" id="child3"> Child 3
|
||||
<input type="checkbox" name="family_floaters[]" value="child4" id="child4"> Child 4
|
||||
<div class="col-md-6" style="margin-bottom:10px">
|
||||
<div style="margin-top:10px">
|
||||
<span style="margin-right: 20px;">Self:</span>
|
||||
<input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked>
|
||||
<span style="margin-right: 20px;">Spouse:</span>
|
||||
<input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse">
|
||||
</div>
|
||||
<div style="margin-top:10px">
|
||||
<input type="checkbox" name="family_floaters[]" value="parent1" id="parent1"> Parent 1
|
||||
<input type="checkbox" name="family_floaters[]" value="parent2" id="parent2"> Parent 2
|
||||
<input type="checkbox" name="family_floaters[]" value="parent_in_law1" id="parent_in_law1"> Parent-In-Law 1
|
||||
<input type="checkbox" name="family_floaters[]" value="parent_in_law2" id="parent_in_law2"> Parent-In-Law 2
|
||||
<span for="children">Children:</span>
|
||||
<select name="family_floaters[]" id="children" style="margin-left: 109px;">
|
||||
<option value="0">None</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="margin-top:10px">
|
||||
<span for="family_floaters">Select Other Members:</span>
|
||||
<select name="family_floaters[]" id="family_floaters" style="margin-left: 10px;">
|
||||
<option value="0">None</option>
|
||||
<option value="1P">Only one parent (Either Father / Mother)</option>
|
||||
<option value="2P">Only two parents (Father+Mother)</option>
|
||||
<option value="1PIL">Only one parent in law (Either MIL / FIL)</option>
|
||||
<option value="2PIL">Only two parents in law (FIL + MIL)</option>
|
||||
<option value="2EPORPIL">Parents or PIL (Any two of Father, Mother, MIl, FIL)</option>
|
||||
<option value="EPORPIL">Either Parents or PIL (Parents or Parents In Law)</option>
|
||||
<option value="4EPORPIL">Parents + PIL (Father + Mother + MIL + FIL)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -465,9 +480,7 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" id="days_of_discharge" name="days_of_discharge" class="form-control " placeholder="Enter the number of days">
|
||||
<div class="input-group-append input-group-append-client-policy-master">
|
||||
<span class="input-group-text" id="basic-addon2">Days</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -477,9 +490,7 @@
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<input type="text" id="days_from_dod" name="days_from_dod" class="form-control " placeholder="Enter the number of days">
|
||||
<div class="input-group-append input-group-append-client-policy-master">
|
||||
<span class="input-group-text" id="basic-addon2">Days</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -597,6 +608,12 @@ var grid_html = '';
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
@ -624,6 +641,8 @@ var grid_html = '';
|
||||
|
||||
|
||||
var gmc_policy_type_id = $(this).attr('id');
|
||||
|
||||
|
||||
if(gmc_policy_type_id >= '2'){
|
||||
|
||||
$('#policyGMCTerms').css('display', '');
|
||||
@ -631,13 +650,19 @@ var grid_html = '';
|
||||
$('.nav.nav-pills.navtab-bg').css('display','none');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','none');
|
||||
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/getterms") ?>',
|
||||
method: 'GET',
|
||||
data: {client_policy_id: client_policy_id},
|
||||
success: function(response) {
|
||||
console.log('response',response);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
||||
$('gmc_emp_count').val(response.count);
|
||||
|
||||
@ -673,12 +698,37 @@ var grid_html = '';
|
||||
if (key.includes("family_floaters")) {
|
||||
let checkboxes = document.querySelectorAll(`input[name="${key}[]"]`);
|
||||
if (jsonObject[key]) {
|
||||
jsonObject[key].forEach(element => {
|
||||
let checkbox = $(`#${element}`);
|
||||
if (checkbox.is(":checkbox")) {
|
||||
checkbox.prop("checked", true);
|
||||
}
|
||||
});
|
||||
console.log(jsonObject[key]);
|
||||
if (jsonObject[key].childrens) {
|
||||
$('#children').val(jsonObject[key].childrens);
|
||||
}
|
||||
|
||||
if (jsonObject[key].self == 0) {
|
||||
$('#self').prop('checked', false);
|
||||
}
|
||||
|
||||
if (jsonObject[key].spouse == 0) {
|
||||
$('#spouse').prop('checked', false);
|
||||
}else{
|
||||
$('#spouse').prop('checked', true);
|
||||
}
|
||||
|
||||
|
||||
if(jsonObject[key]['either-parents-pil'] == 1){
|
||||
$('#family_floaters').val('EPORPIL');
|
||||
}else if(jsonObject[key].parents == 1 && jsonObject[key]['parents-in-law'] == 1){
|
||||
$('#family_floaters').val('2EPORPIL');
|
||||
}else if(jsonObject[key].parents == 2 && jsonObject[key]['parents-in-law'] == 2){
|
||||
$('#family_floaters').val('4EPORPIL');
|
||||
}else if(jsonObject[key].parents == 1){
|
||||
$('#family_floaters').val('1P');
|
||||
}else if(jsonObject[key].parents == 2){
|
||||
$('#family_floaters').val('2P');
|
||||
}else if(jsonObject[key]['parents-in-law'] == 1){
|
||||
$('#family_floaters').val('1PIL');
|
||||
}else if(jsonObject[key]['parents-in-law'] == 2){
|
||||
$('#family_floaters').val('2PIL');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -732,16 +782,21 @@ var grid_html = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#sum_insured").trigger("keyup");
|
||||
|
||||
$('.jodit-wysiwyg').each(function() {
|
||||
$(this).click();
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error:', status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
@ -753,6 +808,7 @@ var grid_html = '';
|
||||
var inputNumber = $(this).val();
|
||||
if (inputNumber) {
|
||||
var result = convertCommaNumberToWords(inputNumber);
|
||||
|
||||
$("#numberToWordGMC").text(result);
|
||||
} else {
|
||||
$("#numberToWordGMC").text("");
|
||||
|
||||
@ -96,7 +96,7 @@
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordSumInsured' class="text-danger" ></div>
|
||||
<div id='numberToWordSumInsured' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordTotalSumInsured' class="text-danger" ></div>
|
||||
<div id='numberToWordTotalSumInsured' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
@ -417,6 +417,10 @@
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -433,7 +437,7 @@
|
||||
$('.nav.nav-pills.navtab-bg').css('display','');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||||
var message = 'Policy Terms Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
toastr.success('message', 'Success');
|
||||
}, 1000);
|
||||
|
||||
});
|
||||
@ -442,12 +446,12 @@
|
||||
$('body').on('click', '.btnPolicyMaster', function () {
|
||||
|
||||
var client_policy_id = $(this).data('id');
|
||||
console.log('client_policy_id :' ,client_policy_id);
|
||||
// console.log('client_policy_id :' ,client_policy_id);
|
||||
|
||||
$('#gpa_client_policy_id').val(client_policy_id);
|
||||
|
||||
var gpa_policy_type_id = $(this).attr('id');
|
||||
console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||||
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||||
|
||||
if(gpa_policy_type_id == '1'){
|
||||
|
||||
@ -457,13 +461,20 @@
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','none');
|
||||
$('.removeDom').remove()
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/getterms") ?>',
|
||||
method: 'GET',
|
||||
data: {client_policy_id: client_policy_id},
|
||||
success: function(res) {
|
||||
|
||||
console.log(res)
|
||||
console.log(res);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('#nameOfThePolicyInGPA').html(' - ' + res.policy_name.name);
|
||||
|
||||
if(res.count){
|
||||
@ -527,11 +538,20 @@
|
||||
});
|
||||
|
||||
}
|
||||
$("#sumInsured2").trigger("keyup");
|
||||
$("#totalSumInsured").trigger("keyup");
|
||||
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -71,7 +71,9 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
var formData = new FormData($('#policytype_general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
var OptionsHTML1 = '';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
@ -80,6 +82,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
$('#policy_type_id').val(res.data.PrimaryKey);
|
||||
$('#policy_id_type').click();
|
||||
@ -90,6 +96,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
60
app/Views/swagger/index.php
Normal file
60
app/Views/swagger/index.php
Normal file
@ -0,0 +1,60 @@
|
||||
<!-- HTML for static distribution bundle build -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="<?= base_url('assets/swagger/swagger-ui.css') ?>">
|
||||
<link rel="icon" type="image/png" href="<?= base_url('assets/swagger/favicon-32x32.png') ?> sizes=" 32x32" />
|
||||
<link rel="icon" type="image/png" href="<?= base_url('assets/swagger/favicon-16x16.png') ?> sizes=" 16x16" />
|
||||
<style>
|
||||
html {
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script src="<?= base_url('assets/swagger/swagger-ui-bundle.js') ?>">console.log(base_url); </script>
|
||||
<script src="<?= base_url('assets/swagger/swagger-ui-standalone-preset.js') ?>"> </script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
// Begin Swagger UI call region
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "<?= base_url('assets/api.yaml') ?>",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout"
|
||||
})
|
||||
// End Swagger UI call region
|
||||
|
||||
window.ui = ui
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@ -56,7 +56,9 @@ $(document).ready(function () {
|
||||
}
|
||||
|
||||
var formData = new FormData($('#tpa_general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
var OptionsHTML1 = '';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
@ -65,6 +67,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
console.log(res);
|
||||
$('#tpa_id').val(res.data.id);
|
||||
@ -86,6 +92,11 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -231,6 +231,10 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
$('#tpa_branch_list tr').remove();
|
||||
var tpaBranchTableInsert = ''
|
||||
@ -253,6 +257,11 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -263,11 +272,17 @@ $(document).ready(function () {
|
||||
contactCount =1;
|
||||
var branch_id = $(this).attr('data-id');
|
||||
tpa_branch_form_action = '<?= base_url("master/tpa/branch/edit"); ?>';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/tpa/branch/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log("tpa.............");
|
||||
console.log(res)
|
||||
$('#add_branch').show();
|
||||
@ -297,6 +312,12 @@ $(document).ready(function () {
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -310,10 +331,16 @@ $(document).ready(function () {
|
||||
|
||||
var tpa_branch_action = base_url + tpa_Branch_PrimaryKey;
|
||||
if ($('#tpa_id_branch').val() != '') {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.ajax({
|
||||
url: tpa_branch_action,
|
||||
type: 'GET',
|
||||
success: function(response) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
var branchTable = '';
|
||||
$.each(response.tpa_branch, function(index, item) {
|
||||
branchTable += `
|
||||
@ -329,6 +356,11 @@ $(document).ready(function () {
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -17,9 +17,12 @@
|
||||
"firebase/php-jwt": "^6.10",
|
||||
"google/apiclient": "^2.15.0",
|
||||
"laminas/laminas-escaper": "^2.9",
|
||||
"php-amqplib/php-amqplib": "^2.8",
|
||||
"phpmailer/phpmailer": "^6.9",
|
||||
"phpoffice/phpspreadsheet": "^2.0",
|
||||
"psr/log": "^1.1",
|
||||
"slim/slim": "^4.13"
|
||||
"slim/slim": "^4.13",
|
||||
"zircote/swagger-php": "^4.8"
|
||||
},
|
||||
"require-dev": {
|
||||
"codeigniter/coding-standard": "^1.7",
|
||||
|
||||
890
public/assets/api.yaml
Normal file
890
public/assets/api.yaml
Normal file
@ -0,0 +1,890 @@
|
||||
openapi: 3.0.0
|
||||
paths:
|
||||
'/nhance/employeeRest/verifyEmployeeNumber':
|
||||
post:
|
||||
tags:
|
||||
- Login
|
||||
summary: 'Add a new VerifyEmployeeNumber to the store'
|
||||
operationId: VerifyEmployeeNumber
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mobile_number:
|
||||
type: string
|
||||
description: mobile_number
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mobile_number:
|
||||
type: string
|
||||
description: mobile_number
|
||||
|
||||
responses:
|
||||
'201':
|
||||
description: 'Upload VerifyEmployeeNumber'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VerifyEmployeeNumber'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/getVerifiedUserData':
|
||||
post:
|
||||
tags:
|
||||
- Login
|
||||
summary: ' GetVerifiedUserData'
|
||||
operationId: GetVerifiedUserData
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mobile_number:
|
||||
type: string
|
||||
description: mobile_number
|
||||
otp:
|
||||
type: string
|
||||
description: otp
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mobile_number:
|
||||
type: string
|
||||
description: mobile_number
|
||||
otp:
|
||||
type: string
|
||||
description: otp
|
||||
responses:
|
||||
'201':
|
||||
description: 'GetVerifiedUserData'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetVerifiedUserData'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/verifyHrWithMobileNumber':
|
||||
post:
|
||||
tags:
|
||||
- Login
|
||||
summary: 'VerifyHrWithMobileNumber'
|
||||
operationId: VerifyHrWithMobileNumber
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mobile_number:
|
||||
type: string
|
||||
description: mobile_number
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mobile_number:
|
||||
type: string
|
||||
description: mobile_number
|
||||
responses:
|
||||
'201':
|
||||
description: 'VerifyHrWithMobileNumber'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/VerifyHrWithMobileNumber'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/getVerifiedHrData':
|
||||
post:
|
||||
tags:
|
||||
- Login
|
||||
summary: ' GetVerifiedHrData'
|
||||
operationId: GetVerifiedHrData
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mobile_number:
|
||||
type: string
|
||||
description: mobile_number
|
||||
otp:
|
||||
type: string
|
||||
description: otp
|
||||
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
mobile_number:
|
||||
type: string
|
||||
description: mobile_number
|
||||
otp:
|
||||
type: string
|
||||
description: otp
|
||||
responses:
|
||||
'201':
|
||||
description: 'GetVerifiedHrData'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetVerifiedHrData'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/employeeUpload':
|
||||
post:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'Add a new EmployeeUpload to the store'
|
||||
operationId: EmployeeUpload
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
client_id:
|
||||
type: integer
|
||||
description: client_id
|
||||
policy_id:
|
||||
type: integer
|
||||
description: policy_id
|
||||
file:
|
||||
type: string
|
||||
format: binary
|
||||
description: File to upload
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
client_id:
|
||||
type: integer
|
||||
description: client_id
|
||||
policy_id:
|
||||
type: integer
|
||||
description: policy_id
|
||||
responses:
|
||||
'201':
|
||||
description: 'Upload EmployeeUpload'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/EmployeeUpload'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/getEmployeeProfile':
|
||||
get:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'GetEmployeeProfile'
|
||||
operationId: GetEmployeeProfile
|
||||
parameters:
|
||||
- name: emp_code
|
||||
in: query
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'201':
|
||||
description: 'GetEmployeeProfile'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetEmployeeProfile'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/editEmployeeProfile':
|
||||
post:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'EditEmployeeProfile'
|
||||
operationId: EditEmployeeProfile
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: The ID of the employee.
|
||||
client_id:
|
||||
type: string
|
||||
description: The ID of the client.
|
||||
relationship:
|
||||
type: string
|
||||
description: The relationship of the employee.
|
||||
relationship_code:
|
||||
type: string
|
||||
description: The code representing the relationship.
|
||||
change_event:
|
||||
type: string
|
||||
description: The change event associated with the employee.
|
||||
batch_id:
|
||||
type: string
|
||||
description: The ID of the batch.
|
||||
emp_code:
|
||||
type: string
|
||||
description: The code of the employee.
|
||||
name:
|
||||
type: string
|
||||
description: The name of the employee.
|
||||
email_personal:
|
||||
type: string
|
||||
description: The personal email of the employee.
|
||||
email_corporate:
|
||||
type: string
|
||||
description: The corporate email of the employee.
|
||||
mobile:
|
||||
type: string
|
||||
description: The mobile number of the employee.
|
||||
gender:
|
||||
type: string
|
||||
description: The gender of the employee.
|
||||
dob:
|
||||
type: string
|
||||
format: date
|
||||
description: The date of birth of the employee.
|
||||
doj:
|
||||
type: string
|
||||
format: date
|
||||
description: The date of joining of the employee.
|
||||
basic_pay:
|
||||
type: string
|
||||
description: The basic pay of the employee.
|
||||
band:
|
||||
type: string
|
||||
description: The band of the employee.
|
||||
designation:
|
||||
type: string
|
||||
description: The designation of the employee.
|
||||
emp_status:
|
||||
type: string
|
||||
description: The status of the employee.
|
||||
is_active:
|
||||
type: string
|
||||
description: Indicates if the employee is active.
|
||||
file_id:
|
||||
type: string
|
||||
description: The ID of the file associated with the employee.
|
||||
|
||||
responses:
|
||||
'201':
|
||||
description: 'EditEmployeeProfile'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/EditEmployeeProfile'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/relationshipList':
|
||||
get:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'RelationshipList'
|
||||
operationId: RelationshipList
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'201':
|
||||
description: 'RelationshipList'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/RelationshipList'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/getEmployeeAndDependence':
|
||||
get:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'GetEmployeeAndDependence'
|
||||
operationId: GetEmployeeAndDependence
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
- name: emp_code
|
||||
in: query
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'201':
|
||||
description: 'GetEmployeeAndDependence'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetEmployeeAndDependence'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/editEmployeeAndDependence':
|
||||
post:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'EditEmployeeAndDependence'
|
||||
operationId: EditEmployeeAndDependence
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: The ID of the employee.
|
||||
client_id:
|
||||
type: string
|
||||
description: The ID of the client.
|
||||
relationship:
|
||||
type: string
|
||||
description: The relationship of the employee.
|
||||
relationship_code:
|
||||
type: string
|
||||
description: The code representing the relationship.
|
||||
change_event:
|
||||
type: string
|
||||
description: The change event associated with the employee.
|
||||
batch_id:
|
||||
type: string
|
||||
description: The ID of the batch.
|
||||
emp_code:
|
||||
type: string
|
||||
description: The code of the employee.
|
||||
name:
|
||||
type: string
|
||||
description: The name of the employee.
|
||||
email_personal:
|
||||
type: string
|
||||
description: The personal email of the employee.
|
||||
email_corporate:
|
||||
type: string
|
||||
description: The corporate email of the employee.
|
||||
mobile:
|
||||
type: string
|
||||
description: The mobile number of the employee.
|
||||
gender:
|
||||
type: string
|
||||
description: The gender of the employee.
|
||||
dob:
|
||||
type: string
|
||||
format: date
|
||||
description: The date of birth of the employee.
|
||||
doj:
|
||||
type: string
|
||||
format: date
|
||||
description: The date of joining of the employee.
|
||||
basic_pay:
|
||||
type: string
|
||||
description: The basic pay of the employee.
|
||||
band:
|
||||
type: string
|
||||
description: The band of the employee.
|
||||
designation:
|
||||
type: string
|
||||
description: The designation of the employee.
|
||||
emp_status:
|
||||
type: string
|
||||
description: The status of the employee.
|
||||
is_active:
|
||||
type: string
|
||||
description: Indicates if the employee is active.
|
||||
file_id:
|
||||
type: string
|
||||
description: The ID of the file associated with the employee.
|
||||
|
||||
responses:
|
||||
'201':
|
||||
description: 'EditEmployeeAndDependence'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/EditEmployeeAndDependence'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/addEmployeeAndDependence':
|
||||
post:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'AddEmployeeAndDependence'
|
||||
operationId: AddEmployeeAndDependence
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
client_id:
|
||||
type: string
|
||||
description: The ID of the client.
|
||||
relationship:
|
||||
type: string
|
||||
description: The relationship of the employee.
|
||||
relationship_code:
|
||||
type: string
|
||||
description: The code representing the relationship.
|
||||
change_event:
|
||||
type: string
|
||||
description: The change event associated with the employee.
|
||||
batch_id:
|
||||
type: string
|
||||
description: The ID of the batch.
|
||||
emp_code:
|
||||
type: string
|
||||
description: The code of the employee.
|
||||
name:
|
||||
type: string
|
||||
description: The name of the employee.
|
||||
email_personal:
|
||||
type: string
|
||||
description: The personal email of the employee.
|
||||
email_corporate:
|
||||
type: string
|
||||
description: The corporate email of the employee.
|
||||
mobile:
|
||||
type: string
|
||||
description: The mobile number of the employee.
|
||||
gender:
|
||||
type: string
|
||||
description: The gender of the employee.
|
||||
dob:
|
||||
type: string
|
||||
format: date
|
||||
description: The date of birth of the employee.
|
||||
doj:
|
||||
type: string
|
||||
format: date
|
||||
description: The date of joining of the employee.
|
||||
basic_pay:
|
||||
type: string
|
||||
description: The basic pay of the employee.
|
||||
band:
|
||||
type: string
|
||||
description: The band of the employee.
|
||||
designation:
|
||||
type: string
|
||||
description: The designation of the employee.
|
||||
emp_status:
|
||||
type: string
|
||||
description: The status of the employee.
|
||||
is_active:
|
||||
type: string
|
||||
description: Indicates if the employee is active.
|
||||
file_id:
|
||||
type: string
|
||||
description: The ID of the file associated with the employee.
|
||||
|
||||
responses:
|
||||
'201':
|
||||
description: 'EditEmployeeAndDependence'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/AddEmployeeAndDependence'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/getEmployeePolicy':
|
||||
get:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'GetEmployeePolicy'
|
||||
operationId: GetEmployeePolicy
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
- name: id
|
||||
in: query
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
- name: emp_code
|
||||
in: query
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'201':
|
||||
description: 'GetEmployeePolicy'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetEmployeePolicy'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/createOrUpdateEmployeePolicySiAmount':
|
||||
post:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'CreateOrUpdateEmployeePolicySiAmount'
|
||||
operationId: CreateOrUpdateEmployeePolicySiAmount
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
employee_id:
|
||||
type: integer
|
||||
description: The ID of the employee.
|
||||
client_policy_id:
|
||||
type: integer
|
||||
description: The ID of the client.
|
||||
basic_cover_si:
|
||||
type: string
|
||||
description: The Employee Policy.
|
||||
premium:
|
||||
type: string
|
||||
description: The code representing the Employee Policy.
|
||||
|
||||
responses:
|
||||
'201':
|
||||
description: 'CreateOrUpdateEmployeePolicySiAmount'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CreateOrUpdateEmployeePolicySiAmount'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/deleteDependence':
|
||||
get:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'DeleteDependence'
|
||||
operationId: DeleteDependence
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
- name: id
|
||||
in: query
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'201':
|
||||
description: 'DeleteDependence'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/DeleteDependence'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/getEmployeeAndDependenceByClientId':
|
||||
get:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'GetEmployeeAndDependenceByClientId'
|
||||
operationId: GetEmployeeAndDependenceByClientId
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
- name: client_id
|
||||
in: query
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
- name: client_policy_id
|
||||
in: query
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'201':
|
||||
description: 'GetEmployeeAndDependenceByClientId'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetEmployeeAndDependenceByClientId'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
'/nhance/employeeRest/getClientPolicy':
|
||||
get:
|
||||
tags:
|
||||
# - EmployeeUpload
|
||||
summary: 'GetClientPolicy'
|
||||
operationId: GetClientPolicy
|
||||
parameters:
|
||||
- name: auth
|
||||
in: header
|
||||
description: an authorization header
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
'201':
|
||||
description: 'GetClientPolicy'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/GetClientPolicy'
|
||||
'405':
|
||||
description: 'Invalid input'
|
||||
security:
|
||||
- bearer_auth: []
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
components:
|
||||
schemas:
|
||||
EmployeeUpload:
|
||||
title: EmployeeUpload
|
||||
description: EmployeeUpload
|
||||
properties:
|
||||
client_id:
|
||||
title: client_id
|
||||
description: client_id
|
||||
type: integer
|
||||
policy_id:
|
||||
title: policy_id
|
||||
description: policy_id
|
||||
type: integer
|
||||
file:
|
||||
title: file
|
||||
description: file
|
||||
type: string
|
||||
format: binary
|
||||
type: object
|
||||
GetVerifiedUserData:
|
||||
title: GetVerifiedUserData
|
||||
description: GetVerifiedUserData
|
||||
properties:
|
||||
mobile_number:
|
||||
title: mobile_number
|
||||
description: mobile_number
|
||||
type: string
|
||||
otp:
|
||||
title: otp
|
||||
description: otp
|
||||
type: string
|
||||
type: object
|
||||
VerifyEmployeeNumber:
|
||||
title: VerifyEmployeeNumber
|
||||
description: VerifyEmployeeNumber
|
||||
properties:
|
||||
mobile_number:
|
||||
title: mobile_number
|
||||
description: mobile_number
|
||||
type: string
|
||||
type: object
|
||||
GetVerifiedHrData:
|
||||
title: GetVerifiedHrData
|
||||
description: GetVerifiedHrData
|
||||
properties:
|
||||
mobile_number:
|
||||
title: mobile_number
|
||||
description: mobile_number
|
||||
type: string
|
||||
otp:
|
||||
title: otp
|
||||
description: otp
|
||||
type: string
|
||||
type: object
|
||||
VerifyHrWithMobileNumber:
|
||||
title: VerifyHrWithMobileNumber
|
||||
description: VerifyHrWithMobileNumber
|
||||
properties:
|
||||
mobile_number:
|
||||
title: mobile_number
|
||||
description: mobile_number
|
||||
type: string
|
||||
type: object
|
||||
GetEmployeeProfile:
|
||||
title: GetEmployeeProfile
|
||||
description: GetEmployeeProfile
|
||||
properties:
|
||||
emp_code:
|
||||
title: emp_code
|
||||
description: emp_code
|
||||
type: string
|
||||
type: object
|
||||
EditEmployeeProfile:
|
||||
title: EditEmployeeProfile
|
||||
description: EditEmployeeProfile
|
||||
properties:
|
||||
emp_code:
|
||||
title: emp_code
|
||||
description: emp_code
|
||||
type: string
|
||||
type: object
|
||||
RelationshipList:
|
||||
title: RelationshipList
|
||||
description: RelationshipList
|
||||
type: object
|
||||
EditEmployeeAndDependence:
|
||||
title: EditEmployeeAndDependence
|
||||
description: EditEmployeeAndDependence
|
||||
properties:
|
||||
emp_code:
|
||||
title: emp_code
|
||||
description: emp_code
|
||||
type: string
|
||||
type: object
|
||||
GetEmployeeAndDependence:
|
||||
title: EditEmployeeAndDependence
|
||||
description: EditEmployeeAndDependence
|
||||
properties:
|
||||
emp_code:
|
||||
title: emp_code
|
||||
description: emp_code
|
||||
type: string
|
||||
type: object
|
||||
AddEmployeeAndDependence:
|
||||
title: AddEmployeeAndDependence
|
||||
description: AddEmployeeAndDependence
|
||||
properties:
|
||||
emp_code:
|
||||
title: emp_code
|
||||
description: emp_code
|
||||
type: string
|
||||
type: object
|
||||
GetEmployeePolicy:
|
||||
title: GetEmployeePolicy
|
||||
description: GetEmployeePolicy
|
||||
properties:
|
||||
id:
|
||||
title: id
|
||||
description: id
|
||||
type: integer
|
||||
emp_code:
|
||||
title: emp_code
|
||||
description: emp_code
|
||||
type: string
|
||||
type: object
|
||||
CreateOrUpdateEmployeePolicySiAmount:
|
||||
title: CreateOrUpdateEmployeePolicySiAmount
|
||||
description: CreateOrUpdateEmployeePolicySiAmount
|
||||
properties:
|
||||
employee_id:
|
||||
title: employee_id
|
||||
description: employee_id
|
||||
type: integer
|
||||
client_policy_id:
|
||||
title: client_policy_id
|
||||
description: client_policy_id
|
||||
type: integer
|
||||
basic_cover_si:
|
||||
title: basic_cover_si
|
||||
description: basic_cover_si
|
||||
type: string
|
||||
premium:
|
||||
title: premium
|
||||
description: premium
|
||||
type: string
|
||||
type: object
|
||||
DeleteDependence:
|
||||
title: DeleteDependence
|
||||
description: DeleteDependence
|
||||
properties:
|
||||
id:
|
||||
title: id
|
||||
description: id
|
||||
type: integer
|
||||
type: object
|
||||
GetEmployeeAndDependenceByClientId:
|
||||
title: GetEmployeeAndDependenceByClientId
|
||||
description: GetEmployeeAndDependenceByClientId
|
||||
properties:
|
||||
client_id:
|
||||
title: client_id
|
||||
description: client_id
|
||||
type: integer
|
||||
client_policy_id:
|
||||
title: client_policy_id
|
||||
description: client_policy_id
|
||||
type: integer
|
||||
type: object
|
||||
GetClientPolicy:
|
||||
title: GetClientPolicy
|
||||
description: GetClientPolicy
|
||||
type: object
|
||||
|
||||
# securitySchemes:
|
||||
# Authorization:
|
||||
# type: http
|
||||
# scheme: bearer
|
||||
# bearerFormat: JWT
|
||||
BIN
public/assets/images/Nhance-Logo-Final.png
Normal file
BIN
public/assets/images/Nhance-Logo-Final.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
BIN
public/assets/swagger/favicon-16x16.png
Normal file
BIN
public/assets/swagger/favicon-16x16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 665 B |
BIN
public/assets/swagger/favicon-32x32.png
Normal file
BIN
public/assets/swagger/favicon-32x32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 628 B |
60
public/assets/swagger/index.html
Normal file
60
public/assets/swagger/index.html
Normal file
@ -0,0 +1,60 @@
|
||||
<!-- HTML for static distribution bundle build -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
|
||||
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||
<style>
|
||||
html
|
||||
{
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
*,
|
||||
*:before,
|
||||
*:after
|
||||
{
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body
|
||||
{
|
||||
margin:0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script src="./swagger-ui-bundle.js"> </script>
|
||||
<script src="./swagger-ui-standalone-preset.js"> </script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
// Begin Swagger UI call region
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "https://petstore.swagger.io/v2/swagger.json",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout"
|
||||
})
|
||||
// End Swagger UI call region
|
||||
|
||||
window.ui = ui
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
68
public/assets/swagger/oauth2-redirect.html
Normal file
68
public/assets/swagger/oauth2-redirect.html
Normal file
@ -0,0 +1,68 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<title>Swagger UI: OAuth2 Redirect</title>
|
||||
<body onload="run()">
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
'use strict';
|
||||
function run () {
|
||||
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||
var sentState = oauth2.state;
|
||||
var redirectUrl = oauth2.redirectUrl;
|
||||
var isValid, qp, arr;
|
||||
|
||||
if (/code|token|error/.test(window.location.hash)) {
|
||||
qp = window.location.hash.substring(1);
|
||||
} else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
|
||||
arr = qp.split("&")
|
||||
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
|
||||
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||
function (key, value) {
|
||||
return key === "" ? value : decodeURIComponent(value)
|
||||
}
|
||||
) : {}
|
||||
|
||||
isValid = qp.state === sentState
|
||||
|
||||
if ((
|
||||
oauth2.auth.schema.get("flow") === "accessCode"||
|
||||
oauth2.auth.schema.get("flow") === "authorizationCode"
|
||||
) && !oauth2.auth.code) {
|
||||
if (!isValid) {
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "warning",
|
||||
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||
});
|
||||
}
|
||||
|
||||
if (qp.code) {
|
||||
delete oauth2.state;
|
||||
oauth2.auth.code = qp.code;
|
||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||
} else {
|
||||
let oauthErrorMsg
|
||||
if (qp.error) {
|
||||
oauthErrorMsg = "["+qp.error+"]: " +
|
||||
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||
}
|
||||
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "error",
|
||||
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
92
public/assets/swagger/swagger-ui-bundle.js
Normal file
92
public/assets/swagger/swagger-ui-bundle.js
Normal file
File diff suppressed because one or more lines are too long
1
public/assets/swagger/swagger-ui-bundle.js.map
Normal file
1
public/assets/swagger/swagger-ui-bundle.js.map
Normal file
File diff suppressed because one or more lines are too long
22
public/assets/swagger/swagger-ui-standalone-preset.js
Normal file
22
public/assets/swagger/swagger-ui-standalone-preset.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
public/assets/swagger/swagger-ui.css
Normal file
4
public/assets/swagger/swagger-ui.css
Normal file
File diff suppressed because one or more lines are too long
1
public/assets/swagger/swagger-ui.css.map
Normal file
1
public/assets/swagger/swagger-ui.css.map
Normal file
File diff suppressed because one or more lines are too long
9
public/assets/swagger/swagger-ui.js
Normal file
9
public/assets/swagger/swagger-ui.js
Normal file
File diff suppressed because one or more lines are too long
1
public/assets/swagger/swagger-ui.js.map
Normal file
1
public/assets/swagger/swagger-ui.js.map
Normal file
File diff suppressed because one or more lines are too long
BIN
public/sample_excel/inception.xls
Normal file
BIN
public/sample_excel/inception.xls
Normal file
Binary file not shown.
BIN
public/sample_excel/inception_1.xls
Normal file
BIN
public/sample_excel/inception_1.xls
Normal file
Binary file not shown.
BIN
public/sample_excel/inception_2.xls
Normal file
BIN
public/sample_excel/inception_2.xls
Normal file
Binary file not shown.
BIN
public/sample_excel/inception_3.xls
Normal file
BIN
public/sample_excel/inception_3.xls
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user