Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
8a34b023ab
5
.cpanel.yml
Normal file
5
.cpanel.yml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
deployment:
|
||||
tasks:
|
||||
- export DEPLOYPATH=home/venbaehn/public_html/nhance/devauto
|
||||
- /bin/cp /home/venbaehn/repositories/nhance_dev/* $DEPLOYPATH -r
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,5 +24,7 @@ writable/**/*.sqlite
|
||||
|
||||
|
||||
vendor/
|
||||
build/
|
||||
composer.lock
|
||||
.env
|
||||
.phpunit*
|
||||
|
||||
@ -2,9 +2,14 @@
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
|
||||
/**
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
|
||||
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
|
||||
|
||||
|
||||
// $routes->get('/', 'LoginController::index');
|
||||
$routes->get('/test', 'Home::index');
|
||||
$routes->get('/login', 'LoginController::index');///auth/google
|
||||
@ -34,6 +39,7 @@ $routes->group("/client", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("list", "ClientController::index");
|
||||
$routes->get("create", "ClientController::clientOnboarding");
|
||||
$routes->get('deposit/(:num)', 'ClientController::deposit/$1');
|
||||
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
|
||||
// application/config/routes.php
|
||||
|
||||
// Add a route for the view_Deposit method
|
||||
@ -53,6 +59,7 @@ $routes->post('save_deposit', 'ClientController::saveDeposit');
|
||||
|
||||
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
||||
|
||||
|
||||
|
||||
$routes->group("general", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("create", "ClientController::createClientGeneralInfo");
|
||||
@ -63,6 +70,7 @@ $routes->post('save_deposit', 'ClientController::saveDeposit');
|
||||
$routes->post("create", "ClientController::createClientBranch");
|
||||
$routes->post("edit", "ClientController::editClientBranch");
|
||||
$routes->get("list/(:any)", "ClientController::getSingleBranchDataById/$1");
|
||||
$routes->get("remove/(:any)", "ClientController::removeClientBranch/$1");
|
||||
});
|
||||
|
||||
$routes->group("relation", ["filter" => "authMVC"], function($routes){
|
||||
@ -111,7 +119,10 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
|
||||
|
||||
|
||||
$routes->group("insurer", ["filter" => "authMVC"], function($routes){
|
||||
|
||||
|
||||
$routes->get("list", "MasterController::insurerList");
|
||||
$routes->get("remove/(:any)", "MasterController::insurerRemove/$1");
|
||||
$routes->get("create", "MasterController::insurerOnboarding");
|
||||
$routes->post("createpost", "MasterController::createInsurerGeneralInfo");
|
||||
$routes->post("edit", "MasterController::editInsurerGeneralInfo");
|
||||
@ -122,6 +133,7 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("edit", "MasterController::editInsurerBranch");
|
||||
$routes->get("editget/(:any)", "MasterController::editInsurerGet/$1");
|
||||
$routes->get("list/(:any)", "MasterController::insurerBranchList/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::removeInsurerBranch/$1");
|
||||
});
|
||||
|
||||
});
|
||||
@ -132,12 +144,14 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("createpost", "MasterController::createTPAGeneralInfo");
|
||||
$routes->post("edit", "MasterController::editTPAGeneralInfo");
|
||||
$routes->get("list/(:any)", "MasterController::editTPAOnboarding/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::tpaRemove/$1");
|
||||
|
||||
$routes->group("branch", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("create", "MasterController::createTPABranch");
|
||||
$routes->get("editget/(:any)", "MasterController::editTPAGet/$1");
|
||||
$routes->post("edit", "MasterController::editTPABranch");
|
||||
$routes->get("list/(:any)", "MasterController::tpaBranchList/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::removeTPABranch/$1");
|
||||
});
|
||||
});
|
||||
|
||||
@ -147,6 +161,7 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("createpost", "MasterController::createKYCInfo");
|
||||
$routes->post("edit", "MasterController::editKYCInfo");
|
||||
$routes->get("list/(:any)", "MasterController::editKYCOnboarding/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::kycRemove/$1");
|
||||
$routes->get("delete/(:any)", "MasterController::deleteClientKycDocs/$1");
|
||||
|
||||
|
||||
@ -154,8 +169,9 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("createpost", "MasterController::createKycDocs");
|
||||
$routes->get("editget/(:any)", "MasterController::editKYCGet/$1");
|
||||
$routes->post("edit", "MasterController::editKYCDocs");
|
||||
$routes->get("list", "MasterController::tpaBranchList");
|
||||
// $routes->get("list", "MasterController::tpaBranchList");
|
||||
$routes->get("list/(:any)", "MasterController::kycDocsList/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::removeKYCDocs/$1");
|
||||
|
||||
});
|
||||
});
|
||||
@ -166,6 +182,7 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("createpost", "MasterController::createPolicyType");
|
||||
$routes->post("edit", "MasterController::editPolicyType");
|
||||
$routes->get("list/(:any)", "MasterController::editPolicyTypeOnboarding/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::policyTypeRemove/$1");
|
||||
|
||||
|
||||
$routes->group("policies", ["filter" => "authMVC"], function($routes){
|
||||
@ -174,6 +191,7 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
|
||||
$routes->post("edit", "MasterController::editPolicies");
|
||||
$routes->get("list", "MasterController::tpaBranchList");
|
||||
$routes->get("list/(:any)", "MasterController::policesList/$1");
|
||||
$routes->get("remove/(:any)", "MasterController::removePolicyPolicies/$1");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -102,6 +102,38 @@ class ClientController extends AdminController
|
||||
// $this->loadLayout('client_onboarding', $data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function removeClient($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Client Remove function called');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->clientModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function removeClientBranch($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Client Branch Remove function called');
|
||||
// $id = $this->request->getPost('PrimaryKey');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->clientBranchModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function clientOnboarding()
|
||||
{
|
||||
|
||||
@ -131,6 +163,7 @@ class ClientController extends AdminController
|
||||
{
|
||||
$headerData['page_name'] = 'Client Deposit';
|
||||
|
||||
$data['clientName'] = $this->clientModel->where('id',$id)->find();
|
||||
$data['clientData'] = $this->clientPolicyModel->getinsurerswithclientid($id);
|
||||
$data['depositsummary'] = $this->clientPolicyModel->getDepositlistsummary($id);
|
||||
|
||||
@ -211,7 +244,7 @@ class ClientController extends AdminController
|
||||
$editData['policyGridData'] = $this->policyGridModel->findAll();
|
||||
|
||||
|
||||
$editData['client'] = $this->clientModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['client'] = $this->clientModel->where(['id' => $id])->first();
|
||||
$editData['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $id)->findAll();
|
||||
$editData['client_branch'] = $this->clientBranchModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['client_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||
@ -230,8 +263,19 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Client general info function called');
|
||||
$uploadFilePath = ROOTPATH . 'public/uploads/logo/';
|
||||
$file_name = file_Upload($this->request->getFile('client_logo'), $uploadFilePath);
|
||||
$data = $this->request->getPost();
|
||||
$data['created_by'] = get_session_userid();
|
||||
$data['client_logo'] = $file_name;
|
||||
|
||||
|
||||
if (!isset($data['is_download_btn'])) {
|
||||
$data['is_download_btn'] = 0;
|
||||
} elseif ($data['is_download_btn']) {
|
||||
$data['is_download_btn'] = 1;
|
||||
}
|
||||
|
||||
$insert = $this->clientModel->insert($data);
|
||||
if($insert){
|
||||
$client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
@ -246,10 +290,27 @@ class ClientController extends AdminController
|
||||
public function editClientGeneralInfo()
|
||||
{
|
||||
$this->myLogger->logme('error','edit client general info function called');
|
||||
$uploadFilePath = ROOTPATH . 'public/uploads/logo/';
|
||||
// print_r($this->request->getFile('client_logo'));die;
|
||||
$file_name = file_Upload($this->request->getFile('client_logo'), $uploadFilePath);
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
|
||||
if(!empty($file_name)){
|
||||
$data['client_logo'] = $file_name;
|
||||
}
|
||||
|
||||
if (!isset($data['is_download_btn'])) {
|
||||
$data['is_download_btn'] = 0;
|
||||
} elseif ($data['is_download_btn']) {
|
||||
$data['is_download_btn'] = 1;
|
||||
}
|
||||
|
||||
$update = $this->clientModel->update($id,$data);
|
||||
|
||||
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $data], 200);
|
||||
}else{
|
||||
@ -262,7 +323,8 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme('error','create Client kyc function called');
|
||||
$data = $this->request->getPost();
|
||||
unset($data['file_name']);
|
||||
$File = file_Upload($this->request->getFile('file_name'));
|
||||
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
|
||||
$File = file_Upload($this->request->getFile('file_name'), $uploadFilePath);
|
||||
if(!empty($File)){
|
||||
$data['file_name'] = $File;
|
||||
}
|
||||
@ -282,7 +344,8 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','edit client kyc function called');
|
||||
$File = file_Upload($this->request->getFile('file_name'));
|
||||
$uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
|
||||
$File = file_Upload($this->request->getFile('file_name'), $uploadFilePath);
|
||||
if(!empty($File)){
|
||||
$data['file_name'] = $File;
|
||||
}
|
||||
@ -446,7 +509,7 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Client branch EDIT function called');
|
||||
$id = $this->request->getPost('PrimaryKey');
|
||||
$id = $this->request->getPost('branch_id_primarykey');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
@ -511,7 +574,13 @@ 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');
|
||||
|
||||
if (!isset($data['is_addon'])) {
|
||||
$data['is_addon'] = 0;
|
||||
} elseif ($data['is_addon']) {
|
||||
$data['is_addon'] = 1;
|
||||
}
|
||||
|
||||
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
@ -565,6 +634,14 @@ 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');
|
||||
|
||||
|
||||
if (!isset($data['is_addon'])) {
|
||||
$data['is_addon'] = 0;
|
||||
} elseif ($data['is_addon']) {
|
||||
$data['is_addon'] = 1;
|
||||
}
|
||||
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$insert = $this->clientPolicyModel->update($id,$data);
|
||||
@ -583,10 +660,14 @@ class ClientController extends AdminController
|
||||
|
||||
public function createClientPolicyPremium()
|
||||
{
|
||||
try {
|
||||
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'];
|
||||
}
|
||||
$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'));
|
||||
@ -767,7 +848,7 @@ class ClientController extends AdminController
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'data' => $data,'message' => 'no data found'], 200);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
// Handle exceptions here
|
||||
echo 'Error: ' . $e->getMessage();
|
||||
}
|
||||
@ -833,8 +914,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=json_decode($record['policy_terms'])->family_floater;
|
||||
$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")
|
||||
@ -865,6 +948,10 @@ 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 $record['client_id'];
|
||||
// echo "-----";
|
||||
// echo $client_policy_id;
|
||||
// print_r($premiumData);die;
|
||||
// echo '<pre>';
|
||||
// echo $family_floater;
|
||||
$resultss = [];
|
||||
@ -876,87 +963,172 @@ class ClientController extends AdminController
|
||||
$resultss[$index] = $record;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}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;
|
||||
// echo "hello";
|
||||
// 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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
$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(
|
||||
@ -965,6 +1137,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) {
|
||||
@ -1023,14 +1196,14 @@ class ClientController extends AdminController
|
||||
/*** 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) {
|
||||
@ -1039,16 +1212,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'] ="";
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -125,11 +125,27 @@ class EmployeeController extends AdminController
|
||||
// print_r($this->request->getPost('upload-action-type'));
|
||||
// die();
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '34']);
|
||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '38']);
|
||||
// dd($res);
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '12']);
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '38']);
|
||||
// dd($res);
|
||||
// $existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: '2');
|
||||
// dd($existing_famility_details);
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->employeesSIEnhanceProcess(['file_id' => '38']);
|
||||
// dd($res);
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->employeesCorrectionProcess(['file_id' => '37']);
|
||||
// // dd($res);
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['client_policy_id' => '3']);
|
||||
// dd($res);
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->employeeDisembark(['file_id' => '36']);
|
||||
// dd($res);
|
||||
|
||||
// if(isset($res['error_summary']) && count($res['error_summary']))
|
||||
@ -173,7 +189,7 @@ class EmployeeController extends AdminController
|
||||
$action = $this->request->getPost('upload-action-type');
|
||||
$status = 'inprogress';
|
||||
|
||||
$file_id = $this->fileModel->insert(['file_name' => $filename,'client_id' => $client_id,'policy_id' => $policy_id,'created_by' => $loggedInUserID,'status' => $status,'action' => $action]);
|
||||
$file_id = $this->fileModel->insert(['file_name' => $filename,'client_id' => $client_id,'policy_id' => $policy_id,'created_by' => $loggedInUserID,'status' => $status,'action' => $action]);//here field policy_id have client_policy_id and not policy id from policy master
|
||||
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
|
||||
|
||||
//start validation process
|
||||
@ -190,16 +206,30 @@ class EmployeeController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
$data['actions'] = ['inception' => 'Inception + Addition + Deletion','correction' =>'Correction','si_enhancement' =>'SI Enhancement'];
|
||||
$data['events'] = ['inception' => 'Inception + Addition','correction' =>'Correction', 'deletion'=>'Deletion' ,'si_enhancement' =>'SI Enhancement'];
|
||||
|
||||
|
||||
$data['events'] = ['inception' => 'Inception (Employee + Dependents)','addition' => 'Addition (Employee + Dependents)','dependent_addition' => 'Dependent Addition (Only Dependents)','deletion' => 'Deletion','correction' =>'Correction','si_enhancement' =>'SI Enhancement'];
|
||||
$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['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')
|
||||
->join('policies pm','files.policy_id = pm.id')
|
||||
->join('clients c','files.client_id = c.id')
|
||||
->where('files.created_by',8)->orderBy('files.created_at','desc')->findAll();
|
||||
->join('client_policy cp','files.policy_id = cp.id')
|
||||
->join('policies pm','cp.policy_id = pm.id')
|
||||
->join('clients c','files.client_id = c.id and files.client_id = cp.client_id')
|
||||
->where('files.created_by',get_session_userid())->orderBy('files.created_at','desc')->findAll();
|
||||
|
||||
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name')
|
||||
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->orderBy('batch_files.id','desc')
|
||||
->findAll();
|
||||
|
||||
|
||||
// dd($data['fileList']);die();
|
||||
if($this->request->getMethod() == "get")
|
||||
{
|
||||
@ -222,8 +252,18 @@ class EmployeeController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
/**This downloadSampleExcelFile() function facilitates downloading various sample Excel files
|
||||
** based on user-selected actions, handling file retrieval and download processes. **/
|
||||
/**
|
||||
* The below function Downloads a sample Excel file based on the provided action type.
|
||||
*
|
||||
* @param string|null $actionType The type of action :
|
||||
*
|
||||
* - inception
|
||||
* - correction
|
||||
* - si_enhancement for selecting the appropriate sample Excel file.
|
||||
*
|
||||
* @return redirect back with an error message if the file is not found, otherwise sends the file to the user for download.
|
||||
*/
|
||||
|
||||
public function downloadSampleExcelFile($actionType = null)
|
||||
{
|
||||
// $actionType = $this->request->getGet();
|
||||
@ -254,193 +294,154 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The below function are Handles import and export operations based on the provided parameters.
|
||||
*
|
||||
* This function logs the call, retrieves necessary data, generates a filename,
|
||||
* and then either exports data to an Excel file or imports data from an Excel file
|
||||
* depending on the provided action type and event type.
|
||||
*
|
||||
* @return void Redirects the user to the appropriate page with flash messages indicating success or failure.
|
||||
*/
|
||||
|
||||
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');
|
||||
$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,
|
||||
];
|
||||
|
||||
$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']);
|
||||
|
||||
// $event_type = 'si_enhancement';
|
||||
|
||||
if($actions == 'export'){
|
||||
|
||||
if($event_type == 'inception'){
|
||||
if($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' ){
|
||||
|
||||
$objects = $this->employeePolicyModel->getInceptionEmployeeDataForExportExcel($client_policy_id, $insurer_or_tpa, $event_type, $actions);
|
||||
$count = count($objects);
|
||||
$this->myLogger->logme('error','Inception export data count : {data}', ['data'=> $count ]);
|
||||
$batch_data['count'] = $count;
|
||||
|
||||
if($count == 0){
|
||||
$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 {data}.', ['data' => $event_type]);
|
||||
}
|
||||
|
||||
session()->setFlashdata('error', 'No data found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else if($event_type == 'correction'){
|
||||
|
||||
$this->myLogger->logme('error','Inception export file name : {data}', ['data'=> $file_name ]);
|
||||
$empDataServiceController->generateExcelForAdditionandInception($batch_data, $objects, $file_name);
|
||||
$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 == 'correction'){
|
||||
} else if($event_type == 'si_enhancement'){
|
||||
|
||||
$objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa);
|
||||
$count = count($objects);
|
||||
$this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
|
||||
$batch_data['count'] = $count;
|
||||
if($count == 0){
|
||||
session()->setFlashdata('error', 'No data found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
$this->myLogger->logme('error','Correction export file name : {data}', ['data'=> $file_name ]);
|
||||
$empDataServiceController->generateExcelForCorrection($file_name, $objects, $batch_data);
|
||||
$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'){
|
||||
$batch_data['file'] = $this->request->getFile('import_file_data');
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
if($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition'){
|
||||
|
||||
$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 ]);
|
||||
$return = $empDataServiceController->importExcelDataForInception($batch_data);
|
||||
if($return == 1){
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
$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();
|
||||
|
||||
$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))
|
||||
{
|
||||
}else if($return == 2){
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($return == 0){
|
||||
session()->setFlashdata('error', 'Something went wrong');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$data = read_excel_file_to_array($file_name_with_path);
|
||||
unset($data[0]);
|
||||
array_pop($data);
|
||||
// dd($data );
|
||||
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];
|
||||
|
||||
// echo $tpa_id, $uhid, $emp_code, $name; die;
|
||||
$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'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
$return = $empDataServiceController->importExcelDataForCorrection($batch_data);
|
||||
if($return == 1){
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
$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();
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
|
||||
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
}else if($return == 2){
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($return == 0){
|
||||
session()->setFlashdata('error', 'Something went wrong');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
$data = read_excel_file_to_array($file_name_with_path);
|
||||
unset($data[0]);
|
||||
// dd($data);
|
||||
foreach ($data as $key => $value) {
|
||||
}else if($event_type == 'si_enhancement'){
|
||||
|
||||
if (!empty($value) && isset($value[10])) {
|
||||
$return = $empDataServiceController->importExcelDataForSIEnhancement($batch_data);
|
||||
if($return == 1){
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
$emp_code = $value[0];
|
||||
$uhid = $value[1];
|
||||
$endorsement_id = $value[10] != null ? $value[10] : '';
|
||||
// $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id);
|
||||
|
||||
$queryData = $this->empEndorsementModel->select('emp_endorsement.*')
|
||||
->join('employees', 'employees.id = emp_endorsement.emp_id')
|
||||
->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'));
|
||||
}
|
||||
}else if($return == 2){
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($return == 0){
|
||||
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'){
|
||||
|
||||
$return = $empDataServiceController->importExcelDataForDeletion($batch_data);
|
||||
if($return == 1){
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($return == 2){
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
}else if($return == 0){
|
||||
session()->setFlashdata('error', 'Something went wrong');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -449,5 +450,5 @@ class EmployeeController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
}
|
||||
@ -1,57 +0,0 @@
|
||||
<?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();
|
||||
}
|
||||
|
||||
}
|
||||
@ -17,6 +17,8 @@ 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 ;
|
||||
@ -43,6 +45,8 @@ class EmployeeRestController extends AdminController
|
||||
protected $policesModel;
|
||||
protected $relationshipModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $policyPremium1Model;
|
||||
protected $policyPremium2Model;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -56,6 +60,8 @@ class EmployeeRestController extends AdminController
|
||||
$this->relationshipModel = new RelationshipModel();
|
||||
$this->fileModel= new FileModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
}
|
||||
|
||||
|
||||
@ -136,6 +142,7 @@ class EmployeeRestController extends AdminController
|
||||
$data = $this->request->getJSON();
|
||||
if ($data) {
|
||||
$updatedCount = 0;
|
||||
|
||||
foreach ($data as $item) {
|
||||
$id = $item->id;
|
||||
$item->dob = $this->convertDateFormat($item->dob);
|
||||
@ -153,8 +160,8 @@ class EmployeeRestController extends AdminController
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th], 500);
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e], 500);
|
||||
}
|
||||
|
||||
}
|
||||
@ -234,6 +241,7 @@ class EmployeeRestController extends AdminController
|
||||
public function deleteDependence()
|
||||
{
|
||||
try {
|
||||
print_r($this->rquest);die;
|
||||
if($this->request->getGet('id'))
|
||||
{
|
||||
$delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete();
|
||||
@ -495,222 +503,290 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// Upload the Sheet Data in DB
|
||||
// Upload the Employee Detail in DB by Sheet Data
|
||||
public function employeeUpload()
|
||||
{
|
||||
$file = $this->request->getFile('file');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
try {
|
||||
$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;
|
||||
$token = $this->request->headers()['Auth']->getValue();
|
||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||
|
||||
//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 employee id from token
|
||||
$employee_id = $decodedPayload['id'];
|
||||
|
||||
// Get the active sheet
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
||||
|
||||
// Get the highest row and column numbers
|
||||
$highestRow = $sheet->getHighestRow();
|
||||
$highestColumn = $sheet->getHighestColumn();
|
||||
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'];
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
// print_r($excel_data);die();
|
||||
// $data = [];
|
||||
// $data[] =$excel_data;
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$filename;
|
||||
|
||||
// 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
|
||||
//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'));
|
||||
}
|
||||
} 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];
|
||||
// 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']=$employee_id;
|
||||
|
||||
$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], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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
|
||||
|
||||
if(count($data[0]) != 10){
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 200);
|
||||
}
|
||||
|
||||
// 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']));
|
||||
//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{
|
||||
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']));
|
||||
} 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];
|
||||
}
|
||||
}
|
||||
}
|
||||
$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);
|
||||
}
|
||||
$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], 200);
|
||||
// }
|
||||
// }
|
||||
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] ;
|
||||
|
||||
//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'];
|
||||
// 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++) {
|
||||
|
||||
$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]);
|
||||
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_by'] = $employee_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) {
|
||||
$data_after_gpa_or_gmc['created_by'] = $employee_id;
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -12,11 +12,15 @@ use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\PolicesModel;
|
||||
use App\Models\FileModel;
|
||||
use App\Models\EmpEndorsementModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use Kint\Kint;
|
||||
|
||||
class EmployeeServiceController extends AdminController
|
||||
{
|
||||
@ -27,9 +31,18 @@ class EmployeeServiceController extends AdminController
|
||||
protected $clientModel;
|
||||
protected $fileModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $policiesModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $general_relationships = ['self' => ['name' => 'Self', 'gender' => 'M','age_min' => 18,'age_max' => null], 'spouse' => ['name' => 'Spouse', 'gender' => 'F','age_min' => 18,'age_max' => null], 'son' => ['name' => 'Son', 'gender' => 'M','age_min' => null,'age_max' => 25], 'daughter' => ['name' => 'Daughter', 'gender' => 'F','age_min' => null,'age_max' => 25], 'father' => ['name' => 'Father', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother' => ['name' => 'Mother', 'gender' => 'F','age_min' => 18,'age_max' => null], 'father-in-law' => ['name' => 'Father in Law', 'gender' => 'M','age_min' => 18,'age_max' => null], 'mother-in-law' => ['name' => 'Mother in Law', 'gender' => 'F','age_min' => 18,'age_max' => null]];
|
||||
|
||||
protected $inception_excel_columns = ['sno' => ['col_idx' => 0,'col_cell_name' => 'A','col_name' => 'S.No','is_mandatory' => true,'data_type' => 'str','format' => null,'allowed_values' => null],'emp_id' => ['col_idx' => 1,'col_cell_name' => 'B','col_name' => 'EMP ID','is_mandatory' => true,'data_type' => 'str','format' => null,'allowed_values' => null],'name_of_emp_dep' => ['col_idx' => 2,'col_cell_name' => 'C','col_name' => 'NAME OF EMP/DEP','is_mandatory' => true,'data_type' => 'str','format' => null,'allowed_values' => null],'dob' => ['col_idx' => 3,'col_cell_name' => 'D','col_name' => 'DOB','is_mandatory' => ['I','A','DA'],'data_type' => 'str','format' => 'd-M-Y','allowed_values' => null,'custom' => 'check_dob_diff','params' => ['row','relationship']],'gender' => ['col_idx' => 4,'col_cell_name' => 'E','col_name' => 'Gender','is_mandatory' => ['I','A','DA'],'data_type' => 'str','format' => null,'allowed_values' => ['M','F']],'relationship' => ['col_idx' => 5,'col_cell_name' => 'F','col_name' => 'RELATIONSHIP','is_mandatory' => ['I','A','DA'],'data_type' => 'str','format' => null,'allowed_values' => null,'custom' => 'check_relationship','params' => ['row','relationship']],'basic_cover_si' => ['col_idx' => 6,'col_cell_name' => 'G','col_name' => 'BASIC COVER SI','is_mandatory' => ['I','A','DA'],'data_type' => 'str','format' => null,'allowed_values' => null],'doj' => ['col_idx' => 7,'col_cell_name' => 'H','col_name' => 'DOJ','is_mandatory' => false,'data_type' => 'str','format' => 'd-M-Y','allowed_values' => null,'custom' => 'check_doj','params' => ['row']],'basic_pay' => ['col_idx' => 8,'col_cell_name' => 'I','col_name' => 'Basic Pay','is_mandatory' => false,'data_type' => 'str','format' => null,'allowed_values' => null,'custom' => 'check_basic_pay','params' => ['row']],'band_grade' => ['col_idx' => 9,'col_cell_name' => 'J','col_name' => 'Band/Grade','is_mandatory' => false,'data_type' => 'str','format' => null,'allowed_values' => null,'custom' => 'check_employee_band','params' => ['row']],'designation' => ['col_idx' => 10,'col_cell_name' => 'K','col_name' => 'Designation','is_mandatory' => false,'data_type' => 'str','format' => null,'allowed_values' => null],'phone' => ['col_idx' => 11,'col_cell_name' => 'L','col_name' => 'Phone','is_mandatory' => false,'data_type' => 'str','format' => null,'allowed_values' => null],'email' => ['col_idx' => 12,'col_cell_name' => 'M','col_name' => 'Email','is_mandatory' => false,'data_type' => 'str','format' => null,'allowed_values' => null],'pre_existing_ailments' => ['col_idx' => 13,'col_cell_name' => 'N','col_name' => 'PRE EXISTING AILMENTS','is_mandatory' => ['I','A','DA'],'data_type' => 'str','format' => null,'allowed_values' => ['0','1']],'change_event' => ['col_idx' => 14,'col_cell_name' => 'O','col_name' => 'Change event','is_mandatory' => ['A','DA','D'],'data_type' => 'str','format' => null,'allowed_values' => null],'date_of_exit' => ['col_idx' => 15,'col_cell_name' => 'P','col_name' => 'Date of exit','is_mandatory' => ['D'],'data_type' => 'str','format' => 'd-M-Y','allowed_values' => null],'reason_for_exit' => ['col_idx' => 16,'col_cell_name' => 'Q','col_name' => 'Reason for exit','is_mandatory' => ['D'],'data_type' => 'str','format' => null,'allowed_values' => null],'action' => ['col_idx' => 17,'col_cell_name' => 'R','col_name' => 'Action','is_mandatory' => true,'data_type' => 'str','format' => null,'allowed_values' => ['I','A','D','DA'] ]];
|
||||
protected $inception_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'dob'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'DOB','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_dob_diff','params'=>['row','relationship']],'gender'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Gender','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['M','F']],'relationship'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'RELATIONSHIP','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_relationship','params'=>['row','relationship']],'basic_cover_si'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'BASIC COVER SI','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'doc'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Date of Coverage','is_mandatory'=>['A','DA'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'params'=>['row']],'doj'=>['col_idx'=>8,'col_cell_name'=>'I','col_name'=>'DOJ','is_mandatory'=>false,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null,'custom'=>'check_doj','params'=>['row']],'basic_pay'=>['col_idx'=>9,'col_cell_name'=>'J','col_name'=>'Basic Pay','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_basic_pay','params'=>['row','policy_terms','slab_details']],'band_grade'=>['col_idx'=>10,'col_cell_name'=>'K','col_name'=>'Band/Grade','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom'=>'check_employee_band','params'=>['row','policy_terms','slab_details']],'designation'=>['col_idx'=>11,'col_cell_name'=>'L','col_name'=>'Designation','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'phone'=>['col_idx'=>12,'col_cell_name'=>'M','col_name'=>'Phone','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'email'=>['col_idx'=>13,'col_cell_name'=>'N','col_name'=>'Email','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null],'pre_existing_ailments'=>['col_idx'=>14,'col_cell_name'=>'O','col_name'=>'PRE EXISTING AILMENTS','is_mandatory'=>['I','A','DA'],'data_type'=>'str','format'=>null,'allowed_values'=>['0','1']],'change_event'=>['col_idx'=>15,'col_cell_name'=>'P','col_name'=>'Change event','is_mandatory'=>['A','DA','D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>16,'col_cell_name'=>'Q','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>17,'col_cell_name'=>'R','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
protected $deletion_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'change_event'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Change event','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_exit'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'reason_for_exit'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Reason for exit','is_mandatory'=>['D'],'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
protected $correction_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'field'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Field','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>['name','dob','relationship']],'value'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Value','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'date_of_correction'=>['col_idx'=>5,'col_cell_name'=>'F','col_name'=>'Date of Correction','is_mandatory'=>true,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null],'change_event'=>['col_idx'=>6,'col_cell_name'=>'G','col_name'=>'Change event','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'remarks'=>['col_idx'=>7,'col_cell_name'=>'H','col_name'=>'Remarks','is_mandatory'=>false,'data_type'=>'str','format'=>null,'allowed_values'=>null]];
|
||||
|
||||
protected $si_enhance_excel_columns = ['sno'=>['col_idx'=>0,'col_cell_name'=>'A','col_name'=>'S.No','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'emp_id'=>['col_idx'=>1,'col_cell_name'=>'B','col_name'=>'EMP ID','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'name_of_emp_dep'=>['col_idx'=>2,'col_cell_name'=>'C','col_name'=>'NAME OF EMP/DEP','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null],'augmented_si'=>['col_idx'=>3,'col_cell_name'=>'D','col_name'=>'Augmented SI','is_mandatory'=>true,'data_type'=>'str','format'=>null,'allowed_values'=>null,'custom' => 'check_si','params' => ['row','policy_terms','slab_details']],'date_of_enhancement'=>['col_idx'=>4,'col_cell_name'=>'E','col_name'=>'Date of SI Enhancement','is_mandatory'=>true,'data_type'=>'str','format'=>'d-M-Y','allowed_values'=>null]];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// helper('utility');
|
||||
@ -40,6 +53,8 @@ class EmployeeServiceController extends AdminController
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->fileModel = new FileModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->policiesModel = new PolicesModel();
|
||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||
}
|
||||
|
||||
public function excelFileFormatValidation($params)
|
||||
@ -74,28 +89,21 @@ class EmployeeServiceController extends AdminController
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
// $highestRow = $sheet->getHighestDataRow(); // 1048576, should be 2
|
||||
// $highestColumn = $sheet->getHighestDataColumn(); // L, should be B
|
||||
// print_r($highestRowAndColumn);
|
||||
// echo $highestRow;echo ' - ' . $highestColumn;
|
||||
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
// $data = array_filter($data);
|
||||
// echo '<pre>';
|
||||
// dd($excel_data);
|
||||
// echo "</pre>";die();
|
||||
// foreach ($excel_data as $key => $value)
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// dd($this->si_enhance_excel_columns);
|
||||
$columns_to_check = [];
|
||||
if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'addition'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'dependent_addition'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'deletion'){ $columns_to_check = $this->deletion_excel_columns; }
|
||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||
|
||||
//check no of columns in excel
|
||||
$total_defined_columns = count($columns_to_check);
|
||||
$excel_columns = ($excel_data[0]);
|
||||
// var_dump($excel_columns);die();
|
||||
// var_dump($total_defined_columns);die();
|
||||
$excel_columns_count = count($excel_columns);
|
||||
if($total_defined_columns != $excel_columns_count)
|
||||
{
|
||||
@ -124,7 +132,15 @@ class EmployeeServiceController extends AdminController
|
||||
//start other checks
|
||||
$result = ['error_type' => 1,'error_summary' => [], 'error_data' => [] ];
|
||||
$keys = array_keys($columns_to_check);
|
||||
// print_r($keys);die();
|
||||
// dd($columns_to_check);die();
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_terms = (array) $policy_terms[0];// convert obj to array
|
||||
|
||||
//get policy slab rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
// dd($slab_details);
|
||||
|
||||
//remove header
|
||||
unset($excel_data[0]);
|
||||
@ -134,7 +150,12 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
//define row wise action/event in temporary variable
|
||||
$current_column_action = null;
|
||||
if($file['action'] == 'inception'){ $current_column_action = $row[17]; }
|
||||
if($file['action'] == 'inception'){ $current_column_action = 'I'; }
|
||||
else if($file['action'] == 'addition'){ $current_column_action = 'A'; }
|
||||
else if($file['action'] == 'dependent_addition'){ $current_column_action = 'DA'; }
|
||||
else if($file['action'] == 'deletion'){ $current_column_action = 'D'; }
|
||||
else if($file['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||
else if($file['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||
//1. avoid empty rows
|
||||
if(check_row_is_empty_or_null($row))
|
||||
{
|
||||
@ -144,15 +165,15 @@ class EmployeeServiceController extends AdminController
|
||||
foreach ($row as $col_key => $col)
|
||||
{
|
||||
|
||||
$is_mandatory = $this->inception_excel_columns[$keys[$col_key]]['is_mandatory'];
|
||||
$format = $this->inception_excel_columns[$keys[$col_key]]['format'];
|
||||
$allowed_values = $this->inception_excel_columns[$keys[$col_key]]['allowed_values'];
|
||||
$custom_function = isset($this->inception_excel_columns[$keys[$col_key]]['custom']) ? $this->inception_excel_columns[$keys[$col_key]]['custom'] : null;
|
||||
$binding_params = isset($this->inception_excel_columns[$keys[$col_key]]['params']) ? $this->inception_excel_columns[$keys[$col_key]]['params'] : null;
|
||||
$column_dispaly_name = $this->inception_excel_columns[$keys[$col_key]]['col_name'];
|
||||
$column_index = $this->inception_excel_columns[$keys[$col_key]]['col_idx'];
|
||||
$column_cell = $this->inception_excel_columns[$keys[$col_key]]['col_cell_name'];
|
||||
|
||||
$is_mandatory = $columns_to_check[$keys[$col_key]]['is_mandatory'];
|
||||
$format = $columns_to_check[$keys[$col_key]]['format'];
|
||||
$allowed_values = $columns_to_check[$keys[$col_key]]['allowed_values'];
|
||||
$custom_function = isset($columns_to_check[$keys[$col_key]]['custom']) ? $columns_to_check[$keys[$col_key]]['custom'] : null;
|
||||
$binding_params = isset($columns_to_check[$keys[$col_key]]['params']) ? $columns_to_check[$keys[$col_key]]['params'] : null;
|
||||
$column_dispaly_name = $columns_to_check[$keys[$col_key]]['col_name'];
|
||||
$column_index = $columns_to_check[$keys[$col_key]]['col_idx'];
|
||||
$column_cell = $columns_to_check[$keys[$col_key]]['col_cell_name'];
|
||||
$row['current_action'] = $current_column_action;
|
||||
|
||||
//mandatory check
|
||||
if(is_bool($is_mandatory) && $is_mandatory === true)
|
||||
@ -169,7 +190,7 @@ class EmployeeServiceController extends AdminController
|
||||
//if is_mandatory is array (action based mandatory check)
|
||||
if($current_column_action != null && is_array($is_mandatory) && in_array(strtoupper(trim($current_column_action)),$is_mandatory))
|
||||
{
|
||||
$allowed_actions = $this->inception_excel_columns[$keys[$col_key]]['is_mandatory'];
|
||||
$allowed_actions = $columns_to_check[$keys[$col_key]]['is_mandatory'];
|
||||
if($col == "" || $col == NULL)
|
||||
{
|
||||
array_push($result['error_summary'],1);
|
||||
@ -196,7 +217,7 @@ class EmployeeServiceController extends AdminController
|
||||
if($is_mandatory === true && isset($allowed_values) && is_array($allowed_values))
|
||||
{
|
||||
|
||||
if(!in_array(trim($col),$allowed_values))
|
||||
if(!in_array(strtolower(trim($col)),$allowed_values))
|
||||
{
|
||||
array_push($result['error_summary'],3);
|
||||
$result['error_data'][$row_key][$keys[$col_key]]['col_name'] = $column_dispaly_name; //push column name
|
||||
@ -246,8 +267,9 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
$jobWorker = new JobWorker();
|
||||
JobWorker::processJob($r);
|
||||
}
|
||||
return $result;
|
||||
|
||||
@ -280,11 +302,16 @@ class EmployeeServiceController extends AdminController
|
||||
return array('error_summary' => [5], 'error_data' => $message);
|
||||
}
|
||||
|
||||
$columns_to_check = [];
|
||||
$columns_to_check = [];
|
||||
if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'addition'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'dependent_addition'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
if($file['action'] == 'deletion'){ $columns_to_check = $this->deletion_excel_columns; }
|
||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyTermsJson($file['client_id'],$file['policy_id']);
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
// dd($policy_terms);
|
||||
$policy_terms = json_decode($policy_terms[0]->policy_terms);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
@ -306,78 +333,569 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
{
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
{
|
||||
|
||||
|
||||
//check name dup within a family
|
||||
$res = name_dup_check_within_family($family);
|
||||
if(count($res))
|
||||
{
|
||||
foreach($res as $k => $rowid)
|
||||
//if action is DA then get all familiy members,transfrom them into excel array, addd data source as db or excel
|
||||
if($file['action'] == 'dependent_addition')
|
||||
{
|
||||
array_push($result['error_summary'],7); // dup entry in excel file
|
||||
$result['error_data'][$rowid]['name_of_emp_dep']['error'][] = "Twofold Name found within family";
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: 'active');
|
||||
// dd($existing_famility_details);
|
||||
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||
// dd($existing_famility_details);
|
||||
$family = array_merge($family,$existing_famility_details);
|
||||
}
|
||||
}
|
||||
//check allowed dependent count and relationship conflict within family at policy level
|
||||
// if($policy_terms['family_floater'] == true)
|
||||
// {
|
||||
// dd($policy_terms['family_floaters']);
|
||||
// }
|
||||
// die('check');
|
||||
$res = check_dependent_conflict($family,$policy_terms);
|
||||
// dd($res);
|
||||
if(!$res['status'])
|
||||
{
|
||||
foreach($res['error_data'] as $key => $value)
|
||||
// kint::dump($family);die();
|
||||
//check name dup within a family
|
||||
|
||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')
|
||||
{
|
||||
array_push($result['error_summary'],$value['code']); //record not avail for deletion
|
||||
$result['error_data'][$rowid][($value['col_name'])]['error'][] = $value['msg'];
|
||||
$res = name_dup_check_within_family($family,$file['action']);
|
||||
// dd($res);
|
||||
if(count($res))
|
||||
{
|
||||
foreach($res as $k => $rowid)
|
||||
{
|
||||
array_push($result['error_summary'],7); // dup entry in excel file
|
||||
$result['error_data'][$rowid]['name_of_emp_dep']['error'][] = "Twofold Name found within family";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($file['action'] == 'dependent_addition' || $file['action'] == 'addition' || $file['action'] == 'inception')
|
||||
{
|
||||
$res = check_dependent_conflict($family,$policy_terms,$file['action']);
|
||||
// dd($res);
|
||||
if(!$res['status'])
|
||||
{
|
||||
foreach($res['error_data'] as $key => $value)
|
||||
{
|
||||
array_push($result['error_summary'],$value['code']);
|
||||
$result['error_data'][ $value['row_id'] ][($value['col_name'])]['error'][] = $value['msg'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check dup with empid and name with db
|
||||
$res = name_and_empid_check_in_db($family,$file);
|
||||
// dd($file);
|
||||
// echo '<br/>';
|
||||
// print_r($res);
|
||||
if(count($res['del']))
|
||||
{
|
||||
foreach($res['del'] as $k => $rowid)
|
||||
{
|
||||
array_push($result['error_summary'],10); //record not avail for deletion
|
||||
$result['error_data'][$rowid]['name_of_emp_dep']['error'][] = "Record Not found ";
|
||||
}
|
||||
}
|
||||
if(count($res['i']))
|
||||
{
|
||||
foreach($res['i'] as $k => $rowid)
|
||||
{
|
||||
array_push($result['error_summary'],9); //dup entry
|
||||
$result['error_data'][$rowid]['name_of_emp_dep']['error'][] = "Record already exists";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check dup with empid and name with db
|
||||
$res = name_and_empid_check_in_db($family,$file['client_id'],$file['policy_id']);
|
||||
// print_r($result);
|
||||
// echo '<br/>';
|
||||
// print_r($res);
|
||||
if(count($res['del']))
|
||||
{
|
||||
foreach($res['del'] as $k => $rowid)
|
||||
{
|
||||
array_push($result['error_summary'],10); //record not avail for deletion
|
||||
$result['error_data'][$rowid]['name_of_emp_dep']['error'][] = "Record Not found for deletion";
|
||||
}
|
||||
}
|
||||
if(count($res['i']))
|
||||
{
|
||||
foreach($res['i'] as $k => $rowid)
|
||||
{
|
||||
array_push($result['error_summary'],9); //dup entry
|
||||
$result['error_data'][$rowid]['name_of_emp_dep']['error'][] = "Record already exists";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dd($result);
|
||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||
{
|
||||
$result['error_summary'] = array_count_values($result['error_summary']);
|
||||
$status = 'failed';
|
||||
$failure_reason = ((json_encode($result)));
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => $status,'reason' => $failure_reason])->update();
|
||||
$this->myLogger->logme("error",'{file_id} uploaded failed',['file_id' => $file_id]);
|
||||
//return $this->respond(['dataStatus' => true,'code' => 404,'data' => 'file upload failed with errors'], 200);
|
||||
// dd($failure_reason);
|
||||
|
||||
|
||||
|
||||
}
|
||||
return $result;
|
||||
// s($result);
|
||||
// die();
|
||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||
{
|
||||
$result['error_summary'] = array_count_values($result['error_summary']);
|
||||
$status = 'failed';
|
||||
$failure_reason = ((json_encode($result)));
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => $status,'reason' => $failure_reason])->update();
|
||||
$this->myLogger->logme("error",'{file_id} uploaded failed',['file_id' => $file_id]);
|
||||
//return $this->respond(['dataStatus' => true,'code' => 404,'data' => 'file upload failed with errors'], 200);
|
||||
// dd($failure_reason);
|
||||
}
|
||||
else if($file['action'] == 'deletion')
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'employeeDisembark','payload' => ['file_id' => $file_id]]);
|
||||
}
|
||||
else if ($file['action'] == 'si_enhancement')
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'employeesSIEnhanceProcess','payload' => ['file_id' => $file_id]]);
|
||||
}
|
||||
else if ($file['action'] == 'correction')
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'employeesCorrectionProcess','payload' => ['file_id' => $file_id]]);
|
||||
}
|
||||
else //inception OR addition OR dependent addition
|
||||
{
|
||||
//proceed next data level validation in JOB queue
|
||||
$job_details = new Jobs();
|
||||
|
||||
$r = Jobs::addJob(['job_name' => 'employeesOnboardPreprocess','payload' => ['file_id' => $file_id]]);
|
||||
$jobWorker = new JobWorker();
|
||||
JobWorker::processJob($r);
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// calculate data points and premium
|
||||
public function employeesOnboardPreprocess($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
// dd($params);
|
||||
if(isset($params['file_id']))//handle data from excel to inception
|
||||
{
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
// dd($file);
|
||||
$return = [];
|
||||
if(!isset($file))
|
||||
{
|
||||
//file not found in DB
|
||||
return array('status' => false, 'msg' => 'file not found in DB');
|
||||
}
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
|
||||
//check physical file
|
||||
if(!file_exists($file_name_with_path))
|
||||
{
|
||||
//file not found update status and reason
|
||||
$message = "Physical file not found";
|
||||
// echo $message;
|
||||
$this->myLogger->logme('error',($message . ' for file id ' . $file_id));
|
||||
$this->fileModel->where('id', $file_id)->set(['status' => 'failed','reason' => json_encode(['error_summary' => array_count_values([5]),'error_data' => $message])])->update();
|
||||
return array('error_summary' => [5], 'error_data' => $message);
|
||||
}
|
||||
|
||||
$columns_to_check = [];
|
||||
if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_terms = (array) $policy_terms[0];// convert obj to array
|
||||
// $policy_terms = json_decode($policy_terms[0]->policy_terms);
|
||||
|
||||
// dd($policy_terms);
|
||||
//get excel data
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
unset($excel_data[0]);
|
||||
|
||||
|
||||
//get policy slab rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
// dd($slab_details);
|
||||
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
{
|
||||
|
||||
//if action is DA then get all familiy members,transfrom them into excel array, addd data source as db or excel
|
||||
if($file['action'] == 'dependent_addition')
|
||||
{
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: 'active');
|
||||
// dd($existing_famility_details);
|
||||
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||
// Kint::dump($existing_famility_details);
|
||||
$family = array_merge($family,$existing_famility_details);
|
||||
// dd($family);
|
||||
}
|
||||
|
||||
// Kint::dump($family);die();
|
||||
$data = calculate_premimum($family,$policy_terms,$slab_details,$file);
|
||||
// dd($data);
|
||||
$employee_data_group_by_family[$emp_id] = $data;
|
||||
//$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||
}
|
||||
}
|
||||
else if(isset($params['client_policy_id']))//handle data from enrollment to inception
|
||||
{
|
||||
$client_policy_id = $params['client_policy_id'];
|
||||
//get client id
|
||||
$client_id = ($this->clientPolicyModel->select('client_id')->find($client_policy_id))['client_id'];
|
||||
// dd($client_id);
|
||||
|
||||
// get policy and rack details
|
||||
$policy_terms = $this->clientPolicyModel->getPolicyDetails($client_id,$client_policy_id);
|
||||
$policy_terms = (array) $policy_terms[0];// convert obj to array
|
||||
|
||||
//get policy slab rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$client_id);
|
||||
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: 'draft');
|
||||
|
||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
||||
// dd($this->employeeModel->getLastQuery());
|
||||
// Kint::dump($existing_famility_details);die();
|
||||
$employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db');
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
{
|
||||
$transformed_famility_details = transform_db_data_to_excel($family);
|
||||
$data = calculate_premimum($transformed_famility_details,$policy_terms,$slab_details,$file);
|
||||
// dd($data);
|
||||
$employee_data_group_by_family[$emp_id] = $data;
|
||||
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||
}
|
||||
|
||||
// dd($employee_data_group_by_family);
|
||||
}
|
||||
|
||||
|
||||
// die();
|
||||
return ($employee_data_group_by_family);
|
||||
|
||||
}
|
||||
|
||||
//deletion of emp
|
||||
public function employeeDisembark($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
|
||||
unset($excel_data[0]);
|
||||
// dd($excel_data);
|
||||
$endorsement_data = [];
|
||||
|
||||
|
||||
//make closure funciton which is going to use only by this method
|
||||
$endorsement = function($data,$file,$row){
|
||||
|
||||
//for emp table
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'emp_status','old_value' => $data['emp_status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
||||
// dd( $this->empEndorsementModel->getLastQuery());
|
||||
// $this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'change_event','old_value' => $data['change_event'],'new_value' => 'deletion','created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
||||
|
||||
// for employee policy table
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'date_of_exit','old_value' => $data['date_of_exit'],'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'reason_for_exit','old_value' => $data['reason_for_exit'],'new_value' => $row[5],'created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'status','old_value' => $data['status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
||||
};
|
||||
//iterate each row
|
||||
foreach ($excel_data as $col_key => $row)
|
||||
{
|
||||
if(check_row_is_empty_or_null($row))
|
||||
{
|
||||
break;
|
||||
}
|
||||
// echo '<br>START- ' . $row[2];
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
||||
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','d')
|
||||
->where('table_name','employees')
|
||||
->where('endorsement_id is null')
|
||||
->where('emp_code',$employee['emp_code'])
|
||||
->where('name',$employee['name'])
|
||||
->where('field_name','emp_status')
|
||||
->findAll();
|
||||
|
||||
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
if(strtolower($employee['relationship']) != 'self')
|
||||
{
|
||||
|
||||
if(!in_array($employee['id'],$endorsement_data))//make entry in endorsement firsttime only with checking that PK of emp exisintg in variable $endorsement_data
|
||||
{
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
$data = ['emp_id' => $employee['id'],'name' => $employee['name'],'emp_status' => $employee['emp_status'],'emp_policy_id' => $employee_policy['id'],'emp_code' => $employee['emp_code'],'change_event' => $employee['change_event'],'date_of_exit' => $employee_policy['date_of_exit'],'reason_for_exit' => $employee_policy['reason_for_exit'],'status' => $employee_policy['status']];
|
||||
$endorsement($data,$file,$row);
|
||||
$endorsement_data[] = $employee['id'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$family = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $row[1],client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: 'active');
|
||||
// Kint::dump($family);
|
||||
foreach ($family as $key => $emp) {
|
||||
|
||||
if(!in_array($emp['emp_id'],$endorsement_data))
|
||||
{
|
||||
$endorsement($emp,$file,$row);
|
||||
|
||||
$endorsement_data[] = $emp['emp_id'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($endorsement_data);
|
||||
|
||||
}
|
||||
return $endorsement_data;
|
||||
|
||||
}
|
||||
|
||||
//correction of emp
|
||||
public function employeesCorrectionProcess($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
|
||||
unset($excel_data[0]);
|
||||
// dd($excel_data);
|
||||
|
||||
//iterate each row
|
||||
foreach ($excel_data as $col_key => $row)
|
||||
{
|
||||
if(check_row_is_empty_or_null($row))
|
||||
{
|
||||
break;
|
||||
}
|
||||
// echo '<br>START- ' . $row[2];
|
||||
|
||||
$field_name = $row[3];
|
||||
$field_value = ($field_name == 'dob' ? change_date_format($row[4],'d-M-Y','Y-m-d') : $row[4] );
|
||||
|
||||
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','c')
|
||||
->where('table_name','employees')
|
||||
->where('endorsement_id is null')
|
||||
->where('emp_code',$employee['emp_code'])
|
||||
->where('name',$employee['name'])
|
||||
->where('field_name',$field_name)
|
||||
->findAll();
|
||||
// dd($existing_endorsements);
|
||||
//make entry in endorsement table
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employees','actions' => 'c','name' => $employee['name'],'field_name' => $field_name,'old_value' => $employee[ $field_name ],'new_value' => $field_value,'created_by' => $file['created_by'],'remarks' => $row[7],'date_of_correction' => change_date_format($row[5],'d-M-Y','Y-m-d')]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//enhance of emp
|
||||
public function employeesSIEnhanceProcess($params)
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
//get file name
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->fileModel->find($file_id);
|
||||
|
||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
|
||||
unset($excel_data[0]);
|
||||
// dd($excel_data);
|
||||
|
||||
//get policy slab rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
//iterate each row
|
||||
// dd($slab_details);
|
||||
foreach ($excel_data as $col_key => $row)
|
||||
{
|
||||
if(check_row_is_empty_or_null($row))
|
||||
{
|
||||
break;
|
||||
}
|
||||
// echo '<br>START- ' . $row[2];
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
||||
->where('table_name','employee_polices')
|
||||
->where('endorsement_id is null')
|
||||
->where('emp_code',$employee['emp_code'])
|
||||
->where('name',$employee['name'])
|
||||
->where('field_name','basic_cover_si')
|
||||
->findAll();
|
||||
// dd($existing_endorsements);
|
||||
//make entry in endorsement table
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $row[3])
|
||||
{
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// insert or update in db for inception addition depent addition
|
||||
public function employeesOnboardProcess($params)
|
||||
{
|
||||
$familiy_data = $params['familiy_data'];
|
||||
$file = $params['file'];
|
||||
// dd($file);
|
||||
// print_r($familiy_data);
|
||||
// echo '------------------------------------------------------';
|
||||
|
||||
|
||||
|
||||
foreach($familiy_data as $fkey => $value)
|
||||
{
|
||||
if($file['id'] == null || ($value['temp']['source'] == 'excel' || (in_array($value['temp']['grid_type'],[10,11]) && strtolower($value['relationship']) == 'self'))) //insert data come from excel and from db
|
||||
{
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmp($value);
|
||||
$policy_data = $value['policy_details'];
|
||||
unset($value['policy_details']);
|
||||
unset($value['temp']);
|
||||
|
||||
if($file['id'] == null && (strtolower($value['relationship']) == 'self' && $value['temp']['source'] == 'db' && $value['temp']['emp_id'] != null && $value['temp']['emp_policy_id'] != null))
|
||||
{
|
||||
//check existing si and new si
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
if($employee_policy['basic_cover_si'] != $policy_data['basic_cover_si'])
|
||||
{
|
||||
|
||||
//check any existing si enhancement pending
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
||||
->where('table_name','employee_polices')
|
||||
->where('endorsement_id is null')
|
||||
->where('emp_code',$employee['emp_code'])
|
||||
->where('name',$employee['name'])
|
||||
->where('field_name','basic_cover_si')
|
||||
->findAll();
|
||||
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $policy_data['si'])
|
||||
{
|
||||
//add new premimum details in endorsement table
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $policy_data['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => ($policy_data['date_coverage']),'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}// end of self employee si enhance ment
|
||||
|
||||
|
||||
//save employee table
|
||||
if(count($employee))
|
||||
{
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee[0]['id'];
|
||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$value['emp_status'] = 'active';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||
}
|
||||
|
||||
$this->employeeModel->save($value);
|
||||
$emp_id = $this->employeeModel->getInsertID();
|
||||
if($emp_id != 0){ $log_message .= $emp_id; }
|
||||
else{ $emp_id = $employee[0]['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
//save policy table
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $file['policy_id']]);
|
||||
if(count($employee_policy))
|
||||
{
|
||||
$policy_data['updated_by'] = $file['created_by'];
|
||||
$policy_data['id'] = $employee_policy[0]['id'];
|
||||
$policy_data['status'] = 'active';
|
||||
|
||||
$log_message = 'Update Employee Policy for '. $value['name'].'('. $value['emp_code'].') with PK- ' . $employee_policy[0]['id'] .' client policy ID '.$employee_policy[0]['client_policy_id'].' with SI '.$policy_data['basic_cover_si'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$policy_data['employee_id'] = $emp_id;
|
||||
$policy_data['client_policy_id'] = $file['policy_id'];
|
||||
$policy_data['created_by'] = $file['created_by'];
|
||||
$policy_data['status'] = 'active';
|
||||
$log_message = 'Insert Employee Policy for '. $value['name'].'('. $value['emp_code'].') - client policy id -'. $file['policy_id'].' - with SI '.$policy_data['basic_cover_si'];
|
||||
}
|
||||
|
||||
$this->employeePolicyModel->save($policy_data);
|
||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
if($emp_policy_id != 0){ $log_message .= ' with PK ' . $emp_policy_id; }
|
||||
else{ $emp_policy_id = $employee_policy[0]['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
|
||||
}// if end
|
||||
}// for end
|
||||
}//function end
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -476,5 +994,6 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -27,6 +27,14 @@ class JobWorker extends AdminController
|
||||
// }
|
||||
}
|
||||
|
||||
public static function streamOutput($data)
|
||||
{
|
||||
ob_implicit_flush(true);
|
||||
// try { ob_end_flush(); } catch(Exception $e) { echo $e->getMessage(); }
|
||||
echo $data;
|
||||
flush();
|
||||
}
|
||||
|
||||
public static function processJobs(array $jobdata = [])
|
||||
{
|
||||
// echo 'listen';//die();
|
||||
@ -49,6 +57,7 @@ class JobWorker extends AdminController
|
||||
//sleep(1);
|
||||
|
||||
SELF::processjob(['id' => $job->id,'uuid' => $job->uuid]);
|
||||
usleep( 500000 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -86,8 +95,15 @@ class JobWorker extends AdminController
|
||||
{
|
||||
$job = $job[0];
|
||||
|
||||
echo "\nProcessing job id - " . $job->id . "\n";
|
||||
echo "Job name - " . $job->name . "\n";
|
||||
|
||||
|
||||
// echo "\nProcessing job id - " . $job->id . "\n";
|
||||
SELF::streamOutput("\nProcessing job id - " . $job->id . "\n");
|
||||
// sleep(5);
|
||||
// echo "Job name - " . $job->name . "\n";
|
||||
SELF::streamOutput("Job name - " . $job->name . "\n");
|
||||
// sleep(5);
|
||||
|
||||
// print_r(SELF::$event_class_mapping);
|
||||
// echo array_key_exists($job->name,SELF::$event_class_mapping) ? 'mapped' : 'notmapped';
|
||||
// die();
|
||||
@ -173,7 +189,8 @@ class JobWorker extends AdminController
|
||||
]);
|
||||
|
||||
// echo "Job $job->id $job_status. Response - $response \n";
|
||||
echo "Job $job->id $job_status \n";
|
||||
// echo "Job $job->id $job_status \n";
|
||||
SELF::streamOutput("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();
|
||||
|
||||
@ -41,24 +41,28 @@ class LoginController extends BaseController
|
||||
$user = $UserModel->getUserByEmail($value->email);
|
||||
if($user){
|
||||
if($user->is_active !== '0'){
|
||||
|
||||
$session_data = ['isLoggedIn' => True ,'userid' => $user->id];
|
||||
$session_data = [
|
||||
'isLoggedIn' => True ,
|
||||
'userid' => $user->id,
|
||||
'userData' => $user,
|
||||
'userProfile' => $value->picture,
|
||||
];
|
||||
set_session_data($session_data);
|
||||
log_message('error', 'Set The UserId : `'. $user->id .'` in Session');
|
||||
log_message('error', 'Is User Login Sucessfully');
|
||||
|
||||
// $this->getUserDeviceInfo($user->id);
|
||||
log_message('error', 'User Login Sucessfully');
|
||||
|
||||
$this->getUserDeviceInfo($user->id, 'NhanceUser');
|
||||
return redirect()->to(base_url('/dashboard/view'));
|
||||
|
||||
}else{
|
||||
log_message('error', 'Is User Not Activate');
|
||||
session()->setFlashdata('error', 'Is 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', 'Is User Not Register');
|
||||
session()->setFlashdata('error', 'Is User Not Register');
|
||||
|
||||
log_message('error', 'User Not Registered');
|
||||
session()->setFlashdata('error', 'User Not Registered');
|
||||
return redirect()->to(base_url('login'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
$this->myLogger->logme('error','Insurer list function called');
|
||||
$headerData['page_name'] = 'Insurer List';
|
||||
$data['insurerList'] = $this->insurerModel->findAll();
|
||||
$data['insurerList'] = $this->insurerModel->where('is_active',1)->findAll();
|
||||
$data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data['insurerList']); die;
|
||||
@ -85,12 +85,45 @@ class MasterController extends AdminController
|
||||
// $this->loadLayout('insurer_onboarding', $data);
|
||||
}
|
||||
|
||||
|
||||
public function insurerRemove($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Insurer Remove function called');
|
||||
// $id = $this->request->getPost('PrimaryKey');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->insurerModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function removeInsurerBranch($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Insurer Branch Remove function called');
|
||||
// $id = $this->request->getPost('PrimaryKey');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->insurerBranchModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editInsurerOnboarding($id = null)
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit Insurer Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit Insurer Onboarding';
|
||||
$headerData['page_name'] = 'Edit Insurer Master';
|
||||
|
||||
$types = array(
|
||||
(object) array('id' => 'pvt', 'name' => 'PVT'),
|
||||
@ -122,7 +155,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Insurer Onboarding function called');
|
||||
$headerData['page_name'] = 'Insurer Onboarding';
|
||||
$headerData['page_name'] = 'Insurer Master';
|
||||
|
||||
$types = array(
|
||||
(object) array('id' => 'pvt', 'name' => 'PVT'),
|
||||
@ -228,12 +261,6 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editInsurerGet($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit TPA Onboarding function called');
|
||||
@ -248,10 +275,6 @@ class MasterController extends AdminController
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editInsurerBranch()
|
||||
{
|
||||
$this->myLogger->logme('error','Insurer branch CREATE function called');
|
||||
@ -259,11 +282,6 @@ class MasterController extends AdminController
|
||||
$data = $this->request->getPost();
|
||||
$update = $this->insurerBranchModel->update($id, $data);
|
||||
|
||||
// print_r($this->request->getPost('name[]'));
|
||||
// print_r($this->request->getPost('email[]'));
|
||||
// print_r($this->request->getPost('mobile[]'));
|
||||
// print_r($this->request->getPost('designation[]'));
|
||||
|
||||
if($update){
|
||||
$contactsToDelete = $this->levelContactModel->where(['ref_id' => $id,'contact_type' => 'insurer', 'is_active' => 1])->get()->getResult();
|
||||
foreach ($contactsToDelete as $contact) {
|
||||
@ -285,10 +303,10 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
if($update){
|
||||
$branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
$branchData = $this->insurerBranchModel->where('insurer_id', $this->request->getPost('insurer_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData, 'edit'));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
echo json_encode(array("status" => false, 'edit'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,7 +324,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
$this->myLogger->logme('error','TPA list function called');
|
||||
$headerData['page_name'] = 'TPA List';
|
||||
$data['tpaList'] = $this->tpaModel->findAll();
|
||||
$data['tpaList'] = $this->tpaModel->where('is_active',1)->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data['insurerList']); die;
|
||||
@ -319,13 +337,42 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function tpaRemove($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','TPA Remove function called');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->tpaModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function removeTPABranch($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','TPA Branch Remove function called');
|
||||
// $id = $this->request->getPost('PrimaryKey');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->tpaBranchModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function tpaOnboarding()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','TPA Onboarding function called');
|
||||
$headerData['page_name'] = 'TPA Onboarding';
|
||||
$headerData['page_name'] = 'TPA Master';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
@ -408,7 +455,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit TPA Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit TPA Onboarding';
|
||||
$headerData['page_name'] = 'Edit TPA Master';
|
||||
|
||||
$editData['tpa'] = $this->tpaModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['tpa_branch'] = $this->tpaBranchModel->where(['tpa_id' => $id, 'is_active' => 1])->findAll();
|
||||
@ -527,7 +574,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
$this->myLogger->logme('error','KYC list function called');
|
||||
$headerData['page_name'] = 'KYC List';
|
||||
$data['kycList'] = $this->kycEntityTypeModel->findAll();
|
||||
$data['kycList'] = $this->kycEntityTypeModel->where('is_active',1)->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data['insurerList']); die;
|
||||
@ -539,14 +586,41 @@ class MasterController extends AdminController
|
||||
// $this->loadLayout('insurer_onboarding', $data);
|
||||
}
|
||||
|
||||
|
||||
public function kycRemove($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','KYC Remove function called');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->kycEntityTypeModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function removeKYCDocs($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','KYC Docs Remove function called');
|
||||
// $id = $this->request->getPost('PrimaryKey');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->kycDocsModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function kycOnboarding()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','KYC Onboarding function called');
|
||||
$headerData['page_name'] = 'KYC Onboarding';
|
||||
$headerData['page_name'] = 'KYC Master';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
@ -594,11 +668,19 @@ class MasterController extends AdminController
|
||||
|
||||
$this->myLogger->logme('error','Kyc Docs CREATE function called');
|
||||
$data = $this->request->getPost();
|
||||
// print_r($data);die;
|
||||
|
||||
if($data['kyc_type_id'] == ''){
|
||||
// PrimaryKey
|
||||
$data['kyc_type_id'] =$data['PrimaryKey'];
|
||||
}
|
||||
// print_r($data);die;
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->kycDocsModel->insert($data);
|
||||
|
||||
if($insert){
|
||||
$kycDocsData = $this->kycDocsModel->where('kyc_type_id', $this->request->getPost('kyc_type_id'))->findAll();
|
||||
$kycDocsData = $this->kycDocsModel->where('kyc_type_id', $data['kyc_type_id'])->where('is_active',1)->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $kycDocsData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
@ -610,7 +692,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit KYC Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit KYC Onboarding';
|
||||
$headerData['page_name'] = 'Edit KYC Master';
|
||||
|
||||
$editData['kyc'] = $this->kycEntityTypeModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['kyc_docs'] = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
@ -630,8 +712,10 @@ class MasterController extends AdminController
|
||||
|
||||
public function kycDocsList($id = null)
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit KYC Docs Onboarding function called');
|
||||
|
||||
|
||||
$editData['kyc_docs'] = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
// Return JSON response
|
||||
@ -698,7 +782,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
$this->myLogger->logme('error','Policy Type list function called');
|
||||
$headerData['page_name'] = 'Policy Type List';
|
||||
$data['policyList'] = $this->policyTypeModel->findAll();
|
||||
$data['policyList'] = $this->policyTypeModel->where('is_active',1)->findAll();
|
||||
// $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
|
||||
// echo '<pre>';
|
||||
// print_r($data['insurerList']); die;
|
||||
@ -710,13 +794,41 @@ class MasterController extends AdminController
|
||||
// $this->loadLayout('insurer_onboarding', $data);
|
||||
}
|
||||
|
||||
|
||||
public function policyTypeRemove($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Policy Type Remove function called');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->policyTypeModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function removePolicyPolicies($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Policies Remove function called');
|
||||
// $id = $this->request->getPost('PrimaryKey');
|
||||
// $data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$data['is_active'] = 0;
|
||||
$update = $this->policesModel->update($id,$data);
|
||||
if($update){
|
||||
return $this->respond(['status' => true,'code' => 200], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function policyTypeOnboarding()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Policy Type Onboarding function called');
|
||||
$headerData['page_name'] = 'Policy Type Onboarding';
|
||||
$headerData['page_name'] = 'Policy Type Master';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
@ -749,7 +861,12 @@ class MasterController extends AdminController
|
||||
$data['created_by'] = get_session_userid();
|
||||
$insert = $this->policesModel->insert($data);
|
||||
if($insert){
|
||||
$policiesData = $this->policesModel->where('policy_type_id', $this->request->getPost('policy_type_id'))->findAll();
|
||||
$policiesData = $this->policesModel->select('policies.*, insurers.name as insurer_name')
|
||||
->join('insurers', 'insurers.id = policies.insurer_id')
|
||||
->where('policies.policy_type_id', $this->request->getPost('policy_type_id'))
|
||||
->where('policies.is_active', 1)
|
||||
->findAll();
|
||||
// $policiesData = $this->policesModel->where('policy_type_id', $this->request->getPost('policy_type_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $policiesData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
@ -776,16 +893,19 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicyTypeOnboarding($id = null)
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit KYC Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit KYC Onboarding';
|
||||
$headerData['page_name'] = 'Edit Policy Type';
|
||||
|
||||
$editData['policytype'] = $this->policyTypeModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['policies'] = $this->policesModel->select('policies.*, insurers.name as insurer_name')
|
||||
->join('insurers', 'insurers.id = policies.insurer_id')
|
||||
->where('policies.policy_type_id', $id)
|
||||
->where('policies.is_active', 1)
|
||||
->findAll();
|
||||
// $editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['insurer'] = $this->insurerModel-> findAll();
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('policy_type_onboarding', $editData);
|
||||
@ -794,9 +914,6 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicyType()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Policy general info function called');
|
||||
@ -812,9 +929,6 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function policesList($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit Policies Onboarding function called');
|
||||
@ -823,10 +937,12 @@ class MasterController extends AdminController
|
||||
|
||||
$policies = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
|
||||
// print_r($id);die;
|
||||
foreach ($policies as $policy) {
|
||||
// Retrieve the insurer information
|
||||
$insurer = $this->insurerModel->find($policy['insurer_id']);
|
||||
|
||||
// print_r($insurer);die;
|
||||
// Add the insurer information to the editData array
|
||||
if ($insurer) {
|
||||
$editData['policies'][$policy['id']] = [
|
||||
@ -838,8 +954,8 @@ class MasterController extends AdminController
|
||||
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
// header('Content-Type: application/json');
|
||||
// echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -848,9 +964,7 @@ class MasterController extends AdminController
|
||||
public function editPoliciesGet($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit Policies Onboarding function called');
|
||||
|
||||
$editData['policies'] = $this->policesModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
@ -858,8 +972,6 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicies()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Policy general info function called');
|
||||
@ -868,7 +980,8 @@ class MasterController extends AdminController
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->policesModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
$policyData = $this->policesModel->where(['id' => $id, 'is_active' => 1])->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $policyData));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
|
||||
@ -130,7 +130,6 @@ class RestAuthenticationController extends AdminController
|
||||
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) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -48,6 +48,19 @@ if (!function_exists('generate_random_string')) {
|
||||
|
||||
|
||||
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
|
||||
@ -62,9 +75,11 @@ if (!function_exists('generate_excel')) {
|
||||
// Set data into the spreadsheet
|
||||
$spreadsheet->getActiveSheet()->fromArray($data, null, 'A2');
|
||||
|
||||
if($totals){
|
||||
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
|
||||
@ -72,7 +87,9 @@ if (!function_exists('generate_excel')) {
|
||||
|
||||
try {
|
||||
// Save Excel file to the specified path
|
||||
$writer->save($filename);
|
||||
// $writer->save($filename);
|
||||
$filePath = WRITEPATH."/uploads/import_excel/" . $filename;
|
||||
$writer->save($filePath);
|
||||
return true; // Return true if file was successfully saved
|
||||
} catch (\Exception $e) {
|
||||
// Log or handle the exception
|
||||
@ -162,6 +179,94 @@ if (! function_exists('transform_objects_to_array_for_correction')) {
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -186,6 +291,30 @@ if (!function_exists('add_totals_row')) {
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
@ -225,8 +354,6 @@ if (!function_exists('read_excel_file_to_array')) {
|
||||
}
|
||||
|
||||
|
||||
// app/Helpers/filename_helper.php
|
||||
|
||||
if (! function_exists('generate_filename')) {
|
||||
function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name) {
|
||||
|
||||
@ -239,6 +366,10 @@ if (! function_exists('generate_filename')) {
|
||||
$evenTypeLabel = 'C';
|
||||
}else if($event_type == 'si_enhancement'){
|
||||
$evenTypeLabel = 'SI';
|
||||
}else if($event_type == 'addition'){
|
||||
$evenTypeLabel = 'A';
|
||||
}else if($event_type == 'dependent_addition'){
|
||||
$evenTypeLabel = 'DA';
|
||||
}
|
||||
|
||||
$insurer_or_tpa_lable = "";
|
||||
@ -258,3 +389,12 @@ if (! function_exists('generate_filename')) {
|
||||
return $file_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('remove_underscore_capitalize_first_letter')) {
|
||||
function remove_underscore_capitalize_first_letter($word) {
|
||||
// Remove underscore and capitalize first letter of each word
|
||||
$formattedEvent = ucwords(str_replace('_', ' ', $word));
|
||||
return $formattedEvent;
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,20 @@
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
|
||||
if(!function_exists('calculate_days_bw_dates'))
|
||||
{
|
||||
function calculate_days_bw_dates(string $from_date = "", string $to_date ="")
|
||||
{
|
||||
if($to_date == ""){ $currentDateTime = new DateTime(); }
|
||||
else{ $currentDateTime = new DateTime($to_date); }
|
||||
if($from_date == ""){ $passedDateTime = new DateTime(); }
|
||||
else{ $passedDateTime = new DateTime($from_date); }
|
||||
|
||||
return $interval = $currentDateTime->diff($passedDateTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('check_columns_name')) {
|
||||
function check_columns_name($definedColumns,$excelColumns)
|
||||
{
|
||||
@ -11,7 +25,7 @@ if (!function_exists('check_columns_name')) {
|
||||
$definedColIdx = $definedCol['col_idx'];
|
||||
$definedColName = $definedCol['col_name'];
|
||||
|
||||
if (strtolower(trim($excelColumns[$definedColIdx])) !== strtolower($definedColName)) {
|
||||
if (strtolower(strip_tags(trim($excelColumns[$definedColIdx]))) !== strtolower($definedColName)) {
|
||||
$mismatchedColumns[] = "Column order conflict. Column order no ".($definedColIdx + 1)." expected : ".$definedColName." and received : ".$excelColumns[$definedColIdx]."<br/>";
|
||||
}
|
||||
}
|
||||
@ -55,23 +69,29 @@ if(!function_exists('check_relationship'))
|
||||
{
|
||||
function check_relationship($row,$relationship)
|
||||
{
|
||||
// print_r($col);print_r($relationship);
|
||||
// print_r($relationship);
|
||||
// echo '<br>';
|
||||
if($row[17] != null && in_array(strtoupper($row[17]), ['I','A','DA']))// check rule only of action column data available
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
if($row[5] != null && $row[4] != null)//$row[5] = relationship $row[4] = Gender
|
||||
{
|
||||
$slug = \Config\Services::slug();
|
||||
$col = $slug->slugify($row[5]);
|
||||
// echo $col;die();
|
||||
// echo $col;//die();
|
||||
if($col != 'self' && $col != 'spouse')
|
||||
{
|
||||
if($relationship[ $col ]['gender'] != $row[4])
|
||||
if(!isset($relationship[ $col ]))
|
||||
{
|
||||
return array('status' => false,'error' => 'Rule Conflict: Unknown Relationship');
|
||||
}
|
||||
|
||||
if(isset($relationship[ $col ]) && $relationship[ $col ]['gender'] != $row[4])
|
||||
{
|
||||
$error = "Gender relationship conflict: Expected ".$relationship[ $col ]['gender'].", received $row[4]";
|
||||
return array('status' => false,'error' => $error);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return array('status' => true);
|
||||
}
|
||||
@ -90,12 +110,12 @@ if(!function_exists('check_doj'))
|
||||
|
||||
function check_doj($row)
|
||||
{
|
||||
if($row[17] != null && in_array(strtoupper($row[17]), ['I','A','DA']))// check rule only of action column data available
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
// echo $relationship;echo $row[7];
|
||||
if($relationship == 'self' && $row[7] == "") { return array('status' => false,'error' => "DOJ mandantory for self"); }
|
||||
if($relationship == 'self' && $row[8] == "") { return array('status' => false,'error' => "DOJ mandantory for self"); }
|
||||
return array('status' => true);
|
||||
}
|
||||
else { return array('status' => true); } // in else condition no need to check rule, just return true
|
||||
@ -105,14 +125,52 @@ if(!function_exists('check_doj'))
|
||||
|
||||
if(!function_exists('check_employee_band'))
|
||||
{
|
||||
function check_employee_band($row)
|
||||
function check_employee_band($row,$policy_terms,$slab_details)
|
||||
{
|
||||
if($row[17] != null && in_array(strtoupper($row[17]), ['I','A','DA']))// check rule only of action column data available
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
$is_emp_band_needed = $slab_details['grid_master']['emp_band'];
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
// echo $relationship;echo $row[7];
|
||||
if($relationship == 'self' && $row[9] == "") { return array('status' => false,'error' => "Band mandantory for self"); }
|
||||
if($is_emp_band_needed && $relationship == 'self' && $row[10] == "") { return array('status' => false,'error' => "Band mandantory for self"); }
|
||||
else if($is_emp_band_needed && $relationship == 'self' && $row[10] != "")
|
||||
{
|
||||
$received_grade = $row[10];
|
||||
$found = false;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['grade'] == $received_grade)
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$found) { return array('status' => false,'error' => "Emp band/Grade not found"); }
|
||||
}
|
||||
return array('status' => true);
|
||||
}else { return array('status' => true); } // in else condition no need to check rule, just return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!function_exists('check_si'))
|
||||
{
|
||||
function check_si($row,$policy_terms,$slab_details)
|
||||
{
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA','SI']))// check rule only of action column data available
|
||||
{
|
||||
$received_si = $row['current_action'] == 'SI' ? $row[3] : $row[6];
|
||||
$found = false;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $received_si)
|
||||
{
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$found) { return array('status' => false,'error' => "Sum insured not found"); }
|
||||
return array('status' => true);
|
||||
}else { return array('status' => true); } // in else condition no need to check rule, just return true
|
||||
}
|
||||
@ -120,14 +178,15 @@ if(!function_exists('check_employee_band'))
|
||||
|
||||
if(!function_exists('check_basic_pay'))
|
||||
{
|
||||
function check_basic_pay($row)
|
||||
function check_basic_pay($row,$policy_terms,$slab_details)
|
||||
{
|
||||
if($row[17] != null && in_array(strtoupper($row[17]), ['I','A','DA']))// check rule only of action column data available
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
$is_basic_pay_needed = $slab_details['grid_master']['basicpay'];
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
// echo $relationship;echo $row[7];
|
||||
if($relationship == 'self' && $row[8] == "") { return array('status' => false,'error' => "Basic pay mandantory for self"); }
|
||||
if($is_basic_pay_needed && $relationship == 'self' && $row[9] == "") { return array('status' => false,'error' => "Basic pay mandantory for self"); }
|
||||
return array('status' => true);
|
||||
}else { return array('status' => true); } // in else condition no need to check rule, just return true
|
||||
}
|
||||
@ -138,7 +197,7 @@ if (!function_exists('check_dob_diff'))
|
||||
{
|
||||
function check_dob_diff($row,$relationships) {
|
||||
// echo 'called';
|
||||
if($row[17] != null && in_array(strtoupper($row[17]), ['I','A','DA']))// check rule only of action column data available
|
||||
if($row['current_action'] != null && in_array(strtoupper($row['current_action']), ['I','A','DA']))// check rule only of action column data available
|
||||
{
|
||||
if($row[3] != null && $row[5] != null)
|
||||
{
|
||||
@ -150,8 +209,8 @@ if (!function_exists('check_dob_diff'))
|
||||
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
$age_min = $relationships[$relationship]['age_min'];
|
||||
$age_max = $relationships[$relationship]['age_max'];
|
||||
$age_min = isset($relationships[$relationship]['age_min']) ? $relationships[$relationship]['age_min'] : NULL;
|
||||
$age_max = isset($relationships[$relationship]['age_max']) ? $relationships[$relationship]['age_max'] : NULL;
|
||||
// echo $relationship.','.$age_min.'-'.$age_max;
|
||||
if($age_min !== null && $age_min > $interval->y)
|
||||
{
|
||||
@ -173,14 +232,21 @@ if (!function_exists('check_dob_diff'))
|
||||
|
||||
if (!function_exists('data_group_by_family'))
|
||||
{
|
||||
function data_group_by_family($emp_data)
|
||||
function data_group_by_family($emp_data,$data_source = 'excel')
|
||||
{
|
||||
$result = [];
|
||||
foreach ($emp_data as $rkey => $row)
|
||||
{
|
||||
if(!check_row_is_empty_or_null($row))
|
||||
if($data_source == 'excel')
|
||||
{
|
||||
$result[$row[1]][] = $row;
|
||||
if(!check_row_is_empty_or_null($row))
|
||||
{
|
||||
$result[$row[1]][] = $row;
|
||||
}
|
||||
|
||||
}else if($data_source = 'db')
|
||||
{
|
||||
$result[$row['emp_code']][] = $row;
|
||||
}
|
||||
|
||||
}
|
||||
@ -216,10 +282,14 @@ if (!function_exists('name_dup_check_within_family'))
|
||||
|
||||
if (!function_exists('name_and_empid_check_in_db'))
|
||||
{
|
||||
function name_and_empid_check_in_db($family_data,$client_id,$policy_id)
|
||||
function name_and_empid_check_in_db($family_data,$actionArr)
|
||||
{
|
||||
$employeeModel = new EmployeeModel();
|
||||
$result = ['del' => [],'i' => []];
|
||||
$client_id = $actionArr['client_id'];
|
||||
$policy_id = $actionArr['policy_id'];
|
||||
$current_action = $actionArr['action'];
|
||||
|
||||
foreach ($family_data as $rkey => $row)
|
||||
{
|
||||
$res = $employeeModel
|
||||
@ -227,22 +297,23 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
->where("cp.policy_id",$policy_id)
|
||||
->where("employees.client_id",$client_id)
|
||||
->like('name',$row[2],'both')->like('emp_code',$row[1],'both')
|
||||
// ->where("ep.client_id",$client_id)
|
||||
->where('name',$row[2])->where('emp_code',$row[1])
|
||||
->findAll();
|
||||
|
||||
|
||||
if(count($res))
|
||||
{
|
||||
if($row[17] == 'D')
|
||||
// dd($employeeModel);
|
||||
|
||||
|
||||
if(($current_action == 'deletion' || $current_action == 'correction' || $current_action == 'si_enhancement') && !count($res))
|
||||
{
|
||||
array_push($result['del'],$row[0]);
|
||||
}
|
||||
else
|
||||
if(($current_action == 'inception' || $current_action == 'dependent_addition' || $current_action == 'addition') && count($res))
|
||||
{
|
||||
array_push($result['i'],$row[0]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -251,7 +322,7 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
|
||||
if (!function_exists('check_dependent_conflict'))
|
||||
{
|
||||
function check_dependent_conflict($family_data,$policy_terms)
|
||||
function check_dependent_conflict($family_data,$policy_terms,$actionArr)
|
||||
{
|
||||
$result = ['status' => true];
|
||||
|
||||
@ -267,24 +338,26 @@ if (!function_exists('check_dependent_conflict'))
|
||||
$allowed_parent_in_laws_count = 0;
|
||||
$received_parent_in_laws_count = 0;
|
||||
$overall_famility_relationships = [];
|
||||
$self_emp_row_id = 0;
|
||||
$temp_counts = [2,3,4,5,6,7,8,9,10]; //temp variable for check relation repetaed count
|
||||
$slug = \Config\Services::slug();
|
||||
|
||||
if($policy_terms['family_floater'] == true)
|
||||
{
|
||||
// if($policy_terms['family_floater'] == true)
|
||||
// {
|
||||
|
||||
// $temp_string = implode(" ",$policy_terms['family_floaters']);
|
||||
$temp = $policy_terms['family_floaters'];
|
||||
$allowed_child_count = count(preg_grep('/child/',$temp));
|
||||
$allowed_spouse_count = count(preg_grep('/spouse/',$temp));
|
||||
$allowed_parents_count = count(preg_grep('/parent[12]/',$temp));
|
||||
$allowed_parent_in_laws_count = count(preg_grep('/parent_in_law[12]/',$temp));
|
||||
|
||||
$allowed_child_count = $temp['childrens'];
|
||||
$allowed_spouse_count = $temp['spouse'];
|
||||
$allowed_adults = $temp['either-parents-pil'];
|
||||
$allowed_parents_count = $temp['either-parents-pil'] == 0 ? $temp['parents'] : 0;
|
||||
$allowed_parent_in_laws_count = $temp['either-parents-pil'] == 0 ? $temp['parents-in-law'] : 0;
|
||||
// dd($allowed_adults == 0);
|
||||
foreach ($family_data as $key => $row)
|
||||
{
|
||||
$relationship = $slug->slugify($row[5]);
|
||||
|
||||
if($row[17] != 'D' && $relationship != 'son' && $relationship != 'daughter')
|
||||
if($actionArr != 'deletion' && $relationship != 'son' && $relationship != 'daughter')
|
||||
{
|
||||
array_push($overall_famility_relationships, $relationship);
|
||||
}
|
||||
@ -293,6 +366,7 @@ if (!function_exists('check_dependent_conflict'))
|
||||
if($relationship == 'self')
|
||||
{
|
||||
$self_gender = $row[4];
|
||||
$self_emp_row_id = $row[0];
|
||||
}
|
||||
if($relationship == 'spouse')
|
||||
{
|
||||
@ -316,7 +390,7 @@ if (!function_exists('check_dependent_conflict'))
|
||||
|
||||
// print_r($overall_famility_relationships);
|
||||
// echo '<br/>';
|
||||
if($row[17] != 'D')
|
||||
if($actionArr != 'deletion')
|
||||
{
|
||||
$repeated_relationships_count = array_count_values($overall_famility_relationships);
|
||||
// print_r($repeated_relationships_count);
|
||||
@ -325,7 +399,7 @@ if (!function_exists('check_dependent_conflict'))
|
||||
if(is_array($repeated_count) && count($repeated_count))
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 13,'col_name' => 'relationship','msg' => 'Rule conflict: Twofold relationship found within family'];
|
||||
$result['error_data'][] = ['code' => 13,'col_name' => 'relationship','msg' => 'Rule conflict: Twofold relationship found within family','row_id' => $family_data[0][0]];
|
||||
}
|
||||
}
|
||||
// print_r($repeated_count);
|
||||
@ -339,29 +413,492 @@ if (!function_exists('check_dependent_conflict'))
|
||||
if($self_gender == $spouse_gender)
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender'];
|
||||
$result['error_data'][] = ['code' => 4,'col_name' => 'gender','msg' => 'Rule conflict: Self and Spouse cannot be same gender','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
|
||||
}
|
||||
if(($allowed_spouse_count < $received_spouse_count) || ($allowed_child_count < $received_child_count) || ($allowed_parents_count < $received_parents_count) || ($allowed_parent_in_laws_count < $received_parent_in_laws_count))
|
||||
|
||||
if(($allowed_spouse_count < $received_spouse_count) || ($allowed_child_count < $received_child_count) )
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 12,'col_name' => null,'msg' => 'Rule conflict: Dependent count greater than allowed dependent count'];//dependent count mismatch
|
||||
$result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: Dependent count greater than allowed dependent count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];//dependent count mismatch
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(count($family_data) > 1)
|
||||
// || ($allowed_parents_count < $received_parents_count) || ($allowed_parent_in_laws_count < $received_parent_in_laws_count)
|
||||
if($allowed_adults == 1 && $received_parents_count && $received_parent_in_laws_count )
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 11,'col_name' => null,'msg' => 'Rule conflict: Dependents not allowed'];//dependents not allowed
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: Parents and Parents in law both not allowed','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];
|
||||
|
||||
if((2 < $received_parents_count) || (2 < $received_parent_in_laws_count))
|
||||
{
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: Dependent count greater than allowed dependent count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];//dependent count mismatch
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// var_dump($allowed_adults == 0);
|
||||
// dd($allowed_adults == 0 && (($allowed_parents_count < $received_parents_count) || ($allowed_parent_in_laws_count < $received_parent_in_laws_count)));
|
||||
if($allowed_adults == 0 && (($allowed_parents_count < $received_parents_count) || ($allowed_parent_in_laws_count < $received_parent_in_laws_count) ))
|
||||
{
|
||||
// dd($allowed_adults);
|
||||
$result['status'] = false;
|
||||
$result['error_data'][] = ['code' => 12,'col_name' => 'sno','msg' => 'Rule conflict: Dependent count greater than allowed dependent count','row_id' => (isset($self_emp_row_id) ? $self_emp_row_id : $family_data[0][0])];//dependent count mismatch
|
||||
}
|
||||
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if(count($family_data) > 1)
|
||||
// {
|
||||
// $result['status'] = false;
|
||||
// $result['error_data'][] = ['code' => 11,'col_name' => 'sno','msg' => 'Rule conflict: Dependents not allowed','row_id' => $row[0]];//dependents not allowed
|
||||
// }
|
||||
// }
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('generate_relationship_code'))
|
||||
{
|
||||
function generate_relationship_code($arr)
|
||||
{
|
||||
$gender = ['M' => 1,'F' => 2];
|
||||
$relationship = ['self' => 1,'spouse' => 2,'son' => 3,'daughter' => 4,'father' => 5,'mother' => 6,'father-in-law' => 7,'mother-in-law' => 8];
|
||||
$slug = \Config\Services::slug();
|
||||
$relationship_code = $slug->slugify($arr['relationship']);
|
||||
$relationship_code = $gender[ $arr['gender'] ] . $relationship[ $relationship_code ] ;
|
||||
return $relationship_code;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('calculate_premimum'))
|
||||
{
|
||||
function calculate_premimum($family_data,$policy_terms,$slab_details,$fileArr)
|
||||
{
|
||||
//
|
||||
// dd($fileArr);
|
||||
// grid type
|
||||
// 1 = premium => si
|
||||
$result = [];
|
||||
$grid_type = $slab_details['grid_master']['ui_type'];
|
||||
$fileArr['grid_type'] = $grid_type;
|
||||
//this variable for store emp id and their band for emp band level premium calculation for all famility members (especially for grid type 9) also store max age and max count of a familiy for grid type 10,11
|
||||
$emp_details_with_empband_max_age_max_count = [];
|
||||
//max age amoung familiy
|
||||
$max_age = max(array_map(function($item) {return calculate_days_bw_dates(from_date: $item[3])->y; }, $family_data));
|
||||
|
||||
foreach($family_data as $fkey => $member)
|
||||
{
|
||||
//transform as db row column
|
||||
$transformed_familiy_member_data = transform_excel_data_to_db($member,$fileArr);
|
||||
// dd($transformed_familiy_member_data);
|
||||
//store emp id and emp band and attach it to their familiy members where band is always empty
|
||||
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['band'] = null;
|
||||
if(strtolower($transformed_familiy_member_data['relationship']) == 'self')
|
||||
{
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['band'] = $transformed_familiy_member_data['band'];
|
||||
}
|
||||
|
||||
//end of store emp id and emp band and attach it to their familiy members where band is always empty
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['maxcount'] =count($family_data);
|
||||
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['maxage'] = $max_age;
|
||||
|
||||
//generate relationship code
|
||||
if($transformed_familiy_member_data['temp']['action'] != 'D' && $transformed_familiy_member_data['temp']['action'] != 'C' && $transformed_familiy_member_data['temp']['action'] != 'SI')
|
||||
{
|
||||
$transformed_familiy_member_data['relationship_code'] = generate_relationship_code($transformed_familiy_member_data);
|
||||
}
|
||||
|
||||
//calculate primimum based on grid type
|
||||
if($transformed_familiy_member_data['temp']['action'] != 'D' && $transformed_familiy_member_data['temp']['action'] != 'C' && $transformed_familiy_member_data['temp']['action'] != 'SI')
|
||||
{
|
||||
|
||||
//before call premium_calculation_manager attach band,max age and max count into the array temporarly for grid 9,10 and 11
|
||||
$transformed_familiy_member_data['temp']['band'] = $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['band'];
|
||||
$transformed_familiy_member_data['temp']['maxage'] = $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['maxage'];
|
||||
$transformed_familiy_member_data['temp']['maxcount'] = $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['maxcount'];
|
||||
|
||||
if( $fileArr['id'] == null || (in_array($grid_type,[10,11]) || $transformed_familiy_member_data['temp']['source'] == 'excel'))//if file id is null then data coming from enrollment (from DB) otherwise data coming from xcel, so calculate only data from excel (new entry) note: even data coming from excel for event dependet additon we fetch other dependts from db and calculate premium for whole family
|
||||
{
|
||||
$transformed_familiy_member_data = premium_calculation_manager($transformed_familiy_member_data,$policy_terms,$slab_details);
|
||||
|
||||
$result[] = $transformed_familiy_member_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('transform_excel_data_to_db'))
|
||||
{
|
||||
function transform_excel_data_to_db($memArr,$actionArr)
|
||||
{
|
||||
|
||||
$current_column_action = null;
|
||||
if($actionArr['action'] == 'inception'){ $current_column_action = 'I'; }
|
||||
else if($actionArr['action'] == 'addition'){ $current_column_action = 'A'; }
|
||||
else if($actionArr['action'] == 'dependent_addition'){ $current_column_action = 'DA'; }
|
||||
else if($actionArr['action'] == 'deletion'){ $current_column_action = 'D'; }
|
||||
else if($actionArr['action'] == 'correction'){ $current_column_action = 'C'; }
|
||||
else if($actionArr['action'] == 'si_enhancement'){ $current_column_action = 'SI'; }
|
||||
|
||||
if($actionArr['action'] == 'inception' || $actionArr['action'] == 'addition' || $actionArr['action'] == 'dependent_addition')
|
||||
{
|
||||
|
||||
$policy['basic_cover_si'] = $memArr[6];
|
||||
$policy['pre_existing_alignments'] = $memArr[14];
|
||||
$policy['date_of_exit'] = isset($memArr[16]) ? change_date_format($memArr[16],'d-M-Y','Y-m-d') : NULL;
|
||||
$policy['reason_for_exit'] = $memArr[17];
|
||||
$policy['client_policy_id'] = $actionArr['policy_id'];
|
||||
$policy['date_coverage'] = isset($memArr[7]) ? change_date_format($memArr[7],'d-M-Y','Y-m-d') : NULL;;
|
||||
$policy['policy_end_date'] = null;
|
||||
$policy['days'] = null;
|
||||
$policy['premium'] = null;
|
||||
$policy['rata_premimum'] = null;
|
||||
$policy['gst'] = null;
|
||||
|
||||
|
||||
$result['emp_code'] = $memArr[1];
|
||||
$result['name'] = $memArr[2];
|
||||
$result['dob'] = isset($memArr[3]) ? change_date_format($memArr[3],'d-M-Y','Y-m-d') : NULL;
|
||||
$result['gender'] = $memArr[4];
|
||||
$result['relationship'] = $memArr[5];
|
||||
$result['relationship_code'] = $memArr[5];
|
||||
$result['doj'] = isset($memArr[8]) ? change_date_format($memArr[8],'d-M-Y','Y-m-d') : NULL;
|
||||
$result['basic_pay'] = $memArr[9];
|
||||
$result['band'] = $memArr[10];
|
||||
$result['designation'] = $memArr[11];
|
||||
$result['mobile'] = $memArr[12];
|
||||
$result['email_corporate'] = $memArr[13];
|
||||
$result['file_id'] = $actionArr['id'];
|
||||
$result['client_id'] = $actionArr['client_id'];
|
||||
$result['change_event'] = $memArr[15];
|
||||
$result['temp']['grid_type'] = $actionArr['grid_type'];
|
||||
$result['temp']['action'] = isset($memArr['current_action']) ? $memArr['current_action'] : $current_column_action;
|
||||
$result['temp']['source'] = isset($memArr['temp']['source']) ? $memArr['temp']['source'] : 'excel';
|
||||
$result['temp']['emp_id'] = isset($memArr['temp']['emp_id']) ? $memArr['temp']['emp_id'] : null;
|
||||
$result['temp']['emp_policy_id'] = isset($memArr['temp']['emp_policy_id']) ? $memArr['temp']['emp_policy_id'] : null;
|
||||
$result['policy_details'] = $policy;
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('premium_calculation_manager'))
|
||||
{
|
||||
function premium_calculation_manager($emp_data,$policy_terms,$slab_details)
|
||||
{
|
||||
// grid type
|
||||
// 1 = premium => si
|
||||
$grid_type = $slab_details['grid_master']['ui_type'];
|
||||
|
||||
switch ($grid_type) {
|
||||
case "1":
|
||||
//GPA - Sum Insured (SI) * Multiplier
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $employee_received_si)
|
||||
{
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "2":
|
||||
//GPA - Flat Rate for all SI
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $employee_received_si)
|
||||
{
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "3":
|
||||
//GMC - SI
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $employee_received_si)
|
||||
{
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case "4":
|
||||
//GMC - Employees Age band
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
|
||||
{
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "5":
|
||||
//GMC - Employees Age + SI
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
|
||||
{
|
||||
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "6":
|
||||
//GMC - Employees + Dependent Age band
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
|
||||
{
|
||||
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "7":
|
||||
//GMC - Employees + Dependent Age + SI
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age))
|
||||
{
|
||||
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "8":
|
||||
//GMC - SI as per Grade or Band
|
||||
$employee_received_band = $emp_data['temp']['band'];
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
|
||||
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si)
|
||||
{
|
||||
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "9":
|
||||
//GMC - Flat Rate for all
|
||||
$employee_received_band = $emp_data['temp']['band'];
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
|
||||
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si)
|
||||
{
|
||||
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
|
||||
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
|
||||
$emp_data['policy_details']['policy_end_date'] = $policy_terms['policy_end_date'];
|
||||
$emp_data['policy_details']['days'] = calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['premium'] = $slab_value['premium'];
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "10":
|
||||
//GMC - Maximum age of Dependents
|
||||
$max_age = $emp_data['temp']['maxage'];
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age))
|
||||
{
|
||||
|
||||
$emp_data['policy_details']['date_coverage'] = (strtolower($emp_data['relationship']) == 'self' ? (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']) : "");
|
||||
$emp_data['policy_details']['policy_end_date'] = (strtolower($emp_data['relationship']) == 'self' ? $policy_terms['policy_end_date'] : "");
|
||||
$emp_data['policy_details']['days'] = (strtolower($emp_data['relationship']) == 'self' ? calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days : 0);
|
||||
$emp_data['policy_details']['premium'] = (strtolower($emp_data['relationship']) == 'self' ? $slab_value['premium'] : 0);
|
||||
$emp_data['policy_details']['rata_premimum'] = (strtolower($emp_data['relationship']) == 'self' ? calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']) : 0);
|
||||
$emp_data['policy_details']['gst'] = (strtolower($emp_data['relationship']) == 'self' ? ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','')) : 0);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "11":
|
||||
//GMC - Maximum count per Family
|
||||
$max_count = $emp_data['temp']['maxage'];
|
||||
$employee_received_band = $emp_data['temp']['band'];
|
||||
$employee_received_si = $emp_data['policy_details']['basic_cover_si'];
|
||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['grade'] == $employee_received_band))
|
||||
{
|
||||
//calculate premium based on count
|
||||
$famility_si_covered = $employee_received_si * $max_count;
|
||||
$famility_si_covered = ($famility_si_covered >= $slab_value['max_si'] ? $slab_value['max_si'] : $famility_si_covered);
|
||||
|
||||
$emp_data['policy_details']['basic_cover_si'] = (strtolower($emp_data['relationship']) == 'self' ? $famility_si_covered : 0);
|
||||
$emp_data['policy_details']['date_coverage'] = (strtolower($emp_data['relationship']) == 'self' ? (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']) : "");
|
||||
$emp_data['policy_details']['policy_end_date'] = (strtolower($emp_data['relationship']) == 'self' ? $policy_terms['policy_end_date'] : "");
|
||||
$emp_data['policy_details']['days'] = (strtolower($emp_data['relationship']) == 'self' ? calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days : 0);
|
||||
$emp_data['policy_details']['premium'] = (strtolower($emp_data['relationship']) == 'self' ? $slab_value['premium'] : 0);
|
||||
$emp_data['policy_details']['rata_premimum'] = (strtolower($emp_data['relationship']) == 'self' ? calculate_pro_rata_premimum($slab_value['premium'],$emp_data['policy_details']['days']) : 0);
|
||||
$emp_data['policy_details']['gst'] = (strtolower($emp_data['relationship']) == 'self' ? ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','')) : 0);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
echo "Not a valid grid";
|
||||
}
|
||||
|
||||
// unset($emp_data['temp']);//remove temp data
|
||||
return $emp_data;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('calculate_pro_rata_premimum'))
|
||||
{
|
||||
function calculate_pro_rata_premimum($premium,$days)
|
||||
{
|
||||
return (float) number_format(($premium / 365) * $days,2,'.','');
|
||||
}
|
||||
}
|
||||
|
||||
//transform db columns into excel rows with indexs
|
||||
if (!function_exists('transform_db_data_to_excel'))
|
||||
{
|
||||
function transform_db_data_to_excel($familiyArr,$actionArr = [])
|
||||
{
|
||||
// if($actionArr['action'] == 'dependent_addition')
|
||||
// {
|
||||
$return_data = [];
|
||||
|
||||
foreach ($familiyArr as $key => $value)
|
||||
{
|
||||
// dd($value);
|
||||
$row = [];
|
||||
$row[0] = ($key + 1);
|
||||
$row[6] = $value['basic_cover_si'];
|
||||
$row[14] = $value['pre_existing_alignments'];
|
||||
$row[16] = isset($value['date_of_exit']) ? change_date_format($value['date_of_exit'], 'Y-m-d', 'd-M-Y') : NULL;
|
||||
$row[17] = $value['reason_for_exit'];
|
||||
|
||||
|
||||
$row[7] = isset($value['date_coverage']) ? change_date_format($value['date_coverage'], 'Y-m-d', 'd-M-Y') : NULL;
|
||||
|
||||
$row[1] = $value['emp_code'];
|
||||
$row[2] = $value['name'];
|
||||
$row[3] = isset($value['dob']) ? change_date_format($value['dob'], 'Y-m-d', 'd-M-Y') : NULL;
|
||||
$row[4] = $value['gender'];
|
||||
$row[5] = $value['relationship'];
|
||||
|
||||
$row[8] = isset($value['doj']) ? change_date_format($value['doj'], 'Y-m-d', 'd-M-Y') : NULL;
|
||||
$row[9] = $value['basic_pay'];
|
||||
$row[10] = $value['band'];
|
||||
$row[11] = $value['designation'];
|
||||
$row[12] = $value['mobile'];
|
||||
$row[13] = $value['email_corporate'];
|
||||
// $actionArr['id'] = $value['file_id'];
|
||||
// $actionArr['client_id'] = $value['client_id'];
|
||||
$row[15] = $value['change_event'];
|
||||
$row['current_action'] = 'DA';
|
||||
$row['temp']['source'] = 'db';
|
||||
$row['temp']['emp_id'] = $value['emp_id'];
|
||||
$row['temp']['emp_policy_id'] = $value['emp_policy_id'];
|
||||
|
||||
array_push($return_data, ($row));
|
||||
}
|
||||
|
||||
return $return_data;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,24 @@ 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_userProfile')) {
|
||||
function get_userProfile()
|
||||
{
|
||||
// $ci =& get_instance();
|
||||
$session = \Config\Services::session();
|
||||
return $session->get('userProfile');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_session_user')) {
|
||||
function get_session_user()
|
||||
{
|
||||
|
||||
@ -44,32 +44,45 @@ if (!function_exists('change_date_format')) {
|
||||
}
|
||||
|
||||
if (!function_exists('file_Upload')) {
|
||||
|
||||
function file_Upload($fileToUpload, $imageDetails = null)
|
||||
function file_Upload($fileToUpload, $filepath)
|
||||
{
|
||||
$fileName = $fileToUpload->getClientName();
|
||||
if ($fileToUpload !== NULL && $fileName !== "") {
|
||||
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
|
||||
|
||||
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);
|
||||
}
|
||||
if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
|
||||
$fileName = $fileToUpload->getName();
|
||||
$fileToUpload->move($filepath, $fileName);
|
||||
return $fileName;
|
||||
} else {
|
||||
$fileName = "";
|
||||
return "";
|
||||
}
|
||||
|
||||
return $fileName;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('file_unlink')) {
|
||||
function file_unlink($filepath)
|
||||
{
|
||||
if (is_file($filepath) && file_exists($filepath)) {
|
||||
unlink($filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
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') {
|
||||
|
||||
@ -22,4 +22,38 @@ class BatchFileModel extends Model
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,6 +21,8 @@ class ClientModel extends Model
|
||||
"city",
|
||||
"state",
|
||||
"pincode",
|
||||
"is_download_btn",
|
||||
"client_logo",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
@ -54,10 +56,9 @@ class ClientModel extends Model
|
||||
|
||||
return $this->db->table('clients')
|
||||
->select('clients.*')
|
||||
->select('user_profiles.first_name as user_name')
|
||||
->join('user_profiles', 'user_profiles.id = clients.created_by')
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -33,9 +33,12 @@ class ClientPolicyModel extends Model
|
||||
"claims_incurred_amount",
|
||||
"policy_terms",
|
||||
"open_for_enrollment",
|
||||
"is_addon",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"Is_active",
|
||||
"date_of_exit",
|
||||
"reason_for_exit"
|
||||
];
|
||||
|
||||
public function getClientPolicyById($id){
|
||||
@ -58,12 +61,14 @@ class ClientPolicyModel extends Model
|
||||
}
|
||||
|
||||
public function getClientPolicyByClientId($client_id){
|
||||
|
||||
|
||||
return $this->db->table('client_policy')
|
||||
->select('client_policy.*')
|
||||
->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
->select('tpa.name as tpa_name, tpa.short_name as tpa_short')
|
||||
->select('policies.name as policy_name')
|
||||
->select('policies.name as policy_name, policies.policy_type_id')
|
||||
->select('policy_type.policy_type as policy_type_name')
|
||||
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
|
||||
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
@ -71,10 +76,13 @@ class ClientPolicyModel extends Model
|
||||
->join('tpa', 'tpa.id = client_policy.tpa_id')
|
||||
->join('tpa_branch', 'client_policy.tpa_branch_id = tpa_branch.id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->join('policy_type', 'policy_type.id = policies.policy_type_id')
|
||||
->where('client_policy.client_id', $client_id)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getPolicyPremium($policy_id){
|
||||
@ -98,11 +106,11 @@ class ClientPolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getPolicyTermsJson($client_id,$policy_id)
|
||||
public function getPolicyDetails($client_id,$policy_id)
|
||||
{
|
||||
return $this->select('policy_terms')
|
||||
return $this->select('*')
|
||||
->where('client_id',$client_id)
|
||||
->where('policy_id',$policy_id)
|
||||
->where('id',$policy_id)
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
@ -121,6 +129,19 @@ class ClientPolicyModel extends Model
|
||||
->groupBy('client_policy.client_id', $id) // Group by insurer_id
|
||||
->get()
|
||||
->getResult();
|
||||
|
||||
// return $this->db->table('client_policy')
|
||||
// ->select('insurers.name as insurer_name, insurers.short_name as insurer_short')
|
||||
// ->select('clients.client_name as client_name')
|
||||
// ->select('MAX(client_policy.id) as max_id') // or any other appropriate aggregate function
|
||||
// ->join('clients', 'clients.id = client_policy.client_id')
|
||||
// ->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
// ->where('client_policy.client_id', $id)
|
||||
// ->groupBy('client_policy.insurer_id')
|
||||
// ->groupBy('client_policy.client_id')
|
||||
// ->get()
|
||||
// ->getResult();
|
||||
|
||||
}
|
||||
|
||||
public function getinsurerswithinsurenceid($insurerId){
|
||||
|
||||
@ -10,7 +10,7 @@ class EmpEndorsementModel extends Model
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'emp_id',
|
||||
'pk',
|
||||
'endorsement_id',
|
||||
'emp_code',
|
||||
'table_name',
|
||||
@ -19,10 +19,12 @@ class EmpEndorsementModel extends Model
|
||||
'field_name',
|
||||
'old_value',
|
||||
'new_value',
|
||||
'date_of_correction',
|
||||
'status',
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"remarks"
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@ -13,6 +13,8 @@ class EmployeeModel extends Model
|
||||
"client_id",
|
||||
"employee_id",
|
||||
"change_event",
|
||||
"relationship",
|
||||
"relationship_code",
|
||||
"relationship_id",
|
||||
"relationship",
|
||||
"batch_id",
|
||||
@ -24,14 +26,96 @@ class EmployeeModel extends Model
|
||||
"gender",
|
||||
"dob",
|
||||
"doj",
|
||||
"basic_pay",
|
||||
"band","designation",
|
||||
"otp",
|
||||
"family_floater_key",
|
||||
"emp_status",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"updated_at",
|
||||
"is_active",
|
||||
"file_id"
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for emp onboard process do not change
|
||||
public function checkExistingEmp($arr)
|
||||
{
|
||||
|
||||
return $this->where('emp_code',$arr['emp_code'])
|
||||
->where('name',$arr['name'])
|
||||
->where('client_id',$arr['client_id'])
|
||||
// ->where('relationship_code',$arr['relationship_code'])
|
||||
->where('gender',$arr['gender'])
|
||||
->where('dob',$arr['dob'])
|
||||
->find();
|
||||
}
|
||||
|
||||
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,string $emp_status = null)
|
||||
{
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', '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.date_of_exit', 'employee_polices.reason_for_exit'])
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->where('employees.is_active',1)
|
||||
->when($client_policy_id, function($query) use ($client_policy_id){
|
||||
return $query->where('employee_polices.client_policy_id',$client_policy_id);
|
||||
})
|
||||
|
||||
->where('employee_polices.is_active',1)
|
||||
->where('employees.emp_status', ($emp_status !== null ? $emp_status : 'active'))
|
||||
// ->where('employees.emp_code',$emp_code)
|
||||
->when($emp_code, function($query) use ($emp_code){
|
||||
return $query->where('employees.emp_code',$emp_code);
|
||||
|
||||
})
|
||||
// ->when($emp_status, function($query) use ($emp_status){
|
||||
// $emp_status = ($emp_status !== null ? $emp_status : 'active');
|
||||
// dd($emp_status);
|
||||
// return $query->where('employees.emp_status', $emp_status);
|
||||
// })
|
||||
->when($client_id, function($query) use ($client_id){
|
||||
return $query->where('employees.client_id',$client_id);
|
||||
})
|
||||
->findAll();
|
||||
// dd($this->db->getLastQuery());
|
||||
|
||||
return ($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,13 +131,10 @@ 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();
|
||||
public function checkExistingEmployee($arr)
|
||||
{
|
||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->where('client_id', $arr['client_id'])->first();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -17,19 +17,56 @@ class EmployeePolicyModel extends Model
|
||||
"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",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
protected function checkAndADDCreatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['created_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['created_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||
{
|
||||
// Check if 'updated_by' value is null or empty
|
||||
if (empty($data['data']['updated_by'])) {
|
||||
// Set 'updated_by' value to the current session user ID
|
||||
$data['data']['updated_by'] = get_session_userid();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
public function getEmployeePolicy($client_id,$policy_id)
|
||||
{
|
||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active'])
|
||||
@ -47,37 +84,52 @@ class EmployeePolicyModel extends Model
|
||||
return ($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//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 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 employee_policy_id,
|
||||
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')
|
||||
public function getInceptionEmployeeDataForExportExcel($ref_data)
|
||||
{
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
->join('employees', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->join("(
|
||||
$sql = "
|
||||
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
|
||||
FROM employee_polices
|
||||
LEFT JOIN employees ON employees.id = employee_polices.employee_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
batch_list.emp_policy_id,
|
||||
batch_list.batch_code as bl,
|
||||
@ -86,91 +138,318 @@ class EmployeePolicyModel extends Model
|
||||
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)
|
||||
->get()
|
||||
->getResult();
|
||||
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.tpa_id IS NULL OR employee_polices.tpa_id = '')
|
||||
AND (employee_polices.uhid IS NULL OR employee_polices.uhid = '')
|
||||
AND employee_polices.is_active = 1";
|
||||
|
||||
// Get the result set
|
||||
$query = $this->db->query($sql);
|
||||
$results = $query->getResult();
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
public function getCorrectionEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa)
|
||||
public function getCorrectionEmployeesDataForExportExcel($ref_data)
|
||||
{
|
||||
|
||||
return $this->db->table('emp_endorsement')
|
||||
->select('emp_endorsement.id,
|
||||
emp_endorsement.emp_id,
|
||||
emp_endorsement.emp_code,
|
||||
emp_endorsement.endorsement_id,
|
||||
emp_endorsement.old_value,
|
||||
emp_endorsement.new_value,
|
||||
emp_endorsement.field_name,
|
||||
emp_endorsement.remarks,
|
||||
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')
|
||||
->join('employees', 'employees.id = emp_endorsement.emp_id', 'left')
|
||||
->join('employee_polices', '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
|
||||
$client_id = $ref_data['client_id'];
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$insurer_or_tpa = $ref_data['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", 'emp_endorsement.emp_id = batch_data.emp_policy_id', 'left', false)
|
||||
->where('batch_data.bf IS NULL')
|
||||
->where('batch_data.bl IS NULL')
|
||||
->where('emp_endorsement.endorsement_id', '')
|
||||
->where('employees.client_id', $client_id)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->get()
|
||||
->getResult();
|
||||
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 updateTPAIDorUHID( $client_policy_id, $client_id, $name, $emp_code, $uhid, $tpa_id)
|
||||
public function getSIEnhancementEmployeesDataForExportExcel($ref_data)
|
||||
{
|
||||
|
||||
// $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();
|
||||
$client_id = $ref_data['client_id'];
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$query = "UPDATE employee_polices
|
||||
$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.rata_premimum 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.rata_premimum AS difference_premium,
|
||||
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
|
||||
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||
((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (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($ref_data)
|
||||
{
|
||||
|
||||
$client_id = $ref_data['client_id'];
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$insurer_or_tpa = $ref_data['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.rata_premimum as 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.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium,
|
||||
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst,
|
||||
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.rata_premimum * 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_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 = 'status'
|
||||
");
|
||||
|
||||
$result = $query->getResult();
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updateTPAIDorUHID($update_data)
|
||||
{
|
||||
$client_id = $update_data['client_id'];
|
||||
$client_policy_id = $update_data['client_policy_id'];
|
||||
$name = $update_data['name'];
|
||||
$emp_code = $update_data['emp_code'];
|
||||
$uhid = $update_data['uhid'];
|
||||
$tpa_id = $update_data['tpa_id'];
|
||||
|
||||
$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}'";
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
";
|
||||
|
||||
$this->query($query);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updateCorrectionData($emp_code, $uhid, $endorsement_id){
|
||||
public function updateCorrectionData($update_data)
|
||||
{
|
||||
|
||||
$emp_code = $update_data['emp_code'];
|
||||
$uhid = $update_data['uhid'];
|
||||
$endorsement_id = $update_data['tpa_id'];
|
||||
|
||||
$sql = "
|
||||
UPDATE emp_endorsement
|
||||
JOIN employees ON employees.id = emp_endorsement.emp_id
|
||||
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'
|
||||
@ -179,15 +458,93 @@ class EmployeePolicyModel extends Model
|
||||
$query = $this->query($sql);
|
||||
}
|
||||
|
||||
|
||||
public function updateEndoresmentIdForSIEnhancement($update_data){
|
||||
|
||||
$client_id = $update_data['client_id'];
|
||||
$client_policy_id = $update_data['client_policy_id'];
|
||||
$emp_name = $update_data['name'];
|
||||
$emp_code = $update_data['emp_code'];
|
||||
$endorsement_id = $update_data['uhid'];
|
||||
|
||||
$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 emp_endorsement.emp_code = '$emp_code'
|
||||
AND employees.client_id = '$client_id'
|
||||
AND employee_polices.client_policy_id = '$client_policy_id'
|
||||
AND emp_endorsement.actions = 'si'
|
||||
AND emp_endorsement.name = '$emp_name'
|
||||
";
|
||||
$query = $this->query($sql);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updateEndoresmentIdForDeletion($update_data){
|
||||
|
||||
$client_id = $update_data['client_id'];
|
||||
$client_policy_id = $update_data['client_policy_id'];
|
||||
$emp_name = $update_data['name'];
|
||||
$emp_code = $update_data['emp_code'];
|
||||
$endorsement_id = $update_data['uhid'];
|
||||
|
||||
$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($fetch_data)
|
||||
{
|
||||
$client_policy_id = $fetch_data['client_policy_id'];
|
||||
$emp_name = $fetch_data['name'];
|
||||
$emp_code = $fetch_data['emp_code'];
|
||||
|
||||
// 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();
|
||||
}
|
||||
// //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)
|
||||
@ -204,4 +561,5 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\PolicyGridModel;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class PolicesModel extends Model
|
||||
{
|
||||
@ -32,23 +33,26 @@ class PolicesModel extends Model
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getPolicySlabRatesForEmpOnboard($policy_id,$client_id)
|
||||
{
|
||||
|
||||
$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();
|
||||
|
||||
if((!count($premium_slab_data)))
|
||||
{
|
||||
$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();
|
||||
$results = $policyGridModel->find($grid_id);
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
|
||||
public function getPolicySlabRatesForEmpOnboard($policy_id,$client_id)
|
||||
|
||||
{
|
||||
|
||||
$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);
|
||||
if(is_array($premium_slab_data) && !count($premium_slab_data))
|
||||
{
|
||||
// echo '2';
|
||||
$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();
|
||||
$results = $policyGridModel->find($grid_id);
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $results];
|
||||
}
|
||||
}
|
||||
|
||||
47
app/Views/batch_list.php
Normal file
47
app/Views/batch_list.php
Normal file
@ -0,0 +1,47 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Batch List</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">Batch Code</th>
|
||||
<th class="font-weight-medium">Client</th>
|
||||
<th class="font-weight-medium">Client Policy</th>
|
||||
<th class="font-weight-medium">Event Type</th>
|
||||
<th class="font-weight-medium">Insurer/TPA</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
<th class="font-weight-medium">Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($batch_list))
|
||||
{
|
||||
foreach ($batch_list as $key => $file) {
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $file['batch_code']?></td>
|
||||
<td><?php echo $file['client_short_name']?></td>
|
||||
<td><?php echo $file['policy_name']?></td>
|
||||
<td><?php echo $file['event_type']?></td>
|
||||
<td><?php echo $file['insurer_or_tpa']?></td>
|
||||
<td><?php echo $file['actions']?></td>
|
||||
<td><?php echo $file['count']?></td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
@ -1,3 +1,65 @@
|
||||
<style>
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 54px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ccc;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
left: 4px;
|
||||
bottom: 4px;
|
||||
background-color: white;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: #2196F3;
|
||||
}
|
||||
|
||||
input:focus + .slider {
|
||||
box-shadow: 0 0 1px #2196F3;
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
}
|
||||
|
||||
.slider.round:before {
|
||||
border-radius: 50%;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="tab-pane fade active show" id="general-q-tab">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@ -43,13 +105,11 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="pan">PAN<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="pan"
|
||||
placeholder="Enter PAN Number" value="<?= isset($client['pan']) ? $client['pan'] : '' ?>" name="pan" data-parsley-trigger="change" data-parsley-pattern="^[A-Z]{5}[0-9]{4}[A-Z]$" required>
|
||||
<input type="text" class="form-control" id="pan" placeholder="Enter PAN Number" data-parsley-error-message="Invalid PAN Number. Example: ABCDE1234F" value="<?= isset($client['pan']) ? $client['pan'] : '' ?>" name="pan" data-parsley-trigger="change" data-parsley-pattern="^[A-Z]{5}[0-9]{4}[A-Z]$" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="gst">GST<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="gst"
|
||||
placeholder="Enter GST Number" value="<?= isset($client['gst']) ? $client['gst'] : '' ?>" name="gst" data-parsley-trigger="change" data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
|
||||
<input type="text" class="form-control" id="gst" placeholder="Enter GST Number" data-parsley-error-message="Invalid GST Number. Example: 12ABCDE1234F5Z6" value="<?= isset($client['gst']) ? $client['gst'] : '' ?>" name="gst" data-parsley-trigger="change" data-parsley-pattern="^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}[Z]{1}[A-Z\d]{1}$" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -103,6 +163,26 @@
|
||||
</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" accept="image/*" onchange="PreviewImage();"><br>
|
||||
<i class="text">( Image dimensions 100 x 100 pixels and size of 200KB. )</i>
|
||||
</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'] : base_url()."public/assets/images/avatar_2x.png" ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="switch">
|
||||
<input id="is_download_btn" type="checkbox" name="is_download_btn" <?= (isset($client['is_download_btn']) && $client['is_download_btn'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="is_download_btn" style=" position: relative;bottom: 5px;">Enable Client Export Option</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||
@ -117,134 +197,236 @@
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const switchCheckbox = document.getElementById('switch-checkbox');
|
||||
const switchInner = document.querySelector('.switch-inner');
|
||||
|
||||
var PrimaryKey = $('#general_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
|
||||
$(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 ;
|
||||
}
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("client/general/create"); ?>';
|
||||
}else{
|
||||
form_action = '<?= base_url("client/general/edit"); ?>';
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var formData = new FormData($('#general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
if(res){
|
||||
setTimeout(function() {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$('#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);
|
||||
}
|
||||
|
||||
$('#client_id').val(res.data.id);
|
||||
$('#client_id_relation').val(res.data.id);
|
||||
$('#relation_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_branch').val(res.data.id);
|
||||
$('#branch_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_policy').val(res.data.id);
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#client_id_kyc').val(res.data.id);
|
||||
$('#kyc_PrimaryKey').val(res.data.id);
|
||||
$('#entity_type').val(res.data.entity_type_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="<?= 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
switchInner.addEventListener('click', function() {
|
||||
switchCheckbox.checked = !switchCheckbox.checked;
|
||||
switchInner.style.transform = switchCheckbox.checked ? 'translateX(100%)' : 'translateX(0)';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
});
|
||||
|
||||
function onlyNumbers(event){
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
<script>
|
||||
|
||||
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 ;
|
||||
}
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("client/general/create"); ?>';
|
||||
}else{
|
||||
form_action = '<?= base_url("client/general/edit"); ?>';
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var formData = new FormData($('#general_form')[0]);
|
||||
var OptionsHTML1 = ''
|
||||
|
||||
$.ajax({
|
||||
data:formData,
|
||||
url: form_action,
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
|
||||
if(res){
|
||||
setTimeout(function() {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$('#kyc_tab').click();
|
||||
|
||||
$('#btnBranchAdd').show();
|
||||
$('#BtnAdd').show();
|
||||
$('#relation_form').show();
|
||||
$('#btnBranchAdd').show();
|
||||
|
||||
var message = (PrimaryKey === '') ? 'Client General Info Created successfully' : 'Client General Info Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
$submitButton.prop('disabled', false);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
var idToUse = res.data.id ? res.data.id : res.data.PrimaryKey;
|
||||
|
||||
$('#client_id').val(idToUse);
|
||||
$('#general_PrimaryKey').val(idToUse);
|
||||
$('#client_id_relation').val(idToUse);
|
||||
$('#relation_PrimaryKey').val(idToUse);
|
||||
$('#client_id_branch').val(idToUse);
|
||||
$('#client_id_for_client_branch').val(idToUse);
|
||||
$('#client_id_policy').val(idToUse);
|
||||
$('#policy_PrimaryKey').val(idToUse);
|
||||
$('#client_id_kyc').val(idToUse);
|
||||
$('#kyc_PrimaryKey').val(idToUse);
|
||||
$('#Client_id').val(idToUse);
|
||||
|
||||
$('#entity_type').val(res.data.entity_type_id);
|
||||
|
||||
|
||||
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" id="id_for_kyc_file" 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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function onlyNumbers(event){
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function PreviewImage() {
|
||||
console.log('function called');
|
||||
var fileInput = document.getElementById("client_logo");
|
||||
var file = fileInput.files[0];
|
||||
|
||||
if (file) {
|
||||
var allowedExtensions = ["jpg", "jpeg", "png"];
|
||||
var fileExtension = file.name.split('.').pop().toLowerCase();
|
||||
|
||||
if (!allowedExtensions.includes(fileExtension) || file.size > 200 * 1024) {
|
||||
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
|
||||
fileInput.value = ""; // Clear the file input
|
||||
document.getElementById("uploadPreview").src = "http://ssl.gstatic.com/accounts/ui/avatar_2x.png"; // Remove the preview image
|
||||
} else {
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
reader.onload = function (event) {
|
||||
document.getElementById("uploadPreview").src = event.target.result;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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.');
|
||||
$("#uploadPreview").attr("src", "http://ssl.gstatic.com/accounts/ui/avatar_2x.png");
|
||||
input.value = "";
|
||||
}
|
||||
|
||||
|
||||
// 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 = "";
|
||||
}
|
||||
|
||||
// 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");
|
||||
}
|
||||
// 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>
|
||||
@ -1,5 +1,5 @@
|
||||
<div class="tab-pane fade" id="branch-tab">
|
||||
|
||||
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
|
||||
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
|
||||
</div>
|
||||
@ -23,7 +23,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -31,8 +31,8 @@
|
||||
<form role="form" class="parsley-examples" method="post" id="branch_form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="branch_PrimaryKey" />
|
||||
<input type="hidden" name="client_id" id="client_id_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
@ -65,7 +65,8 @@
|
||||
placeholder="Enter District" name="district" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="city">City</label>
|
||||
<label for="city">City<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_city"
|
||||
placeholder="Enter City" name="city" required>
|
||||
</div>
|
||||
@ -88,7 +89,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 +98,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>
|
||||
@ -116,17 +117,16 @@
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var branch_form_action = '';
|
||||
var contactCount = 1;
|
||||
var branch_PrimaryKey = $('#client_id_branch').val();
|
||||
var branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
@ -140,7 +140,11 @@ $(document).ready(function () {
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
<td>
|
||||
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeClientBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
@ -168,6 +172,11 @@ $(document).ready(function () {
|
||||
$('.ac').css('display', 'block');
|
||||
contactCount = 1
|
||||
|
||||
var addButton = document.getElementById('add');
|
||||
if (addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
@ -200,6 +209,9 @@ $(document).ready(function () {
|
||||
$('#branch_city').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('.ac').css('display', 'block');
|
||||
$('.parsley-errors-list').remove();
|
||||
$('#branch_form').parsley().reset();
|
||||
contactCount = 1
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
@ -220,12 +232,13 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
$("#branch_form").submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
event.preventDefault();
|
||||
branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||
|
||||
console.log('branch_PrimaryKey', branch_PrimaryKey)
|
||||
|
||||
if (branch_PrimaryKey === '' || branch_PrimaryKey_2 === '') {
|
||||
if (branch_PrimaryKey === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
@ -269,15 +282,17 @@ $(document).ready(function () {
|
||||
var branchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
branchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td>
|
||||
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeClientBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#branch_list').append(branchTableInsert);
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -290,18 +305,35 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
contactCount = 1
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
|
||||
console.log(branch_form_action);
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
var firstElement = buttonIds[i].split('_')[0];
|
||||
console.log(firstElement);
|
||||
|
||||
// Find the element by its ID
|
||||
var elementToRemove = document.getElementById(firstElement);
|
||||
console.log(elementToRemove);
|
||||
|
||||
if (elementToRemove) {
|
||||
console.log(elementToRemove);
|
||||
elementToRemove.parentNode.removeChild(elementToRemove);
|
||||
}
|
||||
localStorage.removeItem('buttonIds')
|
||||
}
|
||||
|
||||
contactCount = 1
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var branch_id = $(this).attr('data-id');
|
||||
$('#branch_id_primarykey').val(branch_id);
|
||||
|
||||
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('client/branch/list/');?>'+branch_id,
|
||||
@ -312,8 +344,10 @@ $(document).ready(function () {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res)
|
||||
}, 500);
|
||||
|
||||
// console.log('branch contact : ',res.contact)
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
@ -331,11 +365,14 @@ $(document).ready(function () {
|
||||
$('#designation').val(res.contact[0].designation);
|
||||
|
||||
res.contact.shift();
|
||||
$.each(res.contact, function(index, contact) {
|
||||
// console.log(res.contact.length)
|
||||
for (let index = 0; index < res.contact.length; index++) {
|
||||
const contact = res.contact[index];
|
||||
if (contact !== undefined) {
|
||||
appendContactHtml(contact);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
@ -352,6 +389,13 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
|
||||
$("#remove_btn").click(function(){
|
||||
$("#name").val('');
|
||||
$("#email").val('');
|
||||
$("#mobile").val('');
|
||||
$("#designation").val('');
|
||||
})
|
||||
|
||||
// Initialize the contact count
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
@ -379,7 +423,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>
|
||||
@ -483,4 +527,42 @@ $(document).ready(function () {
|
||||
return false;
|
||||
}
|
||||
|
||||
function removeClientBranch(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("client/branch/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -2,16 +2,20 @@
|
||||
<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;">Client Deposit-</h4>
|
||||
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<a href="<?= base_url("client/client_deposit"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
|
||||
<h4 class="header-title" style="position: relative;">Client Deposit -
|
||||
<?php echo $clientName[0]['client_name'];?></h4>
|
||||
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("client/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<a href="<?= base_url("client/client_deposit"); ?>" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
|
||||
</div> -->
|
||||
</div>
|
||||
<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">
|
||||
@ -21,44 +25,41 @@
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<?php foreach ($clientData as $value): ?>
|
||||
<td>
|
||||
|
||||
|
||||
<?php echo $value->insurer_name;?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>₹
|
||||
<?php
|
||||
$insurerId = $value->insurer_id;
|
||||
|
||||
// Check if the balance information exists for the insurer
|
||||
if (isset($balances[$insurerId])) {
|
||||
$balance = $balances[$insurerId]->balance;
|
||||
echo $balance;
|
||||
} else {
|
||||
echo "N/A"; // Display "Not Available" if balance information is not present
|
||||
}
|
||||
?>
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<?php foreach ($clientData as $value): ?>
|
||||
<td>
|
||||
<?php echo $value->insurer_name;?>
|
||||
</td>
|
||||
|
||||
<td>₹
|
||||
<?php
|
||||
$insurerId = $value->insurer_id;
|
||||
// Check if the balance information exists for the insurer
|
||||
if (isset($balances[$insurerId])) {
|
||||
$balance = $balances[$insurerId]->balance;
|
||||
echo $balance;
|
||||
} else {
|
||||
echo "N/A"; // Display "Not Available" if balance information is not present
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<a class="dropdown-item" href="<?= base_url("client/view_deposit/{$value->insurer_id}?client_id={$value->client_id}"); ?>">
|
||||
<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View Deposit
|
||||
</a>
|
||||
</td>
|
||||
<a class="dropdown-item"
|
||||
href="<?= base_url("client/view_deposit/{$value->insurer_id}?client_id={$value->client_id}"); ?>">
|
||||
<i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View Deposit
|
||||
</a>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@ -67,22 +68,19 @@
|
||||
<!-- end row -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'ClientList',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}
|
||||
],
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Client_Deposit',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
|
||||
|
||||
language: {
|
||||
@ -92,6 +90,5 @@
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
</script>
|
||||
@ -53,7 +53,8 @@
|
||||
class="text-danger">*</span></label>
|
||||
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4 align-self-end">
|
||||
<!-- <div class="form-group col-md-4 align-self-end"> -->
|
||||
<div class="form-group col-md-4" style="margin-top: 42px;">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"id="btnSubmit">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -105,9 +106,7 @@
|
||||
$(document).on('click', '.submit', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
// kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
kycPrimaryKey = $('#client_id_kyc').val();
|
||||
|
||||
kycPrimaryKey = $('#id_for_kyc_file').val();
|
||||
|
||||
var form = $(this).closest('form');
|
||||
var formData = new FormData(form[0]);
|
||||
@ -130,7 +129,7 @@
|
||||
var fileExtension = fileName.split('.').pop().toLowerCase();
|
||||
if (allowedExtensions.indexOf(fileExtension) === -1) {
|
||||
form.trigger('reset')
|
||||
toastr.warning('File type not allowed: ' + fileName, 'Warning');
|
||||
toastr.warning('File type not allowed: ' + fileName, 'Only Allowed pdf, png, jpg and jpeg');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -166,7 +165,7 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.success('File Uloaded successfully', 'Success');
|
||||
toastr.success('File Uploaded successfully', 'Success');
|
||||
}, 500);
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,14 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@ -39,7 +50,7 @@
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url("client/list/"); ?><?= $row->id;?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>Deposit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -55,32 +66,74 @@
|
||||
</div>
|
||||
<!-- end row -->
|
||||
|
||||
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> -->
|
||||
<!-- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> -->
|
||||
<!-- Include DataTables JS -->
|
||||
<!-- <script src="https://cdn.datatables.net/1.11.6/js/jquery.dataTables.min.js"></script> -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'ClientList',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'ClientList',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
|
||||
});
|
||||
}],
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true ,
|
||||
// pagingType: 'full_numbers'
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
function removeClient(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("client/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -39,7 +39,7 @@ body {
|
||||
<h4 class="header-title" style="position: relative;">Client Onboarding <?php if(isset($client)) {echo ' - ' . $client['client_name']; } ?></h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<!-- <a href="<?= base_url("client/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a> -->
|
||||
<a href="<?= base_url("client/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -121,3 +121,88 @@ body {
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function client_kyc_docs() {
|
||||
var check_client_id = $('#general_PrimaryKey');
|
||||
|
||||
|
||||
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
||||
$('#btnBranchAdd').hide();
|
||||
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnBranchBack')[0].style.display == 'none') {
|
||||
$('#btnBranchAdd').show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function client_relationship_manager() {
|
||||
var check_client_id = $('#general_PrimaryKey');
|
||||
|
||||
|
||||
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
||||
$('#relation_form').hide();
|
||||
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
$('#relation_form').show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function client_policies() {
|
||||
var check_client_id = $('#general_PrimaryKey');
|
||||
|
||||
|
||||
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
||||
$('#BtnAdd').hide();
|
||||
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnPolicyBack')[0].style.display == 'none') {
|
||||
$('#BtnAdd').show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function client_branch_contact() {
|
||||
var check_client_id = $('#general_PrimaryKey');
|
||||
|
||||
|
||||
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
||||
$('#btnBranchAdd').hide();
|
||||
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnBranchBack')[0].style.display == 'none') {
|
||||
$('#btnBranchAdd').show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.getElementById("kyc_tab").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
client_kyc_docs();
|
||||
});
|
||||
|
||||
|
||||
document.getElementById("RM_tab").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
client_relationship_manager();
|
||||
});
|
||||
|
||||
|
||||
document.getElementById("policy_tab").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
client_policies();
|
||||
});
|
||||
|
||||
|
||||
document.getElementById("branch_tab").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
client_branch_contact();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="table_list" >
|
||||
<div class="table-responsive" id="table_list">
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<table class="table table-borderless table-nowrap mb-0" id="table-client-policy">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Insurer</th>
|
||||
@ -28,7 +28,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
<button type="button" id="btnPolicyBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -85,13 +85,21 @@
|
||||
<label for="policy_status">Policy Status</label>
|
||||
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
||||
</div>
|
||||
<div >
|
||||
<label class="switch">
|
||||
<input id="is_addon" type="checkbox" name="is_addon" <?= (isset($client['is_addon']) && $client['is_addon'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="is_addon" style=" position: relative;bottom: 5px;">Is AddOn Policy</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>
|
||||
@ -155,6 +163,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"); ?>');
|
||||
|
||||
})
|
||||
@ -180,12 +194,15 @@
|
||||
if (policy_PrimaryKey !== '') {
|
||||
var policyTable = '';
|
||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||
|
||||
data.forEach(function(item) {
|
||||
// console.log("----------------------------");
|
||||
|
||||
// console.log(item);
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
@ -208,6 +225,12 @@
|
||||
}
|
||||
|
||||
|
||||
$('#table-client-policy').DataTable({
|
||||
paging: true ,
|
||||
searching: false
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
/******** for form submit using AJAX *******/
|
||||
@ -246,6 +269,8 @@
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
@ -281,10 +306,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>
|
||||
@ -292,6 +317,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);
|
||||
@ -365,6 +397,8 @@
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
console.log(res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -392,6 +426,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){
|
||||
@ -738,6 +778,10 @@
|
||||
}
|
||||
convertCommaNumberToWords(input);
|
||||
|
||||
if (input.id == 'gpa_sum_si') {
|
||||
gpaSumInsureMultiplier(input);
|
||||
}
|
||||
|
||||
// if(input.id == 'basic_pay'){
|
||||
// var inputNumber = input.value;
|
||||
// if (inputNumber) {
|
||||
@ -785,4 +829,9 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
function removeClientPolicy(element) {
|
||||
console.log(element);
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -82,6 +82,7 @@ $(document).ready(function(){
|
||||
|
||||
var data = <?= isset($client_relation) ? json_encode($client_relation) : '[]' ?>;
|
||||
if (relation_PrimaryKey !== '') {
|
||||
console.log('test case k212')
|
||||
$('#client_rm_edit').show()
|
||||
$('#client_rm_btnSubmit').hide();
|
||||
$.each(data, function(index, item) {
|
||||
@ -91,14 +92,13 @@ $(document).ready(function(){
|
||||
if ($option.length > 0) {
|
||||
$option.prop('selected', true);
|
||||
}
|
||||
$('#account_manager').multiselect('refresh');
|
||||
$('#head').prop('disabled', true);
|
||||
$('#manager').prop('disabled', true);
|
||||
$('#account_manager').multiselect('disable');
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('#account_manager').multiselect('refresh');
|
||||
$('#head').prop('disabled', true);
|
||||
$('#manager').prop('disabled', true);
|
||||
$('#account_manager').multiselect('disable');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,53 +1,62 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Client</label> <br/>
|
||||
<select class="form-control" id="clients">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Policy</label> <br/>
|
||||
<select class="form-control" id="policies">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("employee/list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Client</label> <br />
|
||||
<select class="form-control" id="clients">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Policy</label> <br />
|
||||
<select class="form-control" id="policies">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</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">
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("employee/list"); ?>"
|
||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row" id="client_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@ -56,22 +65,23 @@
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Employees</h4>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">Employee code</th>
|
||||
<th class="font-weight-medium">Name</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurar name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID ID</th>
|
||||
<th class="font-weight-medium">Policy status</th>
|
||||
<th class="font-weight-medium">Premium</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<!-- <th class="font-weight-medium">Employee code</th> -->
|
||||
<th class="font-weight-medium">Name/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurer name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID ID</th>
|
||||
<th class="font-weight-medium">Policy status</th>
|
||||
<th class="font-weight-medium">Premium</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
@ -79,11 +89,11 @@
|
||||
if(isset($employees))
|
||||
{
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $employee['emp_code']?></td>
|
||||
<td><?php echo $employee['name']?></td>
|
||||
<!-- <td><?php echo $employee['emp_code']?></td> -->
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
||||
<td><?php echo $employee['policy_name']?></td>
|
||||
<td><?php echo $employee['insurer_short_name']?></td>
|
||||
<td><?php echo $employee['tpa_id']?></td>
|
||||
@ -92,18 +102,26 @@
|
||||
<td><?php echo $employee['premium']?></td>
|
||||
<td>
|
||||
<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>
|
||||
<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 class="dropdown-item" href="#"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit Ticket</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as Unread</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
Ticket</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
|
||||
Unread</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -114,98 +132,97 @@
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
|
||||
<script>
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$( document ).ready(function() {
|
||||
console.log( "document loaded" );
|
||||
//fetchClientPolicies();
|
||||
|
||||
});
|
||||
|
||||
$( window ).on( "load", function() {
|
||||
console.log( "window loaded" );
|
||||
fetchClientPolicies();
|
||||
|
||||
});
|
||||
$(document).ready(function() {
|
||||
console.log("document 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 appendClients(data) {
|
||||
function appendClients(data) {
|
||||
$.each(data, function(index, item) {
|
||||
$('#clients').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
$('#clients').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function appendPolicies(data) {
|
||||
function appendPolicies(data) {
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', { value: '0',text: 'Select'}));
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#policies').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
$('#policies').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('#clients').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) {
|
||||
@ -214,25 +231,25 @@ function objectToQueryString(obj) {
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').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);
|
||||
@ -251,5 +268,9 @@ function fetchEmpolyeeList(event) {
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
</script>
|
||||
@ -7,36 +7,46 @@
|
||||
|
||||
|
||||
<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="row">
|
||||
<div class="col-xl-6">
|
||||
<div id="accordion1" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
|
||||
aria-expanded="true">
|
||||
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
|
||||
<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-row">
|
||||
<div class="form-group">
|
||||
|
||||
<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-row">
|
||||
|
||||
<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>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>Event</label> <br />
|
||||
<select name="upload-action-type" class="form-control" id="upload-action-type" required>
|
||||
<option value="">Select</option>
|
||||
<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))
|
||||
{
|
||||
@ -46,35 +56,43 @@
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</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>
|
||||
</select>
|
||||
</div>
|
||||
</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>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -107,15 +125,13 @@
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$('#file_upload').hide();
|
||||
|
||||
$('#file_upload').hide();
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
console.log("document loaded");
|
||||
//fetchClientPolicies();
|
||||
//for modal pop up
|
||||
@ -163,7 +179,7 @@ $(document).ready(function() {
|
||||
$('#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"),
|
||||
@ -181,7 +197,8 @@ $(document).ready(function() {
|
||||
console.log(response);
|
||||
if (response.code === 200 && response.dataStatus === true && response
|
||||
.data !== "") {
|
||||
toastr.success('File upload successs, Data validation is in-progress',
|
||||
toastr.success(
|
||||
'File upload successs, Data validation is in-progress',
|
||||
'success');
|
||||
window.location.reload(true);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
@ -264,29 +281,70 @@ function fetchFileError(file_id) {
|
||||
console.log('fetchFileError');
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"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 !== "") {
|
||||
try {
|
||||
console.log((JSON.parse(response.data)));
|
||||
var file_error_data = (JSON.parse(response.data));
|
||||
var file_error_html = "";
|
||||
|
||||
for (var key in file_error_data['error_summary']) {
|
||||
console.log(key);
|
||||
var err_id = key;
|
||||
var err_count = file_error_data['error_summary'][key];
|
||||
// for (var ckey in col)
|
||||
// {
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
$(this).find(".modal-body").html("");
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "")
|
||||
{
|
||||
try {
|
||||
console.log((JSON.parse(response.data)));
|
||||
var file_error_data = (JSON.parse(response.data));
|
||||
var file_error_html = "";
|
||||
|
||||
for (var key in file_error_data['error_summary']) {
|
||||
console.log(key);
|
||||
var err_id = key;
|
||||
var err_count = file_error_data['error_summary'][key];
|
||||
switch (err_id) {
|
||||
case 1:
|
||||
file_error_html += "<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 2:
|
||||
file_error_html += "<strong>Values not in expected format</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 3:
|
||||
file_error_html += "<strong>Field contains not allowed values</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 4:
|
||||
file_error_html += "<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 5:
|
||||
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
|
||||
break;
|
||||
case 6:
|
||||
file_error_html += "<strong>" + file_error_data['error_data'] + "</strong>";
|
||||
break;
|
||||
case 7:
|
||||
file_error_html += "<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 8:
|
||||
file_error_html += "to be config";
|
||||
break;
|
||||
case 9:
|
||||
file_error_html += "<strong>Duplicate entry</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 10:
|
||||
file_error_html += "<strong>Duplicate entry in file</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 11:
|
||||
file_error_html += "<strong>Rule conflict: Dependents not allowed</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 12:
|
||||
file_error_html += "<strong>Rule conflict: Dependent count greater than allowed dependent count</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
case 13:
|
||||
file_error_html += "<strong>Rule conflict: Twofold relationship found within family</strong> <span class='badge badge-danger float-right'>" + err_count + "</span>";
|
||||
break;
|
||||
|
||||
default:
|
||||
file_error_html += "";
|
||||
break;
|
||||
}
|
||||
file_error_html += (err_id == 1 ?
|
||||
"<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" +
|
||||
err_count + "</span>" : (err_id == 2 ?
|
||||
@ -296,7 +354,8 @@ function fetchFileError(file_id) {
|
||||
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 ?
|
||||
file_error_data['error_data'] + "</strong>" : (err_id ==
|
||||
6 ?
|
||||
"<strong>" + file_error_data['error_data'] +
|
||||
"</strong>" : ""))))));
|
||||
file_error_html += '<br/>';
|
||||
@ -304,10 +363,12 @@ function fetchFileError(file_id) {
|
||||
|
||||
}
|
||||
if (err_id != 5 && err_id != 6) {
|
||||
file_error_html += (file_error_html != "" ? "<a href ='<?php echo base_url()?>" +
|
||||
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;
|
||||
@ -413,34 +474,39 @@ function fetchEmpolyeeList(event) {
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
||||
$('#upload-action-type').change(function() {
|
||||
/**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');
|
||||
}
|
||||
});
|
||||
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. **/
|
||||
/** This function verifies if the download link (#excel_download) has its href attribute set,
|
||||
** ensuring proper link configuration. **/
|
||||
|
||||
$('#excel_download').click(function() {
|
||||
$('#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.');
|
||||
}
|
||||
});
|
||||
// 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.');
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('toggleIcon1').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon1');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
</script>
|
||||
259
app/Views/endorsement_list.php
Normal file
259
app/Views/endorsement_list.php
Normal file
@ -0,0 +1,259 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Client</label> <br />
|
||||
<select class="form-control" id="clients">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-xl-3">
|
||||
<div class="form-group mb-3">
|
||||
<label>Policy</label> <br />
|
||||
<select class="form-control" id="policies">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("employee/endorsement-list"); ?>"
|
||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="row" id="client_list">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row" style="padding-bottom: 10px;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Endorsement List</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">Name/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurar name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID ID</th>
|
||||
<th class="font-weight-medium">Policy status</th>
|
||||
<th class="font-weight-medium">Premium</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($employees))
|
||||
{
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<!-- <td><?php echo $employee['emp_code']?></td> -->
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
||||
<td><?php echo $employee['policy_name']?></td>
|
||||
<td><?php echo $employee['insurer_short_name']?></td>
|
||||
<td><?php echo $employee['tpa_id']?></td>
|
||||
<td><?php echo $employee['uhid']?></td>
|
||||
<td><span class="badge badge-success">active</span></td>
|
||||
<td><?php echo $employee['premium']?></td>
|
||||
<td>
|
||||
<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 class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||
Ticket</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
||||
<a class="dropdown-item" href="#"><i
|
||||
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
|
||||
Unread</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
<!-- end row -->
|
||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
||||
|
||||
<script>
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
console.log("document loaded");
|
||||
//fetchClientPolicies();
|
||||
|
||||
});
|
||||
|
||||
$(window).on("load", function() {
|
||||
console.log("window loaded");
|
||||
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);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function appendClients(data) {
|
||||
$.each(data, function(index, item) {
|
||||
$('#clients').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicies(data) {
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#policies').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
$('#clients').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);
|
||||
appendPolicies(foundPolicies.policies);
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function fetchEmpolyeeList(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').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 = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
}
|
||||
|
||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
</script>
|
||||
@ -1,4 +1,14 @@
|
||||
<style>
|
||||
|
||||
.table th, .table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_add" style="position: relative; bottom: 25px;">
|
||||
<div class="col-12">
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="insurer_name">Insurer Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name"
|
||||
<input type="text" class="form-control" id="insurer_name"
|
||||
placeholder="Enter Insurer Name" value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
@ -97,9 +97,11 @@ $(document).ready(function () {
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
$('#insurer_id').val(res.data.id);
|
||||
$('#insurer_General_PrimaryKey').val(res.data.id);
|
||||
$('#insurer_id_branch').val(res.data.id);
|
||||
$('#insurer_branch_contacts_id').click();
|
||||
|
||||
$('#btnBranchAdd').show();
|
||||
var message = "Insurer General Info";
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -67,7 +67,8 @@
|
||||
placeholder="Enter District" name="district" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="city">City</label>
|
||||
<label for="city">City<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="branch_city"
|
||||
placeholder="Enter City" name="city" required>
|
||||
</div>
|
||||
@ -122,23 +123,44 @@
|
||||
|
||||
<script>
|
||||
|
||||
var contactCount = 1;
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
var insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
|
||||
var contactCount = 1;
|
||||
var insurer_branch_form_action = '';
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
loadBranchList();
|
||||
|
||||
var insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
if(insurer_Branch_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($insuer_branch) ? json_encode($insuer_branch) : '[]' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td>
|
||||
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeInsurerBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#insurer_branch_list').append(branchTable);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#btnBranchAdd').click(function(){
|
||||
|
||||
|
||||
$("#insurer_branch_form")[0].reset();
|
||||
contactCount = 1
|
||||
insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>';
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
@ -149,15 +171,17 @@ $(document).ready(function () {
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
|
||||
$('#name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#designation').val('');
|
||||
|
||||
|
||||
contactCount = 1
|
||||
|
||||
|
||||
var addButton = document.getElementById('add');
|
||||
if (addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
@ -178,6 +202,8 @@ $(document).ready(function () {
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
|
||||
$("#insurer_branch_form")[0].reset();
|
||||
contactCount = 1
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
@ -188,34 +214,17 @@ $(document).ready(function () {
|
||||
$('#state').val('');
|
||||
$('#district').val('');
|
||||
$('#branch_city').val('');
|
||||
|
||||
|
||||
$('#name').val('');
|
||||
$('#email').val('');
|
||||
$('#mobile').val('');
|
||||
$('#designation').val('');
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
if(insurer_Branch_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($insurer_branch) ? json_encode($insurer_branch) : '[]' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#insurer_branch_list').append(branchTable);
|
||||
}
|
||||
|
||||
|
||||
$("#insurer_branch_form").submit(function(events) {
|
||||
console.log(1, insurer_branch_form_action);
|
||||
events.preventDefault();
|
||||
var isValid = $('#insurer_branch_form').parsley().validate();
|
||||
if (isValid) {
|
||||
@ -232,20 +241,23 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
$("#insurer_branch_form")[0].reset();
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
// $('#insurer_branch_list tr').remove();
|
||||
$('#insurer_branch_list tr').remove();
|
||||
var insurerBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
insurerBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
|
||||
<td>
|
||||
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeInsurerBranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
@ -270,17 +282,22 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
$('#container').html("");
|
||||
contactCount =1;
|
||||
contactCount = 1;
|
||||
var branch_id = $(this).attr('data-id');
|
||||
$('#insurer_Branch_PrimaryKey').val(branch_id);
|
||||
|
||||
insurer_branch_form_action = '<?= base_url("master/insurer/branch/edit"); ?>';
|
||||
|
||||
console.log(insurer_branch_form_action)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/insurer/branch/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
@ -300,7 +317,6 @@ $(document).ready(function () {
|
||||
$('#state option[value="' + res.insurerbranch.state + '"]').prop('selected', true);
|
||||
$('#district').val(res.insurerbranch.district);
|
||||
$('#branch_city').val(res.insurerbranch.city);
|
||||
$('#insurer_Branch_PrimaryKey').val(res.insurerbranch.id);
|
||||
|
||||
$('#contact_id_1').val(res.levelcontact[0].id);
|
||||
$('.form-row').find('#name').val(res.levelcontact[0].name);
|
||||
@ -330,185 +346,165 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '#btnSubmit', function(){
|
||||
|
||||
$('#insurer_branch_list').html(" ");
|
||||
loadBranchList();
|
||||
})
|
||||
|
||||
function loadBranchList()
|
||||
{
|
||||
var base_url = '<?= base_url("master/insurer/branch/list/"); ?>';
|
||||
|
||||
var insurer_branch_action = base_url + insurer_Branch_PrimaryKey;
|
||||
if ($('#insurer_id_branch').val() != '') {
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
$('.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 += `
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#insurer_branch_list').html(branchTable);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
console.log('appendContactHtml function called ')
|
||||
contactCount++;
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
var container = document.getElementById('container');
|
||||
var uniqueId = Date.now().toString();
|
||||
|
||||
var html = `
|
||||
<div id="${uniqueId}">
|
||||
<hr>
|
||||
<h6 class="header-title">Contact ${contactCount}</h6>
|
||||
<br>
|
||||
<div class="form-row">
|
||||
<input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
|
||||
</div>
|
||||
</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="${uniqueId}_add">Add Contact</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
if(reset == false){
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
storeButtonId(uniqueId + '_add');
|
||||
|
||||
if (contactCount >= 3) {
|
||||
hideStoredAddButtons();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function removeContact(button) {
|
||||
var uniqueId = button.id.split("_")[0];
|
||||
var contactSection = document.getElementById(uniqueId);
|
||||
|
||||
if (contactSection) {
|
||||
contactSection.parentNode.removeChild(contactSection);
|
||||
contactCount --;
|
||||
|
||||
if (contactCount < 3) {
|
||||
var addButton = document.querySelector('.ac');
|
||||
if (addButton) {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
console.log('appendContactHtml function called ')
|
||||
contactCount++;
|
||||
|
||||
var container = document.getElementById('container');
|
||||
var uniqueId = Date.now().toString();
|
||||
|
||||
var html = `
|
||||
<div id="${uniqueId}">
|
||||
<hr>
|
||||
<h6 class="header-title">Contact ${contactCount}</h6>
|
||||
<br>
|
||||
<div class="form-row">
|
||||
<input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
|
||||
</div>
|
||||
</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="${uniqueId}_add">Add Contact</button>
|
||||
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
if(reset == false){
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
storeButtonId(uniqueId + '_add');
|
||||
|
||||
if (contactCount >= 3) {
|
||||
hideStoredAddButtons();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function removeContact(button) {
|
||||
var uniqueId = button.id.split("_")[0];
|
||||
var contactSection = document.getElementById(uniqueId);
|
||||
|
||||
if (contactSection) {
|
||||
contactSection.parentNode.removeChild(contactSection);
|
||||
contactCount --;
|
||||
|
||||
if (contactCount < 3) {
|
||||
var addButton = document.querySelector('.ac');
|
||||
if (addButton) {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function storeButtonId(id) {
|
||||
function storeButtonId(id) {
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
buttonIds.push(id);
|
||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||
}
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
buttonIds.push(id);
|
||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||
}
|
||||
|
||||
|
||||
function hideStoredAddButtons() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
storedIds.forEach(function(id) {
|
||||
var addButton = document.getElementById(id);
|
||||
var first_addButton = document.querySelector('.ac')
|
||||
if (addButton) {
|
||||
addButton.style.display = 'none';
|
||||
first_addButton.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showNextAddButton() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
var addButtonShown = false;
|
||||
|
||||
// Iterate through the stored IDs to find the next "Add" button to show
|
||||
storedIds.forEach(function(id) {
|
||||
if (!addButtonShown) {
|
||||
function hideStoredAddButtons() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
storedIds.forEach(function(id) {
|
||||
var addButton = document.getElementById(id);
|
||||
if (addButton && addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
addButtonShown = true; // Set to true once an "Add" button is shown
|
||||
var first_addButton = document.querySelector('.ac')
|
||||
if (addButton) {
|
||||
addButton.style.display = 'none';
|
||||
first_addButton.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
$('#insurer_branch_form input, #insurer_branch_form select').each(function() {
|
||||
function showNextAddButton() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
var addButtonShown = false;
|
||||
|
||||
if ($(this).is('input[name="emial[]"]') || $(this).is('input[type="text"]') || $(this).is('select') ) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
isValid = false;
|
||||
return false;
|
||||
// Iterate through the stored IDs to find the next "Add" button to show
|
||||
storedIds.forEach(function(id) {
|
||||
if (!addButtonShown) {
|
||||
var addButton = document.getElementById(id);
|
||||
if (addButton && addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
addButtonShown = true; // Set to true once an "Add" button is shown
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
$('#insurer_branch_form input, #insurer_branch_form select').each(function() {
|
||||
|
||||
if ($(this).is('input[name="emial[]"]') || $(this).is('input[type="text"]') || $(this).is('select') ) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
||||
function removeInsurerBranch(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/insurer/branch/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
@ -30,7 +30,7 @@
|
||||
<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 class="dropdown-item" href="<?= base_url("master/insurer/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeInsurer(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -50,7 +50,9 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
@ -67,7 +69,7 @@
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
paging: true ,
|
||||
});
|
||||
|
||||
})
|
||||
@ -131,4 +133,41 @@ class csvExport {
|
||||
}
|
||||
|
||||
|
||||
function removeInsurer(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/insurer/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -38,9 +38,12 @@ body {
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Insurer</h4>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/insurer/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div> -->
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/insurer/list"); ?>" >
|
||||
<i class="fas fa-arrow-left" style="font-size: 17px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
@ -67,3 +70,26 @@ body {
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function insurer_branch_contact() {
|
||||
var check_insurer_id = $('#insurer_General_PrimaryKey');
|
||||
|
||||
if(check_insurer_id[0].value == '' || check_insurer_id[0].value == null || check_insurer_id[0].value == 0){
|
||||
$('#btnBranchAdd').hide();
|
||||
toastr.warning('First Add the Insurer!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnBranchBack')[0].style.display == 'none') {
|
||||
$('#btnBranchAdd').show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("insurer_branch_contacts_id").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
insurer_branch_contact();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -1,111 +1,135 @@
|
||||
<div class="tab-pane fade active show" id="KYC-DOC-tab">
|
||||
<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="col-xl-6">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<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>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))
|
||||
<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($insurer_or_tpa as $key => $action)
|
||||
foreach($events as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<br>
|
||||
|
||||
<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 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>
|
||||
|
||||
<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 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>
|
||||
</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>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end page title -->
|
||||
<div class="row" id="file_list">
|
||||
<?php include('batch_list.php');?>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
|
||||
|
||||
@ -116,11 +140,11 @@ var clientPolicies = [];
|
||||
$(document).ready(function() {
|
||||
|
||||
<?php if (session()->has('error')): ?>
|
||||
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
|
||||
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (session()->has('success')): ?>
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
|
||||
$('#import_excel_btn').hide();
|
||||
@ -165,7 +189,7 @@ $(document).ready(function() {
|
||||
$('.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);
|
||||
@ -330,5 +354,12 @@ $('#action_type').change(function() {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="table-responsive" id="branch_table" >
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<table class="table table-borderless table-nowrap mb-0" id="table-kyc-docs">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>File Name</th>
|
||||
@ -22,7 +22,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -137,7 +137,10 @@ $(document).ready(function () {
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.file_name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
<td>
|
||||
<a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeKYCDocs(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
@ -157,6 +160,8 @@ $(document).ready(function () {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
console.log("kyc_docs_form_action");
|
||||
console.log(kyc_docs_form_action);
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: kyc_docs_form_action,
|
||||
@ -170,17 +175,20 @@ $(document).ready(function () {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
$('#insurer_branch_list tr').remove();
|
||||
$('#kyc_docs_list tr').remove();
|
||||
var insurerBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
insurerBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.file_name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
<td>
|
||||
<a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeKYCDocs(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#insurer_branch_list').append(insurerBranchTableInsert);
|
||||
$('#kyc_docs_list').append(insurerBranchTableInsert);
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
@ -241,16 +249,23 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
$('body').on('click', '#btnSubmit', function() {
|
||||
$('#kyc_docs_list').html(" ");
|
||||
$('#kyc_docs_list').html("");
|
||||
console.log($('#kyc_docs_list')[0]);
|
||||
setTimeout(function() {
|
||||
loadKYCDocsList();
|
||||
}, 100) });
|
||||
console.log("hjknjkhiulhjulihj----------------------");
|
||||
// loadKYCDocsList();
|
||||
}, 1000) });
|
||||
|
||||
function loadKYCDocsList() {
|
||||
var base_url = '<?= base_url("master/kyc/kycdocs/list/"); ?>';
|
||||
|
||||
var kyc_docs_action = base_url + kyc_Docs_PrimaryKey;
|
||||
console.log(kyc_docs_action);
|
||||
var kyc_Docs_PrimaryKey_1 = $('#kyc_General_PrimaryKey').val();
|
||||
|
||||
// console.log("kyc_Docs_PrimaryKey_1");
|
||||
// console.log(kyc_Docs_PrimaryKey_1);
|
||||
|
||||
var kyc_docs_action = base_url + kyc_Docs_PrimaryKey_1;
|
||||
// console.log(kyc_docs_action);
|
||||
if (kyc_Docs_PrimaryKey != '') {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -261,6 +276,8 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log("response in", res);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -270,10 +287,14 @@ $(document).ready(function () {
|
||||
insurerBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.file_name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
<td>
|
||||
<a class="btnBranchEdit" data-id="${item.id}"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeKYCDocs(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
console.log($('#kyc_docs_list')[0]);
|
||||
$('#kyc_docs_list').append(insurerBranchTableInsert);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
@ -289,6 +310,53 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
$('#table-kyc-docs').DataTable({
|
||||
paging: true ,
|
||||
searching: false
|
||||
});
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
function removeKYCDocs(element) {
|
||||
var kyc_docs_id_for_reload = $('#kyc_type_id').val();
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/kyc/kycdocs/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
// location.reload();
|
||||
window.location.href = '<?= base_url("master/kyc/list/") ?>' + kyc_docs_id_for_reload;
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -5,7 +5,7 @@
|
||||
<form role="form" class="parsley-examples" method="post" id="kyc_general_form" enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="kyc_General_PrimaryKey" value="<?= isset($kyc['id']) ? $kyc['id'] : '' ?>"/>
|
||||
<input type="hidden" name="kyc_type_id" id="kyc_type_id" />
|
||||
<input type="hidden" name="kyc_type_id" id="kyc_type_id" value="<?= isset($kyc['id']) ? $kyc['id'] : '' ?>"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
@ -45,8 +45,8 @@ $(document).ready(function () {
|
||||
var form_action = '';
|
||||
if (isValid) {
|
||||
|
||||
console.log("Primary KEy");
|
||||
console.log(PrimaryKey);
|
||||
// console.log("Primary KEy");
|
||||
// console.log(PrimaryKey);
|
||||
if(PrimaryKey === ''){
|
||||
form_action = '<?= base_url("master/kyc/createpost"); ?>';
|
||||
}else{
|
||||
@ -70,9 +70,12 @@ $(document).ready(function () {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
$('#kyc_type_id').val(res.data.PrimaryKey);
|
||||
$('#kyc_id_docs').val(res.data.PrimaryKey);
|
||||
$('#kyc_type_id').val(res.data.id);
|
||||
$('#kyc_Docs_PrimaryKey').val(res.data.id);
|
||||
$('#kyc_General_PrimaryKey').val(res.data.id);
|
||||
$('#kyc_id_docs').val(res.data.id);
|
||||
$('#kyc_docs_id').click();
|
||||
$('#btnBranchAdd').show();
|
||||
var message = "KYC Entity Type General Info";
|
||||
toastr.success(message, 'Success');
|
||||
},
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
<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 class="dropdown-item" href="<?= base_url("master/kyc/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeKYC(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -48,7 +48,9 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
@ -65,7 +67,7 @@
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
paging: true ,
|
||||
});
|
||||
|
||||
})
|
||||
@ -129,4 +131,44 @@ class csvExport {
|
||||
}
|
||||
|
||||
|
||||
|
||||
function removeKYC(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/kyc/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -38,9 +38,9 @@ body {
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">KYC Entity Type</h4>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/kyc/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div> -->
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/kyc/list"); ?>" ><i class="fas fa-arrow-left" style="font-size: 17px;"></i> </a>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
@ -67,3 +67,25 @@ body {
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
function policy_type_branch_contact() {
|
||||
var check_policy_type_id = $('#kyc_General_PrimaryKey');
|
||||
|
||||
console.log(check_policy_type_id.val());
|
||||
if(check_policy_type_id[0].value == '' || check_policy_type_id[0].value == null || check_policy_type_id[0].value == 0){
|
||||
$('#btnBranchAdd').hide();
|
||||
toastr.warning('First Add the KYC Entity Type!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnBranchBack')[0].style.display == 'none') {
|
||||
$('#btnBranchAdd').show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.getElementById("kyc_docs_id").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
policy_type_branch_contact();
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -3,12 +3,13 @@
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<title><?= isset($page_name) ? $page_name : 'nHance'; ?></title>
|
||||
<title><?= isset($page_name) ? $page_name : 'NHance'; ?></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta content="" name="description" />
|
||||
<meta content="nHANCE" name="nHANCE" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
|
||||
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/favicon.ico">
|
||||
|
||||
@ -205,12 +206,12 @@
|
||||
/* color: #02a8b5 !important; */
|
||||
font-size: 12px;
|
||||
}
|
||||
.form-group {
|
||||
/* margin-bottom: -0.2rem !important; */
|
||||
/* .form-group {
|
||||
margin-bottom: -0.2rem !important;
|
||||
}
|
||||
.form-row{
|
||||
/* width: 84%; */
|
||||
}
|
||||
width: 84%;
|
||||
} */
|
||||
|
||||
</style>
|
||||
|
||||
@ -374,7 +375,7 @@
|
||||
<a href="javascript:void(0);" class="dropdown-item notify-item">
|
||||
<div class="notify-icon bg-secondary">
|
||||
<i class="mdi mdi-heart"></i>
|
||||
</div>
|
||||
</div>composer create-project laravel/laravel:^11.0 example-app
|
||||
<p class="notify-details">Carlos Crouch liked
|
||||
<b>Admin</b>
|
||||
<small class="text-muted">13 days ago</small>
|
||||
@ -392,9 +393,9 @@
|
||||
|
||||
<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
|
||||
<img src="<?php echo (get_userProfile() != null && !empty(get_userProfile())) ? get_userProfile() : base_url() . 'public/assets/images/avatar_2x.png'; ?>" alt="user-image" class="rounded-circle">
|
||||
<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>
|
||||
@ -448,7 +449,7 @@
|
||||
|
||||
<!-- LOGO -->
|
||||
<div class="logo-box">
|
||||
<a href="index.html" class="logo logo-dark text-center">
|
||||
<a href="https://localhost/nhance/dashboard/view" class="logo logo-dark text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
||||
<!-- <span class="logo-lg-text-light">NHANCE</span> -->
|
||||
@ -459,7 +460,7 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a href="index.html" class="logo logo-light text-center">
|
||||
<a href="https://localhost/nhance/dashboard/view" class="logo logo-light text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
||||
</span>
|
||||
@ -501,7 +502,7 @@
|
||||
|
||||
<!-- LOGO -->
|
||||
<div class="logo-box">
|
||||
<a href="index.html" class="logo logo-dark text-center">
|
||||
<a href="<?= base_url('/dashboard/view')?>" class="logo logo-dark text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/logo-sm-dark.png" alt="" height="24">
|
||||
<!-- <span class="logo-lg-text-light">nHance</span> -->
|
||||
@ -512,7 +513,7 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a href="index.html" class="logo logo-light text-center">
|
||||
<a href="<?= base_url('/dashboard/view')?>" class="logo logo-light text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/n.png" alt="" height="24">
|
||||
</span>
|
||||
@ -553,6 +554,9 @@
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/upload')?>">Upload</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/endorsement-list')?>">Endorsement List</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="table-responsive" id="branch_table" >
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<table class="table table-borderless table-nowrap mb-0" id="table-policies">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>Insurer</th>
|
||||
@ -23,7 +23,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -37,7 +37,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="insurer_id">Insurer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer_id" name="insurer_id" required>
|
||||
<option value="0">Select Insurer</option>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php if (!empty($insurer)) { foreach ($insurer as $insurer) : ?>
|
||||
<option value="<?= $insurer['id'] ?>"><?= $insurer['name'] ?></option>
|
||||
<?php endforeach; } ?>
|
||||
@ -81,7 +81,12 @@ $(document).ready(function () {
|
||||
loadPoliciesList();
|
||||
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
$('#table-policies').DataTable({
|
||||
paging: true ,
|
||||
searching: false
|
||||
});
|
||||
}, 2000);
|
||||
|
||||
// var insurer_branch_action = '<?= base_url("master/insurer/list/"); ?>';
|
||||
// if ($('#policy_type_id').val() != '') {
|
||||
@ -181,13 +186,17 @@ $(document).ready(function () {
|
||||
if(policy_type_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($tpa_branch) ? json_encode($tpa_branch) : '[]' ?>;
|
||||
var data = <?= isset($policies) ? json_encode($policies) : '[]' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_id}</td>
|
||||
<td>${item.insurer_name}</td>
|
||||
<td>${item.name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
<td>
|
||||
<a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removePolicies(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
@ -200,12 +209,12 @@ $(document).ready(function () {
|
||||
|
||||
var isValid = $('#tpa_branch_form').parsley().validate();
|
||||
|
||||
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#tpa_branch_form')[0]);
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$('#policies_list').html("");
|
||||
$.ajax({
|
||||
data: formData,
|
||||
url: tpa_branch_form_action,
|
||||
@ -214,25 +223,32 @@ $(document).ready(function () {
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
// console.log(res);
|
||||
// $('#policies_list tr').remove();s
|
||||
// $('#policies_list tr').remove();
|
||||
var tpaBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
tpaBranchTableInsert += `
|
||||
<tr>
|
||||
<td>${item.insurer_id}</td>
|
||||
<td>${item.insurer_name}</td>
|
||||
<td>${item.name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
<td>
|
||||
<a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removePolicies(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
// $('#policies_list').append(tpaBranchTableInsert);
|
||||
$('#policies_list').html("");
|
||||
loadPoliciesList();
|
||||
$('#policies_list').append(tpaBranchTableInsert);
|
||||
// $('#policies_list').html("");
|
||||
// loadPoliciesList();
|
||||
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('#branch_table').show();
|
||||
$('.btnBack').hide();
|
||||
@ -315,8 +331,8 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
$('body').on('click', '#btnSubmit', function() {
|
||||
// $('#policies_list').html("");
|
||||
// loadPoliciesList();
|
||||
$('#policies_list').html("");
|
||||
loadPoliciesList();
|
||||
|
||||
setTimeout(function() {
|
||||
}, 1000) });
|
||||
@ -324,47 +340,93 @@ $(document).ready(function () {
|
||||
function loadPoliciesList() {
|
||||
var base_url = '<?= base_url("master/policy/policies/list/"); ?>';
|
||||
|
||||
var insurer_branch_action = base_url + policy_type_PrimaryKey;
|
||||
var insurer_branch_action = base_url + policy_type_PrimaryKey;
|
||||
|
||||
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);
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td value=''>${item.insurer.name}</td>
|
||||
<td>${item.policy.name}</td>
|
||||
<td><a class="btnBranchEdit" data-id="${item.policy.id}"><i data-id="${item.policy.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#policies_list').append(branchTable);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
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');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log("response", response);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
var branchTable = '';
|
||||
$.each(response.policies, function(index, item) {
|
||||
console.log(item);
|
||||
branchTable += `
|
||||
<tr>
|
||||
<td value=''>${item.insurer.name}</td>
|
||||
<td>${item.policy.name}</td>
|
||||
<td>
|
||||
<a class="btnBranchEdit" data-id="${item.policy.id}"><i data-id="${item.policy.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removePolicies(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
$('#policies_list').append(branchTable);
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
function removePolicies(element) {
|
||||
var policy_id_for_reload = $('#policy_type_id').val()
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/policy/policies/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
// $('#branch_table').empty();
|
||||
|
||||
// location.reload();
|
||||
window.location.href = '<?= base_url("master/policy/list/") ?>' + policy_id_for_reload;
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -13,11 +13,12 @@
|
||||
.radiobuttondiv{
|
||||
margin-left: 32px;
|
||||
}
|
||||
.{
|
||||
|
||||
/* .{
|
||||
width:62% !important;
|
||||
margin-left: 30px;
|
||||
margin-top: 3px
|
||||
}
|
||||
} */
|
||||
/* .form-group.col-md-6 */
|
||||
.form-group-client-policy-master{
|
||||
display:-webkit-box;
|
||||
@ -48,14 +49,14 @@
|
||||
.jodit-status-bar{
|
||||
display:none;
|
||||
}
|
||||
.jodit-container{
|
||||
/* width: 821px !important; */
|
||||
/* margin-top: 3px; */
|
||||
/* margin-bottom: 3px; */
|
||||
/* margin-left: 30px; */
|
||||
/* height: 0px !important; */
|
||||
/* min-height: 100px !important; */
|
||||
}
|
||||
/* .jodit-container{
|
||||
width: 821px !important;
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
margin-left: 30px;
|
||||
height: 0px !important;
|
||||
min-height: 100px !important;
|
||||
} */
|
||||
.input-group {
|
||||
width: 64.5% !important;
|
||||
}
|
||||
@ -109,20 +110,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>
|
||||
@ -580,7 +596,8 @@ var grid_html = '';
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('#policyJsonForm')[0].reset();
|
||||
$('.text-danger-2').html('');
|
||||
if (res.status === false) {
|
||||
toastr.error('Policy Dose Not Create', 'Error');
|
||||
return;
|
||||
@ -628,7 +645,7 @@ var grid_html = '';
|
||||
var gmc_policy_type_id = $(this).attr('id');
|
||||
|
||||
|
||||
if(gmc_policy_type_id >= '2'){
|
||||
if(gmc_policy_type_id >= 2){
|
||||
|
||||
$('#policyGMCTerms').css('display', '');
|
||||
$('#police-tab').css('display', 'none');
|
||||
@ -683,12 +700,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');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -830,6 +872,9 @@ var grid_html = '';
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display','');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||||
|
||||
$('#policyJsonForm')[0].reset();
|
||||
$('.text-danger-2').html('');
|
||||
});
|
||||
|
||||
// function formatNumber(input) {
|
||||
|
||||
@ -52,14 +52,6 @@
|
||||
.jodit-status-bar{
|
||||
display:none;
|
||||
}
|
||||
.jodit-container{
|
||||
/* width: 690px !important; */
|
||||
/* margin-top: 3px; */
|
||||
/* margin-bottom: 3px; */
|
||||
/* margin-left: 30px; */
|
||||
/* height: 0px !important; */
|
||||
/* min-height: 100px !important; */
|
||||
}
|
||||
.input-group {
|
||||
width: 64.5% !important;
|
||||
}
|
||||
@ -409,7 +401,8 @@
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('#policyGPATerms')[0].reset();
|
||||
$('.text-danger-2').html('');
|
||||
console.log(res);
|
||||
|
||||
if (res.status === false) {
|
||||
@ -569,6 +562,9 @@
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display','');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||||
$('#policyGPATerms')[0].reset();
|
||||
$('.text-danger-2').html('');
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -780,10 +780,6 @@
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more_${Count}" onclick="appendGridtHtml('1')">+</button>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
else if(ui_type == '1_2' )
|
||||
{
|
||||
|
||||
}
|
||||
else if(ui_type == '3'){
|
||||
|
||||
@ -1428,7 +1424,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
function gpaSumInsureMultiplier() {
|
||||
function gpaSumInsureMultiplier(element) {
|
||||
console.log(element);
|
||||
var element = $('#gpa_sum_multiplier')[0];
|
||||
var sumInsured = $('input[name="gpa_sum_si[]"]');
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<label for="kyc_name">Policy Type Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="policy_type"
|
||||
placeholder="Enter Kyc Entity Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
|
||||
placeholder="Enter Policy Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="bap">Bap<span
|
||||
@ -24,7 +24,7 @@
|
||||
<label for="allocg">Allocg<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="allocg"
|
||||
placeholder="Enter Short Name" value="<?= isset($policytype['allocg']) ? $policytype['allocg'] : '' ?>" name="allocg" required>
|
||||
placeholder="Enter Allocg" value="<?= isset($policytype['allocg']) ? $policytype['allocg'] : '' ?>" name="allocg" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="alloci">Alloci<span
|
||||
@ -86,9 +86,11 @@ $(document).ready(function () {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
$('#policy_type_id').val(res.data.PrimaryKey);
|
||||
|
||||
$('#policy_type_id').val(res.data.id);
|
||||
$('#policytype_General_PrimaryKey').val(res.data.id);
|
||||
$('#policy_id_type').click();
|
||||
$('#btnBranchAdd').show();
|
||||
var message = "Policy Type General Info";
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<th class="font-weight-medium">Policy Type</th>
|
||||
<th class="font-weight-medium">Bap</th>
|
||||
<th class="font-weight-medium">Allocg</th>
|
||||
<th class="font-weight-medium">alloci</th>
|
||||
<th class="font-weight-medium">Alloci</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -34,7 +34,7 @@
|
||||
<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 class="dropdown-item" href="<?= base_url("master/policy/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removePolciyType(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -54,12 +54,14 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TPAList',
|
||||
title: 'PolicyTypeList',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
}
|
||||
@ -71,7 +73,7 @@
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
paging: true ,
|
||||
});
|
||||
|
||||
})
|
||||
@ -135,4 +137,42 @@ class csvExport {
|
||||
}
|
||||
|
||||
|
||||
function removePolciyType(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/policy/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -38,9 +38,9 @@ body {
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Policy Type</h4>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/policy/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div> -->
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/policy/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i> </a>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
@ -67,3 +67,25 @@ body {
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function policy_type_branch_contact() {
|
||||
var check_policy_type_id = $('#policytype_General_PrimaryKey');
|
||||
|
||||
|
||||
if(check_policy_type_id[0].value == '' || check_policy_type_id[0].value == null || check_policy_type_id[0].value == 0){
|
||||
$('#btnBranchAdd').hide();
|
||||
toastr.warning('First Add the Policy Type!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnBranchBack')[0].style.display == 'none') {
|
||||
$('#btnBranchAdd').show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.getElementById("policy_id_type").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
policy_type_branch_contact();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
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>
|
||||
@ -9,10 +9,8 @@
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="tpa_name">TPA Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="name"
|
||||
placeholder="Enter TPA Name" value="<?= isset($tpa['name']) ? $tpa['name'] : '' ?>" name="name" required>
|
||||
<label for="tpa_name">TPA Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="tpa_name" placeholder="Enter TPA Name" value="<?= isset($tpa['name']) ? $tpa['name'] : '' ?>" name="name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="short_name">TPA Short Name<span class="text-danger">*</span></label>
|
||||
@ -74,9 +72,11 @@ $(document).ready(function () {
|
||||
|
||||
console.log(res);
|
||||
$('#tpa_id').val(res.data.id);
|
||||
$('#tpa_General_PrimaryKey').val(res.data.id);
|
||||
$('#tpa_id_branch').val(res.data.id);
|
||||
$('#tpa_branch_contacts_id').click();
|
||||
|
||||
$('#btnBranchAdd').show();
|
||||
var message = "TPA General Info";
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
<button type="button" id="btnBranchBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
@ -153,7 +153,10 @@ $(document).ready(function () {
|
||||
$('#mobile').val('');
|
||||
$('#designation').val('');
|
||||
|
||||
|
||||
var addButton = document.getElementById('add');
|
||||
if (addButton.style.display === 'none') {
|
||||
addButton.style.display = 'block';
|
||||
}
|
||||
|
||||
contactCount = 1
|
||||
|
||||
@ -243,7 +246,10 @@ $(document).ready(function () {
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
<td>
|
||||
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeTPABranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
`;
|
||||
@ -347,7 +353,10 @@ $(document).ready(function () {
|
||||
<tr>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_code}</td>
|
||||
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
|
||||
<td>
|
||||
<a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a>
|
||||
<a style="color:#02a8b5" data-id="${item.id}" onclick="removeTPABranch(this)"><i data-id="${item.id}" class="mdi mdi-delete" style="font-size:18px;"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
@ -401,7 +410,7 @@ var html = `
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
|
||||
<input data-parsley-type="number" data-parsley-length="[10,10]" value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
|
||||
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" style="display: flex;">
|
||||
@ -496,4 +505,38 @@ function validateForm() {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
|
||||
function removeTPABranch(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/tpa/branch/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@ -28,7 +28,7 @@
|
||||
<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 class="dropdown-item" href="<?= base_url("master/tpa/list/"); ?><?= $row['id'];?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a class="dropdown-item" data-id="<?= $row['id'];?>" onclick="removeTPA(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -48,7 +48,9 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||
"<'row'<'col-sm-12'tr>>" +
|
||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
@ -65,7 +67,7 @@
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
|
||||
paging: true ,
|
||||
});
|
||||
|
||||
})
|
||||
@ -129,4 +131,41 @@ class csvExport {
|
||||
}
|
||||
|
||||
|
||||
function removeTPA(element) {
|
||||
var id = element.getAttribute('data-id');
|
||||
var form_action = '<?= base_url("master/tpa/remove/") ?>' + id;
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
// console.log(res.status == true);
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
toastr.success('Remove Done!', 'success');
|
||||
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
toastr.warning('Remove Not Done!', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
@ -38,9 +38,9 @@ body {
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">TPA</h4>
|
||||
</div>
|
||||
<!-- <div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/tpa/list"); ?>" class="btn btn-primary waves-effect waves-light">Back</a>
|
||||
</div> -->
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/tpa/list"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i> </a>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="nav nav-pills navtab-bg">
|
||||
<li class="nav-item">
|
||||
@ -67,3 +67,25 @@ body {
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function tpa_branch_contact() {
|
||||
var check_tpa_id = $('#tpa_General_PrimaryKey');
|
||||
|
||||
|
||||
if(check_tpa_id[0].value == '' || check_tpa_id[0].value == null || check_tpa_id[0].value == 0){
|
||||
$('#btnBranchAdd').hide();
|
||||
toastr.warning('First Add the TPA!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnBranchBack')[0].style.display == 'none') {
|
||||
$('#btnBranchAdd').show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
document.getElementById("tpa_branch_contacts_id").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
tpa_branch_contact();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,55 +1,67 @@
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="text-center">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-xl-5">
|
||||
<div class="py-1">
|
||||
<i class="font-24"></i>
|
||||
<h4 >Deposit Summary Of <?php echo $clientData->short_name?></h4>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8 col-xl-7">
|
||||
<div class="py-1">
|
||||
<i class=" font-24"></i>
|
||||
|
||||
|
||||
<h4><?php echo $insurerName->name; ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row mt-3 text-center">
|
||||
<div class="col-3">
|
||||
<p class="text-muted font-15 mb-1 text-truncate">Deposits</p>
|
||||
<h4 style="font-size: 26px;"><i class="fe-arrow-up text-success mr-1"></i>₹<?php echo $deposiamount->total_credit?></h4>
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
<p class="text-muted font-15 mb-1 text-truncate">Consumed</p>
|
||||
<h4 style="font-size: 26px;"><i class="fe-arrow-down text-danger mr-1"></i>₹<?php echo $deposiamount->total_withdraw?></h4>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<p class="text-muted font-15 mb-1 text-truncate">Refund</p>
|
||||
<h4 style="font-size: 26px;"><i class="fe-arrow-up text-success mr-1"></i>₹<?php echo $deposiamount->total_refund?></h4>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<p class="text-muted font-15 mb-1 text-truncate">Current Balance</p>
|
||||
<h4 style="font-size: 26px;"><i class="fe-credit-card text-sucess mr-1"></i>₹<?php echo $deposiamount->balance?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="text-center">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6 col-xl-5">
|
||||
<div class="py-1">
|
||||
<i class="font-24"></i>
|
||||
<h4>Deposit Summary Of <?php echo $clientData->short_name?></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 col-xl-5">
|
||||
<div class="py-1">
|
||||
<i class=" font-24"></i>
|
||||
<h4><?php echo $insurerName->name; ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row mt-3 text-center">
|
||||
|
||||
<div class="col-3">
|
||||
<p class="text-muted font-15 mb-1 text-truncate">Deposits</p>
|
||||
<h4 style="font-size: 26px;"><i
|
||||
class="fe-arrow-up text-success mr-1"></i>₹<?php echo $deposiamount->total_credit?>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
<p class="text-muted font-15 mb-1 text-truncate">Consumed</p>
|
||||
<h4 style="font-size: 26px;"><i
|
||||
class="fe-arrow-down text-danger mr-1"></i>₹<?php echo $deposiamount->total_withdraw?>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
<p class="text-muted font-15 mb-1 text-truncate">Refund</p>
|
||||
<h4 style="font-size: 26px;"><i
|
||||
class="fe-arrow-up text-success mr-1"></i>₹<?php echo $deposiamount->total_refund?>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-3">
|
||||
<p class="text-muted font-15 mb-1 text-truncate">Current Balance</p>
|
||||
<h4 style="font-size: 26px;"><i
|
||||
class="fe-credit-card text-sucess mr-1"></i>₹<?php echo $deposiamount->balance?>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
<!-- <div class="row">
|
||||
<div class="col-12">
|
||||
<div class="page-title-box page-title-box-alt">
|
||||
<h4 class="page-title"></h4>
|
||||
@ -57,70 +69,73 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
</div> -->
|
||||
<!-- end page title -->
|
||||
<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;">Transaction Details</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 51px;
|
||||
right: 31px;">
|
||||
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target="#addTransactionModal">New</button>
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("client/deposit/$clientData->id"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row" style="margin-bottom:1rem;">
|
||||
<div class="col-6" style="align-self: center;">
|
||||
<h4 class="header-title" style="position: relative;">Transaction Details</h4>
|
||||
</div>
|
||||
<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">
|
||||
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light"
|
||||
data-toggle="modal" data-target="#addTransactionModal">New</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
<th class="font-weight-medium">Date</th>
|
||||
<th class="font-weight-medium">User</th>
|
||||
<th class="font-weight-medium">Description</th>
|
||||
<th class="font-weight-medium">Sub Type</th>
|
||||
<th class="font-weight-medium">Credit</th>
|
||||
<th class="font-weight-medium">Debit</th>
|
||||
|
||||
<th class="font-weight-medium">Balnce</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($depositdata as $row) { ?>
|
||||
<tr id="<?php echo $row->id;?>">
|
||||
<td class=""><?php echo date('d-m-y h:i A', strtotime($row->created_at)); ?></td>
|
||||
<th class="font-weight-medium">Balance</th>
|
||||
|
||||
<td><?php echo $row->username; ?></td>
|
||||
<td><?php echo $row->description; ?></td>
|
||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo $row->balance; ?></td>
|
||||
|
||||
|
||||
|
||||
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($depositdata as $row) { ?>
|
||||
<tr id="<?php echo $row->id;?>">
|
||||
<td class=""><?php echo date('d-m-y h:i A', strtotime($row->created_at)); ?></td>
|
||||
<td><?php echo $row->username; ?></td>
|
||||
<td><?php echo $row->description; ?></td>
|
||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
||||
</td>
|
||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo $row->balance; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- Add this modal markup at the end of your HTML body -->
|
||||
<!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- Add this modal markup at the end of your HTML body -->
|
||||
<!-- Button to trigger modal -->
|
||||
|
||||
<!-- Add this modal markup at the end of your HTML body -->
|
||||
<div class="modal fade" id="addTransactionModal" tabindex="-1" role="dialog" aria-labelledby="addTransactionModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="addTransactionModal" tabindex="-1" role="dialog" aria-labelledby="addTransactionModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@ -131,15 +146,17 @@
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="transactionMode" class="control-label">Transaction Mode</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="addMode" value="add" checked>
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="addMode"
|
||||
value="add" checked>
|
||||
<label class="form-check-label" for="addMode">Deposit</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="adjustmentMode" value="adjustment">
|
||||
<input class="form-check-input" type="radio" name="transactionMode" id="adjustmentMode"
|
||||
value="adjustment">
|
||||
<label class="form-check-label" for="adjustmentMode">Adjustment</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -150,7 +167,7 @@
|
||||
<input type="number" class="form-control" id="amount" placeholder="Amount">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row" id="transactionTypeRow" style="display:none;">
|
||||
<div class="col-md-6">
|
||||
@ -167,19 +184,20 @@
|
||||
<div class="col-md-12">
|
||||
<div class="form-group no-margin">
|
||||
<label for="description" class="control-label">Description</label>
|
||||
<textarea class="form-control" id="description" placeholder="Write something about the transaction"></textarea>
|
||||
<textarea class="form-control" id="description"
|
||||
placeholder="Write something about the transaction"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="subType" class="control-label"style="display: none;">Transaction Sub Type</label>
|
||||
<select class="form-control" id="subType" name="sub_type"style="display: none;">
|
||||
<option value="Deposit"hidden>Deposit</option>
|
||||
<option value="Adjustment"hidden>Adjustment</option>
|
||||
<!-- Add more options as needed -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<label for="subType" class="control-label" style="display: none;">Transaction Sub Type</label>
|
||||
<select class="form-control" id="subType" name="sub_type" style="display: none;">
|
||||
<option value="Deposit" hidden>Deposit</option>
|
||||
<option value="Adjustment" hidden>Adjustment</option>
|
||||
<!-- Add more options as needed -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" id="saveTransactionBtn">Save Transaction</button>
|
||||
@ -189,33 +207,29 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('input[name="transactionMode"]').change(function () {
|
||||
if ($(this).val() === 'adjustment') {
|
||||
$('#transactionTypeRow').show();
|
||||
} else {
|
||||
$('#transactionTypeRow').hide();
|
||||
}
|
||||
});
|
||||
$(document).ready(function() {
|
||||
$('input[name="transactionMode"]').change(function() {
|
||||
if ($(this).val() === 'adjustment') {
|
||||
$('#transactionTypeRow').show();
|
||||
} else {
|
||||
$('#transactionTypeRow').hide();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#tickets-table').DataTable({
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" ,
|
||||
buttons: [
|
||||
{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>",
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
],
|
||||
}],
|
||||
|
||||
|
||||
language: {
|
||||
@ -225,80 +239,80 @@ $(document).ready(function () {
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
<!-- Include jQuery library (if not already included) -->
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
// Event listener for radio buttons
|
||||
$('input[name="transactionMode"]').change(function () {
|
||||
if ($(this).val() === 'add') {
|
||||
// Set the hidden input value to 'Deposit' when 'Deposit' radio button is selected
|
||||
$('#subType').val('Deposit');
|
||||
} else if ($(this).val() === 'adjustment') {
|
||||
// Set the hidden input value to 'Adjustment' when 'Adjustment' radio button is selected
|
||||
$('#subType').val('Adjustment');
|
||||
$(document).ready(function() {
|
||||
// Event listener for radio buttons
|
||||
$('input[name="transactionMode"]').change(function() {
|
||||
if ($(this).val() === 'add') {
|
||||
// Set the hidden input value to 'Deposit' when 'Deposit' radio button is selected
|
||||
$('#subType').val('Deposit');
|
||||
} else if ($(this).val() === 'adjustment') {
|
||||
// Set the hidden input value to 'Adjustment' when 'Adjustment' radio button is selected
|
||||
$('#subType').val('Adjustment');
|
||||
}
|
||||
});
|
||||
|
||||
$('#saveTransactionBtn').on('click', function() {
|
||||
// Collect data from modal fields
|
||||
var amount = $('#amount').val();
|
||||
var description = $('#description').val();
|
||||
var clientId = '<?php echo $clientData->id; ?>';
|
||||
var insurerId = '<?php echo $insurerName->id; ?>';
|
||||
var transactionType;
|
||||
if ($('#addMode').is(':checked')) {
|
||||
transactionType =
|
||||
'Credit'; // Assuming 'Credit' is the default when the 'Deposit' radio button is selected
|
||||
} else if ($('#adjustmentMode').is(':checked') && $('#transactionTypeRow').is(':visible')) {
|
||||
transactionType = $('#transactionType').val();
|
||||
} else {
|
||||
transactionType = ''; // You might want to handle this case based on your requirements
|
||||
}
|
||||
|
||||
// Fetch sub_type_id based on the selected sub_type
|
||||
var subTypeOptions = {
|
||||
'Deposit': 1,
|
||||
'Adjustment': 2,
|
||||
'Deletion': 3,
|
||||
// Add more options as needed
|
||||
};
|
||||
|
||||
var subType = $('#subType').val();
|
||||
var subTypeId = subTypeOptions[subType] || null;
|
||||
|
||||
if (subTypeId === null) {
|
||||
// Handle the case where sub_type is not found in the options
|
||||
alert('Invalid sub_type selected.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Send data to the server using Ajax
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?= base_url()."client/save_deposit" ?>',
|
||||
data: {
|
||||
amount: amount,
|
||||
description: description,
|
||||
transaction_type: transactionType,
|
||||
sub_type: subType,
|
||||
sub_type_id: subTypeId, // Include sub_type_id
|
||||
client_id: clientId,
|
||||
insurer_id: insurerId
|
||||
},
|
||||
success: function(response) {
|
||||
// Handle success response
|
||||
console.log("Transaction saved successfully");
|
||||
// Reload the page or perform other actions as needed
|
||||
location.reload();
|
||||
},
|
||||
error: function(error) {
|
||||
// Handle error response
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#saveTransactionBtn').on('click', function () {
|
||||
// Collect data from modal fields
|
||||
var amount = $('#amount').val();
|
||||
var description = $('#description').val();
|
||||
var clientId = '<?php echo $clientData->id; ?>';
|
||||
var insurerId = '<?php echo $insurerName->id; ?>';
|
||||
var transactionType;
|
||||
if ($('#addMode').is(':checked')) {
|
||||
transactionType = 'Credit'; // Assuming 'Credit' is the default when the 'Deposit' radio button is selected
|
||||
} else if ($('#adjustmentMode').is(':checked') && $('#transactionTypeRow').is(':visible')) {
|
||||
transactionType = $('#transactionType').val();
|
||||
} else {
|
||||
transactionType = ''; // You might want to handle this case based on your requirements
|
||||
}
|
||||
|
||||
// Fetch sub_type_id based on the selected sub_type
|
||||
var subTypeOptions = {
|
||||
'Deposit': 1,
|
||||
'Adjustment': 2,
|
||||
'Deletion': 3,
|
||||
// Add more options as needed
|
||||
};
|
||||
|
||||
var subType = $('#subType').val();
|
||||
var subTypeId = subTypeOptions[subType] || null;
|
||||
|
||||
if (subTypeId === null) {
|
||||
// Handle the case where sub_type is not found in the options
|
||||
alert('Invalid sub_type selected.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Send data to the server using Ajax
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '<?= base_url()."client/save_deposit" ?>',
|
||||
data: {
|
||||
amount: amount,
|
||||
description: description,
|
||||
transaction_type: transactionType,
|
||||
sub_type: subType,
|
||||
sub_type_id: subTypeId, // Include sub_type_id
|
||||
client_id: clientId,
|
||||
insurer_id: insurerId
|
||||
},
|
||||
success: function (response) {
|
||||
// Handle success response
|
||||
console.log("Transaction saved successfully");
|
||||
// Reload the page or perform other actions as needed
|
||||
location.reload();
|
||||
},
|
||||
error: function (error) {
|
||||
// Handle error response
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
});
|
||||
</script>
|
||||
19
bitbucket-pipelines.yml
Normal file
19
bitbucket-pipelines.yml
Normal file
@ -0,0 +1,19 @@
|
||||
# Template PHP Build
|
||||
|
||||
# This template allows you to validate your PHP application.
|
||||
# The workflow allows running tests and code linting on the default branch.
|
||||
|
||||
image: php:8.2-cli
|
||||
|
||||
|
||||
pipelines:
|
||||
default:
|
||||
- step:
|
||||
name: Initialize and Deploy using Git FTP
|
||||
script:
|
||||
- apt-get update
|
||||
- apt-get -qq install git-ftp
|
||||
- git ftp init -u $FTP_USERNAME -p $FTP_PASSWORD $FTP_URL
|
||||
- git ftp push -u $FTP_USERNAME -p $FTP_PASSWORD $FTP_URL
|
||||
caches:
|
||||
- composer
|
||||
@ -21,7 +21,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/avatar_2x.png
Normal file
BIN
public/assets/images/avatar_2x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 626 B |
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
59
tests/unit/CheckDependentConflictTest.php
Normal file
59
tests/unit/CheckDependentConflictTest.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Tests;
|
||||
|
||||
use CodeIgniter\Test\CIUnitTestCase;
|
||||
use Config\App;
|
||||
use Config\Services;
|
||||
use Tests\Support\Libraries\ConfigReader;
|
||||
|
||||
// use App\Helpers\excel_util_helper;
|
||||
use Kint\Kint;
|
||||
|
||||
class CheckDependentConflictTest extends CIUnitTestCase
|
||||
{
|
||||
public function testCheckDependentConflict()
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
// Sample family data
|
||||
$family_data = [
|
||||
[1, 'John Doe', '1970-01-01', 'male', 'self', 'Self'],
|
||||
[2, 'Jane Doe', '1975-01-01', 'female', 'spouse', 'Spouse'],
|
||||
[3, 'Alice Doe', '2000-01-01', 'female', 'daughter', 'Daughter'],
|
||||
[4, 'Bob Doe', '2005-01-01', 'male', 'son', 'Son'],
|
||||
[5, 'Peter Doe', '1950-01-01', 'male', 'father', 'Father'],
|
||||
[6, 'Mary Doe', '1955-01-01', 'female', 'mother', 'Mother'],
|
||||
[7, 'George Doe', '1945-01-01', 'male', 'father-in-law', 'Father-in-law'],
|
||||
[8, 'Grace Doe', '1950-01-01', 'female', 'mother-in-law', 'Mother-in-law'],
|
||||
];
|
||||
|
||||
// Sample policy terms
|
||||
$policy_terms = [
|
||||
'family_floater' => true,
|
||||
'family_floaters' => [
|
||||
'childrens' => 2,
|
||||
'spouse' => 1,
|
||||
'either-parents-pil' => 0,
|
||||
'parents' => 2,
|
||||
'parents-in-law' => 2,
|
||||
],
|
||||
];
|
||||
|
||||
// Sample action array
|
||||
$actionArr = 'addition';
|
||||
|
||||
// Call the function
|
||||
$result = check_dependent_conflict($family_data, $policy_terms, $actionArr);
|
||||
Kint::dump($result);
|
||||
// Assert that the status is true (no conflicts)
|
||||
$this->assertTrue($result['status']);
|
||||
}
|
||||
|
||||
public function testIsNull()
|
||||
{
|
||||
$i = null;
|
||||
$this->assertTrue($i);
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user