CODE_MERGE : RV
This commit is contained in:
commit
5882b2c7e0
@ -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',
|
||||
],
|
||||
|
||||
@ -6,7 +6,7 @@ use CodeIgniter\Router\RouteCollection;
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
// $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');
|
||||
@ -191,13 +191,17 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
|
||||
$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");
|
||||
//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");
|
||||
@ -208,16 +212,23 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){
|
||||
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
||||
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
||||
|
||||
$routes->get("/getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||
$routes->post("/employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
|
||||
|
||||
|
||||
$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("/relationshipList", "EmployeeRestController::relationshipList");
|
||||
|
||||
$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");
|
||||
|
||||
|
||||
|
||||
@ -583,147 +583,194 @@ class ClientController extends AdminController
|
||||
|
||||
public function createClientPolicyPremium()
|
||||
{
|
||||
// print_r($this->request->getPost());die();
|
||||
$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');
|
||||
$multiplier = $this->request->getPost('multiplier');
|
||||
$si_or_bp = $this->request->getPost('si_or_bp');
|
||||
$basic_multiplier = $this->request->getPost('basic_multiplier');
|
||||
$premium_multiplier =$this->request->getPost('premium_multiplier');
|
||||
$basic_pay = $this->request->getPost('basic_pay');
|
||||
try {
|
||||
$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');
|
||||
$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($policy_type !== null && $policy_type !== ''){
|
||||
$premium = [];
|
||||
|
||||
$this->policyPremium1Model->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');
|
||||
}
|
||||
|
||||
if(is_array($this->request->getPost('premium'))){
|
||||
$premium = isset($this->request->getPost('premium')[$i]) ? $this->request->getPost('premium')[$i] : null;
|
||||
}else{
|
||||
$premium = $this->request->getPost('premium');
|
||||
}
|
||||
// $basic_gpa_premium = isset($basic_gpa_premium[$i]) ? $basic_gpa_premium[$i] : null;
|
||||
if ($si !== null) {
|
||||
$data['si'] = $si;
|
||||
}
|
||||
if ($premium !== null) {
|
||||
$data['premium'] = $premium;
|
||||
}
|
||||
|
||||
if ($multiplier !== null) {
|
||||
$data['multiplier'] = $multiplier;
|
||||
}
|
||||
|
||||
if ($si_or_bp !== null) {
|
||||
$data['si_or_bp'] = $si_or_bp;
|
||||
}
|
||||
|
||||
if ($premium_multiplier !== null) {
|
||||
$data['multiplier'] = $premium_multiplier;
|
||||
}
|
||||
|
||||
if ($basic_multiplier !== null) {
|
||||
$data['basic_multiplier'] = $basic_multiplier;
|
||||
}
|
||||
|
||||
if ($basic_pay !== null) {
|
||||
$data['basic_pay'] = $basic_pay;
|
||||
}
|
||||
|
||||
$this->policyPremium1Model->insert($data);
|
||||
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;
|
||||
}
|
||||
$data = $this->request->getPost();
|
||||
$insert = true;
|
||||
|
||||
if($insert){
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||
}else{
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
||||
|
||||
}
|
||||
// print_r($data);
|
||||
// die();
|
||||
// $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);
|
||||
}
|
||||
$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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -787,6 +834,8 @@ class ClientController extends AdminController
|
||||
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
$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")
|
||||
->where("employees.client_id",$record['client_id'])
|
||||
@ -816,14 +865,30 @@ class ClientController extends AdminController
|
||||
}else{
|
||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||
}
|
||||
|
||||
|
||||
// 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{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($data[0]->policy_type); die;
|
||||
// echo "hello";
|
||||
// print_r($premiumData);
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => $premiumData, 'count' => $emp_count, 'policy_name' => $policy_name], 200);
|
||||
// return json_encode($premiumData);
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
|
||||
|
||||
}
|
||||
|
||||
@ -834,6 +899,7 @@ class ClientController extends AdminController
|
||||
|
||||
$this->myLogger->logme('error','Terms CREATE function called');
|
||||
|
||||
|
||||
/*** Client Policy Table Primary Key(ID) ***/
|
||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||
|
||||
@ -842,6 +908,9 @@ class ClientController extends AdminController
|
||||
$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");
|
||||
}
|
||||
$data['waiverofpreexistingdiseases'] =$this->request->getPost("waiverofpreexistingdiseases");
|
||||
if ($data['waiverofpreexistingdiseases'] == 1) {
|
||||
$data['maternitycoverage'] =$this->request->getPost("maternitycoverage");
|
||||
|
||||
57
app/Controllers/EmployeeModel.php
Normal file
57
app/Controllers/EmployeeModel.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class EmployeeModel extends Model
|
||||
{
|
||||
protected $table = 'employees';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"client_id",
|
||||
"employee_id",
|
||||
"change_event",
|
||||
"relationship_id",
|
||||
"relationship",
|
||||
"batch_id",
|
||||
"emp_code",
|
||||
"name",
|
||||
"email_personal",
|
||||
"email_corporate",
|
||||
"mobile",
|
||||
"gender",
|
||||
"dob",
|
||||
"otp",
|
||||
"emp_status",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
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 checkExistingEmpEntrollment($arr)
|
||||
{
|
||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->first();
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Helpers\MailHelper;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
@ -13,7 +15,16 @@ 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\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;
|
||||
@ -31,6 +42,7 @@ class EmployeeRestController extends AdminController
|
||||
protected $fileModel;
|
||||
protected $policesModel;
|
||||
protected $relationshipModel;
|
||||
protected $clientPolicyModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -42,6 +54,8 @@ class EmployeeRestController extends AdminController
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->policesModel = new PolicesModel();
|
||||
$this->relationshipModel = new RelationshipModel();
|
||||
$this->fileModel= new FileModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
}
|
||||
|
||||
|
||||
@ -63,7 +77,7 @@ class EmployeeRestController extends AdminController
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function editEmployeeProfile()
|
||||
@ -94,14 +108,20 @@ class EmployeeRestController extends AdminController
|
||||
try {
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
if ($emp_code) {
|
||||
$employee = $this->employeeModel->where('emp_code', $emp_code)
|
||||
->findAll();
|
||||
|
||||
$result = $employee;
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
$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 {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []],404);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
@ -118,6 +138,7 @@ class EmployeeRestController extends AdminController
|
||||
$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++;
|
||||
@ -138,32 +159,38 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function addEmployeeAndDependence()
|
||||
{
|
||||
try {
|
||||
$data = $this->request->getJSON();
|
||||
|
||||
|
||||
if ($data) {
|
||||
$updatedCount = 0;
|
||||
$Count = 0;
|
||||
foreach ($data as $item) {
|
||||
$extractData['name'] = $item->name;
|
||||
$extractData['emp_code']= $item->emp_code;
|
||||
$extractData['email_corporate']=$item->email_corporate;
|
||||
$extractData['relationship_code']=$item->relationship_code;
|
||||
$extractData['mobile']=$item->mobile;
|
||||
$extractData['gender']=$item->gender;
|
||||
$extractData['dob']=$item->dob;
|
||||
$extractData['client_id']=$item->client_id;
|
||||
// print_r($extractData);die();
|
||||
$employee = $this->employeeModel->insert($extractData);
|
||||
if ($employee) {
|
||||
$updatedCount++;
|
||||
}
|
||||
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 ($updatedCount > 0) {
|
||||
if ($Count > 0) {
|
||||
$result = [];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||
} else {
|
||||
@ -177,29 +204,220 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
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 {
|
||||
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()
|
||||
{
|
||||
$id= 1;
|
||||
try {
|
||||
$keysToRemove = ["sum_insured","family_floater","corporatebuffer","family_floaters"];
|
||||
$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));
|
||||
|
||||
// $client_id =$array->ClientId;
|
||||
// $policy_id =$array->PolicyId;
|
||||
|
||||
// $rackRate = $this->policesModel->getPolicySlabRatesForEmpOnboard($policy_id, $client_id);
|
||||
|
||||
// $array->Policy_Terms = json_encode($refusingData);
|
||||
|
||||
$array->Policy_Terms = $refusingData;
|
||||
$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);
|
||||
@ -211,6 +429,42 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// 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()
|
||||
{
|
||||
@ -229,56 +483,225 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Upload the Sheet Data in DB
|
||||
public function employeeUpload()
|
||||
{
|
||||
if ($this->request->getFile('file')) {
|
||||
// Load PHPExcel library
|
||||
require_once APPPATH . 'third_party/PHPExcel/PHPExcel.php';
|
||||
|
||||
// Load the uploaded file
|
||||
$file = $this->request->getFile('file');
|
||||
|
||||
// Load file into PHPExcel
|
||||
$inputFileType = PHPExcel_IOFactory::identify($file->getPathname());
|
||||
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
|
||||
$objPHPExcel = $objReader->load($file->getPathname());
|
||||
|
||||
// Get the active sheet
|
||||
$sheet = $objPHPExcel->getActiveSheet();
|
||||
|
||||
// Get the highest row number
|
||||
$highestRow = $sheet->getHighestRow();
|
||||
|
||||
// Assuming your data starts from the second row (after headers)
|
||||
for ($row = 2; $row <= $highestRow; $row++) {
|
||||
// Get cell values
|
||||
$name = $sheet->getCellByColumnAndRow(0, $row)->getValue();
|
||||
$email = $sheet->getCellByColumnAndRow(1, $row)->getValue();
|
||||
// Assuming you have more columns, adjust indexes accordingly
|
||||
|
||||
// Store data into database (Example using CodeIgniter's database methods)
|
||||
$data = array(
|
||||
'name' => $name,
|
||||
'email' => $email,
|
||||
// Add more fields as necessary
|
||||
);
|
||||
// Insert data into the database table
|
||||
$this->db->insert('employees', $data);
|
||||
}
|
||||
|
||||
// Optionally, you can delete the uploaded file after processing
|
||||
unlink($file->getPathname());
|
||||
|
||||
// Optionally, you can redirect the user to a success page
|
||||
redirect('employee/success');
|
||||
} else {
|
||||
// Handle case when no file was uploaded
|
||||
echo 'No file uploaded!';
|
||||
$file = $this->request->getFile('file');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
|
||||
$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']);
|
||||
// print_r($excel_data);die();
|
||||
// $data = [];
|
||||
// $data[] =$excel_data;
|
||||
|
||||
// print_r($data);die;
|
||||
// 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();
|
||||
// // print_r($value);
|
||||
// // Add the cell value to the row data array
|
||||
// $rowData[] = $value;
|
||||
// }
|
||||
|
||||
// // Add the row data to the main data array
|
||||
// $data[] = $rowData;
|
||||
// }
|
||||
// print_r($data);die;
|
||||
|
||||
$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 = [];
|
||||
//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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// print_r("Extra", $extra);die;
|
||||
$dataToInsert = [];
|
||||
$basic_cover_si= [];
|
||||
// print_r($extra);die;
|
||||
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
|
||||
// print_r($extra['3']);die;
|
||||
$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];
|
||||
|
||||
// print_r("--" . $emp_code. "---");
|
||||
// print_r( $emp_code != 0 );
|
||||
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'
|
||||
|
||||
];
|
||||
$record2 = [
|
||||
'basic_cover_si' => isset($extra['9'][$index]) ? $extra['9'][$index] : 0,
|
||||
];
|
||||
$dataToInsert[] = $record;
|
||||
$basic_cover_si[]= $record2;
|
||||
}
|
||||
}
|
||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||
{
|
||||
$employee = $this->employeeModel->checkExistingEmpEntrollment($dataToInsert[$a]);
|
||||
$emp_id =0;
|
||||
|
||||
if ($employee) {
|
||||
$emp_id =$employee['id'];
|
||||
$id =$emp_id;
|
||||
$result = $this->employeeModel->update($id, $dataToInsert[$a]);
|
||||
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 = $this->employeeModel->insert($dataToInsert[$a]);
|
||||
$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'=> $basic_cover_si[$a]
|
||||
];
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]);
|
||||
if ($employee_policy) {
|
||||
foreach ($employee_policy as $existing_policy) {
|
||||
$this->employeePolicyModel->update($existing_policy['id'], $emp_policy_data);
|
||||
}
|
||||
} else {
|
||||
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
||||
}
|
||||
|
||||
|
||||
//trigger
|
||||
// print_r($dataToInsert[$a]['email_personal']);die;
|
||||
$policy = $this->clientPolicyModel->where('id', $policy_id)->first();
|
||||
$policy_name = $this->policesModel->where('id', $policy['policy_id'])->first();
|
||||
$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['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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -20,6 +20,7 @@ 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');
|
||||
@ -33,6 +34,7 @@ class RestAuthenticationController extends AdminController
|
||||
protected $myLogger;
|
||||
protected $employeeModel;
|
||||
protected $authHistoryModel;
|
||||
protected $hrModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -42,6 +44,7 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->authHistoryModel = new AuthHistoryModel();
|
||||
$this->hrModel = new LevelContactModel();
|
||||
|
||||
}
|
||||
|
||||
@ -67,6 +70,7 @@ class RestAuthenticationController extends AdminController
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$randomNumber = rand(100000, 999999);
|
||||
$randomNumber = 123456;
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||
|
||||
@ -121,6 +125,68 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyHrWithMobileNumber()
|
||||
{
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$randomNumber = rand(100000, 999999);
|
||||
$randomNumber = 123456;
|
||||
$HrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
|
||||
|
||||
if ($HrData) {
|
||||
$id= $HrData["id"];
|
||||
$otp = $this->hrModel->where('id', $id)->set('otp', $randomNumber)->update();
|
||||
$result = ['user_verification' => true , 'otp'=>$randomNumber];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
$result = ['user_verification' => false];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getVerifiedHrData()
|
||||
{
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$otp = $this->request->getJSON()->otp;
|
||||
|
||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->first();
|
||||
if ($hrData && $otp == $hrData["otp"]) {
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$data = [
|
||||
'user_id' => $hrData['id'],
|
||||
'user_type' => 'hr',
|
||||
'ip' => $auth['ip'],
|
||||
'platform' => $auth['platform'],
|
||||
'broswer' => $auth['browser'],
|
||||
];
|
||||
|
||||
$authdata= $this->authHistoryModel->insert($data);
|
||||
|
||||
}
|
||||
$otp_null = $this->hrModel->where('id', $hrData["id"])->set('otp', null)->update();
|
||||
|
||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||
->where('level_contacts.mobile', $mobile_number )
|
||||
->find();
|
||||
|
||||
$result = JWTToken::encode($hrData['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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function employeeLogout()
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -23,7 +23,9 @@ class EmployeeModel extends Model
|
||||
"mobile",
|
||||
"gender",
|
||||
"dob",
|
||||
"doj",
|
||||
"otp",
|
||||
"family_floater_key",
|
||||
"emp_status",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
@ -37,7 +39,7 @@ class EmployeeModel extends Model
|
||||
{
|
||||
|
||||
return $this->db->table('employee_polices')
|
||||
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables
|
||||
->select(' policies.name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment') // Select all columns from both tables
|
||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->where('employee_polices.employee_id', $id)
|
||||
@ -45,4 +47,13 @@ class EmployeeModel extends Model
|
||||
->getResult();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// for EMP rest API process do not change
|
||||
public function checkExistingEmpEntrollment($arr)
|
||||
{
|
||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->first();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -447,5 +447,28 @@ class EmployeePolicyModel extends Model
|
||||
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;
|
||||
|
||||
class PolicesModel extends Model
|
||||
@ -35,16 +37,17 @@ class PolicesModel extends Model
|
||||
{
|
||||
|
||||
$premium_slab_data = null;
|
||||
$policyPremium1Model = new policyPremium1Model();
|
||||
|
||||
$policyPremium1Model = new PolicyPremium1Model();
|
||||
$premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
if((isset($premium_slab_data)))
|
||||
|
||||
if((!count($premium_slab_data)))
|
||||
{
|
||||
$policyPremium2Model = new policyPremium2Model();
|
||||
$policyPremium2Model = new PolicyPremium2Model();
|
||||
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
|
||||
}
|
||||
$grid_id = $premium_slab_data[0]['policy_grid_id'];
|
||||
$policyGridModel = new policyGridModel();
|
||||
$policyGridModel = new PolicyGridModel();
|
||||
$results = $policyGridModel->find($grid_id);
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
|
||||
}
|
||||
|
||||
@ -654,31 +654,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,9 +694,21 @@
|
||||
}
|
||||
|
||||
function convertCommaNumberToWords(input) {
|
||||
// console.log(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){
|
||||
@ -708,22 +720,69 @@
|
||||
|
||||
|
||||
function formatNumber(input, maxLength) {
|
||||
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;
|
||||
|
||||
// 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();
|
||||
}
|
||||
basicPayMultiple(input)
|
||||
if (input.id == 'gpa_si') {
|
||||
gpaSumInsureMultiplier();
|
||||
}
|
||||
convertCommaNumberToWords(input);
|
||||
|
||||
return ;
|
||||
// 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>
|
||||
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>
|
||||
@ -465,9 +465,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 +475,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>
|
||||
|
||||
@ -630,6 +626,8 @@ var grid_html = '';
|
||||
|
||||
|
||||
var gmc_policy_type_id = $(this).attr('id');
|
||||
|
||||
|
||||
if(gmc_policy_type_id >= '2'){
|
||||
|
||||
$('#policyGMCTerms').css('display', '');
|
||||
@ -644,11 +642,12 @@ var grid_html = '';
|
||||
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);
|
||||
console.log(response);
|
||||
$('#nameOfThePolicyInGMC').html(' - ' + response.policy_name.name);
|
||||
$('gmc_emp_count').val(response.count);
|
||||
|
||||
|
||||
@ -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);
|
||||
@ -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'){
|
||||
|
||||
@ -466,7 +470,11 @@
|
||||
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){
|
||||
@ -533,10 +541,7 @@
|
||||
$("#sumInsured2").trigger("keyup");
|
||||
$("#totalSumInsured").trigger("keyup");
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
},
|
||||
|
||||
error: function(xhr, status, error) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,8 @@
|
||||
"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"
|
||||
|
||||
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 |
Loading…
Reference in New Issue
Block a user