'MERGE_README_CONFLICT_TEST'
3
.gitignore
vendored
@ -22,6 +22,9 @@ writable/debugbar/*
|
||||
writable/**/*.db
|
||||
writable/**/*.sqlite
|
||||
|
||||
writable/e_card_template/*
|
||||
!writable/e_card_template/.gitkeep
|
||||
|
||||
|
||||
vendor/
|
||||
build/
|
||||
|
||||
60
README.md
@ -1,61 +1,11 @@
|
||||
# CodeIgniter 4 Framework
|
||||
|
||||
## What is CodeIgniter?
|
||||
## Unit Testing
|
||||
|
||||
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
|
||||
More information can be found at the [official site](https://codeigniter.com).
|
||||
From command propmt run the following cmds
|
||||
|
||||
This repository holds the distributable version of the framework.
|
||||
It has been built from the
|
||||
[development repository](https://github.com/codeigniter4/CodeIgniter4).
|
||||
`php vendor/bin/phpunit tests\unit\GridType11PremiumCalculationTest.php`
|
||||
|
||||
More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.
|
||||
Run speeific method
|
||||
|
||||
The user guide corresponding to the latest version of the framework can be found
|
||||
[here](https://codeigniter4.github.io/userguide/).
|
||||
|
||||
## Important Change with index.php
|
||||
|
||||
`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,
|
||||
for better security and separation of components.
|
||||
|
||||
This means that you should configure your web server to "point" to your project's *public* folder, and
|
||||
not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the
|
||||
framework are exposed.
|
||||
|
||||
**Please** read the user guide for a better explanation of how CI4 works!
|
||||
|
||||
## Repository Management
|
||||
|
||||
We use GitHub issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.
|
||||
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
|
||||
FEATURE REQUESTS.
|
||||
|
||||
This repository is a "distribution" one, built by our release preparation script.
|
||||
Problems with it can be raised on our forum, or as issues in the main repository.
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome contributions from the community.
|
||||
|
||||
Please read the [*Contributing to CodeIgniter*](https://github.com/codeigniter4/CodeIgniter4/blob/develop/CONTRIBUTING.md) section in the development repository.
|
||||
|
||||
## Server Requirements
|
||||
|
||||
PHP version 7.4 or higher is required, with the following extensions installed:
|
||||
|
||||
- [intl](http://php.net/manual/en/intl.requirements.php)
|
||||
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
|
||||
|
||||
> **Warning**
|
||||
> The end of life date for PHP 7.4 was November 28, 2022. If you are
|
||||
> still using PHP 7.4, you should upgrade immediately. The end of life date
|
||||
> for PHP 8.0 will be November 26, 2023.
|
||||
|
||||
Additionally, make sure that the following extensions are enabled in your PHP:
|
||||
|
||||
- json (enabled by default - don't turn it off)
|
||||
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL
|
||||
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
|
||||
|
||||
- first test release
|
||||
`php vendor/bin/phpunit tests\unit\PremiumCalculationTest.php --filter testPremiumCalculationWithPrimaryRackRateAndAdditionalRackRate`
|
||||
|
||||
@ -11,6 +11,7 @@ use CodeIgniter\Filters\SecureHeaders;
|
||||
|
||||
use App\Filters\AuthMVC;
|
||||
use App\Filters\HttpRequestLog;
|
||||
use App\Filters\CloseDbConnection;
|
||||
|
||||
use App\Filters\AuthJWT;
|
||||
|
||||
@ -32,7 +33,8 @@ class Filters extends BaseConfig
|
||||
'secureheaders' => SecureHeaders::class,
|
||||
'authMVC' => AuthMVC::class,
|
||||
'HttpRequestLog' => HttpRequestLog::class,
|
||||
'authJWT' => AuthJWT::class
|
||||
'authJWT' => AuthJWT::class,
|
||||
'CloseDbConnection' => CloseDbConnection::class
|
||||
];
|
||||
|
||||
/**
|
||||
@ -49,8 +51,7 @@ class Filters extends BaseConfig
|
||||
// 'invalidchars',
|
||||
],
|
||||
'after' => [
|
||||
// 'HttpRequestLog',
|
||||
//'authMVC',
|
||||
'CloseDbConnection'
|
||||
// 'secureheaders',
|
||||
],
|
||||
];
|
||||
|
||||
@ -19,15 +19,10 @@ $routes->get('/logout', 'LoginController::logout');
|
||||
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
|
||||
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
|
||||
$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
||||
$routes->get('download-e-card/(:segment)', 'EmployeeController::generateIDCardForEmployee/$1');
|
||||
$routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1');
|
||||
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
||||
|
||||
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||
|
||||
|
||||
|
||||
$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "UserController::create");
|
||||
$routes->get("create", "UserController::create");
|
||||
@ -41,6 +36,9 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("view", "DashboardController::dashboard");
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||
});
|
||||
|
||||
|
||||
@ -233,6 +231,9 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("preview-card/(:any)", "EmployeeController::previewTemplate/$1");
|
||||
$routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1");
|
||||
$routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1");
|
||||
$routes->get("get-client-branch/(:any)", "ClientController::getClientBranch/$1");
|
||||
$routes->get("get-client-details/(:any)", "ClientController::getClientAllDetailsByUsingClientID/$1");
|
||||
$routes->get("delete-additional-rack-rate/(:any)", "ClientController::deleteAdditionalRackRate/$1");
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
@ -240,6 +241,7 @@ $routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
$routes->get("processjob", "JobWorker::processJob");
|
||||
|
||||
|
||||
|
||||
//Employee login api's
|
||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
@ -255,12 +257,6 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
|
||||
|
||||
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
||||
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
||||
$routes->post("/calculatePremium", "EmployeeRestController::calculatePremium");
|
||||
|
||||
|
||||
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
@ -290,11 +286,14 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
$routes->get("getEmployeeOldPolicy", "EmployeeRestController::getEmployeeOldPolicy");
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
$routes->get("getFEContent", "EmployeeRestController::getFEContent");
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
});
|
||||
|
||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -40,8 +40,7 @@ class Session extends BaseConfig
|
||||
* The number of SECONDS you want the session to last.
|
||||
* Setting to 0 (zero) means expire when the browser is closed.
|
||||
*/
|
||||
// public int $expiration = 7200;
|
||||
public int $expiration = 86400; //24 Hours
|
||||
public int $expiration = 7200;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
||||
@ -98,12 +98,13 @@ class ClientController extends AdminController
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Client list function called');
|
||||
$headerData['page_name'] = 'Client List';
|
||||
$data['clientList'] = $this->clientModel->getCreatedByUserName();
|
||||
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
|
||||
|
||||
// dd($data);
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_list', $data);
|
||||
echo view('layout/footer');
|
||||
@ -168,8 +169,9 @@ class ClientController extends AdminController
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
$data['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
|
||||
$data['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||
|
||||
// dd($data['placeHolders']);
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_onboarding', $data);
|
||||
@ -282,7 +284,7 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
|
||||
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
|
||||
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
@ -584,6 +586,19 @@ class ClientController extends AdminController
|
||||
|
||||
$this->myLogger->logme('error','Client policy CREATE function called');
|
||||
|
||||
$policy_type_id = $this->request->getPost('policy_type_id');
|
||||
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||
|
||||
$policyCount = $this->clientPolicyModel
|
||||
->where('policy_type_id', $policy_type_id)
|
||||
->where('client_branch_id', $client_branch_id)
|
||||
->countAllResults();
|
||||
|
||||
if($policyCount > 0 ){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
|
||||
return $this->respond(['status' => 'policy_exist','code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200);
|
||||
}
|
||||
|
||||
$insurerValue = (string) $this->request->getPost('insurer');
|
||||
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
@ -623,6 +638,7 @@ class ClientController extends AdminController
|
||||
$data['base_policy'] = $this->request->getPost('base_policy');
|
||||
$data['policy_status'] = 1;
|
||||
$data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1;
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
|
||||
|
||||
|
||||
@ -717,6 +733,8 @@ class ClientController extends AdminController
|
||||
$data['base_policy'] = $this->request->getPost('base_policy');
|
||||
$data['policy_status'] = 1;
|
||||
$data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1;
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
|
||||
|
||||
|
||||
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
|
||||
@ -766,22 +784,43 @@ class ClientController extends AdminController
|
||||
|
||||
public function createClientPolicyPremium()
|
||||
{
|
||||
|
||||
// echo json_encode(['key' => $this->request->getPost()]); die;
|
||||
|
||||
try {
|
||||
$policy_type = $this->request->getPost('policy_type');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||
// $premium_type = $this->request->getPost('premium_type');
|
||||
$premium_type = $this->request->getPost('premium_type');
|
||||
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');
|
||||
$rack_rate_type = $this->request->getPost('rack_rate_type');
|
||||
|
||||
if($policy_grid_id == 10 || $policy_grid_id == 11){
|
||||
$premium_type = 1;
|
||||
}else{
|
||||
$premium_type = 2;
|
||||
}
|
||||
$self = $this->request->getPost('self') ? 1 : 0;
|
||||
$spouse = $this->request->getPost('spouse')? 1 : 0;
|
||||
$childrens = $this->request->getPost('childrens')? 1 : 0;
|
||||
$parents = $this->request->getPost('parents')? 1 : 0;
|
||||
$parents_in_law = $this->request->getPost('parents-in-law')? 1 : 0;
|
||||
$either_parents_pil = $this->request->getPost('either-parents-pil')? 1 : 0;
|
||||
|
||||
$relation_data['self'] = $self;
|
||||
$relation_data['spouse'] = $spouse;
|
||||
$relation_data['childrens'] = $childrens;
|
||||
$relation_data['parents'] = $parents;
|
||||
$relation_data['parents-in-law'] = $parents_in_law;
|
||||
$relation_data['either-parents-pil'] = $either_parents_pil;
|
||||
|
||||
|
||||
$jsonDataForRelation = json_encode($relation_data);
|
||||
|
||||
// if($policy_grid_id == 10 || $policy_grid_id == 11){
|
||||
// $premium_type = 1;
|
||||
// }else{
|
||||
// $premium_type = 2;
|
||||
// }
|
||||
|
||||
$si_or_bp = $this->request->getPost('si_or_bp');
|
||||
$basic_multiplier = str_replace(',', '', $this->request->getPost('basic_multiplier'));
|
||||
@ -794,6 +833,11 @@ class ClientController extends AdminController
|
||||
$data['client_policy_id'] = $client_policy_id;
|
||||
$data['policy_grid_id'] = $policy_grid_id;
|
||||
$data['premium_type'] = $premium_type;
|
||||
$data['rack_rate_type'] = $rack_rate_type;
|
||||
|
||||
if($rack_rate_type == 1){
|
||||
$data['additional_relationship'] = $jsonDataForRelation;
|
||||
}
|
||||
|
||||
|
||||
$premium = [];
|
||||
@ -801,7 +845,7 @@ class ClientController extends AdminController
|
||||
if ($policy_grid_id == '1' || $policy_grid_id == '2') {
|
||||
$this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
} else {
|
||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->where('rack_rate_type', $rack_rate_type)->set('is_active', 0)->update();
|
||||
}
|
||||
|
||||
|
||||
@ -908,6 +952,9 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
$premium = $this->request->getPost('6_premium[]');
|
||||
|
||||
print_r($premium);
|
||||
|
||||
$sum_insure = $this->request->getPost('6_si');
|
||||
$age_from = $this->request->getPost('6_age_from[]');
|
||||
$age_to = $this->request->getPost('6_age_to[]');
|
||||
@ -1118,19 +1165,25 @@ class ClientController extends AdminController
|
||||
$self = $policy_terms_data->family_floaters;
|
||||
}
|
||||
|
||||
$emp_count = $this->employeeModel->join('client_policy cp', "employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
->where("employees.client_id", $record['client_id'])
|
||||
->where("employees.emp_status", 'active')
|
||||
// $emp_count = $this->employeeModel
|
||||
// ->join('client_policy cp', "employees.client_id = cp.client_id")
|
||||
// ->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
// ->where("employees.client_id", $record['client_id'])
|
||||
// ->where("employees.emp_status", 'active')
|
||||
// ->where("ep.status", 'active')
|
||||
// ->where("employees.is_active", 1)
|
||||
// ->where("ep.is_active", 1)
|
||||
// ->countAllResults();
|
||||
|
||||
|
||||
$emp_count = $this->employeePolicyModel
|
||||
->join('client_policy cp', "cp.id = employee_polices.client_policy_id")
|
||||
->where("employee_polices.client_policy_id", $client_policy_id)
|
||||
->where("employee_polices.status", 'active')
|
||||
->where("employee_polices.is_active", 1)
|
||||
->countAllResults();
|
||||
|
||||
|
||||
$data = $this->employeePolicyModel->select('employee_polices.id')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->findAll();
|
||||
|
||||
$emp_count = count($data);
|
||||
// $emp_count = count($data);
|
||||
|
||||
// if($emp_count == 0){
|
||||
// $emp_count = true;
|
||||
@ -1164,6 +1217,11 @@ class ClientController extends AdminController
|
||||
|
||||
$premiumData = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($premiumData); die;
|
||||
|
||||
@ -1176,24 +1234,25 @@ class ClientController extends AdminController
|
||||
|
||||
if ($search_term === 'GMC') {
|
||||
|
||||
$resultss = [];
|
||||
// $resultss = [];
|
||||
$resultss = $results;
|
||||
|
||||
try {
|
||||
foreach ($results as $index => $record) {
|
||||
// if ($self->self == 1 && $self->spouse == 0 && $self->childrens == 0 && $self->parents == 0 && $self->{'parents-in-law'} == 0 && $self->{'either-parents-pil'} == 0 && $family_floater == 0) {
|
||||
if ($family_floater == 1) {
|
||||
if ($index == '7' || $index == '8' || $index == '9' || $index == '10') {
|
||||
$resultss[$index] = $record;
|
||||
}
|
||||
} else {
|
||||
if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6') {
|
||||
$resultss[$index] = $record;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$resultss = $results; // Reset $resultss to an empty array if an exception occurs
|
||||
}
|
||||
// try {
|
||||
// foreach ($results as $index => $record) {
|
||||
// // if ($self->self == 1 && $self->spouse == 0 && $self->childrens == 0 && $self->parents == 0 && $self->{'parents-in-law'} == 0 && $self->{'either-parents-pil'} == 0 && $family_floater == 0) {
|
||||
// if ($family_floater == 1) {
|
||||
// if ($index == '7' || $index == '8' || $index == '9' || $index == '10') {
|
||||
// $resultss[$index] = $record;
|
||||
// }
|
||||
// } else {
|
||||
// if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6') {
|
||||
// $resultss[$index] = $record;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (\Exception $e) {
|
||||
// $resultss = $results; // Reset $resultss to an empty array if an exception occurs
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@ -1219,19 +1278,28 @@ class ClientController extends AdminController
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
|
||||
// print_r($premiumData);die;
|
||||
// $premium1 = [];
|
||||
// $premium2 = [];
|
||||
|
||||
// print_r($data[0]->policy_type); die;
|
||||
// echo "hello";
|
||||
// return json_encode($premiumData);
|
||||
// foreach ($premiumDataa as $key => $item) {
|
||||
// if ($item['rack_rate_type'] == 0) {
|
||||
// $premium1[] = $item;
|
||||
// } elseif ($item['rack_rate_type'] == 1) {
|
||||
// $premium2[] = $item;
|
||||
// }
|
||||
// }
|
||||
|
||||
// print_r($premium1);
|
||||
// print_r($premium2); die;
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
} else if ($search_term === 'GPA') {
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
return $this->respond(['status' => false, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1703,4 +1771,354 @@ class ClientController extends AdminController
|
||||
return "File not found.";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getClientBranch($client_id){
|
||||
|
||||
$branchs = $this->clientBranchModel
|
||||
->select('*')
|
||||
->where('client_id',$client_id)
|
||||
->findAll();
|
||||
|
||||
return $this->respond(['status' => true,'code' => 200, 'data' => $branchs], 200);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getClientAllDetailsByUsingClientID($client_id)
|
||||
{
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
$builder = $db->table('clients');
|
||||
$builder->select('
|
||||
policies.name as policy_name,
|
||||
policy_type.policy_type,
|
||||
insurers.name as insurer_name,
|
||||
insurers.short_name as insurer_short_name,
|
||||
tpa.name as tpa_name,
|
||||
tpa.short_name as tpa_short_name,
|
||||
client_policy.policy_terms,
|
||||
|
||||
DATE_FORMAT(client_policy.policy_start_date, "%d-%b-%Y") as policy_start_date,
|
||||
DATE_FORMAT(client_policy.policy_end_date, "%d-%b-%Y") as policy_end_date,
|
||||
|
||||
CASE
|
||||
WHEN client_policy.base_policy IS NULL THEN "Not Appear"
|
||||
WHEN client_policy.base_policy = 0 THEN "Not Appear"
|
||||
ELSE (SELECT policies.name
|
||||
FROM client_policy AS base_client_policy
|
||||
JOIN policies ON policies.id = base_client_policy.policy_id
|
||||
WHERE base_client_policy.id = client_policy.base_policy)
|
||||
END as base_policy_name,
|
||||
|
||||
CASE
|
||||
WHEN client_policy.is_addon = 1 THEN "Base Policy"
|
||||
WHEN client_policy.is_addon = 2 THEN "SI Topup"
|
||||
WHEN client_policy.is_addon = 3 THEN "Dependent Addon"
|
||||
ELSE "n/a"
|
||||
END as is_addon,
|
||||
|
||||
CASE
|
||||
WHEN client_policy.policy_status = 1 THEN "Active"
|
||||
WHEN client_policy.policy_status = 0 THEN "Expired"
|
||||
ELSE "n/a"
|
||||
END as policy_status,
|
||||
|
||||
CASE
|
||||
WHEN client_policy.inception_type = 1 THEN "File Upload"
|
||||
WHEN client_policy.inception_type = 2 THEN "Enrollment"
|
||||
ELSE "n/a"
|
||||
END as inception_type,
|
||||
|
||||
CASE
|
||||
WHEN client_policy.open_for_enrollment = 1 THEN "Open"
|
||||
WHEN client_policy.open_for_enrollment = 0 THEN "Closed"
|
||||
ELSE "n/a"
|
||||
END as open_for_enrollment,
|
||||
client_branch.branch_name
|
||||
|
||||
', false);
|
||||
$builder->join('client_policy', 'client_policy.client_id = clients.id');
|
||||
$builder->join('client_branch', 'client_policy.client_branch_id = client_branch.id');
|
||||
$builder->join('policies', 'policies.id = client_policy.policy_id');
|
||||
$builder->join('policy_type', 'policy_type.id = policies.policy_type_id');
|
||||
$builder->join('insurers', 'insurers.id = client_policy.insurer_id');
|
||||
$builder->join('tpa', 'tpa.id = client_policy.tpa_id');
|
||||
$builder->where('clients.is_active', 1);
|
||||
$builder->where('client_policy.is_active', 1);
|
||||
$builder->where('policies.is_active', 1);
|
||||
$builder->where('policy_type.is_active', 1);
|
||||
$builder->where('client_policy.policy_status', 1);
|
||||
$builder->where('clients.id', $client_id);
|
||||
|
||||
$query = $builder->get();
|
||||
$client_policy = $query->getResultArray();
|
||||
|
||||
$gmc_keys = [
|
||||
"sum_insured" => "Sum Insured",
|
||||
"family_floater" => "Family Floater",
|
||||
"family_floaters" => "Family Floaters",
|
||||
"member_count" => "Elders Count:",
|
||||
"other_member_min_age" => "Min Age:",
|
||||
"other_member_max_age" => "Min Age:",
|
||||
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
|
||||
"9monthwaitingperiodwaived" => "9-month waiting Period –waived",
|
||||
"coverfromthedateofjoining" => "Cover from the date of Joining",
|
||||
"waiverof1,2,3&4thyearexclusions" => "Waiver of 1, 2, 3 & 4th year Exclusions",
|
||||
"waiverof30dayswaitingperiod" => "Waiver of 30 days waiting period",
|
||||
"prehospitalizationcover" => "Pre Hospitalization Cover",
|
||||
"congenitaldiseasesinternal" => "Congenital Diseases - Internal",
|
||||
"copayzonewisecopay" => "Co-Pay/Zone wise Co Pay",
|
||||
"bioabsorbablestenttoriclensmultifocallens" => "Bio absorbable stent / Toric lens/ Multi Focal lens",
|
||||
"roomrentlimit" => "Room Rent Limit",
|
||||
"proportionatedeductionclause" => "Proportionate Deduction Clause",
|
||||
"nursingallowance" => "Nursing Allowance",
|
||||
"ailmentcapping" => "Ailment capping",
|
||||
"ambulancecharges" => "Ambulance Charges",
|
||||
"airambulance" => "Air Ambulance",
|
||||
"familytransportationbenefit" => "Family Transportation Benefit",
|
||||
"reasonableandcustomarycharges" => "Reasonable and Customary Charges",
|
||||
"daycaretreatment" => "Day Care Treatment",
|
||||
"ayudhtreatmentcover" => "AYUSH treatment cover",
|
||||
"armdcovered" => "ARMD Covered",
|
||||
"suminsuredenhancement" => "Sum Insured enhancement",
|
||||
"automaticsuminsuredreinstatement" => "Automatic Sum Insured reinstatement",
|
||||
"additionalsicknessbenefit" => "Additional Sickness Benefit",
|
||||
"lasiksurgery" => "Lasik Surgery",
|
||||
"midterminclusion" => "Mid Term inclusion",
|
||||
"capd" => "CAPD",
|
||||
"organdonorexpenses" => "Organ donor expenses",
|
||||
"moderntreatmentsasperirdai" => "Modern treatments as per IRDAI",
|
||||
"Wellness" => "Wellness",
|
||||
"days_of_discharge" => "Claim Intimation Clause",
|
||||
"days_from_dod" => "Claim Submission",
|
||||
"cataract" => "Cataract"
|
||||
];
|
||||
|
||||
$gpa_keys = [
|
||||
"sumInsured2" => "Sum Insured",
|
||||
"totalSumInsured" => "Total Sum Assured",
|
||||
"self" => "Self",
|
||||
"self_min_age" => "Min Age",
|
||||
"self_max_age" => "Max Age",
|
||||
"accidentalDeathBenefit" => "Accidental Death Benefit",
|
||||
"permanentTotalDisablement" => "Permanent Total Disablement",
|
||||
"permanentPartialDisablement" => "Permanent Partial Disablement",
|
||||
"temporaryTotalDisablementBenefit" => "Temporary Total Disablement benefit",
|
||||
"accidentalHospitalizationExpenses" => "Accidental Hospitalization Expenses",
|
||||
"childrenEducationWelfareFund" => "Children Education Welfare Fund",
|
||||
"compassionateVisitExpenses" => "Compassionate Visit Expenses",
|
||||
"compassionateVisitExpensesData" => "Compassionate Visit Expenses Data",
|
||||
"brokenBoneExpenses" => "Broken Bone Expenses",
|
||||
"brokenBoneExpensesData" => "Broken Bone Expenses Data",
|
||||
"ambulanceCharges" => "Ambulance charges",
|
||||
"ambulanceChargesData" => "Ambulance charges Data",
|
||||
"burnExpenses" => "Burn Expenses",
|
||||
"burnExpensesData" => "Burn Expenses Data",
|
||||
"carriageOfDeadBody" => "Carriage of Dead Body",
|
||||
"carriageOfDeadBodyData" => "Carriage of Dead Body Data",
|
||||
"animalSnakeInsectBite" => "Animal/Snake/Insect bite",
|
||||
"terrorism" => "Terrorism",
|
||||
"worldwideCover" => "Worldwide Cover"
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($client_policy as $key => $value) {
|
||||
|
||||
$policy_terms = json_decode($value['policy_terms'], true);
|
||||
|
||||
$mapping = $gmc_keys;
|
||||
if ($value['policy_type'] == 'GPA') {
|
||||
$mapping = $gpa_keys;
|
||||
}
|
||||
|
||||
$client_policy[$key]['policy_terms'] = $this->transformArray($policy_terms, $mapping);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$data['client_policy'] = $client_policy;
|
||||
|
||||
|
||||
|
||||
|
||||
$data['client_branch'] = $this->clientModel
|
||||
|
||||
->select('
|
||||
|
||||
client_branch.branch_name,
|
||||
client_branch.branch_code,
|
||||
client_branch.city,
|
||||
level_contacts.name as hr_name,
|
||||
level_contacts.designation,
|
||||
level_contacts.mobile,
|
||||
level_contacts.email
|
||||
')
|
||||
->join('client_branch', 'client_branch.client_id = clients.id')
|
||||
->join('level_contacts', 'level_contacts.ref_id = client_branch.id')
|
||||
->where('clients.is_active', 1)
|
||||
->where('client_branch.is_active', 1)
|
||||
->where('level_contacts.is_active', 1)
|
||||
->where('level_contacts.contact_type', 'client')
|
||||
->where('clients.id', $client_id)
|
||||
->get()->getResultArray();
|
||||
|
||||
|
||||
$data['client'] = $this->clientModel
|
||||
->select('clients.*, states.state as state')
|
||||
->join('states', 'states.id = clients.state')
|
||||
->where('clients.id', $client_id)->first();
|
||||
|
||||
|
||||
$client_rm = $this->clientRMModel
|
||||
->select('client_rm.*, user_profiles.first_name as user_name')
|
||||
->join('user_profiles', 'user_profiles.id = client_rm.user_id')
|
||||
->where('client_id', $client_id)->get()->getResultArray();
|
||||
|
||||
|
||||
$account_managers = [];
|
||||
$managers = [];
|
||||
$heads = [];
|
||||
|
||||
foreach ($client_rm as $key => $value) {
|
||||
if ($value['level'] == 3) {
|
||||
$account_managers[] = $value['user_name'];
|
||||
} elseif ($value['level'] == 2) {
|
||||
$managers[] = $value['user_name'];
|
||||
} elseif ($value['level'] == 1) {
|
||||
$heads[] = $value['user_name'];
|
||||
}
|
||||
}
|
||||
|
||||
$data['account_managers'] = $account_managers;
|
||||
$data['managers'] = $managers;
|
||||
$data['heads'] = $heads;
|
||||
|
||||
// dd($data);
|
||||
//$this->loadLayout('client_info', $data);
|
||||
|
||||
|
||||
$html = view('client_info', $data);
|
||||
return $this->respond(['status' => true,'code' => 200, 'data' => $html], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function transformArray($data, $mapping)
|
||||
{
|
||||
|
||||
// dd($data);
|
||||
$transformedData = [];
|
||||
|
||||
if (!is_array($data)) {
|
||||
return json_encode($transformedData, JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if ($key == 'family_floaters') {
|
||||
$transformedData[$key] = $this->transformFamilyFloaters($value, $data);
|
||||
} else if (array_key_exists($key, $mapping)) {
|
||||
$transformedData[$mapping[$key]] = $value;
|
||||
} else if ($key == 'special_condition_label') {
|
||||
|
||||
foreach ($value as $key => $value) {
|
||||
$transformedData[$value] = $data['special_condition_input'][$key];
|
||||
}
|
||||
} else if ($key == 'gpa_special_condition_label') {
|
||||
|
||||
foreach ($value as $key => $value) {
|
||||
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
||||
}
|
||||
} else if ($key == 'age_ratio') {
|
||||
|
||||
if (isset($data['sumInsured2'])) {
|
||||
|
||||
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
|
||||
}
|
||||
} else {
|
||||
$transformedData[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($transformedData, JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
|
||||
public function transformFamilyFloaters($familyFloaters, $json)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
$min = $json['age_ratio']['self'];
|
||||
$max = $json['age_ratio']['self'];
|
||||
|
||||
$spouse_min = $json['age_ratio']['spouse'];
|
||||
$spouse_max = $json['age_ratio']['spouse'];
|
||||
|
||||
$child_min = $json['age_ratio']['child'];
|
||||
$child_max = $json['age_ratio']['child'];
|
||||
|
||||
$elders_min = $json['age_ratio']['elders'];
|
||||
$elders_max = $json['age_ratio']['elders'];
|
||||
|
||||
foreach ($familyFloaters as $key => $value) {
|
||||
if ($value !== 0) {
|
||||
switch ($key) {
|
||||
case 'self':
|
||||
$result[] = "Self (Min: {$min['min']}, Max: {$max['max']})";
|
||||
break;
|
||||
case 'spouse':
|
||||
$result[] = "Spouse (Min: {$spouse_min['min']}, Max: {$spouse_max['max']})";
|
||||
break;
|
||||
case 'childrens':
|
||||
$result[] = "Children(s) - $value (Min: {$child_min['min']}, Max: {$child_max['max']})";
|
||||
break;
|
||||
case 'parents':
|
||||
$result[] = "Parent(s) - $value (Min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
||||
break;
|
||||
case 'parents-in-law':
|
||||
$result[] = "Parents-in-Law - $value (Min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
||||
break;
|
||||
case 'either-parents-pil':
|
||||
$result[] = "Either Parents Nor Parents-in-Law - $value (elders_min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return implode(", ", $result);
|
||||
}
|
||||
|
||||
|
||||
public function deleteAdditionalRackRate($client_id, $client_policy_id, $rack_rate_type)
|
||||
{
|
||||
try {
|
||||
$result = $this->policyPremium2Model
|
||||
->where('client_id', $client_id)
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('rack_rate_type', $rack_rate_type)
|
||||
->set('is_active', 0)
|
||||
->update();
|
||||
|
||||
if (!$result) {
|
||||
|
||||
return $this->respond(['status' => false,'code' => 200, 'message' => 'Failed to update the record.'], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
log_message('error', $e->getMessage());
|
||||
return $this->respond(['status' => false,'code' => 200, 'message' => 'Failed to update the record.'], 200);
|
||||
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true,'code' => 200, 'message' => 'Additionaly Rack Rate Data Remove Successfully'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -18,11 +18,14 @@ class DashboardController extends AdminController
|
||||
use ResponseTrait;
|
||||
protected $messageModel;
|
||||
protected $userMessageModel;
|
||||
protected $myLogger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_session_context('Dashboard');
|
||||
$this->messageModel = new MessageModel();
|
||||
$this->userMessageModel = new UserMessageModel();
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
@ -34,15 +37,20 @@ class DashboardController extends AdminController
|
||||
|
||||
public function getDashboardNotifications()
|
||||
{
|
||||
//pull notofications to dashboard especially for file upload cases
|
||||
// Pull notifications for the dashboard, especially for file upload cases.
|
||||
$userId = get_session_userid();
|
||||
$roleId = 5;
|
||||
$teamId = 1;
|
||||
|
||||
$messages = $this->messageModel->getMessagesForUser($userId, $roleId, $teamId);
|
||||
|
||||
return $this->respond($messages);
|
||||
|
||||
if ($userId != null && $roleId != null && $teamId != null) {
|
||||
$messages = $this->messageModel->getMessagesForUser($userId, $roleId, $teamId);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $messages], 200);
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'The session is not set correctly. USER_ID : {user_id}, ROLE_ID : {role_id}, TEAM_ID : {team_id}', ['user_id' => $userId, 'role_id' => $roleId, 'team_id' => $teamId]);
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function acknowledgeMessage($messageId)
|
||||
{
|
||||
|
||||
@ -76,7 +76,13 @@ class EmployeeController extends AdminController
|
||||
$data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'expired' => 'Expired'];
|
||||
if (count($this->request->getGet())) {
|
||||
$filterData = $this->request->getGet();
|
||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(client_id: $filterData['client_id'], policy_id: $filterData['policy_id'], status: $filterData['status']);
|
||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
||||
client_id: $filterData['client_id'],
|
||||
policy_id: $filterData['policy_id'],
|
||||
status: $filterData['status'],
|
||||
branch_id: $filterData['branch_id']
|
||||
);
|
||||
|
||||
$data['getData'] = $filterData;
|
||||
}
|
||||
|
||||
@ -89,6 +95,8 @@ class EmployeeController extends AdminController
|
||||
//echo $this->request->isAJAX();die();
|
||||
$result = $this->clientModel->clientsWithPolicies();
|
||||
|
||||
// dd($result);
|
||||
|
||||
// print_r($result);die();
|
||||
if (!count($result)) {
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||
@ -172,16 +180,31 @@ class EmployeeController extends AdminController
|
||||
'emplist' => [
|
||||
'uploaded[emplist]',
|
||||
'mime_in[emplist,application/vnd.ms-excel,application/vnd,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.oasis.opendocument.spreadsheet]',
|
||||
'max_size[emplist,8192]',
|
||||
'max_size[emplist,16384]',
|
||||
],
|
||||
]);
|
||||
|
||||
if ($validated)
|
||||
{
|
||||
$avatar = $this->request->getFile('emplist');
|
||||
if (!$avatar) {
|
||||
$this->myLogger->logme("error", 'File not found');
|
||||
return $this->respond(['dataStatus' => false, 'code' => 400, 'message' => 'File not found'], 400);
|
||||
}
|
||||
|
||||
if ($validated) {
|
||||
$avatar = $this->request->getFile('emplist');
|
||||
$is_moved = $avatar->move(WRITEPATH . 'uploads/excel/');
|
||||
$filename = $avatar->getName();
|
||||
$is_moved = $avatar->move(WRITEPATH . 'uploads/excel/');
|
||||
if ($is_moved) {
|
||||
$filename = $avatar->getName();
|
||||
// Handle successful upload, e.g., log success or further processing
|
||||
$this->myLogger->logme("error", 'File move successful');
|
||||
|
||||
} else {
|
||||
$this->myLogger->logme("error", 'File move failed');
|
||||
return $this->respond(['dataStatus' => false, 'code' => 500, 'message' => 'File move failed'], 500);
|
||||
}
|
||||
} else {
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'invalid file'], 200);
|
||||
$this->myLogger->logme("error", 'Upload failed Invalid file');
|
||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'Invalid file'], 404);
|
||||
}
|
||||
|
||||
//process post variable entry in file table
|
||||
@ -190,10 +213,11 @@ class EmployeeController extends AdminController
|
||||
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
$branch_id = $this->request->getPost('branch_id');
|
||||
$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]); //here field policy_id have client_policy_id and not policy id from policy master
|
||||
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id]); //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
|
||||
@ -232,6 +256,7 @@ class EmployeeController extends AdminController
|
||||
'up.first_name',
|
||||
'pm.name as policy_name',
|
||||
'c.short_name',
|
||||
'cb.branch_name',
|
||||
'cp.id as client_policy_id',
|
||||
'(SELECT COUNT(*)
|
||||
FROM employees e
|
||||
@ -244,6 +269,7 @@ class EmployeeController extends AdminController
|
||||
])
|
||||
->join('user_profiles up', 'files.created_by = up.id')
|
||||
->join('client_policy cp', 'files.policy_id = cp.id', 'left')
|
||||
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||
->join('policies pm', 'cp.policy_id = pm.id', 'left')
|
||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||
->where('files.created_by', get_session_userid())
|
||||
@ -251,8 +277,9 @@ class EmployeeController extends AdminController
|
||||
->findAll();
|
||||
// dd($data['fileList']);
|
||||
|
||||
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name')
|
||||
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name, client_branch.branch_name')
|
||||
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
||||
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->join('clients', 'clients.id = client_policy.client_id')
|
||||
->orderBy('batch_files.id', 'desc')
|
||||
@ -346,42 +373,47 @@ class EmployeeController extends AdminController
|
||||
public function importExport()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error', 'importExport function called');
|
||||
$this->myLogger->logme('error', 'Import Export -- Function called');
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||
$insurer_or_tpa = $this->request->getPost('insurer_or_tpa');
|
||||
$event_type = $this->request->getPost('event_type');
|
||||
$actions = $this->request->getPost('action_type');
|
||||
|
||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
||||
$policy_name = $this->clientPolicyModel->select('policies.name')->join('policies', 'policies.id = client_policy.policy_id')->where('client_policy.id', $client_policy_id)->first();
|
||||
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']);
|
||||
$policy_name_and_branch_name = $this->clientPolicyModel->select('policies.name, client_branch.branch_code')
|
||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||
->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_and_branch_name['name'], $policy_name_and_branch_name['branch_code']);
|
||||
|
||||
$batch_data = [
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'insurer_or_tpa' => $insurer_or_tpa,
|
||||
'event_type' => $event_type,
|
||||
'actions' => $actions,
|
||||
'file_name' => $file_name,
|
||||
];
|
||||
|
||||
// $event_type = 'si_enhancement';
|
||||
|
||||
if ($actions == 'export') {
|
||||
|
||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition') {
|
||||
|
||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||
|
||||
if($return == 0){
|
||||
|
||||
if ($return == 0) {
|
||||
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
@ -391,7 +423,6 @@ class EmployeeController extends AdminController
|
||||
session()->setFlashdata('error', "No data was found for this action. The UHID has already been updated.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'Successfully exported Excel file in {data}.', ['data' => $event_type]);
|
||||
}
|
||||
@ -407,6 +438,13 @@ class EmployeeController extends AdminController
|
||||
} else if ($event_type == 'si_enhancement') {
|
||||
|
||||
$return = $empDataServiceController->generateExcelForSIEnhancement($batch_data);
|
||||
|
||||
if ($return == 0) {
|
||||
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
session()->setFlashdata('error', 'No data found about this action');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
@ -426,101 +464,90 @@ class EmployeeController extends AdminController
|
||||
} else if ($actions == 'import') {
|
||||
|
||||
$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();
|
||||
$this->myLogger->logme('error', 'Inception Import file name : {data}', ['data' => $filename]);
|
||||
|
||||
$random_number_count = 4;
|
||||
$batch_data['batch_code'] = generate_random_string($random_number_count);
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['status'] = 'pending';
|
||||
$batch_data['file_name'] = $filename;
|
||||
|
||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition') {
|
||||
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
$this->myLogger->logme('error', 'Inception Import file name : {data}', ['data' => $filename]);
|
||||
|
||||
|
||||
$random_number_count = 4;
|
||||
$batch_data['batch_code'] = generate_random_string($random_number_count);
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['status'] = 'pending';
|
||||
$batch_data['file_name'] = $filename;
|
||||
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importInceptionFileValidation','payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importInceptionFileValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importInceptionFileValidation(['file_id' => $file_id]);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The TPA ID column is either partially or entirely empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 0) {
|
||||
session()->setFlashdata('error', 'Please upload the correct file.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 3) {
|
||||
session()->setFlashdata('error', 'The list of employees provided has already been updated with the TPA ID, or this is not the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 4) {
|
||||
session()->setFlashdata('error', 'The UHID column is either partially or entirely empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 5) {
|
||||
session()->setFlashdata('error', 'The list of employees provided has already been updated with the UHID, or this is not the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 6) {
|
||||
session()->setFlashdata('error', 'The Excel record count exceeds the DB record count.');
|
||||
} else {
|
||||
session()->setFlashdata($return['status'], $return['message']);
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else if ($event_type == 'correction') {
|
||||
|
||||
$return = $empDataServiceController->importExcelDataForCorrection($batch_data);
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importCorrectionValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importCorrectionValidation(['file_id' => $file_id]);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 0) {
|
||||
session()->setFlashdata('error', 'Please upload the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 3) {
|
||||
session()->setFlashdata('error', 'File already uploaded');
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else if ($event_type == 'si_enhancement') {
|
||||
|
||||
$return = $empDataServiceController->importExcelDataForSIEnhancement($batch_data);
|
||||
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importSIEnhancementValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importSIEnhancementValidation(['file_id' => $file_id]);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 0) {
|
||||
session()->setFlashdata('error', 'Please upload the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 3) {
|
||||
session()->setFlashdata('error', 'File already uploaded');
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else if ($event_type == 'deletion') {
|
||||
|
||||
$return = $empDataServiceController->importExcelDataForDeletion($batch_data);
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importDeletionValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importDeletionValidation(['file_id' => $file_id]);
|
||||
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 0) {
|
||||
session()->setFlashdata('error', 'Please upload the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 3) {
|
||||
session()->setFlashdata('error', 'File already uploaded');
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
}
|
||||
@ -544,8 +571,13 @@ class EmployeeController extends AdminController
|
||||
$data['status'] = ['pending' => 'Pending', 'inprogress' => 'In-Progress', 'complete' => 'Complete'];
|
||||
if (count($this->request->getGet())) {
|
||||
$filterData = $this->request->getGet();
|
||||
$data['employees'] = $this->employeePolicyModel->getEmployeeEndorsementList(client_id: $filterData['client_id'], policy_id: $filterData['policy_id'], status: $filterData['status']);
|
||||
$data['getData'] = $filterData;
|
||||
$data['employees'] = $this->employeePolicyModel->getEmployeeEndorsementList(
|
||||
client_id: $filterData['client_id'],
|
||||
policy_id: $filterData['policy_id'],
|
||||
status: $filterData['status'],
|
||||
branch_id: $filterData['branch_id']
|
||||
);
|
||||
$data['getData'] = $filterData;
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
}
|
||||
@ -684,6 +716,9 @@ class EmployeeController extends AdminController
|
||||
|
||||
public function viewUploadedEmployeeList()
|
||||
{
|
||||
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
|
||||
$file_id = $this->request->getGet('file_id');
|
||||
// $emp_data['employees'] = $this->employeePolicyModel->getViewEmpSuccessList($file_id);
|
||||
// $html = view('view_file_upload_emp_list', $emp_data);
|
||||
@ -695,20 +730,21 @@ class EmployeeController extends AdminController
|
||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||
->where('files.id', $file_id)->first();
|
||||
|
||||
// dd($file_name);
|
||||
|
||||
try {
|
||||
|
||||
$filePath = WRITEPATH . '/uploads/excel/' . $file_name['file_name'];
|
||||
|
||||
if (file_exists($filePath)) {
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filePath);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
// dd($excel_data);
|
||||
|
||||
$excel_data = $empDataServiceController->readExcelFileToArray($filePath);
|
||||
$emp_data['thead'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
$emp_data['tbody'] = $excel_data;
|
||||
$emp_data['count'] = count($excel_data);
|
||||
|
||||
// dd($emp_data);
|
||||
|
||||
$html = view('view_file_upload_emp_list', $emp_data);
|
||||
} else {
|
||||
@ -854,8 +890,9 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function generateIDCardForEmployee($rand_string)
|
||||
{
|
||||
public function generateIDCardForEmployee($rand_string, $people = 0)
|
||||
{
|
||||
// dd($rand_string, $people);
|
||||
|
||||
try {
|
||||
|
||||
@ -883,9 +920,13 @@ class EmployeeController extends AdminController
|
||||
$client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
|
||||
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
|
||||
|
||||
// $data['data'] = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code);
|
||||
|
||||
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code);
|
||||
|
||||
if($people == 0){
|
||||
$data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code);
|
||||
}
|
||||
|
||||
// dd($data);
|
||||
|
||||
$template_data_path = WRITEPATH . 'e_card_template/';
|
||||
@ -920,15 +961,27 @@ class EmployeeController extends AdminController
|
||||
'{DOB}' => date('d-M-Y', strtotime($value['dob'])),
|
||||
'{SELF_NAME}' => $value['self'] ?? $value['name'],
|
||||
'{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])),
|
||||
'{INSURER_NAME}' => $value['insurer_name'],
|
||||
'{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
|
||||
'{POLICY_NO}' => date('d-M-Y', strtotime($value['policy_start_date'])),
|
||||
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
|
||||
'{INSURER_LOGO}' => base_url() . 'public/uploads/logo/' . $value['insurer_logo'],
|
||||
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['front_card'],
|
||||
'{BACK_CARD}' => base_url() . 'public/uploads/logo/' . $value['back_card'],
|
||||
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $value['back_card'],
|
||||
'{EMP_ID}' =>$value['emp_code'],
|
||||
'{CORPORATE_NAME}' =>$value['client_name'],
|
||||
'{AGE}' =>$value['emp_age'],
|
||||
'{TPA_NAME}' =>$value['emp_age'],
|
||||
'{TPA_NAME}' =>$value['tpa_name'],
|
||||
'{INSURER_BRANCH}' =>$value['insurer_branch_city'],
|
||||
'{RELATION}' =>$value['relationship'],
|
||||
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $value['tpa_logo'],
|
||||
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
|
||||
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
|
||||
'{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
|
||||
'{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
|
||||
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
|
||||
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
|
||||
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
|
||||
|
||||
];
|
||||
|
||||
// Replace placeholders with values in HTML content
|
||||
@ -1008,6 +1061,34 @@ class EmployeeController extends AdminController
|
||||
{
|
||||
|
||||
$this->loadLayout('ecard_template/default_ecard');
|
||||
|
||||
// Load the session library if it's not autoloaded
|
||||
// $session = \Config\Services::session();
|
||||
|
||||
// Access session data
|
||||
$sessionData = session()->get();
|
||||
|
||||
// Check if session data exists and if expiration time is set
|
||||
if (!empty($sessionData) && isset($sessionData['isLoggedIn']) && isset($sessionData['session_expiration'])) {
|
||||
// Get the session expiration timestamp
|
||||
$expirationTimestamp = $sessionData['session_expiration'];
|
||||
|
||||
// Get the current timestamp
|
||||
$currentTimestamp = time();
|
||||
|
||||
// Check if the current time is greater than the expiration time
|
||||
if ($currentTimestamp > $expirationTimestamp) {
|
||||
// Session has expired
|
||||
echo "Session has expired";
|
||||
} else {
|
||||
// Session is active
|
||||
echo "Session is active";
|
||||
}
|
||||
} else {
|
||||
// Session data is not set or session is not started
|
||||
echo "Session is not started or data is not set";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1064,9 +1145,32 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function previewTemplate($id = null){
|
||||
|
||||
|
||||
public function previewTemplate($id = null)
|
||||
{
|
||||
|
||||
|
||||
$value = [
|
||||
'tpa_id' => 'TPA12345',
|
||||
'name' => 'John Doe',
|
||||
'uhid' => 'UHID67890',
|
||||
'gender' => 'Male',
|
||||
'dob' => '1985-05-15',
|
||||
'self' => 'John Doe',
|
||||
'policy_end_date' => '2024-12-31',
|
||||
'policy_start_date' => '2023-01-01',
|
||||
'policy_no' => 'POL1234567890',
|
||||
'insurer_name' => 'Example Insurance Company',
|
||||
'emp_code' => 'EMP001122',
|
||||
'client_name' => 'Corporate Client Inc.',
|
||||
'emp_age' => 39,
|
||||
'tpa_name' => 'Example TPA',
|
||||
'insurer_branch_city' => 'New York',
|
||||
'relationship' => 'Self'
|
||||
];
|
||||
|
||||
|
||||
$tpa_id = $this->TPAModel->where('id', $id)->first();
|
||||
|
||||
$template_data_path = WRITEPATH . 'e_card_template/';
|
||||
@ -1077,28 +1181,52 @@ class EmployeeController extends AdminController
|
||||
|
||||
$data['message'] = 'Record Not Found';
|
||||
return view('errors/404', $data);
|
||||
}
|
||||
}
|
||||
|
||||
$tmplt_data = file_get_contents($final_path);
|
||||
|
||||
$placeholders = [
|
||||
'{TPA_ID}' => $value['tpa_id'],
|
||||
'{NAME}' => $value['name'],
|
||||
'{UHID}' => $value['uhid'],
|
||||
'{GENDER}' => $value['gender'],
|
||||
'{DOB}' => date('d-M-Y', strtotime($value['dob'])),
|
||||
'{SELF_NAME}' => $value['self'] ?? $value['name'],
|
||||
'{POLICY_DATE}' => date('d-M-Y', strtotime($value['policy_end_date'])),
|
||||
'{POLICY_START_DATE}' => date('d-M-Y', strtotime($value['policy_start_date'])),
|
||||
'{POLICY_NO}' => $value['policy_no'],
|
||||
'{INSURER_NAME}' => strtoupper($value['insurer_name']),
|
||||
'{EMP_ID}' => $value['emp_code'],
|
||||
'{CORPORATE_NAME}' => $value['client_name'],
|
||||
'{AGE}' => $value['emp_age'],
|
||||
'{TPA_NAME}' => $value['tpa_name'],
|
||||
'{INSURER_BRANCH}' => $value['insurer_branch_city'],
|
||||
'{RELATION}' => $value['relationship'],
|
||||
'{FRONT_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['front_card'],
|
||||
'{BACK_CARD}' => base_url() . 'public/uploads/logo/' . $tpa_id['back_card'],
|
||||
'{BACK_CARD}' => base_url() . 'public/uploads/template_bg/' . $tpa_id['back_card'],
|
||||
'{TPA_LOGO}' => base_url() . 'public/uploads/logo/' . $tpa_id['tpa_logo'],
|
||||
'{INSURER_LOGO}' => base_url() . 'public/assets/images/sample_logo_3.png',
|
||||
'{MEDI_USER}' => base_url() . 'public/e_card_imgs/medi_uesr.jpg',
|
||||
'{MEDI_INSURER}' => base_url() . 'public/e_card_imgs/Magma.png',
|
||||
'{MEDI_BARCODE}' => base_url() . 'public/e_card_imgs/borcode.jpeg',
|
||||
'{QR_ANDROID}' => base_url() . 'public/e_card_imgs/android.png',
|
||||
'{QR_IOS}' => base_url() . 'public/e_card_imgs/ios.png',
|
||||
'{QR_ANDROID_2}' => base_url() . 'public/e_card_imgs/play_store.png',
|
||||
'{QR_IOS_2}' => base_url() . 'public/e_card_imgs/appstore.png',
|
||||
|
||||
];
|
||||
|
||||
|
||||
// Get the values to replace the placeholders
|
||||
$replaceValues = array_values($placeholders);
|
||||
|
||||
|
||||
// Get the placeholders to search for
|
||||
$searchPlaceholders = array_keys($placeholders);
|
||||
|
||||
|
||||
// Replace placeholders with values in HTML content
|
||||
$htmlContent = str_replace($searchPlaceholders, $replaceValues, $tmplt_data);
|
||||
|
||||
|
||||
echo $htmlContent;
|
||||
|
||||
|
||||
echo $htmlContent;
|
||||
}
|
||||
|
||||
|
||||
@ -1111,6 +1239,7 @@ class EmployeeController extends AdminController
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
$event_type = $file['event_type'];
|
||||
|
||||
$error_data = json_decode($file['error_data']);
|
||||
|
||||
@ -1126,8 +1255,10 @@ class EmployeeController extends AdminController
|
||||
$excel_data = $empDataServiceController->readExcelFileToArray($file_name_with_path);
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
|
||||
if($event_type == 'inception' || $event_type == 'deletion'){
|
||||
array_pop($excel_data);
|
||||
}
|
||||
|
||||
$finalArray = [];
|
||||
foreach ($error_data as $key => $values) {
|
||||
@ -1143,15 +1274,22 @@ class EmployeeController extends AdminController
|
||||
|
||||
}else{
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
if($event_type == 'inception'){
|
||||
|
||||
$error = 'Expected value : TPA ID';
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
$error = 'Expected value : UHID';
|
||||
$error = 'Expected value : TPA ID';
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
$error = 'Expected value : UHID';
|
||||
}
|
||||
|
||||
}else{
|
||||
$error = 'Expected value : ENDORSEMENT ID';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$data = ['value' => $excel_data[$row][$column], 'error' => $error,];
|
||||
$excel_data[$row][$column] = $data;
|
||||
@ -1182,9 +1320,18 @@ class EmployeeController extends AdminController
|
||||
{
|
||||
$client_policy_id = $this->request->uri->getSegment(3);
|
||||
$policy_details = $this->clientPolicyModel->find($client_policy_id);
|
||||
// print_r($policy_details);die();
|
||||
$policy_terms = isset($policy_details['policy_terms']) ? true : false;
|
||||
|
||||
$si_enhancement_true_or_false = 1;
|
||||
if($policy_terms){
|
||||
$policyTermsData = json_decode($policy_details['policy_terms']);
|
||||
|
||||
if (isset($policyTermsData->suminsuredenhancement) && $policyTermsData->suminsuredenhancement !== null) {
|
||||
$si_enhancement_true_or_false = $policyTermsData->suminsuredenhancement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']);
|
||||
|
||||
$message = null;
|
||||
@ -1199,7 +1346,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
$message = isset($message) ? ($message . ' not defined for choosed policy') : null;
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message], 200);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,9 @@ use App\Models\PolicyPremium2Model;
|
||||
use App\Models\PolicyTypeModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\UserModel;
|
||||
use App\Models\FEContentModel;
|
||||
use App\Models\AddImgModel;
|
||||
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
@ -57,6 +60,8 @@ class EmployeeRestController extends AdminController
|
||||
protected $policyTypeModel;
|
||||
protected $notificationModel;
|
||||
protected $userModel;
|
||||
protected $feContentModel;
|
||||
protected $addImgModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -76,6 +81,8 @@ class EmployeeRestController extends AdminController
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->userModel = new UserModel();
|
||||
$this->feContentModel = new FEContentModel();
|
||||
$this->addImgModel = new AddImgModel();
|
||||
}
|
||||
|
||||
|
||||
@ -84,15 +91,22 @@ class EmployeeRestController extends AdminController
|
||||
try {
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||
if ($emp_code) {
|
||||
$relationship = 'self';
|
||||
$employee = $this->employeeModel->where('emp_code', $emp_code)
|
||||
->where('client_id', $client_id)
|
||||
->where('client_branch_id', $client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('relationship', $relationship)
|
||||
->first();
|
||||
$result = $employee;
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
$AccountManagerDetails = $this->clientRMModel->select('client_rm.* , user_profiles.*')
|
||||
->join('user_profiles', 'client_rm.user_id = user_profiles.id', 'left')
|
||||
->where('client_rm.client_id', $client_id )
|
||||
->where('client_rm.level', 3 )
|
||||
->findAll();
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result, 'AccountManagerDetails'=> isset($AccountManagerDetails[0]) ? $AccountManagerDetails[0] : null ],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||
@ -102,7 +116,7 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//not in use
|
||||
public function editEmployeeProfile()
|
||||
{
|
||||
try {
|
||||
@ -125,7 +139,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
//not in use
|
||||
public function getEmployeeAndDependence()
|
||||
{
|
||||
try {
|
||||
@ -152,7 +166,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
//not in use
|
||||
public function editEmployeeAndDependence()
|
||||
{
|
||||
try {
|
||||
@ -348,7 +362,7 @@ class EmployeeRestController extends AdminController
|
||||
$Gender = $this->employeeModel->where('emp_code',$empCode)->where('relationship','Self')->get()->getRow()->gender;
|
||||
if($Gender == 'M'){ return 'F'; }else{ return 'M'; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function convertDateFormatYMD($dateString)
|
||||
{
|
||||
@ -372,6 +386,7 @@ class EmployeeRestController extends AdminController
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteDependence()
|
||||
{
|
||||
try {
|
||||
@ -400,11 +415,78 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
// Get the RelationShip list
|
||||
public function createOrUpdateEmployeePolicySiAmount()
|
||||
{
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON();
|
||||
|
||||
foreach ($requestData as $key => $value) {
|
||||
|
||||
|
||||
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
||||
->where('client_policy_id', $value->client_policy_id)
|
||||
->where('is_active', 1 )
|
||||
->findAll();
|
||||
|
||||
|
||||
// dd($checkIfExist);
|
||||
if ($checkIfExist) {
|
||||
|
||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
|
||||
|
||||
}else{
|
||||
|
||||
$data['employee_id']= $value->employee_id;
|
||||
$data['client_policy_id']= $value->client_policy_id;
|
||||
$data['basic_cover_si']= $value->basic_cover_si;
|
||||
$data['status'] = 'draft';
|
||||
|
||||
$this->employeePolicyModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code);
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function findPremiumAmount($slabArray,$siAmount)
|
||||
{
|
||||
foreach ($slabArray as $key => $value) {
|
||||
if($value['si'] == $siAmount){
|
||||
return $value['premium'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function relationshipList()
|
||||
{
|
||||
try {
|
||||
|
||||
$relation_ships= $this->relationshipModel->findAll();
|
||||
|
||||
if(count($relation_ships) > 0){
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getEmployeeAndDependenceByClientId()
|
||||
{
|
||||
try {
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0);
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
|
||||
if ($empData) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
||||
@ -419,11 +501,11 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function exportDataByClientPolicyId()
|
||||
{
|
||||
try {
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0);
|
||||
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
|
||||
if(count($empData))
|
||||
{
|
||||
@ -496,6 +578,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
//not in use
|
||||
public function getClientPolicy()
|
||||
{
|
||||
try {
|
||||
@ -534,73 +617,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
|
||||
// Get the RelationShip list
|
||||
|
||||
public function createOrUpdateEmployeePolicySiAmount()
|
||||
{
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON();
|
||||
|
||||
foreach ($requestData as $key => $value) {
|
||||
|
||||
|
||||
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
||||
->where('client_policy_id', $value->client_policy_id)
|
||||
->where('is_active', 1 )
|
||||
->findAll();
|
||||
|
||||
|
||||
// dd($checkIfExist);
|
||||
if ($checkIfExist) {
|
||||
|
||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
|
||||
|
||||
}else{
|
||||
|
||||
$data['employee_id']= $value->employee_id;
|
||||
$data['client_policy_id']= $value->client_policy_id;
|
||||
$data['basic_cover_si']= $value->basic_cover_si;
|
||||
$data['status'] = 'draft';
|
||||
|
||||
$this->employeePolicyModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code);
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function findPremiumAmount($slabArray,$siAmount)
|
||||
{
|
||||
foreach ($slabArray as $key => $value) {
|
||||
if($value['si'] == $siAmount){
|
||||
return $value['premium'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public function relationshipList()
|
||||
{
|
||||
try {
|
||||
|
||||
$relation_ships= $this->relationshipModel->findAll();
|
||||
|
||||
if(count($relation_ships) > 0){
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// Upload the Employee Detail in DB by Sheet Data
|
||||
public function employeeUpload()
|
||||
@ -614,6 +631,7 @@ class EmployeeRestController extends AdminController
|
||||
// die;
|
||||
$file = $this->request->getFile('file');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
|
||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
||||
@ -632,7 +650,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first();
|
||||
if ($client_policy) {
|
||||
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
|
||||
$policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
|
||||
@ -666,6 +684,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$extractData['file_name']= $filename;
|
||||
$extractData['client_id']= $client_id;
|
||||
$extractData['client_branch_id']= $client_branch_id;
|
||||
$extractData['status']= 'success';
|
||||
$extractData['policy_id']= $policy_id;
|
||||
$extractData['action']= 'enrollment';
|
||||
@ -772,6 +791,7 @@ class EmployeeRestController extends AdminController
|
||||
'client_id' => $client_id,
|
||||
'emp_status'=>'draft',
|
||||
'band'=> $extra['10'][$index],
|
||||
'client_branch_id' => $client_branch_id
|
||||
|
||||
];
|
||||
$basic_cover_si_value = null;
|
||||
@ -928,13 +948,15 @@ public function getAgeRange($terms,$familyFloatesValue)
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getEmployeePolicy()
|
||||
{
|
||||
try {
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||
|
||||
// This is an array containing keys to be removed from the terms and conditions array
|
||||
$keysToRemove = ["removable_keys"];
|
||||
@ -942,8 +964,11 @@ public function getEmployeePolicy()
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id)
|
||||
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
|
||||
->where('client_id',$client_id)
|
||||
->where('client_branch_id',$client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('is_addon_value',0)->findAll();
|
||||
|
||||
|
||||
if ($empPolicy) {
|
||||
@ -1091,12 +1116,13 @@ public function getEmployeePolicy()
|
||||
->where('client_policy.policy_type_id', 3 )
|
||||
->where('client_policy.is_addon', 1 )
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->get()
|
||||
->getResult();
|
||||
if($checkGmcParentsPolicyExist)
|
||||
{
|
||||
$GmcParrentsData = $this->getGmcParrentsPolicy($checkGmcParentsPolicyExist,$emp_code,$client_id);
|
||||
$GmcParrentsData = $this->getGmcParrentsPolicy($checkGmcParentsPolicyExist,$emp_code,$client_id,$client_branch_id);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => [$array,$GmcParrentsData]], 200);
|
||||
|
||||
}
|
||||
@ -1122,11 +1148,14 @@ public function getEmployeePolicy()
|
||||
}
|
||||
|
||||
|
||||
public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||
public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$client_branch_id)
|
||||
{
|
||||
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id)
|
||||
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
|
||||
->where('client_id',$client_id)
|
||||
->where('client_branch_id',$client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('is_addon_value',0)->findAll();
|
||||
foreach ($GmcParrentsPolicy as $key => $array) {
|
||||
|
||||
|
||||
@ -1163,9 +1192,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||
$array->eCardDownload = null;
|
||||
}
|
||||
|
||||
// if($array->tpa_id != null){
|
||||
// $array->eCardDownload = base_url('download-e-card/') . $array->rand_string;
|
||||
// }else{ $array->eCardDownload = null; }
|
||||
|
||||
$array->eCardDownload = null;
|
||||
|
||||
// Map family floaters that already exist in the employee table
|
||||
@ -1256,6 +1283,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function FloterConvertion($array){
|
||||
|
||||
$result = [];
|
||||
@ -1320,7 +1348,8 @@ public function getClientDetails()
|
||||
$client = $this->clientModel->where('id',$this->request->getGet('client_id'))->first();
|
||||
if($client) {
|
||||
$client['client_logo'] = base_url().'public/uploads/logo/'.$client['client_logo'];
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))->findAll();
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => ['client'=>$client,'client_policy'=>$clientPolicy]], 200);
|
||||
|
||||
}else{
|
||||
@ -1335,17 +1364,23 @@ public function getAddOnPolicy()
|
||||
{
|
||||
try {
|
||||
|
||||
$addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',1)->findAll();
|
||||
$addOnEmployeeData = $this->employeeModel->where('is_active', 1 )
|
||||
->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('is_addon_value',1)->findAll();
|
||||
|
||||
|
||||
|
||||
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('policy_status', 1)
|
||||
->findAll();
|
||||
|
||||
|
||||
if(count($clientPolicy))
|
||||
{
|
||||
$band = $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('family_floater_key','self')->get()->getRow()->band;
|
||||
$band = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('client_branch_id',$this->request->getGet('client_branch_id'))->where('family_floater_key','self')->get()->getRow()->band;
|
||||
|
||||
$PolicyData = [];
|
||||
foreach ($clientPolicy as $key => $array) {
|
||||
$responce = [];
|
||||
@ -1361,9 +1396,16 @@ public function getAddOnPolicy()
|
||||
$uniqueData[] = $item;
|
||||
}
|
||||
}else{
|
||||
if (!in_array($item['si'], $siValues)) {
|
||||
$uniqueData[] = $item;
|
||||
$siValues[] = $item['si'];
|
||||
if (!in_array($item['si'], $siValues) ) {
|
||||
|
||||
if ($item['policy_grid_id'] == 11 && ($item['max_si'] != 0 || $item['max_si'] != null)) {
|
||||
$uniqueData[] = $item;
|
||||
$siValues[] = $item['si'];
|
||||
}else if($item['policy_grid_id'] != 11){
|
||||
$uniqueData[] = $item;
|
||||
$siValues[] = $item['si'];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1768,6 +1810,7 @@ public function getCashDepositData()
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->groupBy('client_policy.insurer_id')
|
||||
@ -1789,6 +1832,7 @@ public function getCashDepositData()
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->where('client_policy.insurer_id', $value['insurerId'] )
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->findAll();
|
||||
@ -1797,7 +1841,7 @@ public function getCashDepositData()
|
||||
{
|
||||
|
||||
$value['type'] = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow()->policy_type;
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0);
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
$enrolledCount = 0;
|
||||
$draftCount = 0;
|
||||
if(count($employeeDetails))
|
||||
@ -1970,23 +2014,30 @@ public function removeEmpAndEmpPolicyData()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getEmployeeOldPolicy()
|
||||
function getEmployeeActiveOrInactivePolicy()
|
||||
{
|
||||
|
||||
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; }
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 0)
|
||||
->where('client_policy.policy_status', $policy_status)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
->findAll();
|
||||
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('is_active', 1 )->findAll();
|
||||
$employeeName = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('family_floater_key','self')->where('is_active', 1 )
|
||||
->get()->getRow()->name;
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
|
||||
@ -1995,15 +2046,22 @@ function getEmployeeOldPolicy()
|
||||
$result = [];
|
||||
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
||||
|
||||
|
||||
|
||||
$terms = json_decode($ClientPolicyValue['policy_terms']);
|
||||
// dd($terms);
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['policy_terms'] = $this->policyTermsFiter($terms,'gpa'); }
|
||||
else{ $data['policy_terms'] = $this->policyTermsFiter($terms,'gmc'); }
|
||||
|
||||
$data['client_id'] = $ClientPolicyValue['client_id'];
|
||||
$data['client_policy_id'] = $ClientPolicyValue['id'];
|
||||
$data['policy_name'] = $ClientPolicyValue['policy_name'];
|
||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||
$data['policy_no'] = $ClientPolicyValue['policy_no'];
|
||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||
// $data['policy_terms'] = $terms;
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
||||
@ -2017,29 +2075,42 @@ function getEmployeeOldPolicy()
|
||||
if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
|
||||
}
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string')
|
||||
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->whereIn('employee_polices.employee_id',$whereArrayForId)
|
||||
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
$si_value = 0;
|
||||
$si_premium_value = 0;
|
||||
$si_gst_value = 0;
|
||||
foreach ($employee_policy as $key => $value) {
|
||||
if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
|
||||
if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
|
||||
if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
|
||||
}
|
||||
if(count($employee_policy) > 0)
|
||||
{
|
||||
$si_value = 0;
|
||||
$si_premium_value = 0;
|
||||
$si_gst_value = 0;
|
||||
|
||||
foreach ($employee_policy as $key => $value) {
|
||||
if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
|
||||
if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
|
||||
if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
|
||||
}
|
||||
|
||||
$data['si_value'] = $si_value;
|
||||
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
|
||||
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
|
||||
|
||||
$data['EmployeePolicy'] = $employee_policy;
|
||||
array_push($result, $data);
|
||||
|
||||
if($employee_policy[0]['tpa_id'] != null)
|
||||
$data['eCardDownload'] = base_url('download-e-card/') . $employee_policy[0]['rand_string'];
|
||||
else
|
||||
$data['eCardDownload'] = null;
|
||||
|
||||
|
||||
|
||||
$data['si_value'] = $si_value;
|
||||
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
|
||||
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
|
||||
|
||||
$data['EmployeePolicy'] = $employee_policy;
|
||||
array_push($result, $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ], 200);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result , 'emp_name' => $employeeName ], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
|
||||
@ -2047,81 +2118,70 @@ function getEmployeeOldPolicy()
|
||||
|
||||
}
|
||||
|
||||
function getEmployeeActiveOrInactivePolicy()
|
||||
|
||||
function policyTermsFiter($terms , $type)
|
||||
{
|
||||
|
||||
$gpa = [
|
||||
"sumInsured2" => "Sum Insured",
|
||||
"totalSumInsured" => "Total Sum Assured",
|
||||
"self" => "Self",
|
||||
"self_min_age" => "Min Age",
|
||||
"self_max_age" => "Max Age",
|
||||
"accidentalDeathBenefit" => "Accidental Death Benefit",
|
||||
"permanentTotalDisablement" => "Permanent Total Disablement",
|
||||
"permanentPartialDisablement" => "Permanent Partial Disablement",
|
||||
"temporaryTotalDisablementBenefit" => "Temporary Total Disablement benefit",
|
||||
"accidentalHospitalizationExpenses" => "Accidental Hospitalization Expenses",
|
||||
"childrenEducationWelfareFund" => "Children Education Welfare Fund",
|
||||
"compassionateVisitExpenses" => "Compassionate Visit Expenses",
|
||||
"compassionateVisitExpensesData" => "Compassionate Visit Expenses Data",
|
||||
"brokenBoneExpenses" => "Broken Bone Expenses",
|
||||
"brokenBoneExpensesData" => "Broken Bone Expenses Data",
|
||||
"ambulanceCharges" => "Ambulance charges",
|
||||
"ambulanceChargesData" => "Ambulance charges Data",
|
||||
"burnExpenses" => "Burn Expenses",
|
||||
"burnExpensesData" => "Burn Expenses Data",
|
||||
"carriageOfDeadBody" => "Carriage of Dead Body",
|
||||
"carriageOfDeadBodyData" => "Carriage of Dead Body Data",
|
||||
"animalSnakeInsectBite" => "Animal/Snake/Insect bite",
|
||||
"terrorism" => "Terrorism",
|
||||
"worldwideCover" => "Worldwide Cover"
|
||||
];
|
||||
|
||||
$gmc = [
|
||||
"sum_insured" => "Sum Insured",
|
||||
"waiverofpreexistingdiseases" => "Waiver of Pre-existing Diseases",
|
||||
"maternitycoverage" => "Maternity Coverage",
|
||||
"babyday1cover" => "Baby Day 1 Cover",
|
||||
"9monthwaitingperiodwaived" => "9-month waiting Period –waived",
|
||||
"coverfromthedateofjoining" => "Cover from the date of Joining",
|
||||
"waiverof1,2,3&4thyearexclusions" => "Waiver of 1, 2, 3 & 4th year Exclusions",
|
||||
"waiverof30dayswaitingperiod" => "Waiver of 30 days waiting period",
|
||||
"prehospitalizationcover" => "Pre Hospitalization Cover",
|
||||
"copayzonewisecopay" => "Co-Pay/Zone wise Co Pay",
|
||||
"roomrentlimit" => "Room Rent Limit",
|
||||
"ailmentcapping" => "Ailment capping",
|
||||
];
|
||||
|
||||
if($this->request->getGet('type') == 'Active'){ $value = 1; }else{ $value = 0; }
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', $value)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
->findAll();
|
||||
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('is_active', 1 )->findAll();
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
|
||||
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
||||
|
||||
$terms = json_decode($ClientPolicyValue['policy_terms']);
|
||||
// dd($terms);
|
||||
$data['client_id'] = $ClientPolicyValue['client_id'];
|
||||
$data['client_policy_id'] = $ClientPolicyValue['id'];
|
||||
$data['policy_name'] = $ClientPolicyValue['policy_name'];
|
||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['floter_text_heading'] = 'Sum Insured'; }
|
||||
else
|
||||
{
|
||||
if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
|
||||
}
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->whereIn('employee_polices.employee_id',$whereArrayForId)
|
||||
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
$si_value = 0;
|
||||
$si_premium_value = 0;
|
||||
$si_gst_value = 0;
|
||||
foreach ($employee_policy as $key => $value) {
|
||||
if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
|
||||
if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
|
||||
if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
|
||||
}
|
||||
|
||||
$data['si_value'] = $si_value;
|
||||
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
|
||||
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
|
||||
|
||||
$data['EmployeePolicy'] = $employee_policy;
|
||||
array_push($result, $data);
|
||||
$finalarray = [];
|
||||
if($type == 'gpa'){
|
||||
foreach ($gpa as $key => $value) {
|
||||
if(isset($terms->$key))
|
||||
$finalarray[$value] = $terms->$key;
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
|
||||
foreach ($gmc as $key => $value) {
|
||||
if(isset($terms->$key))
|
||||
$finalarray[$value] = $terms->$key;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $finalarray;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2137,4 +2197,46 @@ private function convertDateFormatDisplay($dateString)
|
||||
}
|
||||
}
|
||||
|
||||
public function getFEContent()
|
||||
{
|
||||
try {
|
||||
|
||||
$feContentData = $this->feContentModel->findAll();
|
||||
if (count($feContentData) > 0) {
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $feContentData ],200);
|
||||
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAdvertisementImage()
|
||||
{
|
||||
try {
|
||||
|
||||
$img = $this->addImgModel->where('is_active',1)->findAll();
|
||||
|
||||
if (count($img) > 0) {
|
||||
$data=[];
|
||||
foreach ($img as $key => $value) {
|
||||
$url = base_url('public/uploads/add_image_upload/').$value['name'];
|
||||
array_push($data,$url);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $data ],200);
|
||||
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -229,12 +229,13 @@ class EmployeeServiceController extends AdminController
|
||||
$result['error_data'][$row_key][$keys[$col_key]]['error'][] = $format_error['error'];
|
||||
}
|
||||
}
|
||||
|
||||
// Kint::dump($is_mandatory);
|
||||
//allowed values check
|
||||
if($is_mandatory === true && isset($allowed_values) && is_array($allowed_values))
|
||||
if(($is_mandatory === true && isset($allowed_values) && is_array($allowed_values)) || (is_array($is_mandatory) && (isset($allowed_values) && is_array($allowed_values))))
|
||||
{
|
||||
|
||||
if(!in_array(strtolower(trim($col)),$allowed_values))
|
||||
// print_r($allowed_values);
|
||||
// dd($col);
|
||||
if(!in_array((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
|
||||
@ -263,9 +264,9 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}//col foreach
|
||||
// break;
|
||||
}//row foreach
|
||||
|
||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||
{
|
||||
@ -348,102 +349,114 @@ class EmployeeServiceController extends AdminController
|
||||
unset($excel_data[0]);
|
||||
$relationship = $this->general_relationships;
|
||||
|
||||
$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'],policy_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(array_keys($existing_famility_details[0]));
|
||||
$family = array_merge($family,$existing_famility_details);
|
||||
// kint::dump($family);
|
||||
$family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array
|
||||
}
|
||||
// kint::dump($family);//die();
|
||||
//check name dup within a family
|
||||
if(in_array($file['action'],['inception','addition','dependent_addition']))// the below funcitons are only for I,DA,A
|
||||
{
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||
|
||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')
|
||||
{
|
||||
$res = name_dup_check_within_family($family,$file['action']);
|
||||
// dd($res);
|
||||
if(count($res))
|
||||
$is_self_available_in_policy_terms = false;
|
||||
if($policy_details['policy_type_id'] == 3) // GMC parents
|
||||
{
|
||||
foreach($res as $k => $rowid)
|
||||
$temp = $policy_terms['family_floaters'];
|
||||
$temp = is_array($temp) ? $temp : (is_object($temp) ? (array)$temp : []);
|
||||
$is_self_available_in_policy_terms = isset($temp['self']) ? true : false;
|
||||
}
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
{
|
||||
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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//check self availbale in uploaded file
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition') && ($policy_details['policy_type_id'] == 3 && $policy_details['base_policy'] == null)) // 3 is GMC parents dep addon)
|
||||
{
|
||||
// dd('file check');
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
// dd($res);
|
||||
if(!$res['is_self_found'])
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $res['row_id'] ]['sno']['error'][] = "Self not found in uploaded file";
|
||||
}
|
||||
}
|
||||
//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'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ]);
|
||||
// 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(array_keys($existing_famility_details[0]));
|
||||
$family = array_merge($family,$existing_famility_details);
|
||||
// kint::dump($family);
|
||||
$family = data_group_by_family($family)[ $emp_id ];// reason to call this again is bring self to first index of the array
|
||||
}
|
||||
// kint::dump($family);//die();
|
||||
//check name dup within a family
|
||||
|
||||
//check self avaialbe where self data is not available either same policy (i.e.) gMC parents
|
||||
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && $policy_details['base_policy'] == null)) // 3 is GMC parents as base policy not as dep addon)
|
||||
{
|
||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active']);
|
||||
// dd($self_details);
|
||||
if(!count($self_details))
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found in System";
|
||||
}
|
||||
}
|
||||
|
||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')
|
||||
{
|
||||
$res = name_dup_check_within_family($family,$file['action']);//in both file data & DB data
|
||||
// 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 self availbale in uploaded file
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'addition') && ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
||||
{
|
||||
// dd('file check');
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
// dd($res);
|
||||
if(!$res['is_self_found'])
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $res['row_id'] ]['sno']['error'][] = "Self not found in uploaded file";
|
||||
}
|
||||
}
|
||||
|
||||
//check dup with empid and name with db
|
||||
$res = name_and_empid_check_in_db($family,$file);
|
||||
// dd($res);
|
||||
// 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 self avaialbe either same policy DB level(i.e.) gMC parents
|
||||
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && !$is_self_available_in_policy_terms)) // 3 is GMC parents as base policy not as dep addon)
|
||||
{
|
||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ]);
|
||||
// dd($self_details);
|
||||
if(!count($self_details))
|
||||
{
|
||||
array_push($result['error_summary'],14); // Self not found
|
||||
$result['error_data'][ $family[0][0] ]['sno']['error'][] = "Self not found in System";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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($res);
|
||||
// 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";
|
||||
}
|
||||
}
|
||||
}// end of foreach
|
||||
}// end of if current action I,DA,A
|
||||
|
||||
// s($result);
|
||||
// die();
|
||||
@ -559,7 +572,7 @@ class EmployeeServiceController extends AdminController
|
||||
//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'],policy_status:['active']);
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active'],client_branch_id: [ $file['client_branch_id'] ]);
|
||||
// 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);
|
||||
@ -652,14 +665,14 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
$group_key = rand(100000, 999999);
|
||||
//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','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
// 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','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$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','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$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' => 'inactive','created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
};
|
||||
//iterate each row
|
||||
foreach ($excel_data as $col_key => $row)
|
||||
@ -669,48 +682,57 @@ class EmployeeServiceController extends AdminController
|
||||
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))
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id'])->first();
|
||||
// $employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
||||
// dd($employee);
|
||||
if(is_array($employee) && count($employee))
|
||||
{
|
||||
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'],policy_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'];
|
||||
|
||||
}
|
||||
}
|
||||
$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'],policy_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'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$this->myLogger->logme("error",'{emp_code} - {name} not found',['emp_code' => $row[1],'name' => $row[2]]);
|
||||
}
|
||||
|
||||
// print_r($endorsement_data);
|
||||
|
||||
@ -759,7 +781,7 @@ class EmployeeServiceController extends AdminController
|
||||
$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();
|
||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id'])->first();
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','c')
|
||||
->where('table_name','employees')
|
||||
->where('endorsement_id is null')
|
||||
@ -772,7 +794,7 @@ class EmployeeServiceController extends AdminController
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
$group_key = rand(100000, 999999);
|
||||
$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'),'group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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'),'group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
}
|
||||
|
||||
|
||||
@ -819,7 +841,7 @@ class EmployeeServiceController extends AdminController
|
||||
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 = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_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')
|
||||
@ -833,15 +855,15 @@ class EmployeeServiceController extends AdminController
|
||||
//make entry in endorsement table
|
||||
if(!count($existing_endorsements))
|
||||
{
|
||||
|
||||
//transform data to send
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $row[3])
|
||||
{
|
||||
$group_key = rand(100000, 999999);
|
||||
$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','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['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','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['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','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
$this->empEndorsementModel->save(['pk' => (int)$employee_policy['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','group_key' => $group_key,'file_id' => $file['id'],'status' => 'pending']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -867,27 +889,29 @@ class EmployeeServiceController extends AdminController
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
foreach($familiy_data as $fkey => $value)
|
||||
{
|
||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 1 || $slab_details['slab_rates'][0]['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 2 || $slab_details['slab_rates'][0]['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||
{
|
||||
|
||||
$employee = $this->employeeModel->checkExistingEmp($value);
|
||||
$employee = $this->employeeModel->checkExistingEmp($value,$file['client_branch_id']);
|
||||
$policy_data = $value['policy_details'];
|
||||
$temp = $value['temp'];
|
||||
unset($value['policy_details']);
|
||||
unset($value['temp']);
|
||||
// Kint::dump($value);
|
||||
// Kint::dump($temp);
|
||||
// Kint::dump($policy_data);
|
||||
// echo '---------------------------------------';
|
||||
|
||||
//start implemet of si enhancement of grid type 10,11
|
||||
if(count($employee) && (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 2 || $slab_details['slab_rates'][0]['premium_type'] == null))))
|
||||
if(count($employee) && $file['action'] == 'dependent_addition' && $temp['source'] == 'db' && in_array($value['temp']['grid_id'],[10,11]) && ( ($slab_details['slab_rates'][0]['premium_type'] == 1 && (strtolower($value['relationship']) == 'self' || $temp['additional_rack_rate_acting_self'])) || ($slab_details['slab_rates'][0]['premium_type'] == 2 || $slab_details['slab_rates'][0]['premium_type'] == null)))
|
||||
{
|
||||
$log_message = 'Employee record from DB,Checking SI for - '.$employee[0]['name'].'('.$employee[0]['emp_code'].')';
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
$res = $this->employeesSIEnhanceProcessWhileOnbboard(employee:$employee[0],policy_data: $policy_data,file:$file);// where employee holds existing emp data and policy_data holds new si enhancement
|
||||
if(!$res)
|
||||
{
|
||||
//if endorsement not happend no need to update emp/policy details in DB.
|
||||
break;
|
||||
}
|
||||
|
||||
break;//skip db employee
|
||||
}
|
||||
//end implemet of si enhancement of grid type 10,11
|
||||
//end implemet of si enhancement of grid type
|
||||
|
||||
//save employee table
|
||||
if(count($employee))
|
||||
@ -895,6 +919,7 @@ class EmployeeServiceController extends AdminController
|
||||
$value['updated_by'] = $file['created_by'];
|
||||
$value['id'] = $employee[0]['id'];
|
||||
$value['emp_status'] = 'active';
|
||||
$value['client_branch_id'] = $file['client_branch_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']));
|
||||
}
|
||||
@ -902,6 +927,7 @@ class EmployeeServiceController extends AdminController
|
||||
{
|
||||
$value['emp_status'] = 'active';
|
||||
$value['created_by'] = $file['created_by'];
|
||||
$value['client_branch_id'] = $file['client_branch_id'];
|
||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||
}
|
||||
@ -934,7 +960,21 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
$this->employeePolicyModel->save($policy_data);
|
||||
$emp_policy_id = $this->employeePolicyModel->getInsertID();
|
||||
if($emp_policy_id != 0){ $log_message .= ' with PK ' . $emp_policy_id; }
|
||||
if($emp_policy_id != 0)//emp policy inserted
|
||||
{
|
||||
$log_message .= ' with PK ' . $emp_policy_id;
|
||||
|
||||
//make endorsement entry if action is addition OR Dependt addition
|
||||
if(($file['action'] == 'dependent_addition' || $file['action'] == 'addition') && $temp['source'] == 'excel')
|
||||
{
|
||||
$log_message = $file['action'].' - endorsement'. $value['emp_code'].' - '.$value['name'].' - with policy id'.$emp_policy_id;
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
$actions = ($file['action'] == 'dependent_addition' ? 'da' : ($file['action'] == 'addition' ? 'a' : NULL));
|
||||
$addition_endorse_data = ['pk' => $emp_policy_id,'group_key' => rand(100000, 999999),'emp_code' => $value['emp_code'],'table_name' => 'employee_polices','actions' => $actions,'name' => $value['name'],'field_name' => 'basic_cover_si','old_value' => NULL,'new_value' => $policy_data['basic_cover_si'],'remarks' => 'addition endorsement','file_id' => $file['id'],'created_by' => $file['created_by']];
|
||||
$this->employeeEndorsementforAddtionAndDependentAddition($addition_endorse_data);
|
||||
}
|
||||
|
||||
}
|
||||
else{ $emp_policy_id = $employee_policy[0]['id']; }
|
||||
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
@ -943,17 +983,27 @@ class EmployeeServiceController extends AdminController
|
||||
}// for end
|
||||
}//function end
|
||||
|
||||
|
||||
public function employeeEndorsementforAddtionAndDependentAddition($employee)
|
||||
{
|
||||
$this->empEndorsementModel->save($employee);
|
||||
}
|
||||
|
||||
// $employee -> holds existing emp model obj and $policy_data holds new policy changes as array
|
||||
public function employeesSIEnhanceProcessWhileOnbboard(array $employee,array $policy_data,array $file)
|
||||
{
|
||||
$employee = $this->employeeModel->where('emp_code', $employee['emp_code'])->where('name',$employee['name'])->where('client_id',$employee['client_id'])->where('is_active',1)->first();
|
||||
|
||||
|
||||
$employee = $this->employeeModel->where('emp_code', $employee['emp_code'])->where('name',$employee['name'])->where('client_id',$employee['client_id'])->where('client_branch_id',$file['client_branch_id'])->where('is_active',1)->first();
|
||||
// Kint::dump($this->employeeModel->getLastQuery());
|
||||
// dd($employee);
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||
// dd($employee_policy);
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($employee_policy['client_policy_id'],$employee['client_id']);
|
||||
// $slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($employee_policy['client_policy_id'],$employee['client_id']);
|
||||
// dd($slab_details);
|
||||
// $temp_slab_details = ($temp['grid_type'] == 'primary' ? $slab_details['slab_rates'] : $slab_details['additional_slab_info']['slab_rates']);
|
||||
|
||||
//check si has changed in normal case OR check premium only changed, still treat as SI enhancement in grid type 10
|
||||
if($employee_policy['basic_cover_si'] != $policy_data['basic_cover_si'] || ($slab_details['grid_master']['ui_type'] == 10 && $policy_data['premimum'] != null && $policy_data['premimum'] != "" && $employee_policy['premimum'] != $policy_data['premimum']))
|
||||
if($employee_policy['basic_cover_si'] != $policy_data['basic_cover_si'] || ($policy_data['premium'] != null && $policy_data['premium'] != "" && $employee_policy['premium'] != $policy_data['premium']))
|
||||
{
|
||||
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
||||
->where('table_name','employee_polices')
|
||||
@ -962,24 +1012,22 @@ class EmployeeServiceController extends AdminController
|
||||
->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'] == $policy_data['basic_cover_si'])
|
||||
{
|
||||
$group_key = rand(100000, 999999);
|
||||
$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['basic_cover_si'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement via DA','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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 via DA','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$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' => date('Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement via DA','group_key' => $group_key,'file_id' => $file['id']]);
|
||||
$this->myLogger->logme('error',($employee['emp_code'].' - '.$employee['name'].'- ( NEW/OLD SI - '.$employee_policy['basic_cover_si'].'/'.$policy_data['basic_cover_si'].')'. '( NEW/OLD PREMIUM - '.$employee_policy['premium'].'/'.$policy_data['premimum'].') '.' - si enhancement via DA'));
|
||||
return true; //retun true when endorsement inserted
|
||||
$group_key = rand(100000, 999999);
|
||||
$data = array(
|
||||
['pk' => (int)$employee_policy['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['basic_cover_si'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement via DA','group_key' => $group_key,'file_id' => $file['id']],
|
||||
['pk' => (int)$employee_policy['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' => $policy_data['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement via DA','group_key' => $group_key,'file_id' => $file['id']],
|
||||
['pk' => (int)$employee_policy['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' => date('Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement via DA','group_key' => $group_key,'file_id' => $file['id']]
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
$this->empEndorsementModel->insertBatch($data);
|
||||
$this->myLogger->logme('error',($employee['emp_code'].' - '.$employee['name'].'- ( NEW/OLD SI - '.$employee_policy['basic_cover_si'].'/'.$policy_data['basic_cover_si'].')'. '( NEW/OLD PREMIUM - '.$employee_policy['premium'].'/'.$policy_data['premium'].') '.' - si enhancement via DA'));
|
||||
$log_message = 'SI enhancement done during dependent_addition - '.$employee['name'].'('.$employee['emp_code'].')';
|
||||
$this->myLogger->logme('error',$log_message);
|
||||
return true; //retun true when endorsement inserted
|
||||
|
||||
}
|
||||
return false; //retun false when endorsement not happend
|
||||
}
|
||||
@ -1108,10 +1156,11 @@ class EmployeeServiceController extends AdminController
|
||||
public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||
|
||||
$data = $this->fileModel
|
||||
->select('files.*, clients.client_name, clients.short_name, policies.name as policy_name')
|
||||
->select('files.*, clients.client_name, clients.short_name, policies.name as policy_name,client_branch.branch_code')
|
||||
->join('clients', 'clients.id = files.client_id')
|
||||
->join('client_policy', 'client_policy.id = files.policy_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->join('client_branch', 'client_branch.id = files.client_branch_id','left')
|
||||
->where('files.id', $file_id)
|
||||
->first();
|
||||
|
||||
@ -1124,7 +1173,7 @@ class EmployeeServiceController extends AdminController
|
||||
$msg_title = 'File Upload Failure';
|
||||
}
|
||||
|
||||
$msg_txt = $data['client_name'] . ' - ' . $data['policy_name'] . ' - ' . ucfirst($data['action']);
|
||||
$msg_txt = $data['client_name'] . ' ('.$data['branch_code'].') - ' . $data['policy_name'] . ' - ' . ucfirst($data['action']);
|
||||
$user_id = $data['created_by'];
|
||||
$url = 'employee/upload';
|
||||
|
||||
|
||||
@ -16,10 +16,22 @@ class JobWorker extends AdminController
|
||||
|
||||
private static $event_class_mapping = [
|
||||
'add' => ['type' => 'HC', 'handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC', 'handler' => 'App\\Controllers\\Jobs\SubJob'], 'fancy_date_time_format' => ['type' => 'HF', 'handler' => 'fancy_date_time_format'], 'addNumber' => ['type' => 'HC', 'handler' => 'App\\Model\\HttpRequestHelper'], 'excelFileFormatValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'excelFileDataValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesOnboardPreprocess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeeDisembark' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesSIEnhanceProcess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesCorrectionProcess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'send_email' => ['type' => 'HC', 'handler' => 'App\\Helpers\\MailHelper'], 'bulk_mail' => ['type' => 'HC', 'handler' => 'App\\Helpers\\MailHelper'], 'insertBatchList' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
|
||||
'importInceptionFileValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importInceptionUpdateTPAandUHID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'cashDepositCalculationForInception' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'sendMailForDownloadingECard' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
|
||||
'importCorrectionValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importCorrectionUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
|
||||
'cashDepositCalculationForSIEnhancement' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importSIEnhancementValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importSIEnhancementUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
|
||||
'cashDepositCalculationForDeletion' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importDeletionValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importDeletionUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
@ -175,7 +187,16 @@ class JobWorker extends AdminController
|
||||
}
|
||||
|
||||
$payload = is_array($payload) ? $payload : [];
|
||||
$response = $jobHandler($payload,$job->id);
|
||||
try
|
||||
{
|
||||
$response = $jobHandler($payload,$job->id);
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
$job_status = self::STATUS_FAILED;
|
||||
$runtime = $runtime === null ? microtime(true) - $start : $runtime;
|
||||
$response = ['file_name' => $e->getFile(),'error' => $e->getMessage(),'line_no' => $e->getLine(),'info' => $e->getTraceAsString()];
|
||||
}
|
||||
|
||||
$runtime = microtime(true) - $start;
|
||||
$job_status = self::STATUS_DONE;
|
||||
|
||||
@ -190,6 +190,11 @@ class MasterController extends AdminController
|
||||
$uploadFilePath = ROOTPATH . 'public/uploads/logo/';
|
||||
$file_name = file_Upload($this->request->getFile('insurer_logo'), $uploadFilePath);
|
||||
$data = $this->request->getPost();
|
||||
|
||||
if($this->request->getPost('addition_add_day')){
|
||||
$data['addition_add_day'] = 1;
|
||||
}
|
||||
|
||||
$data['created_by'] = get_session_userid();
|
||||
$data['insurer_logo'] = $file_name;
|
||||
|
||||
@ -265,6 +270,12 @@ class MasterController extends AdminController
|
||||
$data['insurer_logo'] = $file_name;
|
||||
}
|
||||
|
||||
if($this->request->getPost('addition_add_day')){
|
||||
$data['addition_add_day'] = 1;
|
||||
}else{
|
||||
$data['addition_add_day'] = 0;
|
||||
}
|
||||
|
||||
$update = $this->insurerModel->update($id,$data);
|
||||
if($update){
|
||||
echo json_encode(array("status" => true , 'data' => $data));
|
||||
|
||||
@ -7,20 +7,482 @@ use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\DepositHelper;
|
||||
use App\Helpers\MailHelper;
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\BatchListModel;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\EmpEndorsementModel;
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
use App\Controllers\JobWorker;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
|
||||
class PendingActionsController extends AdminController
|
||||
{
|
||||
|
||||
use ResponseTrait;
|
||||
|
||||
protected $myLogger;
|
||||
protected $employeeModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $clientModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $batchListModel;
|
||||
protected $batchFileModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $db;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//section
|
||||
set_session_context('PendingActionsController Called');
|
||||
|
||||
//services
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->db = \Config\Database::connect();
|
||||
|
||||
//models
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->batchListModel = new BatchListModel();
|
||||
$this->batchFileModel = new BatchFileModel();
|
||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||
}
|
||||
|
||||
|
||||
public function getPendingActions()
|
||||
{
|
||||
//get pending actions like inception, corrections,deletions,SI enhanccnement to users
|
||||
|
||||
$inception = $this->getPendingActionForInception();
|
||||
$correction = $this->getPendingActionForCorrection();
|
||||
$si_enhancement = $this->getPendingActionForSIEnhancement();
|
||||
$deletion = $this->getPendingActionForDeletion();
|
||||
$tpa = $this->getPendingActionForTPAIDEmpty();
|
||||
$uhid = $this->getPendingActionForUHIDEmpty();
|
||||
|
||||
// dd($inception, $si_enhancement, $correction, $deletion, $tpa, $uhid);
|
||||
|
||||
$data = ['inception' => $inception, 'correction' => $correction, 'si_enhancement' => $si_enhancement, 'deletion' => $deletion, 'tpa' => $tpa, 'uhid' => $uhid];
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
|
||||
public function getPendingActionForInception()
|
||||
{
|
||||
|
||||
// Build the query
|
||||
$builder = $this->db->table('client_policy cp');
|
||||
$builder->select('
|
||||
clients.client_name,
|
||||
policies.name as policy_name,
|
||||
cp.id as client_policy_id,
|
||||
cp.client_id,
|
||||
cp.policy_id,
|
||||
cp.policy_type_id,
|
||||
cp.is_addon,
|
||||
cp.policy_status,
|
||||
cp.open_for_enrollment,
|
||||
cp.inception_type,
|
||||
cb.id as branch_id,
|
||||
cb.branch_name,
|
||||
COUNT(ep.id) AS employee_policy_count
|
||||
');
|
||||
$builder->join('employee_polices ep', 'cp.id = ep.client_policy_id AND ep.is_active = 1', 'left');
|
||||
$builder->join('clients', 'cp.client_id = clients.id');
|
||||
$builder->join('client_branch cb', 'cb.id = cp.client_branch_id');
|
||||
$builder->join('policies', 'cp.policy_id = policies.id');
|
||||
$builder->where('cp.is_active', 1);
|
||||
$builder->where('cp.open_for_enrollment', 1);
|
||||
$builder->where('cp.is_addon', 1);
|
||||
$builder->where('cp.policy_status', 1);
|
||||
$builder->where('cp.inception_type', 1);
|
||||
$builder->whereIn('cp.policy_type_id', [1, 2, 3]);
|
||||
$builder->groupBy('cp.id, cp.client_id, cp.policy_id, cp.policy_type_id, cp.is_addon, cp.policy_status, cp.open_for_enrollment');
|
||||
$builder->having('employee_policy_count = 0 OR employee_policy_count IS NULL');
|
||||
|
||||
// Execute the query
|
||||
$query = $builder->get();
|
||||
|
||||
// Fetch the results
|
||||
$results = $query->getResultArray();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
public function getPendingActionForCorrection()
|
||||
{
|
||||
|
||||
// Subquery for batch_export_count
|
||||
$subQueryExport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_id = clients.id')
|
||||
->where('bl.actions', 'export')
|
||||
->where('bl.event_type', 'correction')
|
||||
->where('bl.insurer_or_tpa', 'tpa')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Subquery for batch_import_count
|
||||
$subQueryImport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_id = clients.id')
|
||||
->where('bl.actions', 'import')
|
||||
->where('bl.event_type', 'correction')
|
||||
->where('bl.insurer_or_tpa', 'tpa')
|
||||
->where('bl.status', 'success')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Subquery builder
|
||||
$subqueryBuilder = $this->db->table('emp_endorsement')
|
||||
->select('
|
||||
|
||||
clients.client_name as client_name,
|
||||
clients.id as client_id,
|
||||
client_branch.id as branch_id,
|
||||
client_branch.branch_name,
|
||||
emp_endorsement.id,
|
||||
emp_endorsement.pk,
|
||||
emp_endorsement.endorsement_id,
|
||||
emp_endorsement.group_key,
|
||||
emp_endorsement.emp_code,
|
||||
emp_endorsement.table_name,
|
||||
emp_endorsement.actions,
|
||||
emp_endorsement.name,
|
||||
emp_endorsement.status,
|
||||
employees.name as ename
|
||||
')
|
||||
->join('employees', 'emp_endorsement.pk = employees.id AND employees.is_active = 1 AND employees.emp_status = \'active\'')
|
||||
->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left')
|
||||
->join('client_branch', 'client_branch.id = employees.client_branch_id', 'left')
|
||||
->where([
|
||||
'emp_endorsement.actions' => 'c',
|
||||
'emp_endorsement.is_active' => 1,
|
||||
'emp_endorsement.status' => 'pending',
|
||||
'emp_endorsement.endorsement_id' => null
|
||||
])
|
||||
->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.table_name, emp_endorsement.actions, emp_endorsement.name');
|
||||
|
||||
// Main query builder
|
||||
$builder = $this->db->table('clients');
|
||||
$builder->select("
|
||||
subquery.client_name,
|
||||
subquery.client_id,
|
||||
subquery.branch_name,
|
||||
subquery.branch_id,
|
||||
COUNT(subquery.id) AS subquery_count,
|
||||
($subQueryExport) AS batch_export_count,
|
||||
($subQueryImport) AS batch_import_count
|
||||
");
|
||||
$builder->join('(' . $subqueryBuilder->getCompiledSelect() . ') AS subquery', 'clients.id = subquery.client_id', 'left');
|
||||
$builder->groupBy('clients.id');
|
||||
|
||||
// Execute the query
|
||||
$query = $builder->get();
|
||||
|
||||
// Fetch the results
|
||||
$results = $query->getResultArray();
|
||||
|
||||
|
||||
$filteredResults = array_filter($results, function ($value) {
|
||||
return $value['subquery_count'] != 0;
|
||||
});
|
||||
|
||||
return $filteredResults;
|
||||
}
|
||||
|
||||
|
||||
public function getPendingActionForSIEnhancement()
|
||||
{
|
||||
|
||||
// Subquery for batch_export_count
|
||||
$subQueryExport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_id = clients.id')
|
||||
->where('bl.actions', 'export')
|
||||
->where('bl.event_type', 'si_enhancement')
|
||||
->where('bl.insurer_or_tpa', 'tpa')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Subquery for batch_import_count
|
||||
$subQueryImport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_id = clients.id')
|
||||
->where('bl.actions', 'import')
|
||||
->where('bl.event_type', 'si_enhancement')
|
||||
->where('bl.insurer_or_tpa', 'tpa')
|
||||
->where('bl.status', 'success')
|
||||
->getCompiledSelect();
|
||||
|
||||
|
||||
// Build the subquery
|
||||
$subqueryBuilder = $this->db->table('emp_endorsement')
|
||||
->select('
|
||||
clients.client_name as client_name,
|
||||
clients.id as client_id,
|
||||
client_branch.id as branch_id,
|
||||
client_branch.branch_name,
|
||||
client_policy.id as client_policy_id,
|
||||
policies.name as policy_name,
|
||||
policies.id as pid,
|
||||
emp_endorsement.id,
|
||||
emp_endorsement.pk,
|
||||
emp_endorsement.endorsement_id,
|
||||
emp_endorsement.group_key,
|
||||
emp_endorsement.emp_code,
|
||||
emp_endorsement.table_name,
|
||||
emp_endorsement.actions,
|
||||
emp_endorsement.name,
|
||||
emp_endorsement.status
|
||||
')
|
||||
->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\'')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1')
|
||||
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1')
|
||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1')
|
||||
->where([
|
||||
'emp_endorsement.actions' => 'si',
|
||||
'emp_endorsement.is_active' => 1,
|
||||
'emp_endorsement.status' => 'pending',
|
||||
'emp_endorsement.endorsement_id' => null
|
||||
])
|
||||
->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.table_name, emp_endorsement.actions, emp_endorsement.name');
|
||||
|
||||
// Build the main query
|
||||
$builder = $this->db->table('clients');
|
||||
$builder->select("
|
||||
clients.id,
|
||||
subquery.client_name,
|
||||
subquery.client_id,
|
||||
subquery.client_policy_id,
|
||||
subquery.policy_name,
|
||||
subquery.branch_name,
|
||||
subquery.branch_id,
|
||||
COUNT(subquery.id) AS subquery_count,
|
||||
($subQueryExport) AS batch_export_count,
|
||||
($subQueryImport) AS batch_import_count
|
||||
");
|
||||
$builder->join('(' . $subqueryBuilder->getCompiledSelect() . ') AS subquery', 'clients.id = subquery.client_id', 'left');
|
||||
$builder->groupBy('clients.id');
|
||||
|
||||
// Execute the query
|
||||
$query = $builder->get();
|
||||
|
||||
// Fetch the results
|
||||
$results = $query->getResultArray();
|
||||
|
||||
|
||||
$filteredResults = array_filter($results, function ($value) {
|
||||
return $value['subquery_count'] != 0;
|
||||
});
|
||||
|
||||
return $filteredResults;
|
||||
}
|
||||
|
||||
|
||||
public function getPendingActionForDeletion()
|
||||
{
|
||||
|
||||
|
||||
// Subquery for batch_export_count
|
||||
$subQueryExport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_id = clients.id')
|
||||
->where('bl.actions', 'export')
|
||||
->where('bl.event_type', 'deletion')
|
||||
->where('bl.insurer_or_tpa', 'insurer')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Subquery for batch_import_count
|
||||
$subQueryImport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_id = clients.id')
|
||||
->where('bl.actions', 'import')
|
||||
->where('bl.event_type', 'deletion')
|
||||
->where('bl.insurer_or_tpa', 'insurer')
|
||||
->where('bl.status', 'success')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Build the subquery
|
||||
$subqueryBuilder = $this->db->table('emp_endorsement')
|
||||
->select('
|
||||
clients.id as client_id,
|
||||
clients.client_name as client_name,
|
||||
client_branch.id as branch_id,
|
||||
client_branch.branch_name,
|
||||
client_policy.id as client_policy_id,
|
||||
policies.name as policy_name,
|
||||
policies.id as pid,
|
||||
emp_endorsement.pk,
|
||||
emp_endorsement.id,
|
||||
emp_endorsement.group_key,
|
||||
emp_endorsement.emp_code,
|
||||
emp_endorsement.table_name,
|
||||
emp_endorsement.actions,
|
||||
emp_endorsement.name,
|
||||
emp_endorsement.status
|
||||
|
||||
')
|
||||
->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\' AND emp_endorsement.table_name = \'employee_polices\'', 'left')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1', 'left')
|
||||
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1', 'left')
|
||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id', 'left')
|
||||
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1', 'left')
|
||||
->where([
|
||||
'emp_endorsement.actions' => 'd',
|
||||
'emp_endorsement.is_active' => 1,
|
||||
'emp_endorsement.status' => 'pending',
|
||||
'emp_endorsement.endorsement_id' => null,
|
||||
'emp_endorsement.table_name' => 'employee_polices'
|
||||
])
|
||||
->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.actions, emp_endorsement.name');
|
||||
|
||||
// Build the main query
|
||||
$builder = $this->db->table('clients');
|
||||
$builder->select("
|
||||
clients.id,
|
||||
subquery.client_name,
|
||||
subquery.client_id,
|
||||
subquery.client_policy_id,
|
||||
subquery.policy_name,
|
||||
subquery.branch_name,
|
||||
subquery.branch_id,
|
||||
COUNT(subquery.id) AS subquery_count,
|
||||
($subQueryExport) AS batch_export_count,
|
||||
($subQueryImport) AS batch_import_count
|
||||
");
|
||||
$builder->join('(' . $subqueryBuilder->getCompiledSelect() . ') AS subquery', 'clients.id = subquery.client_id', 'left');
|
||||
$builder->groupBy('clients.id');
|
||||
|
||||
// Execute the query
|
||||
$query = $builder->get();
|
||||
|
||||
// Fetch the results
|
||||
$results = $query->getResultArray();
|
||||
|
||||
$filteredResults = array_filter($results, function ($value) {
|
||||
return $value['subquery_count'] != 0;
|
||||
});
|
||||
|
||||
return $filteredResults;
|
||||
}
|
||||
|
||||
|
||||
public function getPendingActionForUHIDEmpty()
|
||||
{
|
||||
// Subquery for batch_export_count
|
||||
$subQueryExport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_policy_id = cp.id')
|
||||
->where('bl.actions', 'export')
|
||||
->where('bl.event_type', 'inception')
|
||||
->where('bl.insurer_or_tpa', 'insurer')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Subquery for batch_import_count
|
||||
$subQueryImport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_policy_id = cp.id')
|
||||
->where('bl.actions', 'import')
|
||||
->where('bl.event_type', 'inception')
|
||||
->where('bl.insurer_or_tpa', 'insurer')
|
||||
->where('bl.status', 'success')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Main query
|
||||
$query = $this->db->table('employee_polices ep')
|
||||
->select('c.id as client_id')
|
||||
->select('ep.client_policy_id')
|
||||
->select('c.client_name')
|
||||
->select('c.short_name')
|
||||
->select('p.name as policy_name')
|
||||
->select('ep.uhid')
|
||||
->select('cb.branch_name, cb.id as branch_id')
|
||||
->select("($subQueryExport) AS batch_export_count", false)
|
||||
->select("($subQueryImport) AS batch_import_count", false)
|
||||
->join('client_policy cp', 'ep.client_policy_id = cp.id AND cp.is_active = 1 AND cp.policy_status = 1')
|
||||
->join('clients c', 'c.id = cp.client_id')
|
||||
->join('client_branch cb', 'cb.id = cp.client_branch_id')
|
||||
->join('policies p', 'p.id = cp.policy_id')
|
||||
->where('ep.uhid IS NULL')
|
||||
->where('ep.status', 'active')
|
||||
->where('ep.is_active', 1)
|
||||
->groupBy('ep.client_policy_id, ep.uhid, c.short_name, p.name')
|
||||
->get();
|
||||
|
||||
// Fetch the results
|
||||
$results = $query->getResultArray();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
public function getPendingActionForTPAIDEmpty()
|
||||
{
|
||||
|
||||
// Subquery for batch_export_count
|
||||
$subQueryExport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_policy_id = client_policy.id')
|
||||
->where('bl.actions', 'export')
|
||||
->where('bl.event_type', 'inception')
|
||||
->where('bl.insurer_or_tpa', 'tpa')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Subquery for batch_import_count
|
||||
$subQueryImport = $this->db->table('batch_files bl')
|
||||
->select('COUNT(*)')
|
||||
->where('bl.client_policy_id = client_policy.id')
|
||||
->where('bl.actions', 'import')
|
||||
->where('bl.event_type', 'inception')
|
||||
->where('bl.insurer_or_tpa', 'tpa')
|
||||
->where('bl.status', 'success')
|
||||
->getCompiledSelect();
|
||||
|
||||
// Build the query
|
||||
$builder = $this->db->table('employee_polices');
|
||||
$builder->select('
|
||||
|
||||
employee_polices.client_policy_id,
|
||||
employee_polices.uhid,
|
||||
employee_polices.tpa_id,
|
||||
clients.short_name,
|
||||
clients.client_name,
|
||||
policies.name as policy_name,
|
||||
clients.id as client_id,
|
||||
client_branch.id as branch_id,
|
||||
client_branch.branch_name
|
||||
');
|
||||
$builder->select("($subQueryExport) AS batch_export_count", false);
|
||||
$builder->select("($subQueryImport) AS batch_import_count", false);
|
||||
|
||||
$builder->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1');
|
||||
$builder->join('clients', 'clients.id = client_policy.client_id');
|
||||
$builder->join('client_branch', 'client_branch.id = client_policy.client_branch_id');
|
||||
$builder->join('policies', 'policies.id = client_policy.policy_id');
|
||||
$builder->where('employee_polices.tpa_id', null);
|
||||
$builder->where('employee_polices.uhid IS NOT NULL');
|
||||
$builder->where('employee_polices.status', 'active');
|
||||
$builder->where('employee_polices.is_active', 1);
|
||||
$builder->groupBy('employee_polices.client_policy_id');
|
||||
|
||||
// Execute the query
|
||||
$query = $builder->get();
|
||||
|
||||
// Fetch the results
|
||||
$results = $query->getResultArray();
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ class RestAuthenticationController extends AdminController
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$data = [
|
||||
'user_id' => $employeeData['id'],
|
||||
'user_id' => $employeeData['id'],
|
||||
'user_type' => 'employee',
|
||||
'ip' => $auth['ip'],
|
||||
'platform' => $auth['platform'],
|
||||
|
||||
@ -58,9 +58,33 @@ class UserController extends AdminController
|
||||
|
||||
$userData = $this->request->getPost();
|
||||
$userData['created_by'] = get_session_userid();
|
||||
$temp_team = $userData['team'];
|
||||
unset($userData['team']);
|
||||
$insert = $this->userModel->insert($userData);
|
||||
if($insert){
|
||||
$db = \Config\Database::connect();
|
||||
$tableName = 'hdz_staff';
|
||||
|
||||
if($userData['role'] == 1){
|
||||
$admin = 1;
|
||||
}else{
|
||||
$admin = 0;
|
||||
}
|
||||
foreach ($temp_team as $key => $value) {
|
||||
if($value == 2){
|
||||
$hdz_staff = [
|
||||
'emp_code' => $userData['emp_code'],
|
||||
'fullname' => $userData['first_name'],
|
||||
'username' => strtolower($userData['first_name']),
|
||||
'email' => $userData['email'],
|
||||
'admin' => $admin,
|
||||
'registration' => time(),
|
||||
];
|
||||
|
||||
$db->table($tableName)->insert($hdz_staff);
|
||||
}
|
||||
}
|
||||
|
||||
$teamData['user_id'] = $insert ;
|
||||
foreach ($teams as $value) {
|
||||
$teamData['team_id'] = $value;
|
||||
@ -99,6 +123,35 @@ class UserController extends AdminController
|
||||
$update = $this->userModel->where('id', $id )->set($userData)->update();
|
||||
|
||||
if($update){
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$tableName = 'hdz_staff';
|
||||
|
||||
if($userData['role'] == 1){
|
||||
$admin = 1;
|
||||
}else{
|
||||
$admin = 0;
|
||||
}
|
||||
|
||||
foreach ($userData['team'] as $key => $value) {
|
||||
if($value == 2){
|
||||
$hdz_staff = [
|
||||
'emp_code' => $userData['emp_code'],
|
||||
'fullname' => $userData['first_name'],
|
||||
'username' => strtolower($userData['first_name']),
|
||||
'email' => $userData['email'],
|
||||
'admin' => $admin,
|
||||
];
|
||||
|
||||
|
||||
$db->table($tableName)->where('emp_code', $userData['emp_code'])
|
||||
->where('email', $userData['email'])
|
||||
->set($userData)
|
||||
->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->userTeamsModel->where('user_id', $id)->delete();
|
||||
if($teams){
|
||||
$teamData['user_id'] = $id ;
|
||||
@ -120,6 +173,12 @@ class UserController extends AdminController
|
||||
$deactive = $model->where('id', $id)->set(['is_active' => 0])->update();
|
||||
if($deactive)
|
||||
{
|
||||
// $db = \Config\Database::connect();
|
||||
// $tableName = 'hdz_staff';
|
||||
|
||||
// $db->table($tableName)->insert($hdz_staff);
|
||||
|
||||
|
||||
echo json_encode(array("status" => true));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
|
||||
@ -12,6 +12,7 @@ use ReflectionClass;
|
||||
|
||||
require_once('../vendor/autoload.php');
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
|
||||
class AuthJWT implements FilterInterface
|
||||
@ -19,19 +20,27 @@ class AuthJWT implements FilterInterface
|
||||
public function before(RequestInterface $request, $arguments = null)
|
||||
{
|
||||
$jwt = $request->getHeader('Authorization');
|
||||
$model = new EmployeeModel();
|
||||
|
||||
if ($jwt) {
|
||||
if (JWTToken::validateJWT($jwt)) {
|
||||
$data = JWTToken::validateJWT($jwt);
|
||||
$data = json_decode($data);
|
||||
if ($data->status) {
|
||||
// $auth = $request->getHeader("Authorization");
|
||||
|
||||
|
||||
$id = $data->decoded->id;
|
||||
$user_data = $model->where('id', $id)->first();
|
||||
|
||||
if($user_data['token_time_out'] > time()){
|
||||
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
|
||||
$model->update($id, $data);
|
||||
return true;
|
||||
}else{
|
||||
$data =["token_time_out" => ''];
|
||||
$model->update($id, $data);
|
||||
header('Content-Type: application/json');
|
||||
http_response_code(401);
|
||||
$error = json_encode(["status" => 401, "message" => $data->message]);
|
||||
// $error = json_encode(["status" => 401, "message" => $data->message]);
|
||||
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
|
||||
echo $error;
|
||||
exit;
|
||||
}
|
||||
|
||||
25
app/Filters/CloseDbConnection.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Filters\FilterInterface;
|
||||
use CodeIgniter\Database\Config;
|
||||
|
||||
class CloseDbConnection implements FilterInterface
|
||||
{
|
||||
public function before(RequestInterface $request, $arguments = null)
|
||||
{
|
||||
// No action needed before the request
|
||||
}
|
||||
|
||||
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
|
||||
{
|
||||
// Get all database configurations
|
||||
$db = \Config\Database::connect();
|
||||
$log = \Config\Services::mylogger();
|
||||
$log->logme('error','CloseDbConnections....!');
|
||||
$db->close();
|
||||
}
|
||||
}
|
||||
@ -12,27 +12,28 @@ use Firebase\JWT\SignatureInvalidException;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use ReflectionClass;
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
|
||||
|
||||
class JWTToken
|
||||
{
|
||||
public static function encode($data =null)
|
||||
{
|
||||
$secret_Key="secret";
|
||||
$iat = time();
|
||||
$exp = $iat + 36000;
|
||||
$request_data = [
|
||||
"iat" => $iat,
|
||||
"exp" => $exp,
|
||||
];
|
||||
if ($data !== null) {
|
||||
$request_data = array_merge($request_data, (array)$data);
|
||||
}
|
||||
try{
|
||||
$token = JWT::encode($request_data ,$secret_Key,'HS512');
|
||||
$secret_Key ="secret";
|
||||
|
||||
return $token;
|
||||
// return ['status' => true,'token' => $token];
|
||||
$request_data = (array)$data;
|
||||
|
||||
try{
|
||||
$token = JWT::encode($request_data ,$secret_Key,'HS512');
|
||||
|
||||
$model = new EmployeeModel();
|
||||
$id = $request_data['id'];
|
||||
$data =[
|
||||
"token_time_out" => time() + getenv('TOKENTIMEOUT')
|
||||
];
|
||||
$model->update($id, $data);
|
||||
|
||||
return $token;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return ['status' => false,'message' => $e->getMessage()];
|
||||
|
||||
@ -212,10 +212,10 @@ if (! function_exists('transform_objects_to_array_for_si_enhancement')) {
|
||||
$obj->no_of_days,
|
||||
$obj->old_si_premium,
|
||||
$obj->new_si_premium,
|
||||
$obj->difference_premium,
|
||||
round($obj->difference_premium, 2),
|
||||
$obj->pro_rata_premimum,
|
||||
$obj->gst,
|
||||
$obj->total ,
|
||||
round($obj->total, 2),
|
||||
$endorsement_id,
|
||||
];
|
||||
|
||||
@ -359,7 +359,7 @@ if (!function_exists('read_excel_file_to_array')) {
|
||||
|
||||
|
||||
if (! function_exists('generate_filename')) {
|
||||
function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name) {
|
||||
function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name, $branch_code) {
|
||||
|
||||
$evenTypeLabel = '';
|
||||
if($event_type == 'inception'){
|
||||
@ -387,9 +387,10 @@ if (! function_exists('generate_filename')) {
|
||||
$currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||
$formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s');
|
||||
$policy_name = str_replace(' ', '_', $policy_name);
|
||||
$branch_code = isset($branch_code) ? str_replace(' ', '_', $branch_code) : '_';
|
||||
|
||||
// Generate file name
|
||||
$file_name = $client_short_name. '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx';
|
||||
$file_name = $client_short_name. '_' . $branch_code . '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx';
|
||||
return $file_name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,19 +1,27 @@
|
||||
<?php
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\InsurerModel;
|
||||
use Kint\Kint;
|
||||
|
||||
|
||||
if(!function_exists('calculate_days_bw_dates'))
|
||||
{
|
||||
function calculate_days_bw_dates(string $from_date = "", string $to_date ="")
|
||||
function calculate_days_bw_dates(string $from_date = "", string $to_date ="",bool $include_start_date = true)
|
||||
{
|
||||
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);
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
// $totalDays = $interval->days;
|
||||
// if ($include_start_date) {
|
||||
// $totalDays += 1;
|
||||
// }
|
||||
//$interval->totalDays = $totalDays;
|
||||
return $interval;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,35 +201,43 @@ if(!function_exists('check_si'))
|
||||
|
||||
if(!$is_si_found && $slab_value['si'] == $received_si) //match si amount
|
||||
{
|
||||
// echo 'found';
|
||||
$is_si_found = true;
|
||||
}
|
||||
|
||||
// check age slab
|
||||
if($row[3] != null && DateTime::createFromFormat('d-M-Y', $row[3]) !== false)// dob
|
||||
if(in_array(strtoupper($row['current_action']), ['I','A','DA']))
|
||||
{
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
$passedDateTime = new DateTime($dob);
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
if(!$is_age_slab_found)
|
||||
if($row[3] != null && DateTime::createFromFormat('d-M-Y', $row[3]) !== false)// dob
|
||||
{
|
||||
if(isset($slab_value['age_from']) && isset($slab_value['age_to']))
|
||||
$dob = change_date_format($row[3],'d-M-Y','Y-m-d');
|
||||
// echo $row[3].' - '.$dob;echo '<br>';
|
||||
$currentDateTime = new DateTime();//die();
|
||||
$passedDateTime = new DateTime($dob);
|
||||
$interval = $currentDateTime->diff($passedDateTime);
|
||||
if(!$is_age_slab_found)
|
||||
{
|
||||
if($slab_value['age_from'] !== null && $slab_value['age_to'] !== null && $slab_value['age_from'] <= $interval->y && $slab_value['age_to'] >= $interval->y && $slab_value['si'] == $received_si)
|
||||
if(isset($slab_value['age_from']) && isset($slab_value['age_to']))
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age slab found
|
||||
if($slab_value['age_from'] !== null && $slab_value['age_to'] !== null && $slab_value['age_from'] <= $interval->y && $slab_value['age_to'] >= $interval->y && $slab_value['si'] == $received_si)
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age slab found
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$is_age_slab_found = true;// send true if age conditin is not applicable
|
||||
}//end of check age slab
|
||||
}
|
||||
}// end of for loop
|
||||
|
||||
}
|
||||
|
||||
@ -405,15 +421,17 @@ if (!function_exists('name_and_empid_check_in_db'))
|
||||
|
||||
foreach ($family_data as $rkey => $row)
|
||||
{
|
||||
if(isset($row['temp']) && $row['temp']['source'] != 'db')
|
||||
{
|
||||
if($current_action != 'dependent_addition' || (isset($row['temp']) && $row['temp']['source'] != 'db'))
|
||||
{
|
||||
$res = $employeeModel
|
||||
->join('client_policy cp',"employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
// ->where("cp.id",$policy_id)
|
||||
->where("cp.id",$policy_id)
|
||||
->where("employees.client_id",$client_id)
|
||||
->where("employees.is_active",1)
|
||||
->where("employees.emp_status",'active')
|
||||
->where("ep.is_active",1)
|
||||
->where("ep.status",'active')
|
||||
// ->where("ep.client_id",$client_id)
|
||||
->where('name',$row[2])->where('emp_code',$row[1])
|
||||
->findAll();
|
||||
@ -585,8 +603,9 @@ if (!function_exists('generate_relationship_code'))
|
||||
$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']);
|
||||
$emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03');
|
||||
$relationship_code = $gender[ $arr['gender'] ] . $relationship[ $relationship_code ] ;
|
||||
return $relationship_code;
|
||||
return ['relationship_code' => $relationship_code,'emp_type_code' => $emp_type_code];
|
||||
}
|
||||
}
|
||||
|
||||
@ -594,28 +613,90 @@ if (!function_exists('calculate_premimum'))
|
||||
{
|
||||
function calculate_premimum($family_data,$policy_terms,$slab_details,$fileArr,$default_si = null)
|
||||
{
|
||||
//
|
||||
// dd($slab_details);
|
||||
// grid type
|
||||
// 1 = premium => si
|
||||
// dd($family_data);
|
||||
$slug = \Config\Services::slug();
|
||||
$result = [];
|
||||
$grid_type = $slab_details['grid_master']['ui_type'];
|
||||
$fileArr['grid_type'] = $grid_type;
|
||||
$primary_grid_type = $slab_details['grid_master']['ui_type'];
|
||||
|
||||
//gather detailes for additional rack info
|
||||
$additional_grid_type = isset($slab_details['additional_slab_info']['grid_master']['ui_type']) ? $slab_details['additional_slab_info']['grid_master']['ui_type'] : null;
|
||||
// dd(isset($slab_details['additional_slab_info']['grid_master']['ui_type']));
|
||||
$policy_terms_json = ($policy_terms['policy_terms']);
|
||||
$policy_terms_json = (array) json_decode($policy_terms_json);
|
||||
// dd($policy_terms);
|
||||
$primary_rack_rate_applicable_familiy_members = ['self'];
|
||||
if(isset($policy_terms_json['family_floaters']))
|
||||
{
|
||||
$primary_rack_rate_applicable_familiy_members = generate_family_relationship_array((array)$policy_terms_json['family_floaters']);
|
||||
}
|
||||
|
||||
$additional_grid_type_applicable_familiy_members = [];
|
||||
if($additional_grid_type != null)
|
||||
{
|
||||
$additional_grid_type_applicable_familiy_members = (array)json_decode($slab_details['additional_slab_info']['slab_rates'][0]['additional_relationship']);
|
||||
$additional_grid_type_applicable_familiy_members = generate_family_relationship_array($additional_grid_type_applicable_familiy_members);
|
||||
}
|
||||
// Kint::dump($primary_rack_rate_applicable_familiy_members);
|
||||
// Kint::dump($additional_grid_type_applicable_familiy_members);
|
||||
//remove common family members in primary array
|
||||
$primary_rack_rate_applicable_familiy_members = array_diff($primary_rack_rate_applicable_familiy_members,$additional_grid_type_applicable_familiy_members);
|
||||
// dd($primary_rack_rate_applicable_familiy_members);
|
||||
|
||||
|
||||
|
||||
//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));
|
||||
//find max age and max count of family members for both primary and additional grid type
|
||||
$max_age_and_count = (array_reduce($family_data,function($max_age,$family_member) use ($primary_rack_rate_applicable_familiy_members,$slug) {
|
||||
|
||||
if( in_array($slug->slugify($family_member[5]), $primary_rack_rate_applicable_familiy_members))
|
||||
{
|
||||
$max_age['primary_rack_rate_max_age'][] = calculate_days_bw_dates(from_date: $family_member[3])->y;
|
||||
$max_age['primary_rack_rate_max_count'] = $max_age['primary_rack_rate_max_count'] + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$max_age['additional_rack_rate_max_age'][] = calculate_days_bw_dates(from_date: $family_member[3])->y;
|
||||
$max_age['additional_rack_rate_max_count'] = $max_age['additional_rack_rate_max_count'] + 1;
|
||||
}
|
||||
return $max_age;
|
||||
}, ['primary_rack_rate_max_age' => [], 'additional_rack_rate_max_age' => [],'primary_rack_rate_max_count' => 0,'additional_rack_rate_max_count' => 0]));
|
||||
|
||||
|
||||
$get_max_age_or_count = function($relationship,$flag) use ($slug, $primary_rack_rate_applicable_familiy_members, $max_age_and_count)
|
||||
{
|
||||
if(in_array($slug->slugify($relationship),$primary_rack_rate_applicable_familiy_members))
|
||||
{
|
||||
return $flag == 'age' ? max($max_age_and_count['primary_rack_rate_max_age']) : $max_age_and_count['primary_rack_rate_max_count'];
|
||||
}
|
||||
return $flag == 'age' ? max($max_age_and_count['additional_rack_rate_max_age']) : $max_age_and_count['additional_rack_rate_max_count'];
|
||||
};
|
||||
|
||||
|
||||
$get_current_member_grid_type = function($relationship) use ($slug, $primary_rack_rate_applicable_familiy_members,$primary_grid_type,$additional_grid_type)
|
||||
{
|
||||
if(in_array($slug->slugify($relationship),$primary_rack_rate_applicable_familiy_members))
|
||||
{
|
||||
return ['type' => 'primary','grid_id' => $primary_grid_type];
|
||||
}
|
||||
return ['type' => 'additional','grid_id' => $additional_grid_type];
|
||||
};
|
||||
// Kint::dump($max_age_and_count);dd();
|
||||
foreach($family_data as $fkey => $member)
|
||||
{
|
||||
//get grid type either primary or additional based on current member relationship available in primary_rack_rate_applicable_familiy_members or not. if yes then primaty grid type else additional grid type
|
||||
$current_grid_info = $get_current_member_grid_type($member[5]);
|
||||
$fileArr['grid_info'] = $current_grid_info;
|
||||
//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'] = isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['band']) ? $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['band'] : NULL;
|
||||
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si'] = isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si']) ? $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si'] : NULL;
|
||||
//get emp band and si from self and make it available for whole family
|
||||
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'];
|
||||
@ -623,14 +704,38 @@ if (!function_exists('calculate_premimum'))
|
||||
}
|
||||
|
||||
//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'] ]['maxcount'] = $get_max_age_or_count($transformed_familiy_member_data['relationship'],'count');
|
||||
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['maxage'] = $max_age;
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['maxage'] = $get_max_age_or_count($transformed_familiy_member_data['relationship'],'age');
|
||||
|
||||
//set additional_rack_rate_acting_self in emp_details_with_empband_max_age_max_count array
|
||||
$transformed_familiy_member_data['temp']['additional_rack_rate_acting_self'] = false;
|
||||
if(!isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['additional_rack_rate_acting_self']) && $current_grid_info['type'] == 'additional')
|
||||
{
|
||||
|
||||
if($transformed_familiy_member_data['temp']['action'] != 'DA')
|
||||
{
|
||||
$transformed_familiy_member_data['temp']['additional_rack_rate_acting_self'] = true;
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['additional_rack_rate_acting_self'] = true;
|
||||
}
|
||||
else// if dependent addition then set employee from db is an acting self
|
||||
{
|
||||
|
||||
if($transformed_familiy_member_data['temp']['source'] == 'db' && $transformed_familiy_member_data['temp']['rata_premimum'])
|
||||
{
|
||||
// echo 'SETTING';
|
||||
$transformed_familiy_member_data['temp']['additional_rack_rate_acting_self'] = true;
|
||||
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['additional_rack_rate_acting_self'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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);
|
||||
$temp_res = generate_relationship_code($transformed_familiy_member_data);
|
||||
$transformed_familiy_member_data['relationship_code'] = $temp_res['relationship_code'];
|
||||
$transformed_familiy_member_data['emp_type'] = $temp_res['emp_type_code'];
|
||||
}
|
||||
|
||||
//calculate primimum based on grid type
|
||||
@ -642,17 +747,46 @@ if (!function_exists('calculate_premimum'))
|
||||
$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'];
|
||||
|
||||
$transformed_familiy_member_data['policy_details']['basic_cover_si'] = isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si']) ? $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si'] : $transformed_familiy_member_data['policy_details']['basic_cover_si'];
|
||||
//set self si to all familiy members, except they've come from DB
|
||||
// if(isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si']))
|
||||
// {
|
||||
if($transformed_familiy_member_data['temp']['source'] != 'db')
|
||||
{
|
||||
$transformed_familiy_member_data['policy_details']['basic_cover_si'] = isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si']) ? $emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['si'] : $transformed_familiy_member_data['policy_details']['basic_cover_si'];
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
if( $fileArr['id'] == null || $transformed_familiy_member_data['temp']['source'] == 'excel' || ($fileArr['action'] == 'dependent_addition' && in_array($grid_type,[10,11]) && $slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($transformed_familiy_member_data['relationship']) == 'self'))//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
|
||||
{
|
||||
// this array hold conditions to allow calculate premium amt
|
||||
$conditions = [
|
||||
'isEmployeeSourceEnrollment' => $fileArr['id'] == null,
|
||||
'isEmployeeSourceExcelFile' => $transformed_familiy_member_data['temp']['source'] == 'excel',
|
||||
'isCurrentActionDependentAddition' => $fileArr['action'] == 'dependent_addition',
|
||||
'isPrimaryGridType' => $transformed_familiy_member_data['temp']['grid_type'] == 'primary',
|
||||
'isAdditionalGridType' => $transformed_familiy_member_data['temp']['grid_type'] == 'additional',
|
||||
'isPrimaryGridPremiumTypeSingle' => $slab_details['slab_rates'][0]['premium_type'] == 1,
|
||||
'isAdditionalPremiumTypeSingle' => isset($slab_details['additional_slab_info']['slab_rates'][0]['premium_type']) ? ( $slab_details['additional_slab_info']['slab_rates'][0]['premium_type'] == 1) : 0,
|
||||
'isCurrentRelationshipSelf' => strtolower($transformed_familiy_member_data['relationship']) == 'self',
|
||||
'isBasicCoverCalculatedToCurrentEmployee' => ($transformed_familiy_member_data['policy_details']['basic_cover_si'] != null && $transformed_familiy_member_data['policy_details']['basic_cover_si'] != 0)
|
||||
];
|
||||
// Kint::dump($transformed_familiy_member_data['policy_details']);
|
||||
// echo ($transformed_familiy_member_data['policy_details']['basic_cover_si'] != null && $transformed_familiy_member_data['policy_details']['basic_cover_si'] != 0);
|
||||
// echo ($conditions['isBasicCoverCalculatedToCurrentEmployee']);
|
||||
// echo "<br>";
|
||||
// same logic for both primay and additional grid type
|
||||
$primaryGridTypeCondition = $conditions['isCurrentActionDependentAddition'] && $conditions['isPrimaryGridType'] && $conditions['isPrimaryGridPremiumTypeSingle'] && $conditions['isCurrentRelationshipSelf'];
|
||||
$additionalGridTypeCondition = $conditions['isCurrentActionDependentAddition'] && $conditions['isAdditionalGridType'] && $conditions['isAdditionalPremiumTypeSingle'] && $conditions['isBasicCoverCalculatedToCurrentEmployee'];
|
||||
|
||||
// Final combined condition
|
||||
if ($conditions['isEmployeeSourceEnrollment'] || $conditions['isEmployeeSourceExcelFile'] || $primaryGridTypeCondition || $additionalGridTypeCondition) {
|
||||
|
||||
$transformed_familiy_member_data = premium_calculation_manager($transformed_familiy_member_data,$policy_terms,$slab_details,$default_si);
|
||||
|
||||
$result[] = $transformed_familiy_member_data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Kint::dump($emp_details_with_empband_max_age_max_count);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@ -702,13 +836,15 @@ if (!function_exists('transform_excel_data_to_db'))
|
||||
$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']['grid_type'] = $actionArr['grid_info']['type'];
|
||||
$result['temp']['grid_id'] = $actionArr['grid_info']['grid_id'];
|
||||
$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['temp']['policy_status'] = isset($memArr['temp']['policy_status']) ? $memArr['temp']['policy_status'] : null;
|
||||
$result['temp']['emp_status'] = isset($memArr['temp']['emp_status']) ? $memArr['temp']['emp_status'] : null;
|
||||
$result['temp']['rata_premimum'] = isset($memArr['temp']['rata_premimum']) ? $memArr['temp']['rata_premimum'] : 0;
|
||||
$result['policy_details'] = $policy;
|
||||
|
||||
return $result;
|
||||
@ -722,11 +858,12 @@ if (!function_exists('premium_calculation_manager'))
|
||||
{
|
||||
function premium_calculation_manager($emp_data,$policy_terms,$slab_details,$default_si = null)
|
||||
{
|
||||
// Kint::dump($emp_data);
|
||||
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
// grid type
|
||||
// 1 = premium => si
|
||||
// dd($emp_data);
|
||||
// Kint::dump($emp_data);
|
||||
|
||||
//check if the data comes from enrollment (DB) and status is draft then fetch original data of employee from
|
||||
//audit history table then initiate calculation with it. so this data again get updated in emp table
|
||||
@ -758,23 +895,36 @@ if (!function_exists('premium_calculation_manager'))
|
||||
|
||||
//gird and calculation start
|
||||
$slug = \Config\Services::slug();
|
||||
$grid_type = $slab_details['grid_master']['ui_type'];
|
||||
$grid_type = $emp_data['temp']['grid_id'];
|
||||
$temp_slab_rates = $emp_data['temp']['grid_type'] == 'primary' ? $slab_details['slab_rates'] : $slab_details['additional_slab_info']['slab_rates'];
|
||||
|
||||
//if curent action is dependent addition OR addition then pull insurer master to set whether add one day from employee date of coverage
|
||||
if($emp_data['temp']['action'] == 'DA' || $emp_data['temp']['action'] == 'A')
|
||||
{
|
||||
$insurer = new InsurerModel();
|
||||
$insurer = ($insurer->find($policy_terms['insurer_id']));
|
||||
if($insurer['addition_add_day'] == true)
|
||||
{
|
||||
$emp_data['policy_details']['date_coverage'] = (new DateTime($emp_data['policy_details']['date_coverage']))->modify('+1 day')->format('Y-m-d');
|
||||
}
|
||||
}
|
||||
// dd($emp_data);
|
||||
$is_match_found = false;
|
||||
switch ($grid_type) {
|
||||
case "1":
|
||||
//GPA - Sum Insured (SI) * Multiplier
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
$employee_received_band = $emp_data['temp']['band'];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
if(($slab_value['si'] == $employee_received_si) || ($slab_value['grade'] != null && $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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -785,16 +935,16 @@ if (!function_exists('premium_calculation_manager'))
|
||||
case "2":
|
||||
//GPA - Flat Rate for all SI
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
if($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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -804,16 +954,16 @@ if (!function_exists('premium_calculation_manager'))
|
||||
case "3":
|
||||
//GMC - SI
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
if($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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -826,7 +976,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
//GMC - Employees Age band
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
// dd($employee_received_si);
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_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))
|
||||
@ -835,9 +985,9 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -847,7 +997,7 @@ if (!function_exists('premium_calculation_manager'))
|
||||
case "5":
|
||||
//GMC - Employees Age + SI
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_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))
|
||||
@ -855,9 +1005,9 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -867,18 +1017,18 @@ if (!function_exists('premium_calculation_manager'))
|
||||
case "6":
|
||||
//GMC - Employees + Dependent Age band
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_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) && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
// echo $emp_data['name'];
|
||||
$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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -889,17 +1039,17 @@ if (!function_exists('premium_calculation_manager'))
|
||||
case "7":
|
||||
//GMC - Employees + Dependent Age + SI
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_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) && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
$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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
|
||||
$is_match_found = true;
|
||||
@ -911,18 +1061,18 @@ if (!function_exists('premium_calculation_manager'))
|
||||
//GMC - SI as per Grade or Band
|
||||
$employee_received_band = $emp_data['temp']['band'];
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
|
||||
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -933,17 +1083,17 @@ if (!function_exists('premium_calculation_manager'))
|
||||
//GMC - Flat Rate for all
|
||||
$employee_received_band = $emp_data['temp']['band'];
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
|
||||
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
$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($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days;
|
||||
$emp_data['policy_details']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = (float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.','');
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -954,18 +1104,23 @@ if (!function_exists('premium_calculation_manager'))
|
||||
//GMC - Maximum age of Dependents
|
||||
$max_age = $emp_data['temp']['maxage'];
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
// echo $emp_data['name'].'-'.$employee_received_si.'<br>';
|
||||
// echo $emp_data['temp']['grid_type'].'<br>';
|
||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_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) && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
// echo $slab_value['si'].'-'.$slab_value['age_from'].'-'.$slab_value['age_to'].'-'.$max_age.'<br>';
|
||||
if( $slab_value['si'] == $employee_received_si &&
|
||||
($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age) &&
|
||||
(($slab_value['premium_type'] == 1 &&
|
||||
( (strtolower($emp_data['relationship']) == 'self') || ($emp_data['temp']['additional_rack_rate_acting_self']) )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) )
|
||||
{
|
||||
$emp_data['policy_details']['basic_cover_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']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -979,10 +1134,11 @@ if (!function_exists('premium_calculation_manager'))
|
||||
// echo $employee_received_band;
|
||||
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
|
||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
|
||||
if($slab_value['si'] == $employee_received_si && ($slab_value['grade'] == $employee_received_band) && (($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self') || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
if($slab_value['si'] == $employee_received_si && $slab_value['grade'] == $employee_received_band && (($slab_value['premium_type'] == 1 &&
|
||||
( (strtolower($emp_data['relationship']) == 'self') || ($emp_data['temp']['additional_rack_rate_acting_self']) )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
|
||||
{
|
||||
//calculate premium based on count
|
||||
// echo $emp_data['name'];
|
||||
@ -992,9 +1148,9 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$emp_data['policy_details']['basic_cover_si'] = $familiy_si_covered;
|
||||
$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']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$emp_data['policy_details']['premium'] = get_premium_for_si(slab_details: $slab_details,si_amount: $familiy_si_covered,band: $employee_received_band);
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days']);
|
||||
$emp_data['policy_details']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -1009,17 +1165,17 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$employee_relationship = $slug->slugify($emp_data['relationship']);
|
||||
$employee_relationship = ($employee_relationship == 'daughter' || $employee_relationship == 'son' ? $employee_relationship = 'child' : $employee_relationship);
|
||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self')) )
|
||||
if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self'] ) )) )
|
||||
{
|
||||
|
||||
$emp_data['policy_details']['basic_cover_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']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],(calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days + 1));
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -1034,17 +1190,17 @@ if (!function_exists('premium_calculation_manager'))
|
||||
$employee_relationship = ($employee_relationship == 'daughter' || $employee_relationship == 'son' ? $employee_relationship = 'child' : $employee_relationship);
|
||||
$emp_data['policy_details']['basic_cover_si'] = null;
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
foreach ($temp_slab_rates as $skey => $slab_value)
|
||||
{
|
||||
if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && strtolower($emp_data['relationship']) == 'self')) )
|
||||
if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
|
||||
{
|
||||
|
||||
$emp_data['policy_details']['basic_cover_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']['days'] = (calculate_days_bw_dates($emp_data['policy_details']['date_coverage'],$policy_terms['policy_end_date'])->days + 1);
|
||||
$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']['rata_premimum'] = calculate_pro_rata_premimum($emp_data['policy_details']['premium'],$emp_data['policy_details']['days'],calculate_days_bw_dates($policy_terms['policy_start_date'],$policy_terms['policy_end_date'])->days);
|
||||
$emp_data['policy_details']['gst'] = ((float) number_format(($emp_data['policy_details']['rata_premimum'] * (18/100)),2,'.',''));
|
||||
$is_match_found = true;
|
||||
break;
|
||||
@ -1055,13 +1211,13 @@ if (!function_exists('premium_calculation_manager'))
|
||||
|
||||
|
||||
default:
|
||||
$this->myLogger->logme('error',($emp_data['emp_code'].'-'.$emp_data['name'].' - grid type not found'));
|
||||
$myLogger->logme('error',($emp_data['emp_code'].'-'.$emp_data['name'].' - grid type not found'));
|
||||
}
|
||||
if(!$is_match_found)
|
||||
{
|
||||
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
|
||||
$log_message = '[ client_policy_id : ' .$emp_data['policy_details']['client_policy_id'].' - '. $emp_data['emp_code'].' - '.$emp_data['name'] .' - '. $emp_data['policy_details']['basic_cover_si'] . ', Age : '. $age.' ]';
|
||||
if($slab_details['slab_rates'][0]['premium_type'] == 1)
|
||||
if($temp_slab_rates[0]['premium_type'] == 1)
|
||||
{
|
||||
$log_message .= ' - skipping, calculating only self..!';
|
||||
//reset emp si and others policy level data if premium only for self
|
||||
@ -1085,9 +1241,17 @@ if (!function_exists('premium_calculation_manager'))
|
||||
|
||||
if (!function_exists('calculate_pro_rata_premimum'))
|
||||
{
|
||||
function calculate_pro_rata_premimum($premium,$days)
|
||||
function calculate_pro_rata_premimum($premium,$employee_policy_coverage_days,$policy_coverage_days)
|
||||
{
|
||||
return (float) number_format(($premium / 365) * $days,2,'.','');
|
||||
return (float) number_format(($premium / ($policy_coverage_days) ) * $employee_policy_coverage_days,2,'.','');
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('no_of_days_in_current_fin_year'))
|
||||
{
|
||||
function no_of_days_in_current_fin_year()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1134,6 +1298,7 @@ if (!function_exists('transform_db_data_to_excel'))
|
||||
$row['temp']['emp_policy_id'] = $value['emp_policy_id'];
|
||||
$row['temp']['emp_status'] = $value['emp_status'];
|
||||
$row['temp']['policy_status'] = $value['status'];
|
||||
$row['temp']['rata_premimum'] = $value['rata_premimum'];
|
||||
|
||||
array_push($return_data, ($row));
|
||||
}
|
||||
@ -1226,7 +1391,7 @@ if(!function_exists('get_premium_for_si'))
|
||||
{
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band)
|
||||
if($slab_value['si'] == $si_amount && $slab_value['grade'] == $band && $slab_value['max_si'] == 0)
|
||||
{
|
||||
return $slab_value['premium'];
|
||||
}
|
||||
@ -1297,4 +1462,47 @@ if(!function_exists('check_dup_mobileno'))
|
||||
}
|
||||
return array('status' => true);
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('generate_family_relationship_array'))
|
||||
{
|
||||
function generate_family_relationship_array($family_structure_from_policy_terms) {
|
||||
$family_relationships = [];
|
||||
|
||||
// Add self and spouse
|
||||
if ($family_structure_from_policy_terms['self'] > 0) {
|
||||
$family_relationships[] = 'self';
|
||||
}
|
||||
if ($family_structure_from_policy_terms['spouse'] > 0) {
|
||||
$family_relationships[] = 'spouse';
|
||||
}
|
||||
|
||||
// Add children
|
||||
if ($family_structure_from_policy_terms['childrens'] > 0) {
|
||||
$family_relationships[] = 'son';
|
||||
$family_relationships[] = 'daughter';
|
||||
}
|
||||
|
||||
// Add parents
|
||||
if ($family_structure_from_policy_terms['parents'] > 0) {
|
||||
$family_relationships[] = 'father';
|
||||
$family_relationships[] = 'mother';
|
||||
}
|
||||
|
||||
// Add parents-in-law
|
||||
if ($family_structure_from_policy_terms['parents-in-law'] > 0) {
|
||||
$family_relationships[] = 'father-in-law';
|
||||
$family_relationships[] = 'mother-in-law';
|
||||
}
|
||||
|
||||
// Add either parents or parents-in-law
|
||||
if ($family_structure_from_policy_terms['either-parents-pil'] > 0) {
|
||||
$family_relationships[] = 'father';
|
||||
$family_relationships[] = 'mother';
|
||||
$family_relationships[] = 'father-in-law';
|
||||
$family_relationships[] = 'mother-in-law';
|
||||
}
|
||||
|
||||
return $family_relationships;
|
||||
}
|
||||
}
|
||||
@ -105,6 +105,7 @@ class sendMailNotification
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
$mail_content = $notification['mail_content'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
@ -114,8 +115,9 @@ class sendMailNotification
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("[[post_enrollment_app_link]]", "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
|
||||
|
||||
@ -10,6 +10,37 @@ if (!function_exists('check_session')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_last_visited_time')) {
|
||||
function set_last_visited_time()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->set('last_visited', date("Y-m-d H:i:s"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_last_visited_time')) {
|
||||
function get_last_visited_time()
|
||||
{
|
||||
// Get the session service
|
||||
$session = \Config\Services::session();
|
||||
|
||||
// Get the last visited time from session
|
||||
$lastVisitTime = $session->get('last_visited');
|
||||
|
||||
// Check if the last visited time is set
|
||||
if ($lastVisitTime) {
|
||||
// Calculate the time five minutes ago
|
||||
$fiveMinutesBefore = date("YmdHi", strtotime('-5 minutes'));
|
||||
|
||||
// Compare the last visited time with the time five minutes ago
|
||||
return date("YmdHi", strtotime($lastVisitTime)) > $fiveMinutesBefore ? 1 : 0;
|
||||
}
|
||||
|
||||
// If last visited time is not set, return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_session_userid')) {
|
||||
function get_session_userid()
|
||||
{
|
||||
|
||||
@ -188,6 +188,7 @@ if (!function_exists('get_base64_image')) {
|
||||
if (!function_exists('format_indian_number')) {
|
||||
function format_indian_number($number) {
|
||||
// Round the number to two decimal places
|
||||
$number = isset($number) ? $number : 0;
|
||||
$number = round($number, 2);
|
||||
|
||||
// Split the number into integer and decimal parts
|
||||
@ -218,3 +219,23 @@ if (!function_exists('format_indian_number')) {
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('get_username')) {
|
||||
function get_username($user_id) {
|
||||
// Connect to the database
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
// Query the database
|
||||
$query = $db->table('user_profiles')
|
||||
->select('first_name')
|
||||
->where('id', $user_id)
|
||||
->get();
|
||||
|
||||
// Get the result
|
||||
$result = $query->getRow();
|
||||
|
||||
// Return the username if found, otherwise return null
|
||||
return $result ? $result->first_name : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
21
app/Models/AddImgModel.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class AddImgModel extends Model
|
||||
{
|
||||
protected $table = 'advertisement_images';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"name",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@ -24,6 +24,7 @@ class BatchFileModel extends Model
|
||||
"amount",
|
||||
"status",
|
||||
"error_data",
|
||||
"client_branch_id",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\ClientBranchModel;
|
||||
|
||||
class ClientModel extends Model
|
||||
{
|
||||
@ -41,7 +42,19 @@ class ClientModel extends Model
|
||||
|
||||
foreach ($clients as &$client) {
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$clientPolicies = $clientPolicyModel->select(['client_policy.id','p.name','pt.policy_type'])
|
||||
$clientPolicies = $clientPolicyModel
|
||||
->select(['
|
||||
|
||||
client_branch.id as branch_id',
|
||||
'client_branch.branch_name',
|
||||
'client_branch.branch_code',
|
||||
'client_branch.client_id',
|
||||
'client_policy.id as client_policy_id',
|
||||
'client_policy.policy_terms',
|
||||
'p.name',
|
||||
'pt.policy_type',
|
||||
])
|
||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||
->join('policies p', 'p.id = client_policy.policy_id')
|
||||
->join('policy_type pt','client_policy.policy_type_id = pt.id')
|
||||
->where('client_policy.client_id',$client['id'])
|
||||
@ -50,6 +63,13 @@ class ClientModel extends Model
|
||||
->findAll();
|
||||
|
||||
$client['policies'] = $clientPolicies;
|
||||
|
||||
$clientBranchModel = new ClientBranchModel();
|
||||
$clientBranchs = $clientBranchModel->select(['client_branch.id','client_branch.branch_name','client_branch.branch_code', 'client_branch.client_id'])
|
||||
->where('client_branch.client_id',$client['id'])
|
||||
->findAll();
|
||||
|
||||
$client['branchs'] = $clientBranchs;
|
||||
}
|
||||
//print_r(($clients));die();
|
||||
return $clients;
|
||||
|
||||
@ -41,7 +41,8 @@ class ClientPolicyModel extends Model
|
||||
"Is_active",
|
||||
"date_of_exit",
|
||||
"reason_for_exit",
|
||||
"policy_no"
|
||||
"policy_no",
|
||||
"client_branch_id"
|
||||
];
|
||||
|
||||
public function getClientPolicyById($id){
|
||||
|
||||
@ -37,7 +37,10 @@ class EmployeeModel extends Model
|
||||
"is_active",
|
||||
"file_id",
|
||||
"is_addon_value",
|
||||
"is_createdby_hr"
|
||||
"is_createdby_hr",
|
||||
"client_branch_id",
|
||||
"token_time_out",
|
||||
"emp_type"
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
@ -76,7 +79,7 @@ class EmployeeModel extends Model
|
||||
|
||||
|
||||
// for emp onboard process do not change
|
||||
public function checkExistingEmp($arr)
|
||||
public function checkExistingEmp($arr,$client_branch_id)
|
||||
{
|
||||
|
||||
if($arr['temp']['emp_id'] == null)
|
||||
@ -84,9 +87,12 @@ class EmployeeModel extends Model
|
||||
return $this->where('emp_code',$arr['emp_code'])
|
||||
->where('name',$arr['name'])
|
||||
->where('client_id',$arr['client_id'])
|
||||
->where('client_branch_id',$client_branch_id)
|
||||
->where('is_active',1)
|
||||
->where('gender',$arr['gender'])
|
||||
->where('dob',$arr['dob'])
|
||||
->where('is_active',1)
|
||||
->where('emp_status','active')
|
||||
->find();
|
||||
}
|
||||
else
|
||||
@ -96,9 +102,9 @@ class EmployeeModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [])
|
||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [],array $client_branch_id = [])
|
||||
{
|
||||
$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','policies.name as policy_name','client_policy.is_addon'])
|
||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_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','policies.name as policy_name','client_policy.is_addon'])
|
||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
@ -116,6 +122,9 @@ class EmployeeModel extends Model
|
||||
})
|
||||
->when(count($emp_status), function($query) use ($emp_status){
|
||||
return $query->whereIn('employees.emp_status', $emp_status);
|
||||
})
|
||||
->when(count($client_branch_id), function($query) use ($client_branch_id){
|
||||
return $query->whereIn('employees.client_branch_id', $client_branch_id);
|
||||
})
|
||||
->when(count($relationship), function($query) use ($relationship){
|
||||
return $query->whereIn('employees.relationship', $relationship);
|
||||
|
||||
@ -76,7 +76,7 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------
|
||||
public function getEmployeePolicy($client_id,$policy_id,$status)
|
||||
public function getEmployeePolicy($client_id,$policy_id,$status, $branch_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','emp.mobile as mobile'])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
@ -88,6 +88,7 @@ class EmployeePolicyModel extends Model
|
||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||
->where('emp.client_id',$client_id)
|
||||
->where('emp.client_branch_id',$branch_id)
|
||||
->where('employee_polices.is_active',1)
|
||||
->where('emp.is_active',1)
|
||||
->where('employee_polices.client_policy_id',$policy_id)
|
||||
@ -119,6 +120,7 @@ class EmployeePolicyModel extends Model
|
||||
public function getInceptionEmployeeDataForExportExcel($ref_data)
|
||||
{
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
$event = $ref_data['event_type'];
|
||||
|
||||
@ -141,7 +143,7 @@ class EmployeePolicyModel extends Model
|
||||
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,
|
||||
employees.emp_type as emp_type,
|
||||
|
||||
employee_polices.id as primaryKey,
|
||||
employee_polices.tpa_id,
|
||||
@ -173,7 +175,13 @@ class EmployeePolicyModel extends Model
|
||||
) as batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '')
|
||||
AND employee_polices.is_active = 1";
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
AND employee_polices.is_active = 1
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
|
||||
";
|
||||
|
||||
// Get the result set
|
||||
$query = $this->db->query($sql);
|
||||
@ -187,6 +195,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
$client_id = $ref_data['client_id'];
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$sql = "
|
||||
@ -205,7 +214,7 @@ class EmployeePolicyModel extends Model
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.client_id AS emp_client_id,
|
||||
'Has Define' AS emp_type,
|
||||
employees.emp_type as emp_type,
|
||||
employee_polices.uhid,
|
||||
employees.relationship_code,
|
||||
batch_data.emp_policy_id,
|
||||
@ -231,11 +240,16 @@ class EmployeePolicyModel extends Model
|
||||
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}'
|
||||
WHERE employees.client_id = '{$client_id}'
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
AND emp_endorsement.actions = 'c'
|
||||
AND employee_polices.is_active = 1
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
AND (employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id != '')
|
||||
AND (employee_polices.uhid IS NOT NULL AND employee_polices.uhid != '')
|
||||
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
||||
|
||||
// Execute the raw query
|
||||
@ -254,18 +268,20 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
$client_id = $ref_data['client_id'];
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
a.id as endorsement_primarykey,
|
||||
a.group_key,
|
||||
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,
|
||||
employees.emp_type as emp_type,
|
||||
employee_polices.uhid AS risk_id,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.policy_end_date,
|
||||
@ -277,10 +293,15 @@ class EmployeePolicyModel extends Model
|
||||
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
|
||||
@ -340,13 +361,16 @@ class EmployeePolicyModel extends Model
|
||||
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'
|
||||
|
||||
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||
AND a.field_name = 'si_enhancement_date'
|
||||
AND a.actions = 'si'
|
||||
AND employee_polices.is_active = 1
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
group by group_key
|
||||
");
|
||||
|
||||
// Get the result set
|
||||
@ -361,18 +385,20 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
$client_id = $ref_data['client_id'];
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$client_branch_id = $ref_data['client_branch_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
SELECT DISTINCT
|
||||
a.id as endorsement_primarykey,
|
||||
a.group_key,
|
||||
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,
|
||||
employees.emp_type as emp_type,
|
||||
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.uhid as risk_id,
|
||||
@ -396,7 +422,7 @@ class EmployeePolicyModel extends Model
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN
|
||||
employees ON a.emp_code = employees.emp_code
|
||||
employees ON a.emp_code = employees.emp_code and a.pk = employees.id
|
||||
LEFT JOIN
|
||||
employee_polices ON employees.id = employee_polices.employee_id
|
||||
|
||||
@ -431,15 +457,20 @@ class EmployeePolicyModel extends Model
|
||||
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}
|
||||
|
||||
WHERE employee_polices.client_policy_id = {$client_policy_id}
|
||||
AND employees.client_branch_id = {$client_branch_id}
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||
AND a.actions = 'd'
|
||||
AND employee_polices.is_active = 1
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status'
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
group by group_key
|
||||
");
|
||||
|
||||
$result = $query->getResult();
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
@ -538,34 +569,62 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
public function fetchEmpEndorsementData($fetch_data)
|
||||
{
|
||||
// dd($fetch_data);
|
||||
|
||||
$client_policy_id = $fetch_data['client_policy_id'];
|
||||
$client_branch_id = $fetch_data['client_branch_id'];
|
||||
$emp_name = $fetch_data['emp_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";
|
||||
SELECT
|
||||
ee.id as emp_endorsement_primarykey,
|
||||
ep.id as emp_policy_primarykey,
|
||||
e.id as employees_primarykey,
|
||||
ee.group_key,
|
||||
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
|
||||
JOIN employees AS e ON e.emp_code = ee.emp_code
|
||||
WHERE
|
||||
ee.emp_code = '$emp_code'
|
||||
AND ep.client_policy_id = '$client_policy_id'
|
||||
AND e.client_branch_id = '$client_branch_id'
|
||||
AND ee.name = '$emp_name'
|
||||
AND ee.field_name IN ('date_of_exit', 'reason_for_exit', 'status')
|
||||
AND ep.is_active = 1
|
||||
AND ep.status = 'active'
|
||||
AND e.is_active = 1
|
||||
AND e.emp_status = 'active'
|
||||
GROUP BY
|
||||
ee.group_key
|
||||
";
|
||||
|
||||
// dd($sql);
|
||||
|
||||
// Execute the raw SQL query
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
// Fetch and return results
|
||||
return $row = $query->getRowArray();
|
||||
$row = $query->getRowArray();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
@ -592,7 +651,7 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getEmployeeEndorsementList($client_id, $policy_id, $status)
|
||||
public function getEmployeeEndorsementList($client_id, $policy_id, $status, $branch_id)
|
||||
{
|
||||
$query1 = $this->db->table('emp_endorsement e');
|
||||
$query1->select('
|
||||
@ -609,14 +668,16 @@ class EmployeePolicyModel extends Model
|
||||
insurers.short_name as insurer_short_name
|
||||
');
|
||||
$query1->distinct();
|
||||
$query1->join('employee_polices ep', 'ep.id = e.pk', 'left');
|
||||
$query1->join('employees', 'employees.id = ep.employee_id', 'left');
|
||||
$query1->join('client_policy', 'client_policy.id = ep.client_policy_id', 'left');
|
||||
$query1->join('policies', 'policies.id = client_policy.policy_id', 'left');
|
||||
$query1->join('insurers', 'insurers.id = policies.insurer_id', 'left');
|
||||
$query1->join('employee_polices ep', 'ep.id = e.pk');
|
||||
$query1->join('employees', 'employees.id = ep.employee_id');
|
||||
$query1->join('client_policy', 'client_policy.id = ep.client_policy_id');
|
||||
$query1->join('client_branch', 'client_branch.id = employees.client_branch_id');
|
||||
$query1->join('policies', 'policies.id = client_policy.policy_id');
|
||||
$query1->join('insurers', 'insurers.id = policies.insurer_id');
|
||||
$query1->whereIn('e.actions', ['c']);
|
||||
$query1->where('ep.client_policy_id', $client_id);
|
||||
$query1->where('employees.client_id', $policy_id);
|
||||
$query1->where('ep.client_policy_id', $policy_id);
|
||||
$query1->where('employees.client_id', $client_id);
|
||||
$query1->where('employees.client_branch_id', $branch_id);
|
||||
if($status != 0 && !empty($status)){
|
||||
|
||||
$query1->where('e.status', $status);
|
||||
@ -640,14 +701,16 @@ class EmployeePolicyModel extends Model
|
||||
policies.name as policy_name,
|
||||
insurers.short_name as insurer_short_name
|
||||
');
|
||||
$query2->join('employee_polices ep', 'ep.id = e.pk', 'left');
|
||||
$query2->join('employees', 'employees.id = ep.employee_id', 'left');
|
||||
$query2->join('client_policy', 'client_policy.id = ep.client_policy_id', 'left');
|
||||
$query2->join('policies', 'policies.id = client_policy.policy_id', 'left');
|
||||
$query2->join('insurers', 'insurers.id = policies.insurer_id', 'left');
|
||||
$query2->join('employee_polices ep', 'ep.id = e.pk');
|
||||
$query2->join('employees', 'employees.id = ep.employee_id');
|
||||
$query2->join('client_policy', 'client_policy.id = ep.client_policy_id');
|
||||
$query2->join('client_branch', 'client_branch.id = employees.client_branch_id');
|
||||
$query2->join('policies', 'policies.id = client_policy.policy_id');
|
||||
$query2->join('insurers', 'insurers.id = policies.insurer_id');
|
||||
$query2->whereIn('e.actions', ['si', 'd']);
|
||||
$query2->where('ep.client_policy_id', $client_id);
|
||||
$query2->where('employees.client_id', $policy_id);
|
||||
$query2->where('ep.client_policy_id', $policy_id);
|
||||
$query2->where('employees.client_id', $client_id);
|
||||
$query1->where('employees.client_branch_id', $branch_id);
|
||||
if($status != 0 && !empty($status)){
|
||||
|
||||
$query2->where('e.status', $status);
|
||||
@ -731,6 +794,7 @@ class EmployeePolicyModel extends Model
|
||||
clients.short_name AS client_short_name,
|
||||
|
||||
cp.policy_start_date,
|
||||
cp.policy_no,
|
||||
|
||||
policies.name AS policy_name,
|
||||
|
||||
@ -768,6 +832,72 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getECardSingleData($rand_string, $emp_code){
|
||||
|
||||
$result = $this->db->table('employees e')
|
||||
->select('e.id,
|
||||
e.name, e.mobile,
|
||||
e.relationship,
|
||||
e.relationship_code,
|
||||
e.emp_code,
|
||||
e.email_personal,
|
||||
e.email_corporate,
|
||||
e.gender,
|
||||
e.dob,
|
||||
e.doj,
|
||||
e.band,
|
||||
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
||||
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ') AS self,
|
||||
|
||||
|
||||
ep.tpa_id,
|
||||
ep.uhid,
|
||||
ep.policy_end_date,
|
||||
|
||||
clients.client_name,
|
||||
clients.short_name AS client_short_name,
|
||||
|
||||
cp.policy_start_date,
|
||||
cp.policy_no,
|
||||
|
||||
policies.name AS policy_name,
|
||||
|
||||
insurers.name AS insurer_name,
|
||||
insurers.short_name AS insurer_short_name,
|
||||
insurers.insurer_logo,
|
||||
|
||||
insurer_branch.branch_name,
|
||||
insurer_branch.branch_code,
|
||||
insurer_branch.city as insurer_branch_city,
|
||||
|
||||
tpa.name AS tpa_name,
|
||||
tpa.tpa_logo AS tpa_logo,
|
||||
tpa.front_card,
|
||||
tpa.back_card,
|
||||
tpa.short_name AS tpa_short_name'
|
||||
)
|
||||
|
||||
->join('employee_polices ep', 'ep.employee_id = e.id')
|
||||
->join('client_policy cp', 'cp.id = ep.client_policy_id')
|
||||
->join('clients', 'clients.id = cp.client_id')
|
||||
->join('policies', 'policies.id = cp.policy_id')
|
||||
->join('insurers', 'insurers.id = cp.insurer_id')
|
||||
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
|
||||
->join('tpa', 'tpa.id = cp.tpa_id')
|
||||
->where("ep.tpa_id IS NOT NULL AND ep.tpa_id <> ''")
|
||||
->where('e.emp_status', 'active')
|
||||
->where('e.is_active', '1')
|
||||
->where('ep.status', 'active')
|
||||
->where('ep.is_active', '1')
|
||||
->where('ep.rand_string', $rand_string)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -789,4 +919,194 @@ class EmployeePolicyModel extends Model
|
||||
}
|
||||
|
||||
|
||||
public function bulkUpdate($emp_details)
|
||||
{
|
||||
// Extract IDs, tpa_ids, and uhids
|
||||
$ids = array_column($emp_details, 'id');
|
||||
$tpa_ids = array_column($emp_details, 'tpa_id');
|
||||
$uhids = array_column($emp_details, 'uhid');
|
||||
|
||||
// Escape values for SQL
|
||||
$escapedIds = array_map([$this->db, 'escape'], $ids);
|
||||
$escapedTpaIds = array_map([$this->db, 'escape'], $tpa_ids);
|
||||
$escapedUhids = array_map([$this->db, 'escape'], $uhids);
|
||||
|
||||
// Construct the CASE statements
|
||||
$caseTpaId = array_map(function($id, $tpa_id) {
|
||||
return "WHEN id = $id THEN $tpa_id";
|
||||
}, $escapedIds, $escapedTpaIds);
|
||||
|
||||
$caseUhid = array_map(function($id, $uhid) {
|
||||
return "WHEN id = $id THEN $uhid";
|
||||
}, $escapedIds, $escapedUhids);
|
||||
|
||||
// Convert cases to a string
|
||||
$caseTpaIdString = implode(' ', $caseTpaId);
|
||||
$caseUhidString = implode(' ', $caseUhid);
|
||||
|
||||
// Convert ids to a string
|
||||
$idsString = implode(', ', $escapedIds);
|
||||
|
||||
// Construct the SQL query
|
||||
$sql = "
|
||||
UPDATE {$this->table}
|
||||
SET
|
||||
tpa_id = CASE {$caseTpaIdString} END,
|
||||
uhid = CASE {$caseUhidString} END
|
||||
WHERE id IN ({$idsString})
|
||||
";
|
||||
|
||||
// Begin a transaction
|
||||
$this->db->transBegin();
|
||||
|
||||
try {
|
||||
// Execute the query
|
||||
$this->db->query($sql);
|
||||
|
||||
// Commit the transaction
|
||||
if ($this->db->transStatus() === FALSE) {
|
||||
// If something went wrong, rollback
|
||||
$this->db->transRollback();
|
||||
throw new \Exception('Bulk update failed.');
|
||||
} else {
|
||||
// Otherwise, commit
|
||||
$this->db->transCommit();
|
||||
}
|
||||
|
||||
return $this->db->getLastQuery();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Rollback the transaction on error
|
||||
$this->db->transRollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function bulkUpdateForEndorsement($endorsement_details)
|
||||
{
|
||||
|
||||
// Extract IDs, endorsement_ids, and statuses
|
||||
$ids = array_column($endorsement_details, 'group_key');
|
||||
$endorsement_ids = array_column($endorsement_details, 'endorsement_id');
|
||||
$statuses = array_column($endorsement_details, 'status');
|
||||
|
||||
// Escape values for SQL
|
||||
$escapedIds = array_map([$this->db, 'escape'], $ids);
|
||||
$escapedEndorsementIds = array_map([$this->db, 'escape'], $endorsement_ids);
|
||||
$escapedStatuses = array_map([$this->db, 'escape'], $statuses);
|
||||
|
||||
// Construct the CASE statements
|
||||
$caseEndorsementId = array_map(function ($id, $endorsement_id) {
|
||||
return "WHEN group_key = $id THEN $endorsement_id";
|
||||
}, $escapedIds, $escapedEndorsementIds);
|
||||
|
||||
$caseStatus = array_map(function ($id, $status) {
|
||||
return "WHEN status = $id THEN $status";
|
||||
}, $escapedIds, $escapedStatuses);
|
||||
|
||||
// Convert cases to a string
|
||||
$caseEndorsementIdString = implode(' ', $caseEndorsementId);
|
||||
$caseStatusString = implode(' ', $caseStatus);
|
||||
|
||||
// Convert ids to a string
|
||||
$idsString = implode(', ', $escapedIds);
|
||||
|
||||
// Construct the SQL query
|
||||
$sql = "
|
||||
UPDATE emp_endorsement
|
||||
SET
|
||||
endorsement_id = CASE {$caseEndorsementIdString} END,
|
||||
status = CASE {$caseStatusString} END
|
||||
WHERE group_key IN ({$idsString})
|
||||
";
|
||||
|
||||
// Begin a transaction
|
||||
$this->db->transBegin();
|
||||
|
||||
try {
|
||||
// Execute the query
|
||||
$this->db->query($sql);
|
||||
|
||||
// Commit the transaction
|
||||
if ($this->db->transStatus() === FALSE) {
|
||||
// If something went wrong, rollback
|
||||
$this->db->transRollback();
|
||||
throw new \Exception('Bulk update failed.');
|
||||
} else {
|
||||
// Otherwise, commit
|
||||
$this->db->transCommit();
|
||||
}
|
||||
|
||||
return $this->db->getLastQuery();
|
||||
} catch (\Exception $e) {
|
||||
// Rollback the transaction on error
|
||||
$this->db->transRollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function bulkUpdateForCorrection($emp_details){
|
||||
|
||||
foreach ($emp_details as $employee) {
|
||||
$id = $this->db->escape($employee['id']);
|
||||
$ids[] = $id;
|
||||
|
||||
foreach ($employee as $field => $value) {
|
||||
if ($field === 'id') continue;
|
||||
$escapedValue = $this->db->escape($value);
|
||||
|
||||
if (!isset($caseStatements[$field])) {
|
||||
$caseStatements[$field] = [];
|
||||
}
|
||||
|
||||
$caseStatements[$field][] = "WHEN id = $id THEN $escapedValue";
|
||||
}
|
||||
}
|
||||
|
||||
// Construct the CASE strings
|
||||
$caseStrings = [];
|
||||
foreach ($caseStatements as $field => $cases) {
|
||||
$caseStrings[] = "$field = CASE " . implode(' ', $cases) . " END";
|
||||
}
|
||||
|
||||
// Convert ids to a string
|
||||
$idsString = implode(', ', $ids);
|
||||
|
||||
// Construct the SQL query
|
||||
$sql = "
|
||||
UPDATE employees
|
||||
SET " . implode(', ', $caseStrings) . "
|
||||
WHERE id IN ($idsString)
|
||||
";
|
||||
|
||||
// Begin a transaction
|
||||
$this->db->transBegin();
|
||||
|
||||
try {
|
||||
// Execute the query
|
||||
$this->db->query($sql);
|
||||
|
||||
// Commit the transaction
|
||||
if ($this->db->transStatus() === FALSE) {
|
||||
// If something went wrong, rollback
|
||||
$this->db->transRollback();
|
||||
throw new \Exception('Bulk update failed.');
|
||||
} else {
|
||||
// Otherwise, commit
|
||||
$this->db->transCommit();
|
||||
}
|
||||
|
||||
return $this->db->getLastQuery();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Rollback the transaction on error
|
||||
$this->db->transRollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
25
app/Models/FEContentModel.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class FEContentModel extends Model
|
||||
{
|
||||
protected $table = 'fe_content';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"type",
|
||||
"content_section",
|
||||
"heading",
|
||||
"content",
|
||||
"notes",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
];
|
||||
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
@ -17,7 +17,8 @@ class FileModel extends Model
|
||||
"reason",
|
||||
"action",
|
||||
"client_id",
|
||||
"policy_id"
|
||||
"policy_id",
|
||||
"client_branch_id",
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ class InsurerModel extends Model
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"addition_add_day"
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@ class MessageModel extends Model
|
||||
$builder->orWhere('messages.role_id', $roleId);
|
||||
$builder->orWhere('messages.team_id', $teamId);
|
||||
$builder->groupEnd();
|
||||
$builder->orderBy('id', 'desc');
|
||||
|
||||
$query = $builder->get();
|
||||
return $query->getResult();
|
||||
|
||||
@ -39,7 +39,9 @@ class PolicesModel extends Model
|
||||
{
|
||||
|
||||
$premium_slab_data = null;
|
||||
$additional_premium_slab_data = null;
|
||||
$grid_type = null;
|
||||
$additional_grid_type = null;
|
||||
|
||||
$policyPremium1Model = new PolicyPremium1Model();
|
||||
$premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
@ -48,7 +50,12 @@ class PolicesModel extends Model
|
||||
{
|
||||
// echo '2';
|
||||
$policyPremium2Model = new PolicyPremium2Model();
|
||||
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll();
|
||||
$premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1,'rack_rate_type' => 0])->findAll();
|
||||
|
||||
//check any additional rack rate configured
|
||||
$additional_premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1,'rack_rate_type' => 1])->findAll();
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(isset($premium_slab_data[0]['policy_grid_id']))
|
||||
@ -57,7 +64,14 @@ class PolicesModel extends Model
|
||||
$policyGridModel = new PolicyGridModel();
|
||||
$grid_type = $policyGridModel->find($grid_id);
|
||||
}
|
||||
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $grid_type];
|
||||
if(isset($additional_premium_slab_data[0]['policy_grid_id']))
|
||||
{
|
||||
$additional_grid_id = $additional_premium_slab_data[0]['policy_grid_id'];
|
||||
$policyGridModel = new PolicyGridModel();
|
||||
$additional_grid_type = $policyGridModel->find($additional_grid_id);
|
||||
}
|
||||
|
||||
|
||||
return ['slab_rates' => $premium_slab_data,'grid_master' => $grid_type,'additional_slab_info' => ['slab_rates' => $additional_premium_slab_data,'grid_master' => $additional_grid_type]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,8 @@ class PolicyPremium2Model extends Model
|
||||
'is_active',
|
||||
'premium_type',
|
||||
'relationship',
|
||||
'additional_relationship',
|
||||
'rack_rate_type',
|
||||
|
||||
];
|
||||
|
||||
|
||||
@ -42,9 +42,9 @@ table.dataTable tbody td {
|
||||
<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;">User List</h4>
|
||||
<h4 style="position: relative;">User List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<button type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target="#con-close-modal" data-placement="top" title="Add" data-trigger="hover">ADD</button>
|
||||
</div>
|
||||
</div>
|
||||
@ -303,8 +303,9 @@ var form = document.getElementById("UserForm");
|
||||
// Add submit event listener to the form
|
||||
form.addEventListener("submit", function(event) {
|
||||
// Disable the submit button to avoid multiple submissions
|
||||
document.getElementById("btnSubmit").disabled = true;
|
||||
// document.getElementById("btnSubmit").disabled = true;
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -1,33 +1,39 @@
|
||||
<style>
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.reload:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="col-12" id="second_page">
|
||||
<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>
|
||||
<h4 style="position: relative;">Batch List</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive nowrap w-100">
|
||||
<table id="datatable-buttons" class="table table-hover m-0 table-centered dt-responsive w-100">
|
||||
<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">Batch <br> Code</th>
|
||||
<th class="font-weight-medium">File Name</th>
|
||||
<th class="font-weight-medium">Client</th>
|
||||
<th class="font-weight-medium">Client <br> Branch</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">Event <br> Type</th>
|
||||
<th class="font-weight-medium">Insurer/ <br> TPA</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
<th class="font-weight-medium">Count</th>
|
||||
<th class="font-weight-medium">Amount</th>
|
||||
<th class="font-weight-medium">status</th>
|
||||
<th class="font-weight-medium">(₹)Amount</th>
|
||||
<th class="font-weight-medium">User/Time</th>
|
||||
<th class="font-weight-medium">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -37,39 +43,61 @@
|
||||
foreach ($batch_list as $key => $file) {
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1) ?></b></td>
|
||||
<td><?php echo $file['batch_code'] ?></td>
|
||||
<td data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>"><?php echo strlen($file['file_name']) > 5 ? substr($file['file_name'], 0, 10) . "..." : $file['file_name'] ?></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>
|
||||
<td><?php echo intval($file['amount']) ?></td>
|
||||
<td>
|
||||
<?php if ($file['status'] == 'failed') { ?>
|
||||
<?php echo $file['status']; ?> <a href="<?= base_url('/util/export-import-error-list/') . $file['id'] ?>" class="fe-alert-circle" style="color: #000;" aria-hidden="true" target="_blank" data-toggle="tooltip" data-placement="top" title="Click to show the error"></a>
|
||||
<?php } else if ($file['status'] == 'partially success') { ?>
|
||||
<?php echo $file['status']; ?>
|
||||
<?php if ($file['error_data'] != 0) { ?>
|
||||
<a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
<?php } ?>
|
||||
<?php } else if ($file['status'] == 'failed-1') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="The list of employees provided has already been updated with the TPA ID."></a>
|
||||
<?php } else if ($file['status'] == 'failed-2') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="The list of employees provided has already been updated with the UHID."></a>
|
||||
<?php } else if ($file['status'] == 'failed-3') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="The Excel record count exceeds the DB record count."></a>
|
||||
<?php } else if ($file['status'] == 'failed-4') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip" data-placement="top" title="Physical File Not Found."></a>
|
||||
<?php } else { ?>
|
||||
<?php echo $file['status']; ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1) ?></b></td>
|
||||
<td><?php echo $file['batch_code'] ?></td>
|
||||
<td class="reload" data-toggle="tooltip" data-placement="top"
|
||||
title="<?php echo $file['file_name'] ?>">
|
||||
<?php echo $file['file_name'] ?>
|
||||
</td>
|
||||
<td><?php echo $file['client_short_name'] ?></td>
|
||||
<td><?php echo $file['branch_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'] == null ? '-' : $file['count'] ?></td>
|
||||
|
||||
</tr>
|
||||
<td><?php echo format_indian_number($file['amount'])?></td>
|
||||
<td class="reload">
|
||||
<?php echo date('d-M-Y H:i:a', strtotime($file['created_at'])) ?> by <?php echo get_username($file['created_by']) ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($file['status'] == 'failed') { ?>
|
||||
<?php echo $file['status']; ?> <a
|
||||
href="<?= base_url('/util/export-import-error-list/') . $file['id'] ?>"
|
||||
class="fe-alert-circle" style="color: #000;" aria-hidden="true" target="_blank"
|
||||
data-toggle="tooltip" data-placement="top" title="Click to show the error"></a>
|
||||
<?php } else if ($file['status'] == 'partially success') { ?>
|
||||
<?php echo $file['status']; ?>
|
||||
<?php if ($file['error_data'] != 0) { ?>
|
||||
<a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="<?= $file['error_data'] ?>"></a>
|
||||
<?php } ?>
|
||||
<?php } else if ($file['status'] == 'failed-1') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top"
|
||||
title="<?= $file['event_type'] == 'inception' ? 'The list of employees provided has already been updated with the TPA ID.' : 'The list of employees provided has already been updated with the ENDORSEMENT ID.' ?> "></a>
|
||||
<?php } else if ($file['status'] == 'failed-2') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top"
|
||||
title="<?= $file['event_type'] == 'inception' ? 'The list of employees provided has already been updated with the UHID.' : 'The list of employees provided has already been updated with the ENDORSEMENT ID.' ?>"></a>
|
||||
<?php } else if ($file['status'] == 'failed-3') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top"
|
||||
title="The Excel record count exceeds the DB record count."></a>
|
||||
<?php } else if ($file['status'] == 'failed-4') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="Physical File Not Found."></a>
|
||||
<?php } else if ($file['status'] == 'failed-5') { ?>
|
||||
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
|
||||
data-placement="top" title="Wrong File Uploaded"></a>
|
||||
<?php } else { ?>
|
||||
<?php echo $file['status']; ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
|
||||
@ -79,33 +107,75 @@
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#datatable-buttons').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: 'Batch List',
|
||||
className: 'my_class',
|
||||
}],
|
||||
initComplete: function(settings, json) {
|
||||
$('.my_class').css({
|
||||
position: "relative",
|
||||
left: "50px"
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Function to format a number in Indian Rupees format
|
||||
function formatNumberInIndianRupees(number) {
|
||||
|
||||
$('#datatable-buttons').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: 'Batch List',
|
||||
className: 'my_class',
|
||||
}],
|
||||
initComplete: function(settings, json) {
|
||||
$('.my_class').css({
|
||||
position: "relative",
|
||||
left: "50px"
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true
|
||||
});
|
||||
const maxLength = 16;
|
||||
let value = number.toString().replace(/\D/g, ''); // Remove non-numeric characters
|
||||
|
||||
// Limit the number of digits
|
||||
value = value.slice(0, maxLength);
|
||||
|
||||
// Format the number with commas using Indian numbering system
|
||||
const formattedNumber = Number(value).toLocaleString('en-IN');
|
||||
|
||||
return formattedNumber;
|
||||
}
|
||||
|
||||
// Function to format numbers based on a class
|
||||
function formatNumbersByClass(className) {
|
||||
const elements = document.querySelectorAll(`.${className}`);
|
||||
console.log('element', elements)
|
||||
elements.forEach(element => {
|
||||
const number = parseFloat(element.innerText.replace(/,/g, ''));
|
||||
console.log('number', number)
|
||||
|
||||
if (!isNaN(number)) {
|
||||
console.log(formatNumberInIndianRupees(number))
|
||||
element.innerText = formatNumberInIndianRupees(number);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Format numbers when the DOM content is loaded
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
setTimeout(() => {
|
||||
|
||||
formatNumbersByClass('indian-number');
|
||||
|
||||
}, 500);
|
||||
});
|
||||
</script>
|
||||
@ -234,7 +234,7 @@ $(document).ready(function () {
|
||||
$("#branch_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
|
||||
console.log('branch_PrimaryKey', branch_PrimaryKey)
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<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 style="position: relative;">Client Deposit -
|
||||
<?php echo $clientName[0]['client_name'];?></h4>
|
||||
|
||||
</div>
|
||||
|
||||
331
app/Views/client_info.php
Normal file
@ -0,0 +1,331 @@
|
||||
<div id="client_info">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-12">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card">
|
||||
|
||||
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
|
||||
<div class="col-6">
|
||||
<h4 style="position: relative;left: 18px;top: 2px;">Client Basic Info</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-6" style="position: relative;left: 455px;">
|
||||
<button id="close_btn" class="btn btn-primary waves-effect waves-light client_info_close">Close</button>
|
||||
</div>
|
||||
<div class="col-1 float-right" style="position: relative;left: 255px;">
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
|
||||
<div class="card-body" style="position: relative;bottom: 25px;">
|
||||
|
||||
<div class="row" >
|
||||
|
||||
<div class="col-6">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="font-size: 18px;"> <strong> <?= $client['client_name'] ?> (
|
||||
<?= $client['short_name'] ?> ) </strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="font-size: 18px;"> <strong> Relationship Manager </strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-6">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding: 3px;"><label>Address :</label>
|
||||
<?= $client['address1'] ?> <br> <?= $client['address2'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 3px;"><?= $client['city'] ?>, <?= $client['state'] ?> -
|
||||
<?= $client['pincode'] ?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding: 3px;"><label> Account Manager :
|
||||
</label> <?= implode(', ', $account_managers) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 3px;"><label> Manager :
|
||||
</label> <?= implode(', ', $managers) ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 3px;"><label> Head : </label>
|
||||
<?= implode(', ', $heads) ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- end row-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card">
|
||||
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
|
||||
<div class="col-6">
|
||||
<h4 style="position: relative;left: 18px;top: 2px;">Client Policies</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
|
||||
aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary"
|
||||
style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body" style="position: relative;bottom: 25px;">
|
||||
<div class="row">
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100"
|
||||
cellspacing="0">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium"><label> Branch Name </label></th>
|
||||
<th class="font-weight-medium"><label> Policy Name </label></th>
|
||||
<th class="font-weight-medium"><label> Insurer </label></th>
|
||||
<th class="font-weight-medium"><label> TPA </label></th>
|
||||
<th class="font-weight-medium"><label> Policy Validity </label></th>
|
||||
<th class="font-weight-medium"><label> Enrollment Status </label></th>
|
||||
<th class="font-weight-medium"><label> Policy Status </label></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($client_policy as $key => $value) { ?>
|
||||
<tr class="policy_terms"
|
||||
data-id="<?= htmlspecialchars($value['policy_terms']) ?>"
|
||||
data-toggle="modal" data-target="#bs-example-modal-lg">
|
||||
<td><?= $value['branch_name'] ?></td>
|
||||
<td><?= $value['policy_name'] ?> ( <?= $value['policy_type'] ?> )</td>
|
||||
<td><?= $value['insurer_short_name'] ?></td>
|
||||
<td><?= $value['tpa_short_name'] ?></td>
|
||||
<td><?= $value['policy_start_date'] ?> / <?= $value['policy_end_date'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($value['open_for_enrollment'] == 'Open' ) { ?>
|
||||
|
||||
<span
|
||||
class="badge badge-success"><?= $value['open_for_enrollment'] ?></span>
|
||||
|
||||
<?php } else if($value['open_for_enrollment'] == 'Closed') { ?>
|
||||
|
||||
<span
|
||||
class="badge badge-warning"><?= $value['open_for_enrollment'] ?></span>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<span
|
||||
class="badge badge-secondary"><?= $value['open_for_enrollment'] ?></span>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if($value['policy_status'] == 'Active' ) { ?>
|
||||
|
||||
<span class="badge badge-success"><?= $value['policy_status'] ?></span>
|
||||
|
||||
<?php } else { ?>
|
||||
|
||||
<span class="badge badge-danger"><?= $value['policy_status'] ?></span>
|
||||
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card">
|
||||
<div class="row" style="padding-top: 20px;margin-bottom: 18px;">
|
||||
<div class="col-6">
|
||||
<h4 style="position: relative;left: 18px;top: 2px;">Client Contacts</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-6">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse"
|
||||
href="#collapseThree" aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary"
|
||||
style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="collapseThree" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body" style="position: relative;bottom: 25px;">
|
||||
<div class="row">
|
||||
<table id="tb1" class="table table-hover m-0 table-centered dt-responsive nowrap w-100"
|
||||
cellspacing="0">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium"><label> HR Name </label></th>
|
||||
<th class="font-weight-medium"><label> Mobile </label></th>
|
||||
<th class="font-weight-medium"><label> Email </label></th>
|
||||
<th class="font-weight-medium"><label> Branch Name </label></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<?php foreach ($client_branch as $key => $value) { ?>
|
||||
<tr>
|
||||
<td><?= $value['hr_name'] ?> ( <?= $value['designation'] ?> )</td>
|
||||
<td><?= $value['mobile'] ?></td>
|
||||
<td><?= $value['email'] ?></td>
|
||||
<td><?= $value['branch_name'] ?> ( <?= $value['branch_code'] ?> )</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div> <!-- end row-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Modal content for the Large example -->
|
||||
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||
aria-hidden="true" aria-modal="true" data-backdrop="static" style="padding-right: 15px">
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="background: #02a8b5;">
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Policy Terms <span id="nameOfThePolicy"></span>
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="modal_body" >
|
||||
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// $('#tb1').DataTable({
|
||||
// paging: true,
|
||||
// });
|
||||
})
|
||||
|
||||
$(document).on('click', '.policy_terms', function() {
|
||||
var terms = $(this).data('id');
|
||||
console.log(terms);
|
||||
|
||||
// terms = JSON.parse(terms);
|
||||
|
||||
$('#modal_body').empty();
|
||||
|
||||
function createListItems(obj) {
|
||||
const fragment = document.createDocumentFragment();
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== '' && key !=
|
||||
'family_floater' && key != 'gpa_special_condition_input' && key !=
|
||||
'gpa_special_condition_label' && key != 'special_condition_label' && key !=
|
||||
'special_condition_input' && key != 'age_ratio') {
|
||||
|
||||
const listItem = document.createElement('li');
|
||||
|
||||
var formattedKey = '';
|
||||
formattedKey = key.replace(/_/g, ' ');
|
||||
obj[key] = obj[key].replace(/<\/?[^>]+>/gi, '');
|
||||
|
||||
if (obj[key] == 0) {
|
||||
obj[key] = 'No';
|
||||
}
|
||||
|
||||
if (obj[key] == 1) {
|
||||
obj[key] = 'Yes';
|
||||
}
|
||||
|
||||
console.log(formattedKey)
|
||||
|
||||
if (key == 'burnExpenses' && obj[key] == 'Yes') {
|
||||
|
||||
listItem.innerHTML =
|
||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${obj['burnExpensesData']}`;
|
||||
|
||||
} else if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) {
|
||||
|
||||
listItem.innerHTML =
|
||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong>`;
|
||||
const nestedList = document.createElement('ul');
|
||||
|
||||
nestedList.appendChild(createListItems(obj[key]));
|
||||
|
||||
listItem.appendChild(nestedList);
|
||||
|
||||
} else {
|
||||
listItem.innerHTML =
|
||||
`<strong>${formattedKey.charAt(0).toUpperCase() + formattedKey.slice(1)}:</strong> ${Array.isArray(obj[key]) ? JSON.stringify(obj[key]) : obj[key]}`;
|
||||
}
|
||||
|
||||
fragment.appendChild(listItem);
|
||||
}
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
|
||||
$('#modal_body').append(createListItems(terms));
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -51,7 +51,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="kyc_docs">File<span
|
||||
class="text-danger">*</span></label>
|
||||
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required>
|
||||
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png">
|
||||
</div>
|
||||
<!-- <div class="form-group col-md-4 align-self-end"> -->
|
||||
<div class="form-group col-md-4" style="margin-top: 42px;">
|
||||
@ -100,6 +100,7 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
|
||||
$('#others').hide()
|
||||
$('#other_docs_table').hide();
|
||||
|
||||
@ -176,10 +177,10 @@
|
||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||
$('#form_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
console.log('step 1')
|
||||
// console.log('step 1')
|
||||
|
||||
if(item.file_name != null && item.file_name != ""){
|
||||
console.log('step 2')
|
||||
// console.log('step 2')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).show();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
||||
@ -187,14 +188,14 @@
|
||||
|
||||
}
|
||||
else{
|
||||
console.log('step 3')
|
||||
// console.log('step 3')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).hide();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
|
||||
$('#delete_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
}
|
||||
console.log('step 4')
|
||||
// console.log('step 4')
|
||||
|
||||
});
|
||||
|
||||
@ -217,6 +218,9 @@
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/kyc/list/"); ?>' + '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
|
||||
type: "GET",
|
||||
@ -224,6 +228,7 @@
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function (res) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -270,9 +275,20 @@
|
||||
var table = '';
|
||||
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
|
||||
|
||||
console.log(data)
|
||||
// console.log('other documents data', data)
|
||||
|
||||
|
||||
$('#other_docs tr').remove();
|
||||
|
||||
var other_docs_count = 0;
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
if(item.other_docs_name != ""){
|
||||
|
||||
other_docs_count++;
|
||||
}
|
||||
|
||||
if(item.kyc_doc_type_id == '0'){
|
||||
table += `
|
||||
<tr id="kyc-${item.id}">
|
||||
@ -288,6 +304,11 @@
|
||||
}
|
||||
});
|
||||
$('#other_docs').append(table);
|
||||
|
||||
if(other_docs_count > 0){
|
||||
$('#others').show()
|
||||
$('#other_docs_table').show();
|
||||
}
|
||||
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
@ -299,19 +320,17 @@
|
||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||
$('#form_'+item.kyc_doc_type_id).hide();
|
||||
|
||||
console.log('step 1')
|
||||
// console.log('step 1')
|
||||
|
||||
if(item.file_name != null && item.file_name != ""){
|
||||
console.log('step 2')
|
||||
// console.log('step 2')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).show();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
||||
$('#delete_'+item.kyc_doc_type_id).show();
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
console.log('step 3')
|
||||
// console.log('step 3')
|
||||
|
||||
$('#download_'+item.kyc_doc_type_id).hide();
|
||||
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
|
||||
@ -319,7 +338,7 @@
|
||||
|
||||
|
||||
}
|
||||
console.log('step 4')
|
||||
// console.log('step 4')
|
||||
|
||||
}, 1000);
|
||||
|
||||
@ -369,7 +388,7 @@
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
$('#kyc_form').trigger('reset');
|
||||
if(res){
|
||||
setTimeout(function() {
|
||||
@ -380,23 +399,36 @@
|
||||
}, 500);
|
||||
}
|
||||
|
||||
var other_docs_count = 0;
|
||||
|
||||
$('#other_docs tr').remove();
|
||||
$.each(res.data, function(index, item) {
|
||||
console.log("Current item:", item);
|
||||
|
||||
if(item.other_docs_name != ""){
|
||||
|
||||
other_docs_count++;
|
||||
}
|
||||
|
||||
// console.log("Current item:", item);
|
||||
if (item.kyc_doc_type_id == '0') {
|
||||
console.log("Appending item:", item);
|
||||
// console.log("Appending item:", item);
|
||||
var rowHtml = `
|
||||
<tr id="kyc-${item.id}">
|
||||
<td>${item.other_docs_name}</td>
|
||||
<td>${item.file_name}</td>
|
||||
<td>
|
||||
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
||||
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a>
|
||||
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
}
|
||||
$('#other_docs').append(rowHtml);
|
||||
|
||||
if(other_docs_count > 0){
|
||||
$('#others').show()
|
||||
$('#other_docs_table').show();
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@ -431,8 +463,8 @@
|
||||
|
||||
var kyc_id = $(this).attr('data-id');
|
||||
$.get('<?php echo base_url('client/kyc/delete/');?>'+kyc_id, function (data) {
|
||||
console.log('kyc-'+ kyc_id)
|
||||
console.log(data)
|
||||
// console.log('kyc-'+ kyc_id)
|
||||
// console.log(data)
|
||||
if(data){
|
||||
$('#form_'+kyc_id).show();
|
||||
$('#name_'+kyc_id).hide();
|
||||
@ -458,7 +490,7 @@
|
||||
|
||||
var kyc_id = $(this).attr('data-id');
|
||||
$.get('<?php echo base_url('util/kyc-other-docs-delete/');?>'+kyc_id, function (data) {
|
||||
console.log('kyc-'+ kyc_id)
|
||||
// console.log('kyc-'+ kyc_id)
|
||||
if(data){
|
||||
$('#kyc-'+ kyc_id).remove();
|
||||
}
|
||||
@ -468,30 +500,4 @@
|
||||
});
|
||||
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
|
||||
$('#kyc_form input, #kyc_form select').each(function() {
|
||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
console.log('Please fill in all fields');
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($(this).is('input[type="file"]')) {
|
||||
var fileInput = $(this)[0];
|
||||
if (fileInput.files.length === 0) {
|
||||
console.log('Please select an image file');
|
||||
isValid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -7,6 +7,15 @@
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
table.dataTable thead th {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.col-12{
|
||||
|
||||
max-width: 98% !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_list">
|
||||
@ -15,9 +24,9 @@ table.dataTable tbody td {
|
||||
<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 List</h4>
|
||||
<h4 style="position: relative;">Client List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<a href="<?= base_url("client/create"); ?>" 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>
|
||||
@ -33,8 +42,8 @@ table.dataTable tbody td {
|
||||
|
||||
<tbody>
|
||||
<?php foreach($clientList as $row){ ?>
|
||||
<tr>
|
||||
<td><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
|
||||
<tr >
|
||||
<td class="client_info" data-id="<?php echo $row->id; ?>"><?php echo $row->client_name; ?> ( <?php echo $row->short_name; ?> ) </td>
|
||||
<td>
|
||||
<?php $account_managers = ''; ?>
|
||||
<?php foreach ($client_rm as $client): ?>
|
||||
@ -66,10 +75,10 @@ table.dataTable tbody td {
|
||||
</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> -->
|
||||
|
||||
<div id="append_client_info"></div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
@ -96,7 +105,8 @@ table.dataTable tbody td {
|
||||
// pagingType: 'full_numbers'
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
@ -136,4 +146,57 @@ table.dataTable tbody td {
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '.client_info', function() {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var client_id = $(this).data('id')
|
||||
$('#append_client_info').empty();
|
||||
|
||||
console.log(client_id);
|
||||
console.log('client_info');
|
||||
|
||||
$('#client_info').show();
|
||||
$('#client_list').hide();
|
||||
|
||||
$.ajax({
|
||||
url: "<?= base_url('util/get-client-details/') ?>" + client_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log(res);
|
||||
console.log(res.data.length);
|
||||
$('#append_client_info').append(res.data);
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', '.client_info_close', function() {
|
||||
|
||||
console.log('client_info_close');
|
||||
$('#client_info').hide();
|
||||
$('#client_list').show();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -41,7 +41,7 @@ body {
|
||||
<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;">Client Onboarding <?php if(isset($client)) {echo ' - ' . $client['client_name']; } ?></h4>
|
||||
<h4 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"); ?>"><i class="fas fa-arrow-left" style="font-size: 17px;"></i></a>
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<th>Policy</th>
|
||||
<th>TPA</th>
|
||||
<th>Date</th>
|
||||
<th>Enrollment Status</th>
|
||||
<th>Enrollment <br> Status</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -43,6 +43,15 @@
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="client_branch">Client Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch" name="client_branch_id">
|
||||
<option selected >Select Client Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="email"> Policy Type<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="policy_type" name="is_addon" required>
|
||||
@ -117,7 +126,8 @@
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="inception_type" style="position: relative;bottom: 5px;left: 10px;">Enable Employee Enrolment Process</label>
|
||||
<label for="inception_type" style="position: relative;bottom: 5px;left: 10px;">Enable
|
||||
Employee Enrolment Process</label>
|
||||
</div>
|
||||
|
||||
<div id="policy_fields"></div>
|
||||
@ -149,6 +159,7 @@
|
||||
$("#policy").select2();
|
||||
$("#tpa").select2();
|
||||
$("#base_policy").select2();
|
||||
$("#client_branch").select2();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -183,65 +194,16 @@
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#add_form').hide();
|
||||
$('.btnBack').hide();
|
||||
|
||||
|
||||
$('.btnAdd').click(function() {
|
||||
|
||||
fetchClientPolicyList()
|
||||
|
||||
$('#policy_form')[0].reset();
|
||||
$('#add_form').show();
|
||||
$('#table_list').hide();
|
||||
$('.btnBack').show();
|
||||
$('.btnAdd').hide();
|
||||
$('#insurer').val('').change();
|
||||
$('#tpa').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#start_date').val('').change();
|
||||
$('#end_date').val('').change();
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>').change();
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||
$('#policy_status_field').hide()
|
||||
$('#base_policy_id').hide();
|
||||
|
||||
|
||||
$('#first').hide();
|
||||
$('#second').hide();
|
||||
$('#third').hide();
|
||||
$('#base_policy_id').hide();
|
||||
$('#base_policy').prop('required', false);
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('.btnBack').click(function() {
|
||||
$('#policy_form')[0].reset();
|
||||
$('#add_form').hide();
|
||||
$('#table_list').show();
|
||||
$('.btnBack').hide();
|
||||
$('.btnAdd').show();
|
||||
$('#insurer').val('').change();
|
||||
$('#tpa').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#start_date').val('').change();
|
||||
$('#end_date').val('').change();
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
$('#base_policy_id').hide();
|
||||
|
||||
})
|
||||
|
||||
|
||||
if (policy_PrimaryKey !== '') {
|
||||
var policyTable = '';
|
||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||
// console.log('client_policy_data',data)
|
||||
data.forEach(function(item) {
|
||||
console.log(item.open_for_enrollment);
|
||||
// console.log(item.open_for_enrollment);
|
||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
var subject = item.policy_type_name;
|
||||
@ -264,12 +226,15 @@
|
||||
|
||||
if (item.open_for_enrollment == 1) {
|
||||
|
||||
enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrollment">Open</a>'
|
||||
enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id +
|
||||
'" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrollment">Open</a>'
|
||||
|
||||
|
||||
} else if (item.open_for_enrollment == 0) {
|
||||
|
||||
enrollmentStatus = '<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||
enrollmentStatus =
|
||||
'<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" data-id="' +
|
||||
item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||
|
||||
}
|
||||
|
||||
@ -287,7 +252,7 @@
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td>${(item.policy_start_date)} / <br> ${(item.policy_end_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -315,6 +280,57 @@
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('.btnAdd').click(function() {
|
||||
|
||||
// fetchClientPolicyList()
|
||||
fetchClientBranch()
|
||||
|
||||
$('#policy_form')[0].reset();
|
||||
$('#add_form').show();
|
||||
$('#table_list').hide();
|
||||
$('.btnBack').show();
|
||||
$('.btnAdd').hide();
|
||||
$('#insurer').val('').change();
|
||||
$('#tpa').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#start_date').val('').change();
|
||||
$('#end_date').val('').change();
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>').change();
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||
$('#policy_status_field').hide()
|
||||
$('#base_policy_id').hide();
|
||||
|
||||
|
||||
$('#first').hide();
|
||||
$('#second').hide();
|
||||
$('#third').hide();
|
||||
$('#base_policy_id').hide();
|
||||
$('#base_policy').prop('required', false);
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('.btnBack').click(function() {
|
||||
|
||||
$('#policy_form')[0].reset();
|
||||
$('#add_form').hide();
|
||||
$('#table_list').show();
|
||||
$('.btnBack').hide();
|
||||
$('.btnAdd').show();
|
||||
$('#insurer').val('').change();
|
||||
$('#tpa').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#start_date').val('').change();
|
||||
$('#end_date').val('').change();
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
$('#base_policy_id').hide();
|
||||
$('#client_branch').val('').change();
|
||||
|
||||
})
|
||||
|
||||
|
||||
/******** for form submit using AJAX *******/
|
||||
$("#policy_form").submit(function(event) {
|
||||
|
||||
@ -326,8 +342,8 @@
|
||||
var policyDataId = $('#policy').children('option:selected').attr('data-id');
|
||||
var basePolicyDataId = $('#base_policy').children('option:selected').attr('data-id');
|
||||
|
||||
console.log('policyDataId', policyDataId);
|
||||
console.log('basePolicyDataId', basePolicyDataId);
|
||||
// console.log('policyDataId', policyDataId);
|
||||
// console.log('basePolicyDataId', basePolicyDataId);
|
||||
|
||||
if (policy_PrimaryKey === '' && policy_client === '') {
|
||||
toastr.error('Client is required', 'Error');
|
||||
@ -381,6 +397,11 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.staus === 'policy_exist') {
|
||||
|
||||
toastr.error('Policy already exist in the branch', 'Error');
|
||||
}
|
||||
|
||||
if (res) {
|
||||
setTimeout(function() {
|
||||
|
||||
@ -425,12 +446,18 @@
|
||||
|
||||
if (item.open_for_enrollment == 1) {
|
||||
|
||||
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Open</a>'
|
||||
enrollmentStatus =
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' +
|
||||
item.id + '" id="' + item.policy_id +
|
||||
'" class="btnOpenEnroll">Open</a>'
|
||||
|
||||
|
||||
} else if (item.open_for_enrollment == 0) {
|
||||
|
||||
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||
enrollmentStatus =
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' +
|
||||
item.id + '" id="' + item.policy_id +
|
||||
'" class="btnOpenEnroll">Closed</a>'
|
||||
|
||||
}
|
||||
|
||||
@ -447,7 +474,7 @@
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||
<td>${rearrangeDateFormat(item.policy_start_date)} / <br> ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -492,7 +519,7 @@
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
/********* To get th POLICY base on Insurer *******/
|
||||
/********* To get the POLICY base on Insurer *******/
|
||||
$('#insurer').change(function() {
|
||||
var id = $(this).val();
|
||||
var parts = id.split('-');
|
||||
@ -518,18 +545,22 @@
|
||||
|
||||
if (item.policy_type_id == 5) {
|
||||
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
'">' + item.name + '( ' + item.policy_type +
|
||||
' )</option>';
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (item.policy_type_id == 5 || item.policy_type_id == 3) {
|
||||
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
'">' + item.name + '( ' + item.policy_type +
|
||||
' )</option>';
|
||||
}
|
||||
|
||||
}
|
||||
@ -537,21 +568,25 @@
|
||||
|
||||
} else if ($policy_type_value == 2) {
|
||||
if (item.policy_type_id == 4 || item.policy_type_id == 5) {
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
} else if ($policy_type_value == 1) {
|
||||
|
||||
if (item.policy_type_id == 1 || item.policy_type_id == 2 || item.policy_type_id == 3) {
|
||||
if (item.policy_type_id == 1 || item.policy_type_id == 2 || item
|
||||
.policy_type_id == 3) {
|
||||
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
} else {
|
||||
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
@ -571,7 +606,7 @@
|
||||
|
||||
var id = $(this).val();
|
||||
var dataId = $(this).children('option:selected').attr('data-id');
|
||||
console.log('id', id)
|
||||
// console.log('id', id)
|
||||
$('#policy_type_id').val(dataId);
|
||||
|
||||
if (dataId == 1) {
|
||||
@ -596,19 +631,14 @@
|
||||
// }
|
||||
// });
|
||||
|
||||
// if(dataId == 1){
|
||||
// appendPolicyFormFields(1);
|
||||
// }else if (dataId >= 1){
|
||||
// appendPolicyFormFields(2);
|
||||
// }
|
||||
|
||||
if ($('#policy_type').val() == 1) {
|
||||
|
||||
console.log('step 1')
|
||||
// console.log('step 1')
|
||||
|
||||
if (dataId == 3) {
|
||||
|
||||
console.log('step 2')
|
||||
// console.log('step 2')
|
||||
|
||||
var displayStatus = $('#base_policy_id').css('display');
|
||||
$('#base_policy_id').show();
|
||||
@ -616,7 +646,7 @@
|
||||
// $('#base_policy').prop('required', true);
|
||||
|
||||
if (displayStatus === 'none') {
|
||||
console.log('step 2.1')
|
||||
// console.log('step 2.1')
|
||||
|
||||
$('#base_policy').val('').change();
|
||||
}
|
||||
@ -625,7 +655,7 @@
|
||||
|
||||
} else {
|
||||
|
||||
console.log('step 3')
|
||||
// console.log('step 3')
|
||||
|
||||
var displayStatus = $('#base_policy_id').css('display');
|
||||
$('#base_policy_id').hide();
|
||||
@ -633,7 +663,7 @@
|
||||
// $('#base_policy').prop('required', false);
|
||||
|
||||
if (displayStatus === 'none') {
|
||||
console.log('step 3.1')
|
||||
// console.log('step 3.1')
|
||||
|
||||
$('#base_policy').val('').change();
|
||||
}
|
||||
@ -651,6 +681,9 @@
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
fetchClientBranch()
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/list/") ?>' + policy_id,
|
||||
type: "GET",
|
||||
@ -687,6 +720,7 @@
|
||||
// $('#policy').val(res.data.policy_id).change();
|
||||
$('#policy_type').val(res.data.is_addon).change();
|
||||
$('#base_policy').val(res.data.base_policy);
|
||||
$('#client_branch').val(res.data.client_branch_id).change();
|
||||
|
||||
$('#policy_type_id').val(res.data.policy_type_id);
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
@ -787,9 +821,16 @@
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Base Policy</option>';
|
||||
$.each(res.client_policy_list, function(index, item) {
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' + item.id + '" ' + (res.data.base_policy === item.id ?
|
||||
'selected="selected"' : '') + '>' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
|
||||
if (item.client_branch_id == res.data.client_branch_id) {
|
||||
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' + item.id + '" ' + (res.data.base_policy === item.id ?
|
||||
'selected="selected"' : '') + '>' + item.name + '( ' + item
|
||||
.policy_type + ' )</option>';
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
$('#base_policy').html(OptionsHTML);
|
||||
|
||||
@ -831,10 +872,6 @@
|
||||
var policy_id = $(this).attr('id');
|
||||
var client_id = $('#client_id_policy').val()
|
||||
|
||||
console.log('client_policy_id', client_policy_id)
|
||||
console.log('policy_id', policy_id)
|
||||
console.log('client_id', client_id)
|
||||
|
||||
if (client_policy_id) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -848,8 +885,6 @@
|
||||
},
|
||||
success: function(res) {
|
||||
|
||||
console.log(res.client_policy_data);
|
||||
|
||||
if (res) {
|
||||
if (res.open_for_enrollment) {
|
||||
var json_decode = JSON.parse(res.open_for_enrollment);
|
||||
@ -860,7 +895,12 @@
|
||||
|
||||
$('.btnOpenEnroll').each(function(index, element) {
|
||||
if ($(element).data('id') == client_policy_id) {
|
||||
$(element).html('<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' + res.client_policy_data.id + '" id="' + res.client_policy_data.policy_id + '" class="btnOpenEnroll">Open</a>');
|
||||
$(element).html(
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' +
|
||||
res.client_policy_data.id +
|
||||
'" id="' + res.client_policy_data
|
||||
.policy_id +
|
||||
'" class="btnOpenEnroll">Open</a>');
|
||||
}
|
||||
});
|
||||
|
||||
@ -868,7 +908,13 @@
|
||||
|
||||
$('.btnOpenEnroll').each(function(index, element) {
|
||||
if ($(element).data('id') == client_policy_id) {
|
||||
$(element).html('<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' + res.client_policy_data.id + '" id="' + res.client_policy_data.policy_id + '" class="btnOpenEnroll">Closed</a>');
|
||||
$(element).html(
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' +
|
||||
res.client_policy_data.id +
|
||||
'" id="' + res.client_policy_data
|
||||
.policy_id +
|
||||
'" class="btnOpenEnroll">Closed</a>'
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -909,147 +955,6 @@
|
||||
});
|
||||
|
||||
|
||||
function appendPolicyFormFields(policy_type, data = false) {
|
||||
|
||||
var html = '';
|
||||
var container = document.getElementById('policy_fields');
|
||||
|
||||
if (policy_type == 2) {
|
||||
|
||||
$('#GMC').remove();
|
||||
$('#GPA').remove();
|
||||
|
||||
html = `
|
||||
<div id="GMC">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="earned_premium_date">Earned Premium Date<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? rearrangeDateFormat(data.earned_premium_date) : ''}" type="date" class="form-control" placeholder="Enter Earned Premium Date " name="earned_premium_date" id="earned_premium_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="earned_premium_amount">Earned Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.earned_premium_amount : ''}" type="text" class="form-control" placeholder="Enter Earned Premium " name="earned_premium_amount" id="earned_premium_amount" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claims_incurred_date">Claims Incurred Date<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? rearrangeDateFormat(data.claims_incurred_date) : ''}" type="date" class="form-control" placeholder="Enter Claims Incurred Date " name="claims_incurred_date" id="claims_incurred_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="claims_incurred_amount">Claims Incurred<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.claims_incurred_amount : ''}" type="text" class="form-control" placeholder="Enter Claims Incurred " name="claims_incurred_amount" id="claims_incurred_amount" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-3">
|
||||
<label for="no_of_employees">No of Employees<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_employees : ''}" type="text" class="form-control" placeholder="Enter No of Employees" name="no_of_employees" id="no_of_employees" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="no_of_lives">No of Lives<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_lives : ''}" type="text" class="form-control" placeholder="Enter No of Lives " name="no_of_lives" id="no_of_lives" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="no_lives_at_inception">No Lives at Inception<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.no_lives_at_inception : ''}" type="text" class="form-control" placeholder="Enter No Lives at Inception " name="no_lives_at_inception" id="no_lives_at_inception" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="premium_paid_at_inception">Premium paid at Inception<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium_paid_at_inception : ''}" type="text" class="form-control" placeholder="Enter Premium paid at Inception" name="premium_paid_at_inception" id="premium_paid_at_inception" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="incurred_claims_ratio">Incurred Claims Ratio<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.incurred_claims_ratio : '0'}" type="text" class="form-control" placeholder="Enter Claims Ratio" name="incurred_claims_ratio" id="incurred_claims_ratio" readonly required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_status">Policy Status<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.policy_status : ''}" type="text" class="form-control" placeholder="Enter Policy Status " name="policy_status" id="policy_status" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
} else if (policy_type == 1) {
|
||||
|
||||
$('#GMC').remove();
|
||||
$('#GPA').remove();
|
||||
|
||||
html = `
|
||||
<div class="form-row" id="GPA">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="no_of_employees">No of Employees<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.no_of_employees : ''}" type="text" class="form-control" placeholder="Enter No of Employees" name="no_of_employees" id="no_of_employees" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_status">Policy Status<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.policy_status : ''}" type="text" class="form-control" placeholder="Enter Policy Status " name="policy_status" id="policy_status" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="claims_experience_for_last_3_years">Claims Experience for Last 3 Years<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.claims_experience_for_last_3_years : ''}" type="text" class="form-control" placeholder="Enter Claims Experience for Last 3 Years " name="claims_experience_for_last_3_years" id="claims_experience_for_last_3_years" required>
|
||||
</div>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
|
||||
if (policy_type == 2) {
|
||||
//Configure Flatpicker for the earned_premium_date datepicker.
|
||||
flatpickr("#earned_premium_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: "today",
|
||||
allowInput: false,
|
||||
});
|
||||
|
||||
//Configure Flatpicker for the claims_incurred_date datepicker.
|
||||
flatpickr("#claims_incurred_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: "today",
|
||||
allowInput: false
|
||||
});
|
||||
}
|
||||
|
||||
$('#earned_premium_amount').keyup(function() {
|
||||
|
||||
var PA = parseFloat($(this).val());
|
||||
var CA = parseFloat($('#claims_incurred_amount').val());
|
||||
// console.log('earned_premium_amount',PA)
|
||||
// console.log('claims_incurred_amount',CA)
|
||||
|
||||
if (!isNaN(PA) && !isNaN(CA) && CA !== 0) {
|
||||
var incurredClaimRatio = CA / PA;
|
||||
// console.log(incurredClaimRatio)
|
||||
$('#incurred_claims_ratio').val(incurredClaimRatio.toFixed(2));
|
||||
} else {
|
||||
$('#incurred_claims_ratio').val('0');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#claims_incurred_amount').keyup(function() {
|
||||
|
||||
var CA = $(this).val()
|
||||
var PA = $('#earned_premium_amount').val()
|
||||
// console.log('earned_premium_amount',PA)
|
||||
// console.log('claims_incurred_amount',CA)
|
||||
|
||||
if (!isNaN(PA) && !isNaN(CA) && CA !== 0) {
|
||||
var incurredClaimRatio = CA / PA;
|
||||
// console.log(incurredClaimRatio)
|
||||
$('#incurred_claims_ratio').val(incurredClaimRatio.toFixed(2));
|
||||
} else {
|
||||
$('#incurred_claims_ratio').val('0');
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
||||
function rearrangeDateFormat(inputDate) {
|
||||
|
||||
@ -1113,7 +1018,7 @@
|
||||
80: "Eighty",
|
||||
90: "Ninety"
|
||||
};
|
||||
|
||||
|
||||
function convertNumberToWords(number) {
|
||||
if (number === 0) {
|
||||
return numberWords[number];
|
||||
@ -1122,22 +1027,34 @@
|
||||
let word = '';
|
||||
|
||||
if (number >= 10000000) {
|
||||
word += convertNumberToWords(Math.floor(number / 10000000)) + " Crore ";
|
||||
const crore = Math.floor(number / 10000000);
|
||||
if (crore > 0) {
|
||||
word += convertNumberToWords(crore) + " Crore ";
|
||||
}
|
||||
number %= 10000000;
|
||||
}
|
||||
|
||||
if (number >= 100000) {
|
||||
word += convertNumberToWords(Math.floor(number / 100000)) + " Lakh ";
|
||||
const lakh = Math.floor(number / 100000);
|
||||
if (lakh > 0) {
|
||||
word += convertNumberToWords(lakh) + " Lakh ";
|
||||
}
|
||||
number %= 100000;
|
||||
}
|
||||
|
||||
if (number >= 1000) {
|
||||
word += convertNumberToWords(Math.floor(number / 1000)) + " Thousand ";
|
||||
const thousand = Math.floor(number / 1000);
|
||||
if (thousand > 0) {
|
||||
word += convertNumberToWords(thousand) + " Thousand ";
|
||||
}
|
||||
number %= 1000;
|
||||
}
|
||||
|
||||
if (number >= 100) {
|
||||
word += convertNumberToWords(Math.floor(number / 100)) + " Hundred ";
|
||||
const hundred = Math.floor(number / 100);
|
||||
if (hundred > 0) {
|
||||
word += convertNumberToWords(hundred) + " Hundred ";
|
||||
}
|
||||
number %= 100;
|
||||
}
|
||||
|
||||
@ -1154,44 +1071,66 @@
|
||||
return word.trim();
|
||||
}
|
||||
|
||||
|
||||
function convertCommaNumberToWords(input) {
|
||||
|
||||
let number;
|
||||
if (input instanceof HTMLElement) {
|
||||
const inputValue = input.value;
|
||||
number = parseInt(inputValue.replace(/,/g, ''), 10);
|
||||
var convert_word_value = convertNumberToWords(number);
|
||||
|
||||
if (input.nextElementSibling !== null) {
|
||||
input.nextElementSibling.textContent = convert_word_value;
|
||||
}
|
||||
number = parseFloat(inputValue.replace(/,/g, ''), 10);
|
||||
} else {
|
||||
number = parseInt(input.replace(/,/g, ''), 10);
|
||||
number = parseFloat(input.replace(/,/g, ''), 10);
|
||||
}
|
||||
var convert_word_value = convertNumberToWords(number);
|
||||
|
||||
return convert_word_value;
|
||||
const [integerPart, decimalPart] = number.toFixed(2).split('.');
|
||||
const integerWord = convertNumberToWords(parseInt(integerPart, 10));
|
||||
let result = `${integerWord}`;
|
||||
|
||||
console.log('decimalPart',decimalPart)
|
||||
console.log('decimalPart',typeof decimalPart)
|
||||
|
||||
if (decimalPart != '00' && decimalPart != undefined) {
|
||||
result += ` and `;
|
||||
let decimalWord = convertNumberToWords(parseInt(decimalPart, 10))
|
||||
result += `${decimalWord}`
|
||||
result += ` Paisa`;
|
||||
}
|
||||
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if (charcode >= 48 && charcode <= 57) return true;
|
||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function formatNumber(input, maxLength) {
|
||||
|
||||
// console.log("input", input);
|
||||
console.log("input", input);
|
||||
console.log("input value", input.value);
|
||||
|
||||
maxLength = 16;
|
||||
let value = input.value.replace(/\D/g, ''); // Remove non-numeric characters
|
||||
let value = input.value.replace(/[^\d.]/g, ''); // Remove non-numeric characters
|
||||
console.log('Remove non-numeric characters', value)
|
||||
|
||||
|
||||
// Limit the number of digits
|
||||
value = value.slice(0, maxLength);
|
||||
console.log('Limited value', value);
|
||||
|
||||
|
||||
// Format the number with commas using Indian numbering system
|
||||
value = Number(value).toLocaleString('en-IN');
|
||||
input.value = value;
|
||||
value = parseFloat(value).toLocaleString("en-IN",{
|
||||
maximumFractionDigits: 2
|
||||
});
|
||||
|
||||
console.log('formetted value', value);
|
||||
|
||||
input.value = (value);
|
||||
|
||||
basicPayMultiple(input)
|
||||
if (input.id == 'gpa_si') {
|
||||
@ -1256,7 +1195,7 @@
|
||||
|
||||
|
||||
function removeClientPolicy(element) {
|
||||
console.log(element);
|
||||
// console.log(element);
|
||||
}
|
||||
|
||||
|
||||
@ -1345,6 +1284,9 @@
|
||||
function fetchClientPolicyList() {
|
||||
|
||||
var client_id = $('#client_id_policy').val()
|
||||
var client_branch_id = $('#client_branch').val()
|
||||
|
||||
// console.log('client_branch_id', client_branch_id)
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/featch-client-policy-list/") ?>' + client_id,
|
||||
@ -1354,33 +1296,38 @@
|
||||
|
||||
console.log('one', res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
return;
|
||||
}
|
||||
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Base Policy</option>';
|
||||
$.each(res.data, function(index, item) {
|
||||
|
||||
if ($('#policy_type').val() == 1) {
|
||||
// console.log('item.client_branch_id', item.client_branch_id)
|
||||
|
||||
console.log('if')
|
||||
|
||||
if (item.policy_type_id == 1 || item.policy_type_id == 2) {
|
||||
console.log('if 2')
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
|
||||
if (item.client_branch_id == client_branch_id) {
|
||||
|
||||
if ($('#policy_type').val() == 1) {
|
||||
|
||||
if (item.policy_type_id == 1 || item.policy_type_id == 2) {
|
||||
// console.log('if 2')
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||
item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
|
||||
} else {
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item
|
||||
.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('if')
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
|
||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||
}
|
||||
});
|
||||
$('#base_policy').html(OptionsHTML);
|
||||
@ -1405,13 +1352,13 @@
|
||||
|
||||
var client_policy_id = $(this).val()
|
||||
var policy_type = $('#policy_type').val()
|
||||
console.log(client_policy_id);
|
||||
// console.log(client_policy_id);
|
||||
|
||||
dataId = $('#policy').children('option:selected').attr('data-id');
|
||||
console.log('dataId', dataId)
|
||||
// console.log('dataId', dataId)
|
||||
|
||||
base_policy_data_id = $(this).children('option:selected').attr('data-id');
|
||||
console.log('base_policy_data_id', base_policy_data_id);
|
||||
// console.log('base_policy_data_id', base_policy_data_id);
|
||||
|
||||
var queryParams = {
|
||||
client_policy_id: client_policy_id,
|
||||
@ -1442,21 +1389,25 @@
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
|
||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
|
||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id)
|
||||
.change();
|
||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
||||
$('#policy_no').val(res.data.policy_no).change();
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date)).change();
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date))
|
||||
.change();
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
|
||||
|
||||
var policeOptionHTML = '';
|
||||
$policy_type_value = $('#policy_type').val();
|
||||
$.each(res.policy, function(index, item) {
|
||||
|
||||
console.log(item);
|
||||
// console.log(item);
|
||||
|
||||
policeOptionHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
|
||||
'selected="selected"' : '') + '>' + item.name + '</option>';
|
||||
'" value="' + item.id + '" ' + (res.data.policy_id === item
|
||||
.id ?
|
||||
'selected="selected"' : '') + '>' + item.name +
|
||||
'</option>';
|
||||
|
||||
});
|
||||
|
||||
@ -1464,17 +1415,19 @@
|
||||
|
||||
if (dataId == 3 || policy_type == 1) {
|
||||
|
||||
console.log('step 1')
|
||||
// console.log('step 1')
|
||||
|
||||
setTimeout(function() {
|
||||
console.log('step 2')
|
||||
// console.log('step 2')
|
||||
var $option = $('#policy').find('option[data-id="3"]');
|
||||
if ($option.length > 0) {
|
||||
console.log('step 3')
|
||||
// console.log('step 3')
|
||||
$option.prop('selected', true).change();
|
||||
} else {
|
||||
console.log('step 4');
|
||||
toastr.warning('The insurer does not have a GMC-Parents policy.', 'Warning');
|
||||
// console.log('step 4');
|
||||
toastr.warning(
|
||||
'The insurer does not have a GMC-Parents policy.',
|
||||
'Warning');
|
||||
}
|
||||
}, 1500);
|
||||
}
|
||||
@ -1497,4 +1450,82 @@
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
|
||||
function fetchClientBranch() {
|
||||
|
||||
console.log('function called');
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var client_id = 0;
|
||||
|
||||
if ($('#client_id_policy').val() != "") {
|
||||
client_id = $('#client_id_policy').val();
|
||||
} else if ($('#policy_PrimaryKey').val() != "") {
|
||||
client_id = $('#policy_PrimaryKey').val();
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "<?= base_url('util/get-client-branch/') ?>" + client_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log(res);
|
||||
// console.log(res.data.length);
|
||||
|
||||
if (res.data.length == 0) {
|
||||
toastr.warning('The client does not have any branches.', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
appendClientBranch(res.data)
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function appendClientBranch(data) {
|
||||
|
||||
$('#client_branch').empty();
|
||||
|
||||
|
||||
$('#client_branch').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Branch',
|
||||
selected: true
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name
|
||||
});
|
||||
|
||||
$('#client_branch').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#client_branch").on('change', function() {
|
||||
// console.log('fetchClientPolicyList change')
|
||||
fetchClientPolicyList();
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
@ -1,5 +1,4 @@
|
||||
<style>
|
||||
|
||||
.badge2 {
|
||||
box-shadow: none;
|
||||
}
|
||||
@ -22,130 +21,239 @@
|
||||
transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
|
||||
}
|
||||
|
||||
.table-responsive {
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.word-wrap {
|
||||
word-wrap: break-word;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<?php $pro_rata_total = 0; $gst_total = 0 ?>
|
||||
|
||||
<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;">Employees</h4>
|
||||
<h4 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">
|
||||
<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/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</th>
|
||||
<th class="font-weight-medium">Policy status</th>
|
||||
<th class="font-weight-medium">Sum Insured</th>
|
||||
<th class="font-weight-medium">Premium</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover m-0 table-centered dt-responsive 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/code</th>
|
||||
<th class="font-weight-medium">Policy name</th>
|
||||
<th class="font-weight-medium">Insurer <br> name</th>
|
||||
<th class="font-weight-medium">TPA ID</th>
|
||||
<th class="font-weight-medium">UHID</th>
|
||||
<th class="font-weight-medium">Policy <br> status</th>
|
||||
<th class="font-weight-medium">(₹)Sum Insured</th>
|
||||
<th class="font-weight-medium">(₹)Premium</th>
|
||||
<th class="font-weight-medium" id="rata_premium" data-toggle="tooltip" data-placement="top">
|
||||
(₹)Pro Rata <br> Premium</th>
|
||||
<th class="font-weight-medium" id="gst" data-toggle="tooltip" data-placement="top">(₹)GST
|
||||
</th>
|
||||
<!-- <th class="font-weight-medium">Action</th> -->
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($employees))
|
||||
{
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
<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>
|
||||
<?php
|
||||
if ($employee['status'] == 'draft') {
|
||||
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'active') {
|
||||
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'inactive') {
|
||||
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||
}elseif ($employee['status'] == 'expired') {
|
||||
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||
}elseif ($employee['status'] == 'enrolled') {
|
||||
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
|
||||
}else{
|
||||
echo $employee['status'];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td> <?php echo $employee['basic_cover_si']?> </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>
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> - <?php echo $employee['relationship']?> )</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>
|
||||
<?php
|
||||
if ($employee['status'] == 'draft') {
|
||||
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'active') {
|
||||
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'inactive') {
|
||||
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||
}elseif ($employee['status'] == 'expired') {
|
||||
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||
}elseif ($employee['status'] == 'enrolled') {
|
||||
echo '<span class="badge2 badge2-secondary2">' . $employee['status'] . '</span>';
|
||||
}else{
|
||||
echo $employee['status'];
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo format_indian_number($employee['basic_cover_si'])?> </td>
|
||||
<td><?php echo format_indian_number($employee['premium'])?></td>
|
||||
<td><?php $pro_rata_total = $pro_rata_total + $employee['rata_premimum']; echo format_indian_number($employee['rata_premimum'])?></td>
|
||||
<td><?php $gst_total = $gst_total + $employee['gst']; echo format_indian_number($employee['gst'])?></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>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
</td> -->
|
||||
</tr>
|
||||
<?php }}?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>Total</th>
|
||||
<th><?php echo format_indian_number($pro_rata_total) ?></th>
|
||||
<th><?php echo format_indian_number($gst_total) ?></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/tippy.js@6/dist/tippy.css">
|
||||
<script src="https://unpkg.com/@popperjs/core@2"></script>
|
||||
<script src="https://unpkg.com/tippy.js@6"></script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#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": 'Employee-List',
|
||||
"className": 'my_class',
|
||||
"exportOptions": {
|
||||
"columns": ':not(:last-child)'
|
||||
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: 'Employee-List',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)', // Adjust as needed
|
||||
footer: true // Include the footer in the export
|
||||
}
|
||||
}],
|
||||
initComplete: function(settings, json) {
|
||||
$('.my_class').css({
|
||||
position: "relative",
|
||||
left: "82px"
|
||||
});
|
||||
},
|
||||
}],
|
||||
"initComplete": function(settings, json) {
|
||||
$('.my_class').css({
|
||||
"position": "relative",
|
||||
"left": "82px"
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true ,
|
||||
// pagingType: 'full_numbers'
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true,
|
||||
// pagingType: 'full_numbers'
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
// // Function to format a number in Indian Rupees format
|
||||
// function formatNumberInIndianRupees(number) {
|
||||
// const maxLength = 24;
|
||||
// let value = number.toString().replace(/[^\d.]/g, ''); // Remove non-numeric characters
|
||||
|
||||
// // Limit the number of digits before the decimal point
|
||||
// if (value.includes('.')) {
|
||||
// let parts = value.split('.');
|
||||
// parts[0] = parts[0].slice(0, maxLength); // Limit the integer part
|
||||
// value = parts.join('.');
|
||||
// } else {
|
||||
// value = value.slice(0, maxLength);
|
||||
// }
|
||||
|
||||
// // Convert to a number and format with commas using the Indian numbering system
|
||||
// const formattedNumber = Number(value).toLocaleString('en-IN', {
|
||||
// maximumFractionDigits: 2 // Optional: limit to 2 decimal places if required
|
||||
// });
|
||||
|
||||
// return formattedNumber;
|
||||
// }
|
||||
|
||||
|
||||
// // Function to format numbers based on a class
|
||||
// function formatNumbersByClass(className) {
|
||||
// const elements = document.querySelectorAll(`.${className}`);
|
||||
// elements.forEach(element => {
|
||||
// const number = parseFloat(element.innerText.replace(/,/g, ''));
|
||||
|
||||
// if (!isNaN(number)) {
|
||||
// element.innerText = formatNumberInIndianRupees(number);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// // Format numbers when the DOM content is loaded
|
||||
// document.addEventListener("DOMContentLoaded", function() {
|
||||
// setTimeout(() => {
|
||||
|
||||
// formatNumbersByClass('indian-number');
|
||||
|
||||
// }, 500);
|
||||
// });
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
// $(document).ready(function() {
|
||||
|
||||
// var table = $('#tickets-table').DataTable({
|
||||
// "footer": true
|
||||
// });
|
||||
|
||||
// var sumColumn9 = table.column(9).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b);
|
||||
// }, 0);
|
||||
|
||||
// console.log(sumColumn9)
|
||||
|
||||
// var sumColumn10 = table.column(10).data().reduce(function(a, b) {
|
||||
// return parseFloat(a) + parseFloat(b);
|
||||
// }, 0);
|
||||
|
||||
// console.log(sumColumn10)
|
||||
|
||||
// $('#tickets-table tfoot th:eq(9)').html(sumColumn9);
|
||||
// $('#tickets-table tfoot th:eq(10)').html(sumColumn10);
|
||||
// });
|
||||
</script>
|
||||
@ -29,6 +29,15 @@ table.dataTable tbody td {
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Branch</label> <br />
|
||||
<select name="branch_id" class="form-control" id="branch_id">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
@ -80,6 +89,7 @@ $(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#clients").select2();
|
||||
$("#policies").select2();
|
||||
$("#branch_id").select2();
|
||||
|
||||
// if ($('.select2-selection__arrow').length > 0) {
|
||||
// $('.select2-selection__arrow').removeClass('select2-selection__arrow').addClass('fa fa-chevron-down');
|
||||
@ -88,7 +98,12 @@ $(document).ready(function() {
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var clientPoliciesWithBranch = {
|
||||
policies: []
|
||||
};
|
||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
@ -107,7 +122,7 @@ function fetchClientPolicies() {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
console.log('fetchClientPolicies');
|
||||
console.log(apiURL);
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
@ -122,17 +137,42 @@ function fetchClientPolicies() {
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
console.log('1',clientPolicies);
|
||||
|
||||
response.data.forEach(policy => {
|
||||
// console.log('policies', policy.policies);
|
||||
policy.policies.forEach(p => {
|
||||
clientPoliciesWithBranch.policies.push(p);
|
||||
});
|
||||
});
|
||||
|
||||
// console.log('1',clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
|
||||
//this function for reselect the policy
|
||||
setTimeout(function() {
|
||||
if (client_id != 0 ) {
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
console.log(typeof item.id)
|
||||
// console.log(typeof item.id)
|
||||
return item.id == client_id;
|
||||
});
|
||||
appendPolicies(foundPolicies.policies);
|
||||
appendBranch(foundPolicies.branchs);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_branch_id != 0 ) {
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === client_branch_id;
|
||||
});
|
||||
|
||||
if (foundPolicies) {
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
} else {
|
||||
console.log('No policies found for the selected client');
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
//end
|
||||
@ -170,6 +210,26 @@ function appendClients(data) {
|
||||
}
|
||||
|
||||
|
||||
function appendBranch(data) {
|
||||
|
||||
$('#branch_id').empty();
|
||||
$('#branch_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name
|
||||
});
|
||||
if (client_branch_id == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#branch_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function appendPolicies(data) {
|
||||
|
||||
$('#policies').empty();
|
||||
@ -179,13 +239,13 @@ function appendPolicies(data) {
|
||||
}));
|
||||
|
||||
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
||||
console.log(PolicyID)
|
||||
// console.log(PolicyID)
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
value: item.client_policy_id,
|
||||
text: item.name + ' - ' + item.policy_type
|
||||
});
|
||||
if (PolicyID == item.id) {
|
||||
if (PolicyID == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#policies').append(option);
|
||||
@ -193,21 +253,58 @@ function appendPolicies(data) {
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
console.log('selectedClient', selectedClient);
|
||||
// console.log('selectedClient', 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);
|
||||
// console.log(foundPolicies.branchs);
|
||||
appendBranch(foundPolicies.branchs);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#branch_id').on('change', function() {
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
|
||||
// console.log('selectedBranch', selectedClient);
|
||||
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === selectedClient;
|
||||
});
|
||||
|
||||
|
||||
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||
|
||||
appendPolicies(foundPolicies);
|
||||
toastr.warning('No policies found for the selected client branch.');
|
||||
|
||||
} else {
|
||||
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
@ -220,8 +317,9 @@ function fetchEmpolyeeList(event) {
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').val();
|
||||
var status = $('#status2').val();
|
||||
var branch_id = $('#branch_id').val();
|
||||
|
||||
console.log(client_id + '-' + policy_id);
|
||||
// console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
@ -231,12 +329,13 @@ function fetchEmpolyeeList(event) {
|
||||
|
||||
client_id: client_id,
|
||||
policy_id: policy_id,
|
||||
branch_id: branch_id,
|
||||
status : status,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
// console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
|
||||
@ -264,6 +363,4 @@ document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@ -20,8 +20,8 @@ option:disabled {
|
||||
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form class="parsley-examples" id="emp-upload-form"
|
||||
action="<?php echo base_url().'employee/upload'?>" method="post">
|
||||
<form class="parsley-examples" id="emp-upload-form" action="<?php echo base_url().'employee/upload'?>" method="post" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>"
|
||||
id="csrf_token">
|
||||
|
||||
@ -37,12 +37,23 @@ option:disabled {
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="policy_id" class="form-control" id="policy_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)">
|
||||
<label>Branch</label> <br />
|
||||
<select name="branch_id" class="form-control" id="branch_id" required>
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="policy_id" class="form-control" id="policy_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)" required>
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Event</label> <br />
|
||||
<select name="upload-action-type" class="form-control"
|
||||
@ -53,7 +64,7 @@ option:disabled {
|
||||
{
|
||||
foreach($actions as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -166,20 +177,28 @@ $(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#client_id").select2();
|
||||
$("#policy_id").select2();
|
||||
$("#branch_id").select2();
|
||||
|
||||
});
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var clientPoliciesWithBranch = {
|
||||
policies: []
|
||||
};
|
||||
var client_id_param = 0;
|
||||
var client_branch_id_param = 0;
|
||||
var client_policy_param = 0;
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
console.log("document loaded");
|
||||
// console.log("document loaded");
|
||||
//fetchClientPolicies();
|
||||
//for modal pop up
|
||||
$('#file-err-modal').on('show.bs.modal', function(event) {
|
||||
// console.log(event.relatedTarget);
|
||||
var myVal = $(event.relatedTarget).data('err');
|
||||
console.log(myVal);
|
||||
// console.log(myVal);
|
||||
var loader =
|
||||
'<div style="text-align: center;"><img src="<?php echo base_url()?>public/assets/images/simple_loader.gif" height="50px" width="50px" ></div>';
|
||||
$('#file-err-modal').find(".modal-body").html(loader);
|
||||
@ -192,10 +211,41 @@ $(document).ready(function() {
|
||||
//for form submit
|
||||
$("#emp-upload-form").submit(function(event) {
|
||||
event.preventDefault(); // Prevent default form submission
|
||||
console.log('submit called');
|
||||
// console.log('submit called');
|
||||
|
||||
|
||||
if(checkValues() == 'client'){
|
||||
|
||||
toastr.warning('Client is Required', 'warning')
|
||||
return false;
|
||||
|
||||
}else if(checkValues() == 'policy'){
|
||||
|
||||
toastr.warning('Policy is Required', 'warning')
|
||||
return false;
|
||||
|
||||
}else if(checkValues() == 'branch'){
|
||||
|
||||
toastr.warning('Branch is Required', 'warning')
|
||||
return false;
|
||||
|
||||
}else if(checkValues() == 'event'){
|
||||
|
||||
toastr.warning('Event is Required', 'warning')
|
||||
return false;
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
|
||||
$('#client_id').val()
|
||||
$('#policy_id').val()
|
||||
$('#branch_id').val()
|
||||
$('#upload-action-type').val()
|
||||
|
||||
var isValid = $('#emp-upload-form').parsley().validate();
|
||||
|
||||
console.log('isValid', isValid)
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
@ -203,7 +253,7 @@ $(document).ready(function() {
|
||||
|
||||
var action_item = $('#upload-action-type').val();
|
||||
var policy_id = $('#policy_id').val();
|
||||
console.log('action_item - ' + action_item);
|
||||
// console.log('action_item - ' + action_item);
|
||||
if (action_item != 'correction' && policy_id == "") {
|
||||
// $('#policy_id').attr('required', true);
|
||||
// $('#policy_id').prop('title', 'plz choose policy');
|
||||
@ -222,10 +272,10 @@ $(document).ready(function() {
|
||||
// Create FormData object
|
||||
var formData = new FormData($(this)[0]);
|
||||
for (var pair of formData.entries()) {
|
||||
console.log(pair[0] + ', ' + pair[1]);
|
||||
// console.log(pair[0] + ', ' + pair[1]);
|
||||
}
|
||||
|
||||
console.log(formData);
|
||||
// console.log(formData);
|
||||
$('#emp_form_submit_button').prop('disabled', true);
|
||||
$('#emp_form_submit_button').html(
|
||||
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...'
|
||||
@ -244,7 +294,7 @@ $(document).ready(function() {
|
||||
success: function(response) {
|
||||
// Request successful, handle response
|
||||
$('#policy_id').attr('required', false);
|
||||
console.log(response);
|
||||
// console.log(response);
|
||||
if (response.code === 200 && response.dataStatus === true && response
|
||||
.data !== "") {
|
||||
toastr.success(
|
||||
@ -278,16 +328,51 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
$(window).on("load", function() {
|
||||
|
||||
console.log("window loaded");
|
||||
fetchClientPolicies();
|
||||
|
||||
// Get the current page URL
|
||||
const url = window.location.href;
|
||||
|
||||
// Create a new URL object
|
||||
const urlObject = new URL(url);
|
||||
|
||||
// Use URLSearchParams to get the query parameters
|
||||
const params = new URLSearchParams(urlObject.search);
|
||||
|
||||
// Get the value of 'client_id' and 'client_policy_id'
|
||||
client_id_param = params.get('client_id');
|
||||
client_policy_param = params.get('client_policy_id');
|
||||
client_branch_id_param = params.get('client_branch_id');
|
||||
inception_param = params.get('actions');
|
||||
|
||||
// console.log('client_id:', client_id_param);
|
||||
// console.log('client_policy_id:', client_policy_param);
|
||||
// console.log('inception_param:', inception_param);
|
||||
|
||||
if(inception_param != null){
|
||||
$('#upload-action-type').val('inception').change()
|
||||
|
||||
var selectedValue = inception_param;
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
function fetchClientPolicies() {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
console.log('fetchClientPolicies');
|
||||
console.log(apiURL);
|
||||
// console.log('fetchClientPolicies');
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
@ -296,14 +381,57 @@ function fetchClientPolicies() {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
|
||||
console.log(response);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
clientPolicies = (response.data)
|
||||
// console.log(clientPolicies);
|
||||
|
||||
response.data.forEach(policy => {
|
||||
// console.log('policies', policy.policies);
|
||||
policy.policies.forEach(p => {
|
||||
clientPoliciesWithBranch.policies.push(p);
|
||||
});
|
||||
});
|
||||
|
||||
// console.log(clientPoliciesWithBranch);
|
||||
|
||||
appendClients(clientPolicies);
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_id_param != null ) {
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
// console.log(typeof item.id)
|
||||
return item.id == client_id_param;
|
||||
});
|
||||
appendBranch(foundPolicies.branchs);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_branch_id_param != null ) {
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === client_branch_id_param;
|
||||
});
|
||||
|
||||
|
||||
if (foundPolicies) {
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
} else {
|
||||
console.log('No policies found for the selected client');
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
@ -325,8 +453,8 @@ function fetchClientPolicies() {
|
||||
function fetchFileError(file_id) {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/get-file-error/' + file_id;
|
||||
console.log('fetchFileError');
|
||||
console.log(apiURL);
|
||||
// console.log('fetchFileError');
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
@ -338,7 +466,7 @@ function fetchFileError(file_id) {
|
||||
$(this).find(".modal-body").html("");
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
console.log((JSON.parse(response.data)));
|
||||
// console.log((JSON.parse(response.data)));
|
||||
var file_error_data = (JSON.parse(response.data));
|
||||
var file_error_html = "";
|
||||
|
||||
@ -462,58 +590,136 @@ function fetchFileError(file_id) {
|
||||
|
||||
|
||||
function appendClients(data) {
|
||||
|
||||
// console.log('client_id_param', client_id_param)
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#client_id').append($('<option>', {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
});
|
||||
if (client_id_param == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#client_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicies(data) {
|
||||
$('#policy_id').empty();
|
||||
$('#policy_id').append($('<option>', {
|
||||
value: '',
|
||||
|
||||
function appendBranch(data) {
|
||||
|
||||
$('#branch_id').empty();
|
||||
$('#branch_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
$.each(data, function(index, item) {
|
||||
$('#policy_id').append($('<option>', {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.name + ' ('+ item.policy_type+')'
|
||||
}));
|
||||
text: item.branch_name
|
||||
});
|
||||
if (client_branch_id_param == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#branch_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function appendPolicies(data) {
|
||||
|
||||
// console.log(data)
|
||||
|
||||
$('#policy_id').empty();
|
||||
|
||||
$('#policy_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select',
|
||||
selected: true
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
// console.log(item)
|
||||
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
text: item.name + ' - ' + item.policy_type
|
||||
});
|
||||
if (client_policy_param == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#policy_id').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#client_id').on('change', function() {
|
||||
|
||||
$('#policy_id').empty();
|
||||
|
||||
$('#policy_id').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
|
||||
console.log('selectedClient', selectedClient);
|
||||
// console.log('selectedClient', 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);
|
||||
console.log('foundPolicies.branchs', foundPolicies.branchs);
|
||||
appendBranch(foundPolicies.branchs);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#branch_id').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
|
||||
// console.log('selectedBranch', selectedClient);
|
||||
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === selectedClient;
|
||||
});
|
||||
|
||||
|
||||
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||
|
||||
appendPolicies(foundPolicies);
|
||||
toastr.warning('No policies found for the selected client branch.');
|
||||
|
||||
} else {
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// 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 = $('#client_id').val();
|
||||
var policy_id = $('#policy_id').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
// console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
toastr.warning('Please select values in both dropdowns.');
|
||||
return;
|
||||
@ -526,7 +732,7 @@ function fetchEmpolyeeList(event) {
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
// console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
|
||||
@ -575,7 +781,7 @@ $('#excel_download').click(function() {
|
||||
// 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.');
|
||||
// console.log('Download action triggered.');
|
||||
}
|
||||
});
|
||||
|
||||
@ -591,15 +797,15 @@ $('#fetch_enrolled_data').click(function()
|
||||
|
||||
var policy_id = $('#policy_id').val();
|
||||
var uri = '<?= base_url('util/init-Emp-onboard/') ?>' + policy_id;
|
||||
console.log(policy_id);
|
||||
console.log(uri);
|
||||
// console.log(policy_id);
|
||||
// console.log(uri);
|
||||
$('#fetch_btn').attr('href', uri);
|
||||
|
||||
$('#emp_data').empty();
|
||||
var client_id = $('#client_id').val();
|
||||
var policy_id = $('#policy_id').val();
|
||||
var action = $('#upload-action-type').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
// console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
toastr.warning('please select the client and policy for this uploaing event', 'warning')
|
||||
$('#full-width-modal').modal('hide');
|
||||
@ -612,14 +818,14 @@ $('#fetch_enrolled_data').click(function()
|
||||
action: action
|
||||
};
|
||||
|
||||
console.log('queryParams', queryParams)
|
||||
// console.log('queryParams', queryParams)
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
console.log('queryString', queryString)
|
||||
// console.log('queryString', queryString)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var uri = '<?= base_url('util/featch-emp-list')?>?' + queryString
|
||||
console.log(uri)
|
||||
// console.log(uri)
|
||||
|
||||
$.ajax({
|
||||
url: uri,
|
||||
@ -633,7 +839,7 @@ $('#fetch_enrolled_data').click(function()
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log(res);
|
||||
// console.log(res);
|
||||
|
||||
if (res) {
|
||||
setTimeout(function() {
|
||||
@ -663,13 +869,13 @@ $(document).ready(function() {
|
||||
$('#policy_id').change(function(){
|
||||
|
||||
var selectedpolicy = $(this).val();
|
||||
console.log('selectedpolicy',selectedpolicy)
|
||||
// console.log('selectedpolicy',selectedpolicy)
|
||||
$('#upload-action-type').val('').change();
|
||||
$('#file_upload').hide();
|
||||
$('#excel_download').removeAttr('href');
|
||||
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/fetch-emp-count/' + selectedpolicy;
|
||||
console.log(apiURL);
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
@ -679,11 +885,11 @@ $(document).ready(function() {
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
console.log('responce data emp_count', response);
|
||||
// console.log('responce data emp_count', response);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
console.log(response.emp_count.length)
|
||||
// console.log(response.emp_count.length)
|
||||
if(response.emp_count > 0){
|
||||
|
||||
var select = document.getElementById("upload-action-type");
|
||||
@ -734,11 +940,13 @@ $(document).ready(function() {
|
||||
|
||||
function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
{
|
||||
console.log(event.target.id);
|
||||
// console.log(event.target.id);
|
||||
var policy_id = (event.target.value);
|
||||
console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
||||
if(policy_id != 0 && policy_id != " " && policy_id != undefined)
|
||||
{
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/has_policy_config_completed/' + policy_id;
|
||||
console.log(apiURL);
|
||||
// console.log(apiURL);
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
@ -754,12 +962,19 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
success: function(response) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 300);
|
||||
|
||||
console.log('check policy responce', response);
|
||||
|
||||
if (response.hasOwnProperty('si_enhancement') && response.si_enhancement == 0) {
|
||||
$('.si-enhancement-option').hide();
|
||||
} else {
|
||||
$('.si-enhancement-option').show();
|
||||
}
|
||||
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.message !== null) {
|
||||
toastr.error(response.message, 'Error');
|
||||
$('#emp_form_submit_button').prop('disabled', true);
|
||||
@ -781,15 +996,47 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
toastr.error('Something went wrong! Try Later', 'Error');
|
||||
}, 300);
|
||||
// toastr.error('Something went wrong! Try Later', 'Error');
|
||||
console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function checkValues() {
|
||||
|
||||
var clientId = $('#client_id').val();
|
||||
var policyId = $('#policy_id').val();
|
||||
var branchId = $('#branch_id').val();
|
||||
var uploadActionType = $('#upload-action-type').val();
|
||||
|
||||
if (!clientId || clientId == '0') {
|
||||
// alert('Client ID is empty or zero');
|
||||
return 'client';
|
||||
}
|
||||
|
||||
if (!branchId || branchId == '0') {
|
||||
// alert('Branch ID is empty or zero');
|
||||
return 'branch';
|
||||
}
|
||||
|
||||
if (!policyId || policyId == '0') {
|
||||
// alert('Policy ID is empty or zero');
|
||||
return 'policy';
|
||||
}
|
||||
|
||||
if (!uploadActionType || uploadActionType == '0') {
|
||||
// alert('Upload action type is empty or zero');
|
||||
return 'event';
|
||||
}
|
||||
|
||||
// If all values are valid, return true
|
||||
// return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -1,18 +1,17 @@
|
||||
<style>
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
.table th,
|
||||
.table td {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.btn .btn-secondary .buttons-csv .buttons-html5 .my_class{
|
||||
position: relative;
|
||||
left: 79px;
|
||||
}
|
||||
table.dataTable tbody td {
|
||||
padding: 4px 4px !important;
|
||||
}
|
||||
|
||||
.btn .btn-secondary .buttons-csv .buttons-html5 .my_class {
|
||||
position: relative;
|
||||
left: 79px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
@ -20,8 +19,7 @@ table.dataTable tbody td {
|
||||
<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">
|
||||
<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>
|
||||
@ -36,6 +34,14 @@ table.dataTable tbody td {
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Branch</label> <br />
|
||||
<select name="branch_id" class="form-control" id="branch_id">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select class="form-control" id="policies">
|
||||
@ -47,11 +53,10 @@ table.dataTable tbody td {
|
||||
<label>Status</label> <br />
|
||||
<select class="form-control" id="status1">
|
||||
<option value="0">Select</option>
|
||||
<?php foreach($status as $key => $value) { ?>
|
||||
<option value="<?= $key ?>"
|
||||
<?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
||||
<?= $value ?>
|
||||
</option>
|
||||
<?php foreach ($status as $key => $value) { ?>
|
||||
<option value="<?= $key ?>" <?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
||||
<?= $value ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
@ -59,9 +64,7 @@ table.dataTable tbody td {
|
||||
</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>
|
||||
<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> -->
|
||||
@ -80,12 +83,11 @@ table.dataTable tbody td {
|
||||
<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>
|
||||
<h4 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">
|
||||
<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>
|
||||
@ -101,47 +103,45 @@ table.dataTable tbody td {
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($employees))
|
||||
{
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
<?php
|
||||
if (isset($employees)) {
|
||||
foreach ($employees as $key => $employee) { ?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
||||
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?></td>
|
||||
<td><?php echo $employee['endorsement_id']?></td>
|
||||
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
||||
</td>
|
||||
<td><?php echo $employee['remarks']?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($employee['actions'] == 'c') {
|
||||
echo 'Correction';
|
||||
} elseif ($employee['actions'] == 'si') {
|
||||
echo 'SI Enhancement';
|
||||
} elseif ($employee['actions'] == 'd') {
|
||||
echo 'Deletion';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($employee['status'] == 'pending') {
|
||||
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'inprogress') {
|
||||
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'complete') {
|
||||
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="text-center"><a href="#" data-id="<?php echo $employee['id']?>"
|
||||
class="fa fa-eye emp_data_model" aria-hidden="true" data-toggle="modal"
|
||||
data-target="#centermodal"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1) ?></b></td>
|
||||
<td><?php echo $employee['name'] ?>( <?php echo $employee['emp_code'] ?> )</td>
|
||||
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?></td>
|
||||
<td><?php echo $employee['endorsement_id'] ?></td>
|
||||
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
||||
</td>
|
||||
<td><?php echo $employee['remarks'] ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if ($employee['actions'] == 'c') {
|
||||
echo 'Correction';
|
||||
} elseif ($employee['actions'] == 'si') {
|
||||
echo 'SI Enhancement';
|
||||
} elseif ($employee['actions'] == 'd') {
|
||||
echo 'Deletion';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if ($employee['status'] == 'pending') {
|
||||
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'inprogress') {
|
||||
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||
} elseif ($employee['status'] == 'complete') {
|
||||
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="text-center"><a href="#" data-id="<?php echo $employee['id'] ?>" class="fa fa-eye emp_data_model" aria-hidden="true" data-toggle="modal" data-target="#centermodal"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }
|
||||
} ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@ -153,7 +153,7 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="background-color: gainsboro;">
|
||||
@ -179,351 +179,436 @@ table.dataTable tbody td {
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#clients").select2();
|
||||
$("#policies").select2();
|
||||
$("#branch_id").select2();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#clients").select2();
|
||||
$("#policies").select2();
|
||||
});
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var clientPoliciesWithBranch = {
|
||||
policies: []
|
||||
};
|
||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||
|
||||
$(window).on("load", function() {
|
||||
console.log("window loaded");
|
||||
fetchClientPolicies();
|
||||
});
|
||||
$(window).on("load", function() {
|
||||
console.log("window loaded");
|
||||
fetchClientPolicies();
|
||||
});
|
||||
|
||||
|
||||
function fetchClientPolicies() {
|
||||
function fetchClientPolicies() {
|
||||
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
console.log('fetchClientPolicies');
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
console.log(clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
$('#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);
|
||||
|
||||
//this function for reselect policy
|
||||
setTimeout(function() {
|
||||
if (client_id) {
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
console.log(typeof item.id)
|
||||
return item.id == client_id;
|
||||
|
||||
response.data.forEach(policy => {
|
||||
// console.log('policies', policy.policies);
|
||||
policy.policies.forEach(p => {
|
||||
clientPoliciesWithBranch.policies.push(p);
|
||||
});
|
||||
appendPolicies(foundPolicies.policies);
|
||||
}
|
||||
}, 500);
|
||||
//end
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
// console.log(clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_id) {
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
// console.log(typeof item.id)
|
||||
return item.id == client_id;
|
||||
});
|
||||
appendBranch(foundPolicies.branchs);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_branch_id) {
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === client_branch_id;
|
||||
});
|
||||
|
||||
if (foundPolicies) {
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
} else {
|
||||
console.log('No policies found for the selected client');
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
|
||||
} 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!');
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function appendClients(data) {
|
||||
|
||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
});
|
||||
if (clientID == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#clients').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function appendPolicies(data) {
|
||||
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
||||
console.log(PolicyID)
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
});
|
||||
if (PolicyID == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#policies').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#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();
|
||||
var status = $('#status1').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id,
|
||||
status: status,
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
function appendClients(data) {
|
||||
|
||||
}
|
||||
|
||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
});
|
||||
if (clientID == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#clients').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('.emp_data_model').click(function() {
|
||||
var myVal = $(this).data('id');
|
||||
console.log(myVal);
|
||||
fetchEmpEndorsementData(myVal)
|
||||
function appendBranch(data) {
|
||||
|
||||
});
|
||||
$('#branch_id').empty();
|
||||
$('#branch_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name
|
||||
});
|
||||
if (client_branch_id == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#branch_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function fetchEmpEndorsementData(id) {
|
||||
function appendPolicies(data) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/get-emp-endorsement/' + id;
|
||||
console.log('fetchEmpEndorsementData');
|
||||
console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
if (response.code === 200 && response.dataStatus === true) {
|
||||
try {
|
||||
endorsementData = (response.data);
|
||||
endorsementData2 = (response.data2);
|
||||
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0' ?>;
|
||||
// console.log(PolicyID)
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
text: item.name
|
||||
});
|
||||
if (PolicyID == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#policies').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
e_actions = endorsementData2[0]['actions'];
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
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.branchs);
|
||||
appendBranch(foundPolicies.branchs);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#branch_id').on('change', function() {
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
|
||||
// console.log('selectedBranch', selectedClient);
|
||||
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === selectedClient;
|
||||
});
|
||||
|
||||
|
||||
var heading = "";
|
||||
if (endorsementData2[0]['actions'] == 'si') {
|
||||
heading = ' - ' + 'SI Enhancement';
|
||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
} else if (endorsementData2[0]['actions'] == 'd') {
|
||||
heading = ' - ' + 'Deletion';
|
||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
} else if (endorsementData2[0]['actions'] == 'c') {
|
||||
heading = ' - ' + 'Correction';
|
||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
}
|
||||
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||
|
||||
$('#heading').html(heading);
|
||||
|
||||
$('#table_data').empty();
|
||||
$('#table_head_data').empty();
|
||||
appendPolicies(foundPolicies);
|
||||
toastr.warning('No policies found for the selected client branch.');
|
||||
|
||||
|
||||
if(e_actions == 'd'){
|
||||
} else {
|
||||
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
}
|
||||
});
|
||||
|
||||
$.each(endorsementData, function(index, item) {
|
||||
var tableHtml = `
|
||||
});
|
||||
|
||||
// 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();
|
||||
var status = $('#status1').val();
|
||||
var branch_id = $('#branch_id').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,
|
||||
branch_id: branch_id,
|
||||
status: status,
|
||||
};
|
||||
|
||||
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');
|
||||
});
|
||||
|
||||
|
||||
$('.emp_data_model').click(function() {
|
||||
var myVal = $(this).data('id');
|
||||
// console.log(myVal);
|
||||
fetchEmpEndorsementData(myVal)
|
||||
|
||||
});
|
||||
|
||||
|
||||
function fetchEmpEndorsementData(id) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var apiURL = '<?php echo base_url(); ?>' + 'util/get-emp-endorsement/' + id;
|
||||
console.log('fetchEmpEndorsementData');
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response);
|
||||
if (response.code === 200 && response.dataStatus === true) {
|
||||
try {
|
||||
endorsementData = (response.data);
|
||||
endorsementData2 = (response.data2);
|
||||
|
||||
e_actions = endorsementData2[0]['actions'];
|
||||
|
||||
|
||||
var heading = "";
|
||||
if (endorsementData2[0]['actions'] == 'si') {
|
||||
heading = ' - ' + 'SI Enhancement';
|
||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
} else if (endorsementData2[0]['actions'] == 'd') {
|
||||
heading = ' - ' + 'Deletion';
|
||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
} else if (endorsementData2[0]['actions'] == 'c') {
|
||||
heading = ' - ' + 'Correction';
|
||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
}
|
||||
|
||||
$('#heading').html(heading);
|
||||
|
||||
$('#table_data').empty();
|
||||
$('#table_head_data').empty();
|
||||
|
||||
|
||||
if (e_actions == 'd') {
|
||||
|
||||
$.each(endorsementData, function(index, item) {
|
||||
var tableHtml = `
|
||||
<tr>
|
||||
<td>${item.field_name}</td>
|
||||
<td>${formatNumberToIndianLocale(item.data, item.field_name, e_actions)}</td>
|
||||
</tr>
|
||||
`;
|
||||
$('#table_data').append(tableHtml);
|
||||
});
|
||||
|
||||
$('#table_data').append(tableHtml);
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
var table_head = `
|
||||
|
||||
} else {
|
||||
|
||||
var table_head = `
|
||||
<tr>
|
||||
<th class="font-weight-medium"></th>
|
||||
<th class="font-weight-medium">Old Value</th>
|
||||
<th class="font-weight-medium">New Value</th>
|
||||
</tr>
|
||||
`;
|
||||
$('#table_head_data').append(table_head);
|
||||
$('#table_head_data').append(table_head);
|
||||
|
||||
$.each(endorsementData, function(index, item) {
|
||||
var tableHtml = `
|
||||
$.each(endorsementData, function(index, item) {
|
||||
var tableHtml = `
|
||||
<tr>
|
||||
<td>${item.field_name}</td>
|
||||
<td>${formatNumberToIndianLocale(item.old_value, item.field_name)}</td>
|
||||
<td>${formatNumberToIndianLocale(item.new_value, item.field_name, e_actions)}</td>
|
||||
</tr>
|
||||
`;
|
||||
$('#table_data').append(tableHtml);
|
||||
});
|
||||
$('#table_data').append(tableHtml);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
|
||||
|
||||
} 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!');
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 200);
|
||||
}
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 200);
|
||||
}
|
||||
|
||||
function formatNumberToIndianLocale(value, field_name, action) {
|
||||
function formatNumberToIndianLocale(value, field_name, action) {
|
||||
|
||||
// Check if the value is a valid number (either as a number or as a string)
|
||||
if (!isNaN(value) && !isNaN(parseFloat(value)) && field_name != 'No of Days') {
|
||||
// Check if the value is a valid number (either as a number or as a string)
|
||||
if (!isNaN(value) && !isNaN(parseFloat(value)) && field_name != 'No of Days') {
|
||||
|
||||
// Convert the value to a number and format it using Indian English locale
|
||||
var return_val = parseFloat(value).toLocaleString('en-IN');
|
||||
// Convert the value to a number and format it using Indian English locale
|
||||
var return_val = parseFloat(value).toLocaleString('en-IN');
|
||||
|
||||
if(field_name == 'Period of non coverage'){
|
||||
if (field_name == 'Period of non coverage') {
|
||||
|
||||
return value + ' days';
|
||||
}
|
||||
return value + ' days';
|
||||
}
|
||||
|
||||
if(field_name == 'Total Amount'){
|
||||
|
||||
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||
}
|
||||
|
||||
if(field_name == 'Total'){
|
||||
|
||||
if(action == 'd'){
|
||||
if (field_name == 'Total Amount') {
|
||||
|
||||
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||
|
||||
}else if(action == 'si'){
|
||||
|
||||
return '₹ ' + return_val + ' ( To be paid )';
|
||||
}
|
||||
|
||||
if (field_name == 'Total') {
|
||||
|
||||
if (action == 'd') {
|
||||
|
||||
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||
|
||||
} else if (action == 'si') {
|
||||
|
||||
return '₹ ' + return_val + ' ( To be paid )';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return '₹ ' + return_val;
|
||||
|
||||
} else {
|
||||
// Return the original value if it's not a valid number
|
||||
return value;
|
||||
}
|
||||
|
||||
return '₹ ' + return_val;
|
||||
|
||||
} else {
|
||||
// Return the original value if it's not a valid number
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
$('.close').click(function(){
|
||||
$('.close').click(function() {
|
||||
|
||||
$('#table_data').empty();
|
||||
})
|
||||
$('#table_data').empty();
|
||||
})
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#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": 'Endorsement-List',
|
||||
"className": 'my_class',
|
||||
"exportOptions": {
|
||||
"columns": ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
"initComplete": function(settings, json) {
|
||||
$('.my_class').css({
|
||||
"position": "relative",
|
||||
"left": "79px"
|
||||
$('#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": 'Endorsement-List',
|
||||
"className": 'my_class',
|
||||
"exportOptions": {
|
||||
"columns": ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
"initComplete": function(settings, json) {
|
||||
$('.my_class').css({
|
||||
"position": "relative",
|
||||
"left": "79px"
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true,
|
||||
// pagingType: 'full_numbers'
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true ,
|
||||
// pagingType: 'full_numbers'
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@ -14,17 +14,18 @@
|
||||
<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;">Files</h4>
|
||||
<h4 style="position: relative;">Files</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">File name</th>
|
||||
<th class="font-weight-medium">Client</th>
|
||||
<th class="font-weight-medium">Client Branch</th>
|
||||
<th class="font-weight-medium">Policy</th>
|
||||
<th class="font-weight-medium">Event</th>
|
||||
<th class="font-weight-medium">User/Time</th>
|
||||
@ -34,42 +35,49 @@
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php
|
||||
if(isset($fileList))
|
||||
{
|
||||
<?php
|
||||
if (isset($fileList)) {
|
||||
foreach ($fileList as $key => $file) { //print_r((json_decode($file['reason'])));
|
||||
// $reason = json_decode(($file['reason']));
|
||||
// $reason = "{'date':'value data kbckl kcn/aksl'}";
|
||||
// echo $reason;
|
||||
?>
|
||||
// $reason = json_decode(($file['reason']));
|
||||
// $reason = "{'date':'value data kbckl kcn/aksl'}";
|
||||
// echo $reason;
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><b><?php echo ($key + 1)?></b></td>
|
||||
<td><?php echo $file['file_name']?></td>
|
||||
<td><?php echo $file['short_name']?></td>
|
||||
<td><?php echo $file['policy_name']?></td>
|
||||
<td><?php echo $file['action']?></td>
|
||||
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?>
|
||||
<td><b><?php echo ($key + 1) ?></b></td>
|
||||
<td><?php echo $file['file_name'] ?></td>
|
||||
<td><?php echo $file['short_name'] ?></td>
|
||||
<td><?php echo $file['branch_name'] ?></td>
|
||||
<td><?php echo $file['policy_name'] ?></td>
|
||||
<td><?php echo $file['action'] ?></td>
|
||||
<td><?php echo fancy_date_time_format($file['created_at']) . ' by <strong>' . $file['first_name'] . '</strong>' ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if($file['status'] == 'failed')
|
||||
{
|
||||
echo $file['status'] . " <span class='col-xl-3 col-lg-4 col-sm-6'> <i class='fe-alert-circle' data-toggle='modal' data-target='#file-err-modal' data-err=".$file['id']."></i></span>";
|
||||
|
||||
}else if( $file['status'] == 'inprogress'){
|
||||
<?php
|
||||
if ($file['status'] == 'failed') {
|
||||
echo $file['status'] . " <span class='col-xl-3 col-lg-4 col-sm-6'> <i class='fe-alert-circle' data-toggle='modal' data-target='#file-err-modal' data-err=" . $file['id'] . "></i></span>";
|
||||
} else if ($file['status'] == 'inprogress') {
|
||||
|
||||
$tool_tip_text = "Live(s) : {$file['employee_count']}" . " | Total premium : ₹ " . format_indian_number($file['total'],2,',') ." | Click to reload";
|
||||
echo '<a data-toggle="tooltip" data-placement="top" data-id="' . $file['status'] . '" class="reload" title="'.$tool_tip_text.'" href="#">' . $file['status'] . '</a>';
|
||||
|
||||
}else{
|
||||
if ($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addtion') {
|
||||
|
||||
$tool_tip_text = "Live(s) : {$file['employee_count']}" . " | Total premium : ₹ " . format_indian_number($file['total'],2,',') ;
|
||||
// $tool_tip_text = "dssd";
|
||||
// Total Amount : $file['total']";
|
||||
echo '<span data-toggle="tooltip" data-placement="top" data-id="' . $file['status'] . '" title=" '. $tool_tip_text.' ">' . $file['status'] . '</span>';
|
||||
}
|
||||
?>
|
||||
$tool_tip_text = "Live(s) : {$file['employee_count']}" . " | Total premium : ₹ " . format_indian_number($file['total'], 2, ',') . " | Click to reload";
|
||||
echo '<a data-toggle="tooltip" data-placement="top" data-id="' . $file['status'] . '" class="reload" title="' . $tool_tip_text . '" href="#">' . $file['status'] . '</a>';
|
||||
}
|
||||
} else if ($file['status'] == 'success') {
|
||||
|
||||
if ($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addtion') {
|
||||
$tool_tip_text = "Live(s) : {$file['employee_count']}" . " | Total premium : ₹ " . format_indian_number($file['total'], 2, ',');
|
||||
// $tool_tip_text = "dssd";
|
||||
// Total Amount : $file['total']";
|
||||
echo '<span data-toggle="tooltip" data-placement="top" data-id="' . $file['status'] . '" title=" ' . $tool_tip_text . ' ">' . $file['status'] . '</span>';
|
||||
}else{
|
||||
echo '<span data-id="' . $file['status'] . '" >' . $file['status'] . '</span>';
|
||||
}
|
||||
}else{
|
||||
|
||||
echo '<span data-id="' . $file['status'] . '" >' . $file['status'] . '</span>';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@ -78,30 +86,34 @@
|
||||
data-toggle="dropdown" aria-expanded="false"><i
|
||||
class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<?php if($file['status'] == 'failed') { ?>
|
||||
<a data-id="<?= htmlspecialchars(json_encode($file)) ?>" data-toggle="modal"
|
||||
data-target="#file-upload-modal" class="dropdown-item upload_button" href="#"><i
|
||||
<?php if ($file['status'] == 'failed') { ?>
|
||||
<a data-id="<?= htmlspecialchars(json_encode(['client_id' => $file['client_id'], 'client_policy_id' => $file['client_policy_id'], 'client_branch_id' => $file['client_branch_id'], 'action' => $file['action']])) ?>"
|
||||
data-toggle="modal" data-target="#file-upload-modal"
|
||||
class="dropdown-item upload_button" href="#"><i
|
||||
class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Re-Upload</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item"
|
||||
href="<?= base_url("util/download-file-list/").$file['id']; ?>"><i
|
||||
href="<?= base_url("util/download-file-list/") . $file['id']; ?>"><i
|
||||
class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
||||
|
||||
<a data-id="<?php echo $file['id']?>" data-toggle="modal"
|
||||
<a data-id="<?php echo $file['id'] ?>" data-toggle="modal"
|
||||
data-target="#full-width-modal-emp-list" class="dropdown-item view_emp_list"
|
||||
href="#"><i
|
||||
class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View</a>
|
||||
<?php if($file['status'] == 'success'){?>
|
||||
<a data-id="<?php echo $file['id']?>" class="dropdown-item truncate"
|
||||
href="#"><i
|
||||
<?php if ($file['status'] == 'success') { ?>
|
||||
|
||||
|
||||
<a data-id="<?php echo $file['id'] ?>" class="dropdown-item truncate" href="#"><i
|
||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Truncate</a>
|
||||
<?php } ?>
|
||||
<?php
|
||||
} ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php }}?>
|
||||
<?php }
|
||||
} ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@ -115,7 +127,8 @@
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="fullWidthModalLabel">Upload Employee List <span id="title_header_name"></span></h4>
|
||||
<h4 class="modal-title" id="fullWidthModalLabel">Upload Employee List <span
|
||||
id="title_header_name"></span></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body" id="emp_data_success">
|
||||
@ -134,14 +147,15 @@
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Reupload the file</h4>
|
||||
<h4 class="modal-title" id="myCenterModalLabel">ReUpload the file</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="parsley-examples" id="uploadForm" action="<?php echo base_url().'employee/upload'?>"
|
||||
<form class="parsley-examples" id="uploadForm" action="<?php echo base_url() . 'employee/upload' ?>"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" id="file_client_id" name="client_id">
|
||||
<input type="hidden" id="file_policy_id" name="policy_id">
|
||||
<input type="hidden" id="file_branch_id" name="branch_id">
|
||||
<input type="hidden" id="file_upload_actions" name="upload-action-type">
|
||||
<input type="file" id="fileInput" name="emplist" required
|
||||
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
|
||||
@ -156,7 +170,7 @@
|
||||
<script>
|
||||
$('body').on('click', '.view_emp_list', function() {
|
||||
|
||||
console.log('file_id');
|
||||
console.log('file_id', 'file_id');
|
||||
$('#emp_data_success').empty();
|
||||
$('#title').html(' ');
|
||||
var file_id = $(this).attr('data-id');
|
||||
@ -172,7 +186,7 @@ $('body').on('click', '.view_emp_list', function() {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var uri = '<?= base_url('util/view-success-emp-list')?>?' + queryString
|
||||
var uri = '<?= base_url('util/view-success-emp-list') ?>?' + queryString
|
||||
console.log(uri)
|
||||
|
||||
$.ajax({
|
||||
@ -232,79 +246,81 @@ $('body').on('click', '.upload_button', function() {
|
||||
console.log(fileId); // Use fileId as needed
|
||||
$('#file_client_id').val(fileId.client_id)
|
||||
$('#file_policy_id').val(fileId.client_policy_id)
|
||||
$('#file_branch_id').val(fileId.client_branch_id)
|
||||
$('#file_upload_actions').val(fileId.action)
|
||||
})
|
||||
|
||||
$('body').on('click', '.truncate', function() {
|
||||
$('body').on('click', '.truncate', function(event) {
|
||||
event.preventDefault();
|
||||
// console.log(event);
|
||||
var fileId = JSON.parse(this.getAttribute('data-id'));
|
||||
// alert('Hi' + fileId);
|
||||
|
||||
Swal.fire({
|
||||
title: "Do you want to truncate data from uploaded file?",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Delete",
|
||||
confirmButtonColor: "#ff3333",
|
||||
}).then((result) => {
|
||||
|
||||
console.log(result);
|
||||
if (result.isConfirmed) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var apiURL = '<?php echo base_url();?>' + 'employee/truncate/' + fileId;
|
||||
$.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);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
Swal.fire({
|
||||
title: "Do you want to truncate data from uploaded file?",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "Delete",
|
||||
confirmButtonColor: "#ff3333",
|
||||
}).then((result) => {
|
||||
|
||||
console.log(result);
|
||||
if (result.isConfirmed) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var apiURL = '<?php echo base_url(); ?>' + 'employee/truncate/' + fileId;
|
||||
$.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);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
Swal.fire({
|
||||
title: "Deleted!",
|
||||
// text: "Data from truncated",
|
||||
icon: "success"
|
||||
});
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: response.message,
|
||||
icon: "error"
|
||||
});
|
||||
} else {
|
||||
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: 'Something went wrong! Try later',
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
if (response.code === 200 && response.dataStatus === true && response
|
||||
.data !== "") {
|
||||
Swal.fire({
|
||||
title: "Deleted!",
|
||||
// text: "Data from truncated",
|
||||
icon: "success"
|
||||
});
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: response.message,
|
||||
icon: "error"
|
||||
});
|
||||
} else {
|
||||
|
||||
console.error('Error fetching data from API:', error);
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
Swal.fire({
|
||||
title: "Failed!",
|
||||
text: 'Something went wrong! Try later',
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
console.error('Error fetching data from API:', error);
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
@ -345,7 +361,7 @@ $('#uploadForm').submit(function() {
|
||||
toastr.success(
|
||||
'File upload successs, Data validation is in-progress',
|
||||
'success');
|
||||
|
||||
$('.close').click()
|
||||
window.location.reload(true);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
@ -381,32 +397,32 @@ $('body').on('click', '.reload', function() {
|
||||
}
|
||||
})
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#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": 'Employee-Upload-List',
|
||||
"className": 'my_class',
|
||||
"exportOptions": {
|
||||
"columns": ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
"initComplete": function(settings, json) {
|
||||
$('.my_class').css({
|
||||
"position": "relative",
|
||||
"left": "79px"
|
||||
});
|
||||
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": 'Employee-Upload-List',
|
||||
"className": 'my_class',
|
||||
"exportOptions": {
|
||||
"columns": ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
"initComplete": function(settings, json) {
|
||||
$('.my_class').css({
|
||||
"position": "relative",
|
||||
"left": "79px"
|
||||
});
|
||||
},
|
||||
language: {
|
||||
search: "_INPUT_",
|
||||
searchPlaceholder: "Search..."
|
||||
},
|
||||
paging: true ,
|
||||
paging: true,
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -46,4 +46,7 @@
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
@ -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">
|
||||
@ -16,10 +78,20 @@
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="short_name">Insurer Short Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="short_name" placeholder="Enter Short Name" value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>" name="short_name" required minlength="3" maxlength="8">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label class="switch" style="position: absolute;top: 32px;left: 17px;">
|
||||
<input id="addition_add_day" type="checkbox" name="addition_add_day" <?= (isset($insurer['addition_add_day']) && $insurer['addition_add_day'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="is_download_btn" style="position: relative;top: 30px;left: 82px;">Add one day to date of coverage when Addition/Dependent addition</label>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
<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;">Insurer List</h4>
|
||||
<h4 style="position: relative;">Insurer List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<a href="<?= base_url("master/insurer/create"); ?>" 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>
|
||||
|
||||
@ -36,7 +36,7 @@ body {
|
||||
<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;">Insurer</h4>
|
||||
<h4 style="position: relative;">Insurer</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right;">
|
||||
<a href="<?= base_url("master/insurer/list"); ?>" >
|
||||
|
||||
@ -4,19 +4,16 @@
|
||||
<div class="col-xl-12">
|
||||
<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>
|
||||
<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">
|
||||
<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">
|
||||
@ -27,61 +24,61 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy<span class="text-danger">*</span></label> <br />
|
||||
<select name="client_policy_id" class="form-control" id="policy" required>
|
||||
<option value="">Select</option>
|
||||
<label>Branch</label> <br />
|
||||
<select name="client_branch_id" class="form-control" id="client_branch_id" required>
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Insurer/TPA Data<span class="text-danger">*</span></label> <br />
|
||||
<select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa"
|
||||
required>
|
||||
<label>Policy<span class="text-danger" id="policy_danger">*</span></label> <br />
|
||||
<select name="client_policy_id" class="form-control" id="policy" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)" 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>Insurer/TPA Data<span class="text-danger">*</span></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 class="form-group col-md-4">
|
||||
<label>Action<span class="text-danger">*</span></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>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
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<span class="text-danger">*</span></label> <br />
|
||||
<select name="event_type" class="form-control" id="upload-action-type"
|
||||
required>
|
||||
<select name="event_type" class="form-control" id="event_type" required>
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
if(isset($events) && count($events))
|
||||
{
|
||||
foreach($events as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
if (isset($events) && count($events)) {
|
||||
foreach ($events as $key => $action) {
|
||||
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
@ -93,25 +90,19 @@
|
||||
<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>
|
||||
<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="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>
|
||||
<button id="emp_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="export_excel_btn">
|
||||
<div class="d-flex align-items-center justify-content-start"
|
||||
style="margin-top: 18px;">
|
||||
<div class="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>
|
||||
<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>
|
||||
@ -125,253 +116,446 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end page title -->
|
||||
<div class="row" id="file_list">
|
||||
<?php include('batch_list.php');?>
|
||||
<!-- end page title -->
|
||||
<div class="row" id="file_list">
|
||||
<?php include('batch_list.php'); ?>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#client").select2();
|
||||
$("#policy").select2();
|
||||
});
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#client").select2();
|
||||
$("#policy").select2();
|
||||
$("#client_branch_id").select2();
|
||||
});
|
||||
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var clientPoliciesWithBranch2 = {
|
||||
policies: []
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
var client_id_param2 = 0;
|
||||
var client_branch_id_param2 = 0;
|
||||
var client_policy_param2 = 0;
|
||||
|
||||
<?php if (session()->has('error')): ?>
|
||||
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
|
||||
<?php endif; ?>
|
||||
$(document).ready(function() {
|
||||
|
||||
<?php if (session()->has('success')): ?>
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
<?php if (session()->has('error')) : ?>
|
||||
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
|
||||
<?php endif; ?>
|
||||
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
<?php if (session()->has('success')) : ?>
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
|
||||
// for form submit
|
||||
$("#import_export_excel_forms").submit(function(event) {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
|
||||
var action = "<?php echo base_url().'util/import-export'?>"
|
||||
// var action = $(this).attr("action");
|
||||
event.preventDefault(); // Prevent default form submission
|
||||
console.log('submit called');
|
||||
// for form submit
|
||||
$("#import_export_excel_forms").submit(function(event) {
|
||||
|
||||
var isValid = $('#import_export_excel_form').parsley().validate();
|
||||
var action = "<?php echo base_url() . 'util/import-export' ?>"
|
||||
// var action = $(this).attr("action");
|
||||
event.preventDefault(); // Prevent default form submission
|
||||
console.log('submit called');
|
||||
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
var isValid = $('#import_export_excel_form').parsley().validate();
|
||||
|
||||
// Create FormData object
|
||||
var formData = new FormData($(this)[0]);
|
||||
for (var pair of formData.entries()) {
|
||||
console.log(pair[0] + ', ' + pair[1]);
|
||||
}
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
// Create FormData object
|
||||
var formData = new FormData($(this)[0]);
|
||||
for (var pair of formData.entries()) {
|
||||
// console.log(pair[0] + ', ' + pair[1]);
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false, // Prevent jQuery from automatically processing the data
|
||||
contentType: false, // Let jQuery handle the content type
|
||||
success: function(response) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
console.log(response);
|
||||
if (response.code === 200 && response.status === true) {
|
||||
$.ajax({
|
||||
url: action,
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false, // Prevent jQuery from automatically processing the data
|
||||
contentType: false, // Let jQuery handle the content type
|
||||
success: function(response) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$$("#import_export_excel_form")[0].reset()
|
||||
toastr.success('File Download successs', 'success');
|
||||
// console.log(response);
|
||||
if (response.code === 200 && response.status === true) {
|
||||
|
||||
} else if (response.code === 404 && response.status === false) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$$("#import_export_excel_form")[0].reset()
|
||||
toastr.success('File Download successs', 'success');
|
||||
|
||||
console.error('no data found', response);
|
||||
} else if (response.code === 404 && response.status === false) {
|
||||
|
||||
console.error('no data found', response);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$("#import_export_excel_form")[0].reset()
|
||||
toastr.error(response.message, 'Failed');
|
||||
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
// toastr.error('Something went wrong! Try later', 'Error');
|
||||
// window.location.reload(true);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Request failed, handle error
|
||||
console.error("Request failed:", status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$("#import_export_excel_form")[0].reset()
|
||||
toastr.error(response.message, 'Failed');
|
||||
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
// toastr.error('Something went wrong! Try later', 'Error');
|
||||
// window.location.reload(true);
|
||||
}
|
||||
});
|
||||
}); //end
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(window).on("load", function() {
|
||||
|
||||
fetchClientPolicies2();
|
||||
|
||||
// Get the current page URL
|
||||
const url = window.location.href;
|
||||
|
||||
// Create a new URL object
|
||||
const urlObject = new URL(url);
|
||||
|
||||
// Use URLSearchParams to get the query parameters
|
||||
const params = new URLSearchParams(urlObject.search);
|
||||
|
||||
|
||||
|
||||
// Get the value of 'client_id' and 'client_policy_id'
|
||||
client_id_param2 = params.get('client_id');
|
||||
client_policy_param2 = params.get('client_policy_id');
|
||||
client_branch_id_param2 = params.get('client_branch_id');
|
||||
actions = params.get('actions');
|
||||
insurer_or_tpa = params.get('insurer_or_tpa');
|
||||
event = params.get('event');
|
||||
|
||||
|
||||
|
||||
// console.log('client_id2:', client_id_param2);
|
||||
// console.log('client_policy_id2:', client_policy_param2);
|
||||
// console.log('actions:', actions);
|
||||
// console.log('insurer_or_tpa:', insurer_or_tpa);
|
||||
// console.log('event:', event);
|
||||
|
||||
|
||||
|
||||
if (inception_param != null) {
|
||||
|
||||
$('#action_type').val(actions).change()
|
||||
$('#event_type').val(event).change()
|
||||
$('#insurer_or_tpa').val(insurer_or_tpa).change()
|
||||
|
||||
var selectedValue = actions;
|
||||
// console.log(selectedValue);
|
||||
|
||||
if (selectedValue == '') {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'import') {
|
||||
$('#import_file').prop('required', true);
|
||||
$('#import_file').attr('name', 'import_file_data');
|
||||
$('#import_excel_btn').show();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'export') {
|
||||
$('#import_file').removeAttr('name');
|
||||
$('#import_file').prop('required', false);
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').show();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
function fetchClientPolicies2() {
|
||||
|
||||
$('#loader').show();
|
||||
|
||||
var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
// console.log(clientPolicies);
|
||||
|
||||
|
||||
response.data.forEach(policy => {
|
||||
// console.log('policies', policy.policies);
|
||||
policy.policies.forEach(p => {
|
||||
clientPoliciesWithBranch2.policies.push(p);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
appendClients2(clientPolicies);
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_branch_id_param2 != null) {
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
// console.log(typeof item.id)
|
||||
return item.id == client_id_param2;
|
||||
});
|
||||
appendBranch2(foundPolicies.branchs);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_id_param2 != null) {
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === client_branch_id_param2;
|
||||
});
|
||||
|
||||
|
||||
if (foundPolicies) {
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies2(foundPolicies);
|
||||
} else {
|
||||
console.log('No policies found for the selected client');
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
|
||||
} 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) {
|
||||
// Request failed, handle error
|
||||
console.error("Request failed:", status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$("#import_export_excel_form")[0].reset()
|
||||
toastr.error('Something went wrong! Try later', 'Error');
|
||||
// window.location.reload(true);
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
}); //end
|
||||
|
||||
});
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function appendClients2(data) {
|
||||
|
||||
$(window).on("load", function() {
|
||||
fetchClientPolicies2();
|
||||
});
|
||||
// console.log('client_id_param2', client_id_param2)
|
||||
|
||||
|
||||
function fetchClientPolicies2() {
|
||||
|
||||
$('#loader').show();
|
||||
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
console.log(clientPolicies);
|
||||
appendClients2(clientPolicies);
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
});
|
||||
if (client_id_param2 == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
$('#client').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function appendBranch2(data) {
|
||||
|
||||
// console.log(data)
|
||||
|
||||
$('#client_branch_id').empty();
|
||||
$('#client_branch_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name
|
||||
});
|
||||
if (client_branch_id_param2 == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#client_branch_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function appendPolicies2(data) {
|
||||
|
||||
$('#policy').empty();
|
||||
$('#policy').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
text: item.name + ' - ' + item.policy_type
|
||||
});
|
||||
if (client_policy_param2 == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#policy').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#client').on('change', function() {
|
||||
|
||||
$('#policy').empty();
|
||||
$('#policy').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
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.branchs);
|
||||
appendBranch2(foundPolicies.branchs);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#client_branch_id').on('change', function() {
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
|
||||
// console.log('selectedBranch', selectedClient);
|
||||
// console.log('clientPolicies', clientPoliciesWithBranch2);
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
|
||||
return item.branch_id === selectedClient;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||
|
||||
appendPolicies2(foundPolicies);
|
||||
toastr.warning('No policies found for the selected client branch.');
|
||||
|
||||
} else {
|
||||
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies2(foundPolicies);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString2(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function fetchEmpolyeeList2(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var client_id = $('#client').val();
|
||||
var policy_id = $('#policy').val();
|
||||
// console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
}
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString2(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
// console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
$('#action_type').change(function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
// console.log(selectedValue);
|
||||
|
||||
if (selectedValue == '') {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'import') {
|
||||
$('#import_file').prop('required', true);
|
||||
$('#import_file').attr('name', 'import_file_data');
|
||||
$('#import_excel_btn').show();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'export') {
|
||||
$('#import_file').removeAttr('name');
|
||||
$('#import_file').prop('required', false);
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
|
||||
|
||||
function appendClients2(data) {
|
||||
$.each(data, function(index, item) {
|
||||
$('#client').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.client_name
|
||||
}));
|
||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
}
|
||||
|
||||
function appendPolicies2(data) {
|
||||
$('#policy').empty();
|
||||
$('#policy').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
$('#policy').append($('<option>', {
|
||||
value: item.id,
|
||||
text: item.name
|
||||
}));
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#event_type').change(function() {
|
||||
var selectedVal = $(this).val();
|
||||
// console.log(selectedVal);
|
||||
|
||||
if (selectedVal === 'correction') {
|
||||
$('#policy').prop('required', false);
|
||||
$('#policy_danger').hide();
|
||||
} else {
|
||||
$('#policy').prop('required', true);
|
||||
$('#policy_danger').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#client').on('change', function() {
|
||||
var selectedClient = $(this).val();
|
||||
console.log(selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
console.log(foundPolicies.policies);
|
||||
appendPolicies2(foundPolicies.policies);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString2(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
|
||||
function fetchEmpolyeeList2(event) {
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var client_id = $('#client').val();
|
||||
var policy_id = $('#policy').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
}
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString2(queryParams);
|
||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||
console.log(apiURL);
|
||||
window.location.href = apiURL;
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
$('#action_type').change(function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
console.log(selectedValue);
|
||||
|
||||
if (selectedValue == '') {
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'import') {
|
||||
$('#import_file').prop('required', true);
|
||||
$('#import_file').attr('name', 'import_file_data');
|
||||
$('#import_excel_btn').show();
|
||||
$('#export_excel_btn').hide();
|
||||
} else if (selectedValue == 'export') {
|
||||
$('#import_file').removeAttr('name');
|
||||
$('#import_file').prop('required', false);
|
||||
$('#import_excel_btn').hide();
|
||||
$('#export_excel_btn').show();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||
var icon = document.getElementById('icon');
|
||||
icon.classList.toggle('mdi-chevron-down');
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -4,9 +4,9 @@
|
||||
<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;">KYC List</h4>
|
||||
<h4 style="position: relative;">KYC List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<a href="<?= base_url("master/kyc/create"); ?>" 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>
|
||||
|
||||
@ -36,7 +36,7 @@ body {
|
||||
<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;">KYC Entity Type</h4>
|
||||
<h4 style="position: relative;">KYC Entity Type</h4>
|
||||
</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>
|
||||
|
||||
@ -35,23 +35,31 @@
|
||||
|
||||
<!-- Right Sidebar -->
|
||||
<div class="right-bar">
|
||||
<div data-simplebar class="h-100">
|
||||
|
||||
<!-- Tab panes -->
|
||||
<h6 class="font-weight-medium px-3 m-0 py-2 font-13 text-uppercase bg-light">
|
||||
<i class="mdi mdi-message-text-outline font-22"></i><span class="" style="position: relative;bottom: 5px;left: 60px;">Notification</span>
|
||||
<div class="h-100">
|
||||
<!-- Notifications Header -->
|
||||
<h6 class="font-weight-medium px-3 m-0 py-2 font-13 text-uppercase bg-light fixed-header">
|
||||
<i class="mdi mdi-message-text-outline font-22"></i>
|
||||
<span class="header-title">Notification</span>
|
||||
</h6>
|
||||
|
||||
<div id="header-bar">
|
||||
<div>
|
||||
<ul class="list-unstyled" id="messages-list"></ul>
|
||||
</div>
|
||||
<div class="scrollable-content">
|
||||
<ul class="list-unstyled" id="messages-list">
|
||||
<!-- Notifications list items go here -->
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div> <!-- end slimscroll-menu-->
|
||||
<!-- Pending Action Header -->
|
||||
<h6 class="font-weight-medium px-3 m-0 py-2 font-13 bg-light fixed-header">
|
||||
<i class="mdi mdi-format-list-checks font-22"></i>
|
||||
<span class="header-title">TO DOs</span>
|
||||
</h6>
|
||||
<div class="scrollable-content">
|
||||
<ul class="list-unstyled" id="messages-list-2">
|
||||
<!-- Pending action list items go here -->
|
||||
</ul>
|
||||
</div>
|
||||
</div> <!-- end simplebar -->
|
||||
</div>
|
||||
|
||||
<!-- /Right-bar -->
|
||||
|
||||
<!-- Right bar overlay-->
|
||||
@ -131,64 +139,69 @@
|
||||
|
||||
<script>
|
||||
toastr.options = {
|
||||
"timeOut": 5000,
|
||||
"timeOut": 2000,
|
||||
"closeButton": true,
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var pullNotificationCount = 0;
|
||||
var pendingActionCount = 0;
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
function fetchMessages() {
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('get-notification') ?>',
|
||||
url: '<?= base_url('dashboard/get-notification') ?>',
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
// $(document).ready(function() {
|
||||
// $("#playMusic").get(0).play();
|
||||
// });
|
||||
|
||||
|
||||
console.log('responce', response)
|
||||
|
||||
let unreadCount = 0;
|
||||
if(response.status == false){
|
||||
$('#notification_count').html('0')
|
||||
console.log('The session is not set correctly. ')
|
||||
return;
|
||||
}
|
||||
|
||||
let messagesList = $('#messages-list');
|
||||
messagesList.empty();
|
||||
|
||||
var html = "";
|
||||
|
||||
response.forEach(message => {
|
||||
pullNotificationCount = response.message.length
|
||||
|
||||
if (!message.is_read) {
|
||||
unreadCount++;
|
||||
}
|
||||
localStorage.setItem('pullNotificationCount', pullNotificationCount)
|
||||
|
||||
response.message.forEach(message => {
|
||||
|
||||
// if (!message.is_read) {
|
||||
// unreadCount++;
|
||||
// }
|
||||
|
||||
var jasonDecodeData = JSON.parse(message.message_text)
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
var toast_status_word = 'Success';
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
var toast_status_word = 'Success';
|
||||
|
||||
if(jasonDecodeData.msg_status == 'failure'){
|
||||
if (jasonDecodeData.msg_status == 'failure') {
|
||||
|
||||
toast_body_css = 'background : #fdcfcf !important;';
|
||||
toast_head_css = 'background-color : rgb(235 105 105 / 85%) !important; color :#000; border-bottom: 0;';
|
||||
toast_icon = 'mdi mdi-information mr-auto'
|
||||
toast_status_word = 'Failure';
|
||||
|
||||
}else if(jasonDecodeData.msg_status == 'success'){
|
||||
} else if (jasonDecodeData.msg_status == 'success') {
|
||||
|
||||
toast_body_css = 'background : #bfd7eb !important;';
|
||||
toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto'
|
||||
toast_status_word = 'Success';
|
||||
toast_body_css = 'background : #bfd7eb !important;';
|
||||
toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto'
|
||||
toast_status_word = 'Success';
|
||||
}
|
||||
|
||||
var html = ` <li data-id="${message.id}" data-url="${jasonDecodeData.action_url != undefined && jasonDecodeData.action_url != "" ? jasonDecodeData.action_url : 'dashboard/view'}">
|
||||
@ -218,29 +231,40 @@
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
});
|
||||
|
||||
$('#notification_count').html(unreadCount);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText); // Log the error response
|
||||
}
|
||||
});
|
||||
|
||||
let PNCount = parseInt(localStorage.getItem('pullNotificationCount'));
|
||||
let PACount = parseInt(localStorage.getItem('pendingActionCount'));
|
||||
|
||||
totalcount = PNCount + PACount
|
||||
$('#notification_count').html(totalcount);
|
||||
|
||||
}
|
||||
|
||||
function acknowledgeMessage(messageId) {
|
||||
$.ajax({
|
||||
url: '<?= base_url('acknowledge-notification/') ?>' + messageId,
|
||||
url: '<?= base_url('dashboard/acknowledge-notification/') ?>' + messageId,
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
fetchMessages();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText); // Log the error response
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#messages-list').on('click', 'li', function(event) {
|
||||
|
||||
console.log('messages-list click li')
|
||||
//console.log('messages-list click li')
|
||||
|
||||
if ($(event.target).closest('.rm_msg').length > 0) {
|
||||
|
||||
console.log('.rm_msg')
|
||||
//console.log('.rm_msg')
|
||||
|
||||
let messageId = $(this).data('id');
|
||||
let url = $(this).data('url');
|
||||
@ -250,13 +274,13 @@
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
} else if ($(event.target).closest('.redirect_page').length > 0){
|
||||
} else if ($(event.target).closest('.redirect_page').length > 0) {
|
||||
|
||||
//console.log('redirect_page')
|
||||
|
||||
console.log('redirect_page')
|
||||
|
||||
let messageId = $(this).data('id');
|
||||
let url = $(this).data('url');
|
||||
console.log('url : ', url)
|
||||
//console.log('url : ', url)
|
||||
acknowledgeMessage(messageId);
|
||||
|
||||
window.location.href = '<?= base_url() ?>' + url;
|
||||
@ -267,9 +291,495 @@
|
||||
|
||||
fetchMessages();
|
||||
|
||||
setInterval(fetchMessages, 10000); // Fetch messages every minute
|
||||
setInterval(fetchMessages, 10000); // Fetch messages every ten seconds
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
function fetchPendingAction() {
|
||||
|
||||
$.ajax({
|
||||
|
||||
url: '<?= base_url('dashboard/get-pending-action') ?>',
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
//console.log(response);
|
||||
|
||||
if (response.length == 0) {
|
||||
|
||||
pendingActionCount = 0;
|
||||
localStorage.setItem('pendingActionCount', pendingActionCount);
|
||||
}
|
||||
|
||||
for (let key in response) {
|
||||
pendingActionCount += response[key].length;
|
||||
}
|
||||
|
||||
let messagesList = $('#messages-list-2');
|
||||
messagesList.empty();
|
||||
|
||||
|
||||
response.inception.forEach(function(item, index) {
|
||||
|
||||
var queryParams = {
|
||||
client_id: item.client_id,
|
||||
client_policy_id: item.client_policy_id,
|
||||
client_branch_id: item.branch_id,
|
||||
actions: 'inception'
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
var toast_status_word = 'Info';
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
}
|
||||
|
||||
////console.log(item.branch_name);
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||
<div class="toast-header " style="${toast_head_css}" >
|
||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body" style="${toast_body_css}">
|
||||
<strong>Inception Pending</strong><br><br>
|
||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||
<div class="toast-footer">
|
||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>`
|
||||
|
||||
|
||||
messagesList.append(html);
|
||||
|
||||
});
|
||||
|
||||
response.correction.forEach(function(item, index) {
|
||||
|
||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||
|
||||
|
||||
var queryParams = {
|
||||
client_id: item.client_id,
|
||||
client_branch_id: item.branch_id,
|
||||
event: 'correction',
|
||||
actions: 'export',
|
||||
insurer_or_tpa: 'tpa',
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
var toast_status_word = 'Info';
|
||||
|
||||
var title = 'Correction Pending';
|
||||
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
// title = 'Correction Import Pending';
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + ' - ' + item.branch_name;
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||
<div class="toast-header " style="${toast_head_css}" >
|
||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body" style="${toast_body_css}">
|
||||
<strong>${title}</strong><br><br>
|
||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||
<div class="toast-footer">
|
||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>`
|
||||
|
||||
|
||||
messagesList.append(html);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
response.deletion.forEach(function(item, index) {
|
||||
|
||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||
|
||||
|
||||
var queryParams = {
|
||||
|
||||
client_id: item.client_id,
|
||||
client_policy_id: item.client_policy_id,
|
||||
client_branch_id: item.branch_id,
|
||||
event: 'deletion',
|
||||
actions: 'export',
|
||||
insurer_or_tpa: 'tpa',
|
||||
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
var toast_status_word = 'Info';
|
||||
var title = 'Deletion Pending';
|
||||
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
// title = 'Deletion Import Pending';
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||
<div class="toast-header " style="${toast_head_css}" >
|
||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body" style="${toast_body_css}">
|
||||
<strong>${title}</strong><br><br>
|
||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||
<div class="toast-footer">
|
||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>`
|
||||
|
||||
|
||||
messagesList.append(html);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
response.si_enhancement.forEach(function(item, index) {
|
||||
|
||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||
|
||||
|
||||
var queryParams = {
|
||||
client_id: item.client_id,
|
||||
client_policy_id: item.client_policy_id,
|
||||
client_branch_id: item.branch_id,
|
||||
event: 'si_enhancement',
|
||||
actions: 'export',
|
||||
insurer_or_tpa: 'tpa',
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
var toast_status_word = 'Info';
|
||||
var title = 'SI Enhancement Pending';
|
||||
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
// title = 'SI Enhancement Import Pending';
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||
<div class="toast-header " style="${toast_head_css}" >
|
||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body" style="${toast_body_css}">
|
||||
<strong>${title}</strong><br><br>
|
||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||
<div class="toast-footer">
|
||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>`
|
||||
|
||||
|
||||
messagesList.append(html);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
response.tpa.forEach(function(item, index) {
|
||||
|
||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||
|
||||
|
||||
var queryParams = {
|
||||
client_id: item.client_id,
|
||||
client_policy_id: item.client_policy_id,
|
||||
client_branch_id: item.branch_id,
|
||||
event: 'inception',
|
||||
insurer_or_tpa: 'tpa',
|
||||
actions: 'export',
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
var toast_status_word = 'Info';
|
||||
var title = 'TPA Pending';
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
// title = 'TPA Import Pending';
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||
<div class="toast-header " style="${toast_head_css}" >
|
||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body" style="${toast_body_css}">
|
||||
<strong>${title}</strong><br><br>
|
||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||
<div class="toast-footer">
|
||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>`
|
||||
|
||||
|
||||
messagesList.append(html);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
response.uhid.forEach(function(item, index) {
|
||||
|
||||
if (item.batch_export_count == 0 || item.batch_import_count == 0) {
|
||||
|
||||
var queryParams = {
|
||||
|
||||
client_id: item.client_id,
|
||||
client_policy_id: item.client_policy_id,
|
||||
client_branch_id: item.branch_id,
|
||||
event: 'inception',
|
||||
insurer_or_tpa: 'insurer',
|
||||
actions: 'export',
|
||||
};
|
||||
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
////console.log(url)
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
var toast_status_word = 'Info';
|
||||
var title = 'Insurer Pending';
|
||||
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
// title = 'Insurer Import Pending';
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
|
||||
<div class="toast-header " style="${toast_head_css}" >
|
||||
<strong class="${toast_icon}"> ${toast_status_word}</strong>
|
||||
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="toast-body" style="${toast_body_css}">
|
||||
<strong>${title}</strong><br><br>
|
||||
<small style="position: relative;bottom: 8px;">${toast_body_data}</small>
|
||||
<div class="toast-footer">
|
||||
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 142px;position: relative;top: 2px;">see more</small></a>
|
||||
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;"></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>`
|
||||
|
||||
|
||||
messagesList.append(html);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
localStorage.setItem('pendingActionCount', pendingActionCount)
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText); // Log the error response
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
fetchPendingAction()
|
||||
|
||||
$('#messages-list-2').on('click', 'li', function(event) {
|
||||
|
||||
//console.log('messages-list-2 click li')
|
||||
|
||||
if ($(event.target).closest('.rm_msg').length > 0) {
|
||||
|
||||
//console.log('.rm_msg')
|
||||
|
||||
$(this).delay(300).fadeOut('slow', function() {
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
} else if ($(event.target).closest('.redirect_page').length > 0) {
|
||||
|
||||
//console.log('redirect_page')
|
||||
|
||||
let url = $(this).data('url');
|
||||
//console.log('url : ', url);
|
||||
|
||||
window.location.href = '<?= base_url() ?>' + url;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -1,235 +1,245 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
<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/Nhance_Favi.svg">
|
||||
<head>
|
||||
|
||||
<!-- plugin css -->
|
||||
<link href="<?= base_url()."public"; ?>/assets/libs/admin-resources/jquery.vectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- third party css -->
|
||||
<link href="<?= base_url()."public"; ?>/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?= base_url()."public"; ?>/assets/libs/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?= base_url()."public"; ?>/assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?= base_url()."public"; ?>/assets/libs/datatables.net-select-bs4/css//select.bootstrap4.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- third party css end -->
|
||||
|
||||
<!-- App css -->
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/bootstrap-creative.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/app-creative.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/bootstrap-creative-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/app-creative-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
<!-- <link href="<?= base_url()."public"; ?>/assets/css/bootstrap-material.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" /> -->
|
||||
<!-- <link href="<?= base_url()."public"; ?>/assets/css/app-material.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" /> -->
|
||||
<meta charset="utf-8" />
|
||||
<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" />
|
||||
|
||||
|
||||
<!-- <link href="<?= base_url()."public"; ?>/assets/css/bootstrap-editable.css" rel="stylesheet" type="text/css" /> -->
|
||||
|
||||
<!-- Jodit Css -->
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
|
||||
<!-- App favicon -->
|
||||
<link rel="shortcut icon" href="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg">
|
||||
|
||||
|
||||
<!-- JQuery CDN -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<!-- plugin css -->
|
||||
<link href="<?= base_url() . "public"; ?>/assets/libs/admin-resources/jquery.vectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<!-- Sweet Alert CDN -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script>
|
||||
<!-- third party css -->
|
||||
<link href="<?= base_url() . "public"; ?>/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?= base_url() . "public"; ?>/assets/libs/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?= base_url() . "public"; ?>/assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?= base_url() . "public"; ?>/assets/libs/datatables.net-select-bs4/css//select.bootstrap4.min.css" rel="stylesheet" type="text/css" />
|
||||
<!-- third party css end -->
|
||||
|
||||
<!-- select2 -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
|
||||
<!-- App css -->
|
||||
<link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-creative.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
|
||||
<link href="<?= base_url() . "public"; ?>/assets/css/app-creative.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
|
||||
|
||||
<link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-creative-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
|
||||
<link href="<?= base_url() . "public"; ?>/assets/css/app-creative-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
|
||||
|
||||
<!-- icons -->
|
||||
<link href="<?= base_url() . "public"; ?>/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
<link rel="manifest" href="../manifest.json">
|
||||
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-material.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" /> -->
|
||||
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/app-material.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" /> -->
|
||||
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('../service-worker.js').then(function(registration) {
|
||||
// console.log('Service Worker registration successful with scope:', registration.scope);
|
||||
}, function(err) {
|
||||
// console.log('Service Worker registration failed:', err);
|
||||
});
|
||||
|
||||
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-editable.css" rel="stylesheet" type="text/css" /> -->
|
||||
|
||||
<!-- Jodit Css -->
|
||||
<link href="<?= base_url() . "public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
<!-- JQuery CDN -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
|
||||
<!-- Sweet Alert CDN -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script>
|
||||
|
||||
<!-- select2 -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
|
||||
|
||||
|
||||
<link rel="manifest" href="../manifest.json">
|
||||
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('../service-worker.js').then(function(registration) {
|
||||
// console.log('Service Worker registration successful with scope:', registration.scope);
|
||||
}, function(err) {
|
||||
// console.log('Service Worker registration failed:', err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages){
|
||||
min-height: 0;
|
||||
}
|
||||
.navbar-custom{
|
||||
top: -10px !important;
|
||||
height: 61px !important;
|
||||
}
|
||||
.logo-box{
|
||||
top: -10px !important;
|
||||
height: 61px !important;
|
||||
}
|
||||
.content-page {
|
||||
padding: 80px 15px 65px 15px !important;
|
||||
}
|
||||
/* Media query for small screens */
|
||||
@media screen and (min-width: 768px) {
|
||||
/* Styles for screens with a minimum width of 768px (e.g., tablets and larger devices) */
|
||||
.navbar-custom .button-menu-mobile {
|
||||
display: none; /* Hide the button on larger screens */
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.loader-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #00000069;
|
||||
z-index: 99999;
|
||||
.navbar-custom {
|
||||
top: -10px !important;
|
||||
height: 61px !important;
|
||||
}
|
||||
|
||||
.logo-box {
|
||||
top: -10px !important;
|
||||
height: 61px !important;
|
||||
}
|
||||
|
||||
.content-page {
|
||||
padding: 80px 15px 65px 15px !important;
|
||||
}
|
||||
|
||||
/* Media query for small screens */
|
||||
@media screen and (min-width: 768px) {
|
||||
|
||||
/* Styles for screens with a minimum width of 768px (e.g., tablets and larger devices) */
|
||||
.navbar-custom .button-menu-mobile {
|
||||
display: none;
|
||||
/* Hide the button on larger screens */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.loader-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #00000069;
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
.loader {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
font-size: 0;
|
||||
color: #00c9d0;
|
||||
display: inline-block;
|
||||
margin: -25px 0 0 -25px;
|
||||
text-indent: -9999em;
|
||||
-webkit-transform: translateZ(0);
|
||||
-ms-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
.lead {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.loader div {
|
||||
background-color: #6ad9cf;
|
||||
display: inline-block;
|
||||
float: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
opacity: .5;
|
||||
border-radius: 50%;
|
||||
-webkit-animation: ballPulseDouble 2s ease-in-out infinite;
|
||||
animation: ballPulseDouble 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.loader div:last-child {
|
||||
-webkit-animation-delay: -1s;
|
||||
animation-delay: -1s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes ballPulseDouble {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
.loader {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
font-size: 0;
|
||||
color: #00c9d0;
|
||||
display: inline-block;
|
||||
margin: -25px 0 0 -25px;
|
||||
text-indent: -9999em;
|
||||
-webkit-transform: translateZ(0);
|
||||
-ms-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
50% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
.lead{
|
||||
font-size:13px;
|
||||
}
|
||||
.loader div {
|
||||
background-color: #6ad9cf;
|
||||
display: inline-block;
|
||||
float: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
opacity: .5;
|
||||
border-radius: 50%;
|
||||
-webkit-animation: ballPulseDouble 2s ease-in-out infinite;
|
||||
animation: ballPulseDouble 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes ballPulseDouble {
|
||||
|
||||
0%,
|
||||
100% {
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
.loader div:last-child {
|
||||
-webkit-animation-delay: -1s;
|
||||
animation-delay: -1s;
|
||||
50% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes ballPulseDouble {
|
||||
0%,
|
||||
100% {
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
.toast-success {
|
||||
background-color: #009688 !important;
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
@keyframes ballPulseDouble {
|
||||
0%,
|
||||
100% {
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
}
|
||||
50% {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.toast-success {
|
||||
background-color: #009688 !important;
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
/* .dataTables_wrapper .text-right {
|
||||
/* .dataTables_wrapper .text-right {
|
||||
position: relative;
|
||||
} */
|
||||
|
||||
.dataTables_wrapper .dt-buttons .buttons-csv,
|
||||
.dataTables_wrapper .dt-buttons .buttons-html5 {
|
||||
background-color: #02a8b5;
|
||||
color: #fff;
|
||||
border-color: #02a8b5;
|
||||
}
|
||||
.dataTables_wrapper .dt-buttons .buttons-csv,
|
||||
.dataTables_wrapper .dt-buttons .buttons-html5 {
|
||||
background-color: #02a8b5;
|
||||
color: #fff;
|
||||
border-color: #02a8b5;
|
||||
}
|
||||
|
||||
.dataTables_wrapper .dt-buttons .buttons-csv:hover,
|
||||
.dataTables_wrapper .dt-buttons .buttons-html5:hover {
|
||||
background-color: #028291;
|
||||
border-color: #028291;
|
||||
}
|
||||
.dataTables_wrapper .dt-buttons .buttons-csv:hover,
|
||||
.dataTables_wrapper .dt-buttons .buttons-html5:hover {
|
||||
background-color: #028291;
|
||||
border-color: #028291;
|
||||
}
|
||||
|
||||
|
||||
.modal-full-width {
|
||||
width: 80% !important;
|
||||
/* width: 95% !important; */
|
||||
/* max-width: none; */
|
||||
}
|
||||
.modal-full-width {
|
||||
width: 80% !important;
|
||||
/* width: 95% !important; */
|
||||
/* max-width: none; */
|
||||
}
|
||||
|
||||
.modal-body {
|
||||
/* position: relative;
|
||||
.modal-body {
|
||||
/* position: relative;
|
||||
flex: 1 1 auto; */
|
||||
padding: 2rem !important;
|
||||
}
|
||||
padding: 2rem !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.text-danger-2 {
|
||||
font-style: italic;
|
||||
color: black !important;
|
||||
/* color: #02a8b5 !important; */
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.text-danger-2 {
|
||||
font-style: italic;
|
||||
color: black !important;
|
||||
/* color: #02a8b5 !important; */
|
||||
font-size: 12px;
|
||||
}
|
||||
/* .form-group {
|
||||
/* .form-group {
|
||||
margin-bottom: -0.2rem !important;
|
||||
}
|
||||
.form-row{
|
||||
width: 84%;
|
||||
} */
|
||||
</style>
|
||||
|
||||
</style>
|
||||
<style>
|
||||
.select2-container--default .select2-selection--single {
|
||||
height: 37px !important;
|
||||
}
|
||||
|
||||
<style>
|
||||
.select2-container--default .select2-selection--single {
|
||||
height: 37px !important;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height: 35px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height: 35px !important;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
top: 7px !important;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
top: 7px !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
@ -240,7 +250,8 @@
|
||||
|
||||
#messages-list li {
|
||||
margin-top: 0;
|
||||
margin-bottom: -25px; /* Adjust this value to reduce the space */
|
||||
margin-bottom: -25px;
|
||||
/* Adjust this value to reduce the space */
|
||||
}
|
||||
|
||||
.toast-footer {
|
||||
@ -252,51 +263,76 @@
|
||||
}
|
||||
|
||||
|
||||
.right-bar {
|
||||
width: 300px;
|
||||
/* Adjust as needed */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fixed-header {
|
||||
position: relative;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
background-color: #f8f9fa !important;
|
||||
}
|
||||
|
||||
.scrollable-content {
|
||||
max-height: 42vh;
|
||||
overflow-y: auto;
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
/* Additional styles to enhance appearance */
|
||||
.header-title {
|
||||
position: relative;
|
||||
bottom: 5px;
|
||||
left: 60px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
$(window).on('load', function() {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').fadeOut('slow');
|
||||
}, 2000);
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
$(window).on('load', function() {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').fadeOut('slow');
|
||||
}, 1000);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="loading" data-layout-mode="" data-layout='{"mode": "light", "width": "fluid", "menuPosition": "fixed", "sidebar": { "color": "light", "size": "condensed", "showuser": false}, "topbar": {"color": "dark"}, "showRightSidebarOnPageLoad": false}' ></body>
|
||||
</head>
|
||||
|
||||
<!-- Preloader -->
|
||||
<div class="loader-mask">
|
||||
<div class="loader">
|
||||
<img src="<?= base_url()."public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading...">
|
||||
</div>
|
||||
</div>
|
||||
<body class="loading" data-layout-mode="" data-layout='{"mode": "light", "width": "fluid", "menuPosition": "fixed", "sidebar": { "color": "light", "size": "condensed", "showuser": false}, "topbar": {"color": "dark"}, "showRightSidebarOnPageLoad": false}'></body>
|
||||
|
||||
<!-- <img src="<?= base_url()."public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading..."> -->
|
||||
<!-- Begin page -->
|
||||
<div id="wrapper">
|
||||
<!-- Preloader -->
|
||||
<div class="loader-mask">
|
||||
<div class="loader">
|
||||
<img src="<?= base_url() . "public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Topbar Start -->
|
||||
<div class="navbar-custom">
|
||||
<div class="container-fluid">
|
||||
<ul class="list-unstyled topnav-menu float-right mb-0">
|
||||
<!-- <img src="<?= base_url() . "public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading..."> -->
|
||||
<!-- Begin page -->
|
||||
<div id="wrapper">
|
||||
|
||||
<li class="d-none d-lg-block">
|
||||
<form class="app-search">
|
||||
<div class="app-search-box dropdown">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" placeholder="Search..." id="top-search">
|
||||
<div class="input-group-append">
|
||||
<button class="btn" type="submit">
|
||||
<i class="fe-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="dropdown-menu dropdown-lg" id="search-dropdown">
|
||||
<!-- Topbar Start -->
|
||||
<div class="navbar-custom">
|
||||
<div class="container-fluid">
|
||||
<ul class="list-unstyled topnav-menu float-right mb-0">
|
||||
|
||||
<li class="d-none d-lg-block">
|
||||
<form class="app-search">
|
||||
<div class="app-search-box dropdown">
|
||||
<div class="input-group">
|
||||
<input type="search" class="form-control" placeholder="Search..." id="top-search">
|
||||
<div class="input-group-append">
|
||||
<button class="btn" type="submit">
|
||||
<i class="fe-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="dropdown-menu dropdown-lg" id="search-dropdown">
|
||||
<div class="dropdown-header noti-title">
|
||||
<h5 class="text-overflow mb-2">Found <span class="text-danger">09</span> results</h5>
|
||||
</div>
|
||||
@ -323,7 +359,7 @@
|
||||
<div class="notification-list">
|
||||
<a href="javascript:void(0);" class="dropdown-item notify-item">
|
||||
<div class="media">
|
||||
<img class="d-flex mr-2 rounded-circle" src="<?= base_url()."public"; ?>/assets/images/users/avatar-2.jpg" alt="Generic placeholder image" height="32">
|
||||
<img class="d-flex mr-2 rounded-circle" src="<?= base_url() . "public"; ?>/assets/images/users/avatar-2.jpg" alt="Generic placeholder image" height="32">
|
||||
<div class="media-body">
|
||||
<h5 class="m-0 font-14">Erwin E. Brown</h5>
|
||||
<span class="font-12 mb-0">UI Designer</span>
|
||||
@ -333,7 +369,7 @@
|
||||
|
||||
<a href="javascript:void(0);" class="dropdown-item notify-item">
|
||||
<div class="media">
|
||||
<img class="d-flex mr-2 rounded-circle" src="<?= base_url()."public"; ?>/assets/images/users/avatar-5.jpg" alt="Generic placeholder image" height="32">
|
||||
<img class="d-flex mr-2 rounded-circle" src="<?= base_url() . "public"; ?>/assets/images/users/avatar-5.jpg" alt="Generic placeholder image" height="32">
|
||||
<div class="media-body">
|
||||
<h5 class="m-0 font-14">Jacob Deo</h5>
|
||||
<span class="font-12 mb-0">Developer</span>
|
||||
@ -343,29 +379,26 @@
|
||||
</div>
|
||||
|
||||
</div> -->
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
<li class="dropdown notification-list topbar-dropdown">
|
||||
<a class="nav-link dropdown-toggle right-bar-toggle waves-effect waves-light">
|
||||
<i class="fe-bell noti-icon"></i>
|
||||
<span class="badge badge-danger rounded-circle noti-icon-badge" id="notification_count">0</span>
|
||||
</a>
|
||||
<!-- <audio id="playMusic" playcount="2">
|
||||
<source src="https://media.geeksforgeeks.org/wp-content/uploads/20190531135120/beep.mp3" type="audio/mpeg">
|
||||
</audio> -->
|
||||
</li>
|
||||
|
||||
<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="<?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>
|
||||
<!--<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
|
||||
</div>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
<li class="dropdown notification-list topbar-dropdown">
|
||||
<a class="nav-link dropdown-toggle right-bar-toggle waves-effect waves-light">
|
||||
<i class="fe-bell noti-icon"></i>
|
||||
<span class="badge badge-danger rounded-circle noti-icon-badge" id="notification_count">0</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<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="<?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>
|
||||
<!--<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
|
||||
<div class="dropdown-header noti-title">
|
||||
<h6 class="text-overflow m-0">Welcome !</h6>
|
||||
</div>
|
||||
@ -397,197 +430,196 @@
|
||||
</a>
|
||||
|
||||
</div>-->
|
||||
</li>
|
||||
</li>
|
||||
|
||||
<!-- <li class="dropdown notification-list">
|
||||
<!-- <li class="dropdown notification-list">
|
||||
<a href="javascript:void(0);" class="nav-link right-bar-toggle waves-effect waves-light">
|
||||
<i class="fe-settings noti-icon"></i>
|
||||
</a>
|
||||
</li> -->
|
||||
|
||||
<li class="dropdown notification-list">
|
||||
<a href="<?= base_url('/logout'); ?>" class="nav-link waves-effect waves-light">
|
||||
<i class="ri-logout-box-r-line" style="font-size: 25px;"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<!-- LOGO -->
|
||||
<div class="logo-box">
|
||||
<a href="https://localhost/nhance/dashboard/view" class="logo logo-dark text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="24">
|
||||
<!-- <span class="logo-lg-text-light">NHANCE</span> -->
|
||||
</span>
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="20">
|
||||
<!-- <span class="logo-lg-text-light">M</span> -->
|
||||
</span>
|
||||
</a>
|
||||
<li class="dropdown notification-list">
|
||||
<a href="<?= base_url('/logout'); ?>" class="nav-link waves-effect waves-light">
|
||||
<i class="ri-logout-box-r-line" style="font-size: 25px;"></i>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<a href="https://localhost/nhance/dashboard/view" class="logo logo-light text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="24">
|
||||
</span>
|
||||
<!-- <span class="logo-lg">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/logo-light.png" alt="" height="20">
|
||||
</ul>
|
||||
|
||||
<!-- LOGO -->
|
||||
<div class="logo-box">
|
||||
<a href="https://localhost/nhance/dashboard/view" class="logo logo-dark text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="24">
|
||||
<!-- <span class="logo-lg-text-light">NHANCE</span> -->
|
||||
</span>
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="20">
|
||||
<!-- <span class="logo-lg-text-light">M</span> -->
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a href="https://localhost/nhance/dashboard/view" class="logo logo-light text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="24">
|
||||
</span>
|
||||
<!-- <span class="logo-lg">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/logo-light.png" alt="" height="20">
|
||||
</span> -->
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<ul class="list-unstyled topnav-menu topnav-menu-left m-0">
|
||||
<li>
|
||||
<button class="button-menu-mobile waves-effect waves-light">
|
||||
<i class="fe-menu"></i>
|
||||
</button>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<!-- Mobile menu toggle (Horizontal Layout)-->
|
||||
<a class="navbar-toggle nav-link" data-toggle="collapse" data-target="#topnav-menu-content">
|
||||
<div class="lines">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
</a>
|
||||
<!-- End mobile menu toggle-->
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<!-- end Topbar -->
|
||||
|
||||
<!-- ========== Left Sidebar Start ========== -->
|
||||
<div class="left-side-menu">
|
||||
<ul class="list-unstyled topnav-menu topnav-menu-left m-0">
|
||||
<li>
|
||||
<button class="button-menu-mobile waves-effect waves-light">
|
||||
<i class="fe-menu"></i>
|
||||
</button>
|
||||
</li>
|
||||
|
||||
|
||||
<!-- LOGO -->
|
||||
<div class="logo-box">
|
||||
<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> -->
|
||||
</span>
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/logo-dark.png" alt="" height="20">
|
||||
<!-- <span class="logo-lg-text-light">N</span> -->
|
||||
</span>
|
||||
<li>
|
||||
<!-- Mobile menu toggle (Horizontal Layout)-->
|
||||
<a class="navbar-toggle nav-link" data-toggle="collapse" data-target="#topnav-menu-content">
|
||||
<div class="lines">
|
||||
<span></span>
|
||||
<span></span>
|
||||
<span></span>
|
||||
</div>
|
||||
</a>
|
||||
<!-- End mobile menu toggle-->
|
||||
</li>
|
||||
|
||||
<a href="<?= base_url('/dashboard/view')?>" class="logo logo-light text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url()."public"; ?>/assets/images/Nhance_Favi_white_2.png" alt="" width="30" height="30">
|
||||
</span>
|
||||
<!-- <span class="logo-lg">
|
||||
<img src="<?= base_url()."public"; ?>./assets/images/logo-light.png" alt="" height="20">
|
||||
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end Topbar -->
|
||||
|
||||
<!-- ========== Left Sidebar Start ========== -->
|
||||
<div class="left-side-menu">
|
||||
|
||||
|
||||
<!-- LOGO -->
|
||||
<div class="logo-box">
|
||||
<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> -->
|
||||
</span>
|
||||
<span class="logo-lg">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/logo-dark.png" alt="" height="20">
|
||||
<!-- <span class="logo-lg-text-light">N</span> -->
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a href="<?= base_url('/dashboard/view') ?>" class="logo logo-light text-center">
|
||||
<span class="logo-sm">
|
||||
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi_white_2.png" alt="" width="30" height="30">
|
||||
</span>
|
||||
<!-- <span class="logo-lg">
|
||||
<img src="<?= base_url() . "public"; ?>./assets/images/logo-light.png" alt="" height="20">
|
||||
</span> -->
|
||||
</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="h-100" data-simplebar>
|
||||
<div class="h-100" data-simplebar>
|
||||
|
||||
<!--- Sidemenu -->
|
||||
<div id="sidebar-menu">
|
||||
<ul id="side-menu">
|
||||
<!--- Sidemenu -->
|
||||
<div id="sidebar-menu">
|
||||
<ul id="side-menu">
|
||||
<li>
|
||||
<a href="<?= base_url('/dashboard/view') ?>">
|
||||
<i class="ri-dashboard-line"></i>
|
||||
<span> Dashboard </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/client/list') ?>">
|
||||
<i class="mdi mdi-domain"></i>
|
||||
<span> Clients </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="fas fa-user-tie"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Employees </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/dashboard/view')?>">
|
||||
<i class="ri-dashboard-line"></i>
|
||||
<span> Dashboard </span>
|
||||
</a>
|
||||
<a href="<?= base_url('/employee/list') ?>">List</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/client/list')?>">
|
||||
<i class="mdi mdi-domain"></i>
|
||||
<span> Clients </span>
|
||||
</a>
|
||||
<a href="<?= base_url('/employee/upload') ?>">Upload</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="fas fa-user-tie"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Employees </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/list')?>">List</a>
|
||||
</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>
|
||||
<a href="<?= base_url('/employee/endorsement-list') ?>">Endorsement List</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/insurer/list')?>">Insurer</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/tpa/list')?>">TPA</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/kyc/list')?>">KYC</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/policy/list')?>">Policy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<?php
|
||||
$sessionData = get_session_userdata();
|
||||
$currentUrl = base_url();
|
||||
$parsedUrl = parse_url($currentUrl);
|
||||
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
||||
$redirectUrl = $baseUrl . 'Ticketing/staff/login?' . http_build_query(['token' => $sessionData]);
|
||||
?>
|
||||
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
||||
<i class="mdi mdi-lifebuoy"></i>
|
||||
<span> Tickets </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/user/list')?>">
|
||||
<i class=" ri-user-3-line"></i>
|
||||
<span> Users </span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li class="menu-title mt-2">Apps</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- End Sidebar -->
|
||||
|
||||
</div>
|
||||
<!-- Sidebar -left -->
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
|
||||
<i class="ri-database-2-line"></i>
|
||||
<span class="badge badge-success badge-pill float-right">2</span>
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/insurer/list') ?>">Insurer</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/tpa/list') ?>">TPA</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/kyc/list') ?>">KYC</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<?php
|
||||
$sessionData = get_session_userdata();
|
||||
$currentUrl = base_url();
|
||||
$parsedUrl = parse_url($currentUrl);
|
||||
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
||||
$hashedEmail = hash('sha256', $sessionData->email);
|
||||
$redirectUrl = getenv('helpdeskURL') .'/staff/login?' . http_build_query(['token' => $hashedEmail]);
|
||||
?>
|
||||
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
||||
<i class="mdi mdi-lifebuoy"></i>
|
||||
<span> Tickets </span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/user/list') ?>">
|
||||
<i class=" ri-user-3-line"></i>
|
||||
<span> Users </span>
|
||||
</a>
|
||||
</li>
|
||||
<!-- <li class="menu-title mt-2">Apps</li> -->
|
||||
</ul>
|
||||
</div>
|
||||
<!-- Left Sidebar End -->
|
||||
<!-- End Sidebar -->
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start Page Content here -->
|
||||
<!-- ============================================================== -->
|
||||
</div>
|
||||
<!-- Sidebar -left -->
|
||||
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
</div>
|
||||
<!-- Left Sidebar End -->
|
||||
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- Start Page Content here -->
|
||||
<!-- ============================================================== -->
|
||||
|
||||
<div class="content-page">
|
||||
<div class="content">
|
||||
|
||||
<!-- Start Content-->
|
||||
<div class="container-fluid">
|
||||
@ -30,6 +30,18 @@
|
||||
a:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
/* .auth-fluid {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
flex-direction: row;
|
||||
align-items: stretch;
|
||||
background: url("<?= base_url()."public"; ?>/assets/images/login_bg.png") center !important;
|
||||
background-size: cover;
|
||||
} */
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
@ -370,7 +370,8 @@
|
||||
<select id="member_ecard_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $value): ?>
|
||||
<?php if($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'ecard_download_link'){ ?>
|
||||
|
||||
<?php if($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'post_enrollment_app_link' || $value == 'client_name' || $value == 'ecard_download_link'){ ?>
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
@ -136,13 +136,13 @@
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Self:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;" name="family_floaters[]" value="self" id="self" checked> </td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 25%;;" type="number" name="self_min_age" id="self_min_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo (isset($self_min_age) && $self_min_age > 0) ? $self_min_age : '18'; ?>" style="width: 25%;;" type="number" name="self_min_age" id="self_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="self-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($self_max_age) ? $self_max_age : '60'; ?>" style="width: 25%;;" type="number" name="self_max_age" id="self_max_age" oninput="this.value = this.value.replace(/\D/g, '').substring(0, 2)"></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
<td style="width: 11%;"><span style="margin-right: 20px;">Spouse:</span></td>
|
||||
<td style="width: 11%;"><input type="checkbox" style="margin-right: 70px;"name="family_floaters[]" value="spouse" id="spouse"></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '60'; ?>" style="width: 25%;;" type="number" name="spouse_min_age" id="spouse_min_age"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($spouse_min_age) ? $spouse_min_age : '18'; ?>" style="width: 25%;;" type="number" name="spouse_min_age" id="spouse_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="spouse-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($spouse_max_age) ? $spouse_max_age : '60'; ?>" style="width: 25%;;" type="number" name="spouse_max_age" id="spouse_max_age" ></div></td>
|
||||
</tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr>
|
||||
<tr>
|
||||
@ -185,8 +185,8 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 22%;" ><div class="other-member-age"><span style="margin-right: 20px;">Elders Count:</span><input class="underline-input" id="member_count" style="width: 25%;;" type="number" name="member_count" disabled id="member_count"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 25%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" ></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 25%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" ></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Min Age:</span><input class="underline-input min_age" value="<?php echo isset($other_member_min_age) ? $other_member_min_age : '18'; ?>" style="width: 25%;;" type="number" class="underline-input min_age" name="other_member_min_age" id="other_member_min_age" oninput="lowerIsEighteen(this)"></div></td>
|
||||
<td style="width: 28%;" ><div class="other-member-age"><span style="margin-right: 20px;">Max Age:</span><input class="underline-input max_age" value="<?php echo isset($other_member_max_age) ? $other_member_max_age : '60'; ?>" style="width: 25%;;" type="number" class="underline-input max_age" name="other_member_max_age" id="other_member_max_age" ></div></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
@ -1317,4 +1317,14 @@
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function lowerIsEighteen(params) {
|
||||
|
||||
|
||||
if($(params).val() < 18){
|
||||
$(params).val(18);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
412
app/Views/policy_grid_excel.php
Normal file
@ -0,0 +1,412 @@
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td,
|
||||
th {
|
||||
padding: 0.2rem;
|
||||
}
|
||||
|
||||
.error {
|
||||
background-color: #f8d7da;
|
||||
}
|
||||
|
||||
.duplicate {
|
||||
background-color: #fff3cd;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.compact-table td,
|
||||
.compact-table th {
|
||||
padding: 0.1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
const formatType = 0; // Specify the format type here
|
||||
const excel_headers = {
|
||||
3: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
4: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
5: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
6: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
7: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
8: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium"
|
||||
},
|
||||
9: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
10: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
11: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium",
|
||||
"max_si": "Max Si"
|
||||
},
|
||||
12: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"premium": "Premium"
|
||||
},
|
||||
13: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function slugify(text) {
|
||||
return text.toString().toLowerCase().replace(/\s+/g, '_').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '_')
|
||||
.replace(/^-+/, '').replace(/-+$/, '');
|
||||
}
|
||||
|
||||
function copyHeaders(rack_rate_type) {
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
if(rack_rate_type == 1){
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
console.log(obj)
|
||||
console.log(formatType)
|
||||
|
||||
if(!formatType && formatType == ""){
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
const headerString = Object.values(excel_headers[formatType]).join("\t"); // Using specified format type for copying headers
|
||||
navigator.clipboard.writeText(headerString).then(function() {
|
||||
toastr.success('Headers copied to clipboard', 'success');
|
||||
}, function(err) {
|
||||
toastr.error(err, 'Could not copy headers:');
|
||||
});
|
||||
}
|
||||
|
||||
function generateTable(rack_rate_type) {
|
||||
|
||||
var data = $('#copied_excel_data').val();
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
data = $('#additional_copied_excel_data').val();
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
console.log(obj);
|
||||
console.log(formatType);
|
||||
console.log(data);
|
||||
|
||||
if (!formatType || formatType == "") {
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Excel data is empty
|
||||
if (!data.trim()) {
|
||||
toastr.warning('Excel data is empty.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = data.split("\n");
|
||||
|
||||
// Filter out empty rows
|
||||
rows = rows.filter(rowText => rowText.split("\t").some(cell => cell.trim()));
|
||||
|
||||
if (rows.length === 0) {
|
||||
toastr.warning('All rows are empty after filtering.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var header = rows[0].split("\t");
|
||||
|
||||
// Determine the columns to keep (non-empty columns)
|
||||
var columnsToKeep = [];
|
||||
for (let i = 0; i < header.length; i++) {
|
||||
if (rows.some(rowText => rowText.split("\t")[i].trim())) {
|
||||
columnsToKeep.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
// Filter header based on columns to keep
|
||||
header = columnsToKeep.map(i => slugify(header[i]));
|
||||
|
||||
if (!excel_headers[formatType]) {
|
||||
toastr.warning("Unknown format type. Please check the header columns.", 'Warning');
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
|
||||
var expectedHeader = Object.keys(excel_headers[formatType]);
|
||||
|
||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType]));
|
||||
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||
|
||||
Swal.fire({
|
||||
title: "Header Mismatch",
|
||||
html: `
|
||||
<p>Header columns do not match expected format:</p>
|
||||
<p><strong>Expected:</strong> ${expectedHeaders}</p>
|
||||
<p><strong>Received:</strong> ${receivedHeaders}</p>
|
||||
`,
|
||||
icon: "error"
|
||||
});
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
|
||||
var table = $('<table class="table table-striped compact-table" />');
|
||||
var uniqueRows = new Set();
|
||||
var emptyCellCount = 0;
|
||||
|
||||
rows.forEach((rowText, y) => {
|
||||
var cells = rowText.split("\t").filter((_, i) => columnsToKeep.includes(i));
|
||||
var row = $('<tr />');
|
||||
|
||||
// Skip empty rows after filtering columns
|
||||
if (cells.every(cell => !cell.trim())) {
|
||||
return;
|
||||
}
|
||||
|
||||
cells.forEach(cellText => {
|
||||
row.append('<td>' + cellText + '</td>');
|
||||
if (!cellText.trim()) {
|
||||
emptyCellCount++;
|
||||
}
|
||||
});
|
||||
|
||||
var key;
|
||||
switch (formatType) {
|
||||
case 3:
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
break;
|
||||
case 4:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 5:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 6:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 7:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 8:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
||||
break;
|
||||
case 9:
|
||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Premium
|
||||
break;
|
||||
case 10:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 11:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, Grade, Premium, Max SI
|
||||
break;
|
||||
case 12:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
||||
break;
|
||||
case 13:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Sum Insured, Relationship, From Age, To Age, Premium
|
||||
break;
|
||||
default:
|
||||
key = cells.join("|");
|
||||
|
||||
}
|
||||
|
||||
if (y > 0 && uniqueRows.has(key)) {
|
||||
row.addClass('duplicate');
|
||||
} else {
|
||||
uniqueRows.add(key);
|
||||
}
|
||||
table.append(row);
|
||||
});
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
$('#additional_excel_table').empty();
|
||||
$('#additional_excel_table').html(table);
|
||||
} else if (rack_rate_type == 0) {
|
||||
$('#excel_table').empty();
|
||||
$('#excel_table').html(table);
|
||||
}
|
||||
|
||||
if ($('.duplicate').length > 0) {
|
||||
console.log('test');
|
||||
toastr.warning("Duplicates found!", "warning");
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
|
||||
if (emptyCellCount > 0) {
|
||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
submitData(rack_rate_type);
|
||||
}
|
||||
|
||||
|
||||
function submitData(rack_rate_type) {
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
var obj = $('#grid');
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
|
||||
formatType = $('#additional_grid').val();
|
||||
table = $('#additional_excel_table table');
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
|
||||
var headers = $(table).find('tr').first().find('td').map(function() {
|
||||
return slugify($(this).text());
|
||||
}).get();
|
||||
|
||||
var rows = $(table).find('tr:gt(0)').map(function() {
|
||||
return $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
}).get();
|
||||
|
||||
var jsonData = [];
|
||||
|
||||
$(table).find('tr:gt(0)').each(function(idx) {
|
||||
var row = $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
var rowData = {};
|
||||
row.forEach((cell, colIdx) => {
|
||||
rowData[headers[colIdx]] = cell;
|
||||
});
|
||||
jsonData.push(rowData);
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
jsonData.forEach(obj => {
|
||||
|
||||
if ('sum_insured' in obj) {
|
||||
obj.si = obj.sum_insured;
|
||||
delete obj.sum_insured;
|
||||
}
|
||||
|
||||
if ('from_age' in obj) {
|
||||
obj.age_from = obj.from_age;
|
||||
delete obj.from_age;
|
||||
}
|
||||
|
||||
if ('to_age' in obj) {
|
||||
obj.age_to = obj.to_age;
|
||||
delete obj.to_age;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
|
||||
$('#additional_grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcelforadditional').text() == "Manual entry") {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#additional_grid_content_input').toggle();
|
||||
$('#additional_grid_content_from_excel').toggle();
|
||||
|
||||
}else{
|
||||
|
||||
$('#grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcel').text() == "Manual entry") {
|
||||
$('#copyfromexcel').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcel').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#grid_content_input').toggle();
|
||||
$('#grid_content_from_excel').toggle();
|
||||
|
||||
|
||||
}
|
||||
|
||||
$.each(jsonData, function(index, item) {
|
||||
appendGridtHtml(formatType, rack_rate_type, item)
|
||||
});
|
||||
|
||||
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
|
||||
$(`input[name="${formatType}_si[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$(`input[name="${formatType}_premium[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -4,9 +4,9 @@
|
||||
<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;">Policy Type List</h4>
|
||||
<h4 style="position: relative;">Policy Type List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<a href="<?= base_url("master/policy/create"); ?>" 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>
|
||||
|
||||
@ -36,7 +36,7 @@ body {
|
||||
<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;">Policy Type</h4>
|
||||
<h4 style="position: relative;">Policy Type</h4>
|
||||
</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>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-10">
|
||||
<label for="tpa_ecard_template">E-Card Template<span class="text-danger"></span></label>
|
||||
<textarea style="height: 100px;" class="form-control" id="ecard_content" placeholder="Enter E-card Content" name="ecard_content"><?= isset($template_data) ? $template_data : '' ?></textarea>
|
||||
<textarea style="height: 380px;" class="form-control" id="ecard_content" placeholder="Enter E-card Content" name="ecard_content"><?= isset($template_data) ? $template_data : '' ?></textarea>
|
||||
</div>
|
||||
<div class="form-group col-md-2 float-right" style="position: relative;top: 0px;left: 40px;">
|
||||
<label for="tpa_logo_preview">Logo Preview<span class="text-danger"></span></label>
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
<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;">TPA List</h4>
|
||||
<h4 style="position: relative;">TPA List</h4>
|
||||
</div>
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<a href="<?= base_url("master/tpa/create"); ?>" 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>
|
||||
|
||||
@ -36,7 +36,7 @@ body {
|
||||
<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;">TPA</h4>
|
||||
<h4 style="position: relative;">TPA</h4>
|
||||
</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>
|
||||
|
||||
@ -84,16 +84,16 @@
|
||||
|
||||
<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>
|
||||
<h4 style="position: relative;">Transaction Details</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||
<div class="col-6" style="text-align: right; position: relative;top: 56px;">
|
||||
<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"
|
||||
<table class="table table-sm table-hover m-0 table-centered dt-responsive w-100" cellspacing="0"
|
||||
id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
|
||||
@ -22,7 +22,7 @@ table.dataTable tbody td {
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php for ($i = 1; $i <= count($tbody); $i++): ?>
|
||||
<?php for ($i = 1; $i <= $count; $i++): ?>
|
||||
<tr>
|
||||
<?php foreach ($tbody[$i] as $data): ?>
|
||||
<td>
|
||||
|
||||
BIN
public/assets/images/sample_logo.png
Normal file
|
After Width: | Height: | Size: 109 KiB |
BIN
public/assets/images/sample_logo_2.jpeg
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
public/assets/images/sample_logo_3.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
public/e_card_imgs/Magma.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
public/e_card_imgs/android.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
public/e_card_imgs/appstore.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
public/e_card_imgs/barcode.jpg
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
public/e_card_imgs/borcode.jpeg
Normal file
|
After Width: | Height: | Size: 56 KiB |
BIN
public/e_card_imgs/ios.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
public/e_card_imgs/medi_uesr.jpg
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
public/e_card_imgs/niva_babu.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
public/e_card_imgs/play_store.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
154
tests/unit/PremiumCalculationTest.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?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 PremiumCalculationTest extends CIUnitTestCase
|
||||
{
|
||||
public function testPremiumCalculationWithPrimaryRackRateAndAdditionalRackRate($MY_PARAM = 'TATATATATA')
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
$param = getenv('MY_PARAM');
|
||||
echo isset($param) && $param != NULL ? $param : $MY_PARAM;
|
||||
$additional_relationship = '{"self":0,"spouse":0,"childrens":1,"parents":0,"parents-in-law":0,"either-parents-pil":0}';
|
||||
$primary_grid_id = 11;
|
||||
$additional_grid_id = 10;
|
||||
$primary_grid_type = 2;
|
||||
$addtional_grid_type = 2;
|
||||
|
||||
$primary_max_si = 35000000;
|
||||
|
||||
$slab_details = [ 'slab_rates' =>[
|
||||
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 500, 'max_si' => $primary_max_si,'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 1500, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 2000, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 2500, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 3000, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 3500, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 4000, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 4500, 'max_si' => $primary_max_si, 'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => $primary_max_si, 'premium' => 15000, 'max_si' => 0, 'premium_type' => $primary_grid_type, 'relationship' => null],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $primary_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 30000000, 'premium' => 30000, 'max_si' => 0, 'premium_type' => $primary_grid_type, 'relationship' => null]
|
||||
],
|
||||
|
||||
'grid_master' => ['id' => 4,'policy_type' => 'GMC','ui_type' => $primary_grid_id,'policy_grid_type' => 'Employees + Relationship + max count','is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0],
|
||||
|
||||
'additional_slab_info' => [
|
||||
|
||||
'slab_rates' =>[
|
||||
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $additional_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 500, 'max_si' => 2500000,'premium_type' => $addtional_grid_type, 'relationship' => null,'additional_relationship' => $additional_relationship ],
|
||||
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $additional_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 1500, 'max_si' => 2000000, 'premium_type' => $addtional_grid_type, 'relationship' => null,'additional_relationship' => $additional_relationship],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $additional_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 2000, 'max_si' => 1800000, 'premium_type' => $addtional_grid_type, 'relationship' => null,'additional_relationship' => $additional_relationship],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $additional_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 2500, 'max_si' => 150000, 'premium_type' => $addtional_grid_type, 'relationship' => null,'additional_relationship' => $additional_relationship],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $additional_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 3000, 'max_si' => 130000, 'premium_type' => $addtional_grid_type, 'relationship' => null,'additional_relationship' => $additional_relationship],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $additional_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 3500, 'max_si' => 10, 'premium_type' => $addtional_grid_type, 'relationship' => null,'additional_relationship' => $additional_relationship],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $additional_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 4000, 'max_si' => 5, 'premium_type' => $addtional_grid_type, 'relationship' => null,'additional_relationship' => $additional_relationship],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $additional_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 4500, 'max_si' => 5, 'premium_type' => $addtional_grid_type, 'relationship' => null,'additional_relationship' => $additional_relationship]],
|
||||
|
||||
'grid_master' => ['id' => 4,'policy_type' => 'GMC','ui_type' => $additional_grid_id,'policy_grid_type' => 'Employees + Relationship + max count','is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0]]
|
||||
];
|
||||
// Sample family data
|
||||
$family_details = [ 'TEST001' =>
|
||||
[2,'TEST001','John Doe', '01-Jan-1988', 'M', 'Self', '5000000', NULL, '', '', 'G', '', '', '', '', '', '',''],
|
||||
[1,'TEST001','Jane Doe', '01-Jan-1985', 'F', 'Spouse', 5000000, '01-Jan-2024', '01-Jan-2020', 50000, 'A', 'Manager', '1234567890', 'john.doe@example.com', '0', '', '', ''],
|
||||
|
||||
[3,'TEST001','Peter Doe', '01-Jan-1955', 'M', 'Father', '', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||
[4,'TEST001','Mary Doe', '01-Jan-1953', 'F', 'Mother', '', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||
[5,'TEST001','Grace Doe', '01-Jan-1954', 'F', 'Mother in law', '', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||
[6,'TEST001','George Doe', '01-Jan-1948', 'M', 'Father in law', '', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||
[7,'TEST001','Alice Doe', '01-Jan-1990', 'F', 'Daughter', 5000000, '01-Jan-2024', '01-Jan-2024', 40000, 'B', 'Supervisor', '9876543210', '', '', '', '',''],
|
||||
[6,'TEST001','Bob Doe', '01-Jan-1993', 'M', 'son', '50000', NULL, '', '', '', '', '', '', '', '', '',''],
|
||||
];
|
||||
|
||||
// Sample policy terms
|
||||
$policy_terms = [
|
||||
'family_floater' => true,
|
||||
'family_floaters' => [
|
||||
'self' => 1,
|
||||
'childrens' => 2,
|
||||
'spouse' => 1,
|
||||
'either-parents-pil' => 0,
|
||||
'parents' => 2,
|
||||
'parents-in-law' => 2,
|
||||
],
|
||||
];
|
||||
|
||||
$policy_details = ['base_policy' => null,"policy_start_date" => "2023-02-02","policy_end_date" => "2024-02-02","policy_terms" => json_encode($policy_terms)];
|
||||
$file = ['id' => null,'client_id' => 10,'policy_id' => 10,'action' => 'inception'];
|
||||
$data = calculate_premimum($family_details,$policy_details,$slab_details,$file);
|
||||
$policy_created_count = 0;
|
||||
echo "\n";
|
||||
$result_to_display = [];
|
||||
foreach ($data as $key => $value)
|
||||
{
|
||||
$result_to_display[$key]['emp_code'] = $value['emp_code'];
|
||||
$result_to_display[$key]['name'] = $value['name'].'('.calculate_days_bw_dates($value['dob'])->y.')';
|
||||
$result_to_display[$key]['relation'] = $value['relationship'];
|
||||
$temp_grid = substr($value['temp']['grid_type'],0,1);
|
||||
$temp_grid_type = ($temp_grid == 'p' ? $primary_grid_type : $addtional_grid_type);
|
||||
$temp_grid_type = ($temp_grid_type == 1 ? 'S' : 'I');
|
||||
$result_to_display[$key]['premium_type'] = $temp_grid.'#'.$value['temp']['grid_id'].'#'.
|
||||
($value['temp']['additional_rack_rate_acting_self'] == true ? 'Y' : 'N' ) .'#'. ($temp_grid_type) ;
|
||||
$result_to_display[$key]['si'] = $value['policy_details']['basic_cover_si'];
|
||||
$result_to_display[$key]['premium'] = $value['policy_details']['premium'];
|
||||
$result_to_display[$key]['policy days'] = calculate_days_bw_dates($policy_details['policy_start_date'],$policy_details['policy_end_date'])->days;
|
||||
$result_to_display[$key]['no of days'] = $value['policy_details']['days'];
|
||||
$result_to_display[$key]['rata_premimum'] = $value['policy_details']['rata_premimum'];
|
||||
$result_to_display[$key]['gst'] = $value['policy_details']['gst'];
|
||||
|
||||
if(!empty($value['policy_details']['premium'])){ $policy_created_count = $policy_created_count + 1; }
|
||||
}
|
||||
|
||||
TableDisplay::displayTable($result_to_display);
|
||||
$this->assertTrue(($policy_created_count = 1 || $policy_created_count = 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class TableDisplay
|
||||
{
|
||||
public static function displayTable(array $data)
|
||||
{
|
||||
if (empty($data)) {
|
||||
echo "No data to display.\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate column widths
|
||||
$columns = array_keys($data[0]);
|
||||
$widths = array_map(function ($col) use ($data) {
|
||||
$maxWidth = strlen($col);
|
||||
foreach ($data as $row) {
|
||||
$maxWidth = max($maxWidth, strlen($row[$col]));
|
||||
}
|
||||
return $maxWidth;
|
||||
}, $columns);
|
||||
|
||||
// Print header
|
||||
echo str_repeat('-', array_sum($widths) + count($columns) * 3) . PHP_EOL;
|
||||
foreach ($columns as $i => $col) {
|
||||
echo str_pad($col, $widths[$i]) . " | ";
|
||||
}
|
||||
echo PHP_EOL;
|
||||
echo str_repeat('-', array_sum($widths) + count($columns) * 3) . PHP_EOL;
|
||||
|
||||
// Print rows
|
||||
foreach ($data as $row) {
|
||||
foreach ($columns as $i => $col) {
|
||||
echo str_pad($row[$col], $widths[$i]) . " | ";
|
||||
}
|
||||
|
||||
echo PHP_EOL;
|
||||
}
|
||||
echo str_repeat('-', array_sum($widths) + count($columns) * 3) . PHP_EOL;
|
||||
}
|
||||
}
|
||||
11
writable/e_card_template/.gitkeep
Normal file
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -1,119 +1,65 @@
|
||||
<body>
|
||||
|
||||
<div style="display: flex;gap: 5px;width: 810px;justify-content: center;margin: 0 auto;">
|
||||
<div class="card" style="border: 1px solid #50505059;width: 420px;min-height: 280px; padding:10px 10px 0px 10px;background-image: url('<?php ?>');background-position: center;background-size: cover;">
|
||||
|
||||
<div style="display: flex;justify-content: center;gap: 10px; width:840px;margin:0 auto 15px; page-break-after: auto;">
|
||||
<div style="position: absolute;left: 590px;" ><img src="{INSURER_LOGO}" alt="" width="70px" height="70px"></div>
|
||||
<h6 style="margin-top: 20px;margin-bottom: 26px;font-weight: 700;font-size: 14px;">{INSURER_NAME}</h6>
|
||||
|
||||
<div style="border: 1px solid black;width: 400px;max-height: 300px;background: url('{FRONT_CARD}');background-size: 100% 100%;padding: 10px;">
|
||||
<table style="font-size: 14px;margin-top:9px ;margin-left: 20px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>POLICY NO</td>
|
||||
<td>:</td>
|
||||
<td>{POLICY_NO}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>:</td>
|
||||
<td>{NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>TPA ID</td>
|
||||
<td>:</td>
|
||||
<td>{TPA_ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>age</td>
|
||||
<td>:</td>
|
||||
<td>{AGE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Employee code</td>
|
||||
<td>:</td>
|
||||
<td>{EMP_ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Corporate name</td>
|
||||
<td>:</td>
|
||||
<td>{CORPORATE_NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Valid form</td>
|
||||
<td>:</td>
|
||||
<td>{POLICY_DATE}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div style="display: flex;">
|
||||
<div><img src="{INSURER_LOGO}" alt="" width="60px"
|
||||
width="60px" style="object-fit: fill;;"></div>
|
||||
<div style="text-align: center;font-family: sans-serif;font-weight: 600;margin-top: 10px;"><span>THE NEW
|
||||
INDIA ASSURANCE CO.LTD.</span> <br><span style="font-size: 15px;">GOOD HEALTH MEDICLAIM
|
||||
POLICY</span></div>
|
||||
</div>
|
||||
<div style="position: relative;left: 204px;top: 30px;"><img src="{TPA_LOGO}" alt="" width="170px" height="30px" style="object-fit: fill;"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<table
|
||||
style="font-family: sans-serif;font-size: 14px;width: 100%;margin-top: 20px;margin-left: 20px;line-height: 20px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>MDID : {TPA_ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b>{NAME}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Certificate No : {UHID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Sex : {GENDER} </span> <span style="margin-left: 30px;"> Date of Birth : {DOB}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b>{SELF_NAME}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Valid form :{POLICY_DATE}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div style="border: 1px solid black;width: 400px;max-height: 300px;padding: 5px;">
|
||||
<div style="font-size: 11px;text-align: center;">The card is for identification purpose only</div>
|
||||
<table style="width: 100%;text-align: center;font-size: 11px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>General & Claim Enquiry Helpline</td>
|
||||
<td>Cashless Enquiry helpline</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<table style="font-size: 11px;width: 100%;text-align: center;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Toll Free : 1800-209-7777 <br>Email :
|
||||
citibank_chennai@mdindia.com</td>
|
||||
<td style="border: 1px solid black;">Toll Free : 1800-209-7800 <br>Email:
|
||||
authorisation@mdindia.com</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="font-size: 14px;text-align: center;">CITI MDIndia branch contact</div>
|
||||
|
||||
<div>
|
||||
<table style="text-align: center;width: 100%;font-size: 12px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="border: 1px solid black;">Center</th>
|
||||
<th style="border: 1px solid black;">Ph.No/Fax.No.</th>
|
||||
<th style="border: 1px solid black;">Center</th>
|
||||
<th style="border: 1px solid black;">Ph.No/Fax.No.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Chennai</td>
|
||||
<td style="border: 1px solid black;">9381819401</td>
|
||||
<td style="border: 1px solid black;">Delhi</td>
|
||||
<td style="border: 1px solid black;">9310596976</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Chennai</td>
|
||||
<td style="border: 1px solid black;">9381819501</td>
|
||||
<td style="border: 1px solid black;">Mumbai</td>
|
||||
<td style="border: 1px solid black;">9320373542</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Hyderabad</td>
|
||||
<td style="border: 1px solid black;">9390838023</td>
|
||||
<td style="border: 1px solid black;">Pune</td>
|
||||
<td style="border: 1px solid black;">9371644536</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Bangalore</td>
|
||||
<td style="border: 1px solid black;">9341555665</td>
|
||||
<td style="border: 1px solid black;">Kolkata</td>
|
||||
<td style="border: 1px solid black;">9333441389</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<h6 style="margin: 5px;">TERMS AND CONDITIONS</h6>
|
||||
<ol style="font-size: 11px;padding-left: 15px;margin-top: 0px;">
|
||||
<li>Pre authorisation is compulsary from tpa prior to planned admission within 24hours for
|
||||
emergencies.</li>
|
||||
<li>Admission for Investigation/Evaluation Not covered.</li>
|
||||
<li>All terms and conditions of the policy would be applicable</li>
|
||||
<li>cashless hospitalisation in network hospitals can be obtained in conjunction with this card.an
|
||||
authorisation letter issued by tpa and photo identification and such as Voters ID,Driver
|
||||
Licence,Passport,etc.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" style="border: 1px solid #50505059;width:420px;min-height: 280px; padding: 0px 20px 5px 0px;">
|
||||
<h6 style="text-align: center;font-weight: 700;margin: 0px;font-size: 14px;"><u>Terms&conditions</u></h6>
|
||||
<ul style="font-size: 11px;text-align: justify;font-weight: bolder;font-weight: 600;line-height: 13px;margin-bottom: 5px;">
|
||||
<li>Submit this card & photo ID for availing cashless insurrer empanelled hospitals</li>
|
||||
<li>Cashless facility is subject to approved by {TPA_NAME} as per policy terms and conditions</li>
|
||||
<li>Validdity of this card is subject to valid policy renewal of policy</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</body>
|
||||
89
writable/e_card_template/fhpl_tpa.html
Normal file
@ -0,0 +1,89 @@
|
||||
<body>
|
||||
|
||||
|
||||
<div style="display: flex;justify-content: center;gap: 10px;width: 840px;margin: 0 auto;">
|
||||
|
||||
<div style="width: 420px;min-height: 320px; background-image:url({FRONT_CARD});background-size: 100% 100%;border: 1px solid black;line-height: 15px;font-size: 14px;position: relative;">
|
||||
|
||||
<h3 style="font-family: sans-serif;padding-left: 89px;margin-top: 35px;">{INSURER_NAME}</h3>
|
||||
<table style="margin-top: 35px;width: 86%;font-family: sans-serif;padding-left: 20px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>UHID No</td>
|
||||
<td>:</td>
|
||||
<td>{UHID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>{NAME}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Age</td>
|
||||
<td>:</td>
|
||||
<td>{AGE} years</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Relationship</td>
|
||||
<td>:</td>
|
||||
<td>{RELATION}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Plan Period</td>
|
||||
<td>:</td>
|
||||
<td >{POLICY_START_DATE} To {POLICY_DATE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Policy No</td>
|
||||
<td>:</td>
|
||||
<td>{POLICY_NO}</td>
|
||||
</tr>
|
||||
<td>Insurer</td>
|
||||
<td>:</td>
|
||||
<td>LCO : {TPA_ID} : {INSURER_BRANCH}</td>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div>
|
||||
<img src="{INSURER_LOGO}" alt="" width="70px" height="70px" style="object-fit: fill;position: absolute;top: 6px;left: 15px;">
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 420px;min-height: 320px; background-image: url('{BACK_CARD}');background-size: 100% 100%;border: 1px solid black;padding-top: 10px;padding-right: 10px;">
|
||||
<h4 style="font-family: sans-serif;padding-left: 20px;margin:0px;">Instructions</h4>
|
||||
<ul style="font-family: sans-serif;font-size: 11px;line-height: 15px;padding-left: 30px;">
|
||||
<li>Card has to be presented to our network hospitals at the time of the admission while availing cashless</li>
|
||||
<li>Free authorizationfrom FHPL it must should be taken before 48 hrs for all planed admissions & emergency admissions within 24 hrs of getting admitted to any network hospitals FHPL</li>
|
||||
<li>The issuance of this card doesnot guarantee cashless benefits /hospitalisation</li>
|
||||
<li>The card is for the identification purpose.in case of without photograph card.Alternative identification proof such as Voter ID/driving license etc...should be produced</li>
|
||||
<li>All insurance claim will be processed as per policy terms & conditions</li>
|
||||
<li>For more details kindly referbook kindly provided</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 50px;">
|
||||
<h4 style="font-family: sans-serif;margin: 0px;margin-left: 30px;">TERMS AND CONDITIONS:</h4>
|
||||
<div style="width: 100%;line-height: 30px;">
|
||||
<ol type="number" style="font-family: sans-serif;">
|
||||
<li>This card is generated as per the details given by your employer/HR. Incase of any errors in the
|
||||
details you may confirm the same through your employer for making required corrections.</li>
|
||||
<li>No physical card will be provided to you. For all requirements you may use this card printed in black
|
||||
and white or colour.</li>
|
||||
<li>You can access our network hospitals list from our website https://www.fhpl.net for any information
|
||||
regarding hospitals available within your location or as required.</li>
|
||||
<li>For the convenience of the members the guide book is made available on our website
|
||||
https://www.fhpl.net for understanding protocols in the event of any hospitalization assistance required
|
||||
for availing cashless service and also to forward any claim where the member has spent on his/her own.</li>
|
||||
<li>All our network hospitals will accept the printed card and seek the preauthorization from FHPL in the
|
||||
event of any in-patient hospitalization.</li>
|
||||
<li>Incase there is no photograph on the ID card, the member has to identify himself/herself with any other
|
||||
photo-card like: credit card, ration card, electoral card, Company ID card etc in conjunction with this card.</li>
|
||||
<li>This card is not transferable and cannot be forwarded further to any other person by email/fax.</li>
|
||||
<li> The card will be visible to any member as long the policy is valid after which this service will be
|
||||
withdrawn or till such time the member is employed with the current employer.</li>
|
||||
<li>Usage of this card after the validity/policy expiry will not be entertained.</li>
|
||||
<li>A fresh card will be generated subjected to the renewal of the policy.</li>
|
||||
<li>For Any further queries, Please feel free to contact us on Toll—Free Helpline :1800 - 103 - 7519</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
@ -1,118 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>vidal Ecard</title>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div style="display: flex;gap: 5px;width: 840px;justify-content: center;margin: 0 auto;">
|
||||
<div class="card" style="border: 1px solid #50505059;width: 420px;min-height: 280px; padding:10px 10px 0px 10px;background-image: url(../image/vidal\ background\ image.jpg);background-position: center;background-size: cover;">
|
||||
|
||||
<div><img src="../image/New_India_Assurance.png" alt="" width="70px" height="70px" style="position: absolute;object-fit: fill;right: 16px;top: 17px;"></div>
|
||||
<h6 style="margin-top: 20px;margin-bottom: 26px;font-weight: 700;font-size: 14px;">THE NEW INDIA COMPANY PRIVATE LIMITED</h6>
|
||||
|
||||
<table style="font-size: 14px;margin-top:9px ;margin-left: 20px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Card No</td>
|
||||
<td>:</td>
|
||||
<td>CHE-NI-K0674-001-0000003-A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>:</td>
|
||||
<td>BHODANADHAN S</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Gender</td>
|
||||
<td>:</td>
|
||||
<td>M</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>age</td>
|
||||
<td>:</td>
|
||||
<td>53 years</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Employee code</td>
|
||||
<td>:</td>
|
||||
<td>1015</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Corporate name</td>
|
||||
<td>:</td>
|
||||
<td>KELD ELLENTOFT INDIA PVT LTD</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Valid form</td>
|
||||
<td>:</td>
|
||||
<td>28-04-2024</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div style="position: absolute;bottom: 11px;right: 11px;"><img src="../image/logo.png" alt="" width="170px" height="30px" style="object-fit: fill;"></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card" style="border: 1px solid #50505059;width:420px;min-height: 280px; padding: 0px 20px 5px 0px;">
|
||||
<h6 style="text-align: center;font-weight: 700;margin: 0px;font-size: 14px;"><u>Terms&conditions</u></h6>
|
||||
<ul style="font-size: 11px;text-align: justify;font-weight: bolder;font-weight: 600;line-height: 13px;margin-bottom: 5px;">
|
||||
<li>Submit this card & photo ID for availing cashless insurrer empanelled hospitals</li>
|
||||
<li>Cashless facility is subject to approved by vidal health as per policy terms and conditions</li>
|
||||
<li>Validdity of this card is subject to valid policy renewal of policy</li>
|
||||
<li>imidiate intimation to vidal health is must incase of any hospitalisation</li>
|
||||
<li>Download the vidal health mobile app from android iOS to get an E-Card check your policy claim status, Hospital list and more, Give a missed call to 022-4892-6099 from your registered mobile number, or visit www.vidalhealthpa.com,or scan << Qr code on corner >></li>
|
||||
</ul>
|
||||
<div >
|
||||
<img src="../image/logo.png" alt="" width="100px" height="25px" style="object-fit: fill; rotate: -90deg; position: absolute;left: -34px;bottom: 77px;">
|
||||
</div>
|
||||
<div style="font-size: 10px;font-weight: bold; line-height: 10px;margin-left: 40px;width: 70%;">
|
||||
<div><u>24x7 help line no</u> </div>
|
||||
<div>
|
||||
<div>
|
||||
<span>karnataka/andrapradesh/telangana</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-46267018/1860425051</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>North and east region/gujarat</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-46267021/18604250261</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Maharastra</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-46267020/18604250254</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Tamil Nadu</span style="padding: 0px 5px 0px 5px ;">:<span></span><span style="font-weight: 400;">080-46267020/18604250254</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Kerala</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-46267019/18604250253</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>S.R citizen</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-4626-7070</span>
|
||||
</div>
|
||||
<div>
|
||||
<span style="font-weight: 400;">vidal health insurance <b>TPA</b> pvt limited,tower no 2,</span>
|
||||
<br>
|
||||
<span style="font-weight: 400;">First Floor,<b>SJR </b>ipark,<b>EPIP </b>zone ,whitefield,bangalore,</span>
|
||||
<br>
|
||||
</div>
|
||||
<div>
|
||||
<span style="font-weight: 400;"><b>email:</b>helpvidalhealthpa@gmail.com</span><span style="padding: 0px 5px 0px 5px ;">/</span><span style="font-weight: 400;"><b>website:</b>WWW.vidalhealthp.com</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div><img src="../image/2-play store.png" alt="" width="80px" height="80px" style="position: absolute;top: 158px; right: 90px;"></div>
|
||||
<div><img src="../image/2-appstore.png" alt="" width="76px" height="80px" style="position: absolute;right: 10px;top:158px;"></div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -3,25 +3,25 @@
|
||||
<div style="display: flex;justify-content:center;gap: 10px;">
|
||||
<div style="border: 1px solid black;max-height: 250px;width: 400px;background-image: url({FRONT_CARD});background-size: 100% 100%;position: relative;">
|
||||
<div style="height: 50px;width: 100px;position: absolute;top: 20px;right: 40px;">
|
||||
<img src="../image/niva.png" alt="" width="100px" height="50px" style="object-fit: fill;">
|
||||
<img src="{INSURER_LOGO}" alt="" width="100px" height="50px" style="object-fit: fill;">
|
||||
</div>
|
||||
<table style="width: 100%;font-family: sans-serif;font-size: 14px;margin-left: 20px;margin-top: 55px;line-height: 19px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Haamira Banu</td>
|
||||
<td>{NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: auto;"><b>Xoriant Solutions Pvt Ltd</b></td>
|
||||
<td style="width: auto;"><b>{CORPORATE_NAME}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Dob : 02/05/2000</span><span style="padding-left: 40px;">EMP ID : 73496</span></td>
|
||||
<td><span>Dob : {DOB}</span><span style="padding-left: 40px;">EMP ID : {EMP_ID}</span></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>PHS ID : MBHI CHE 38728183 XSP E</td>
|
||||
<td>PHS ID : {TPA_ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Valid upto : 31/01/2024</td>
|
||||
<td>Valid upto : {POLICY_DATE}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -47,9 +47,9 @@
|
||||
<div style="display: flex;justify-content: center;">
|
||||
<table style="border-spacing:50px 10px;">
|
||||
<tr>
|
||||
<td><img src="../image/1 android.png" alt="" width="170px" height="135px"></td>
|
||||
<td><img src="{QR_ANDROID}" alt="" width="170px" height="135px"></td>
|
||||
<td style="font-family: sans-serif;display: flex;align-items: start;font-size: 22px;"><b>Mobile App</b></td>
|
||||
<td><img src="../image/1-ios.png" alt="" width="150px" height="140px"></td>
|
||||
<td><img src="{QR_IOS}" alt="" width="150px" height="140px"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@ -1,119 +1,102 @@
|
||||
<body>
|
||||
|
||||
<div style="display: flex;justify-content: center;gap: 10px; width:840px;margin:0 auto 15px; page-break-after: auto;">
|
||||
<div style="display: flex;gap: 5px;width: 810px;justify-content: center;margin: 0 auto;">
|
||||
<div class="card" style="border: 1px solid #50505059;width: 420px;min-height: 280px; padding:10px 10px 0px 10px;background-image: url('{FRONT_CARD}');background-position: center;background-size: cover;">
|
||||
|
||||
<div style="border: 1px solid black;width: 400px;max-height: 300px;background: url('{FRONT_CARD}');background-size: 100% 100%;padding: 10px;">
|
||||
<div style="position: absolute;left: 317px;"><img src="{INSURER_LOGO}" alt="" width="70px" height="70px" ></div>
|
||||
<h6 style="margin-top: 20px;margin-bottom: 26px;font-weight: 700;font-size: 14px;">{INSURER_NAME}</h6>
|
||||
|
||||
<div style="display: flex;">
|
||||
<div><img src="{INSURER_LOGO}" alt="" width="60px"
|
||||
width="60px" style="object-fit: fill;;"></div>
|
||||
<div style="text-align: center;font-family: sans-serif;font-weight: 600;margin-top: 10px;"><span>THE NEW
|
||||
INDIA ASSURANCE CO.LTD.</span> <br><span style="font-size: 15px;">GOOD HEALTH MEDICLAIM
|
||||
POLICY</span></div>
|
||||
</div>
|
||||
|
||||
<table
|
||||
style="font-family: sans-serif;font-size: 14px;width: 100%;margin-top: 20px;margin-left: 20px;line-height: 20px;">
|
||||
<table style="font-size: 14px;margin-top:9px ;margin-left: 20px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>MDID : {TPA_ID}</td>
|
||||
<td>Card No</td>
|
||||
<td>:</td>
|
||||
<td>{POLICY_NO}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b>{NAME}</b></td>
|
||||
<td>Name</td>
|
||||
<td>:</td>
|
||||
<td>{NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Certificate No : {UHID}</td>
|
||||
<td>Gender</td>
|
||||
<td>:</td>
|
||||
<td>{GENDER}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span>Sex : {GENDER} </span> <span style="margin-left: 30px;"> Date of Birth : {DOB}</span>
|
||||
</td>
|
||||
<td>age</td>
|
||||
<td>:</td>
|
||||
<td>{AGE} years</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><b>{SELF_NAME}</b></td>
|
||||
<td>Employee code</td>
|
||||
<td>:</td>
|
||||
<td>{EMP_ID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Valid form :{POLICY_DATE}</td>
|
||||
<td>Corporate name</td>
|
||||
<td>:</td>
|
||||
<td>{CORPORATE_NAME}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Valid form</td>
|
||||
<td>:</td>
|
||||
<td>{POLICY_DATE}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<div style="border: 1px solid black;width: 400px;max-height: 300px;padding: 5px;">
|
||||
<div style="font-size: 11px;text-align: center;">The card is for identification purpose only</div>
|
||||
<table style="width: 100%;text-align: center;font-size: 11px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>General & Claim Enquiry Helpline</td>
|
||||
<td>Cashless Enquiry helpline</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="position: relative;left: 204px;top: 30px;"><img src="{TPA_LOGO}" alt="" width="170px" height="30px" style="object-fit: fill;"></div>
|
||||
|
||||
|
||||
<table style="font-size: 11px;width: 100%;text-align: center;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Toll Free : 1800-209-7777 <br>Email :
|
||||
citibank_chennai@mdindia.com</td>
|
||||
<td style="border: 1px solid black;">Toll Free : 1800-209-7800 <br>Email:
|
||||
authorisation@mdindia.com</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div style="font-size: 14px;text-align: center;">CITI MDIndia branch contact</div>
|
||||
|
||||
<div>
|
||||
<table style="text-align: center;width: 100%;font-size: 12px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="border: 1px solid black;">Center</th>
|
||||
<th style="border: 1px solid black;">Ph.No/Fax.No.</th>
|
||||
<th style="border: 1px solid black;">Center</th>
|
||||
<th style="border: 1px solid black;">Ph.No/Fax.No.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Chennai</td>
|
||||
<td style="border: 1px solid black;">9381819401</td>
|
||||
<td style="border: 1px solid black;">Delhi</td>
|
||||
<td style="border: 1px solid black;">9310596976</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Chennai</td>
|
||||
<td style="border: 1px solid black;">9381819501</td>
|
||||
<td style="border: 1px solid black;">Mumbai</td>
|
||||
<td style="border: 1px solid black;">9320373542</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Hyderabad</td>
|
||||
<td style="border: 1px solid black;">9390838023</td>
|
||||
<td style="border: 1px solid black;">Pune</td>
|
||||
<td style="border: 1px solid black;">9371644536</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="border: 1px solid black;">Bangalore</td>
|
||||
<td style="border: 1px solid black;">9341555665</td>
|
||||
<td style="border: 1px solid black;">Kolkata</td>
|
||||
<td style="border: 1px solid black;">9333441389</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<h6 style="margin: 5px;">TERMS AND CONDITIONS</h6>
|
||||
<ol style="font-size: 11px;padding-left: 15px;margin-top: 0px;">
|
||||
<li>Pre authorisation is compulsary from tpa prior to planned admission within 24hours for
|
||||
emergencies.</li>
|
||||
<li>Admission for Investigation/Evaluation Not covered.</li>
|
||||
<li>All terms and conditions of the policy would be applicable</li>
|
||||
<li>cashless hospitalisation in network hospitals can be obtained in conjunction with this card.an
|
||||
authorisation letter issued by tpa and photo identification and such as Voters ID,Driver
|
||||
Licence,Passport,etc.</li>
|
||||
</ol>
|
||||
|
||||
<div class="card" style="border: 1px solid #50505059;width:420px;min-height: 280px; padding: 0px 20px 5px 0px;">
|
||||
<h6 style="text-align: center;font-weight: 700;margin: 0px;font-size: 14px;"><u>Terms&conditions</u></h6>
|
||||
<ul style="font-size: 11px;text-align: justify;font-weight: bolder;font-weight: 600;line-height: 13px;margin-bottom: 5px;">
|
||||
<li>Submit this card & photo ID for availing cashless insurrer empanelled hospitals</li>
|
||||
<li>Cashless facility is subject to approved by vidal health as per policy terms and conditions</li>
|
||||
<li>Validdity of this card is subject to valid policy renewal of policy</li>
|
||||
<li>imidiate intimation to vidal health is must incase of any hospitalisation</li>
|
||||
<li>Download the vidal health mobile app from android iOS to get an E-Card check your policy claim status, Hospital list and more, Give a missed call to 022-4892-6099 from your registered mobile number, or visit www.vidalhealthpa.com,or scan << Qr code on corner >></li>
|
||||
</ul>
|
||||
<div style="font-size: 10px;font-weight: bold; line-height: 10px;margin-left: 40px;width: 70%;">
|
||||
<div><u>24x7 help line no</u> </div>
|
||||
<div>
|
||||
<div>
|
||||
<span>karnataka/andrapradesh/telangana</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-46267018/1860425051</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>North and east region/gujarat</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-46267021/18604250261</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Maharastra</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-46267020/18604250254</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Tamil Nadu</span style="padding: 0px 5px 0px 5px ;">:<span></span><span style="font-weight: 400;">080-46267020/18604250254</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>Kerala</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-46267019/18604250253</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>S.R citizen</span><span style="padding: 0px 5px 0px 5px ;">:</span><span style="font-weight: 400;">080-4626-7070</span>
|
||||
</div>
|
||||
<div>
|
||||
<span style="font-weight: 400;">vidal health insurance <b>TPA</b> pvt limited,tower no 2,</span>
|
||||
<br>
|
||||
<span style="font-weight: 400;">First Floor,<b>SJR </b>ipark,<b>EPIP </b>zone ,whitefield,bangalore,</span>
|
||||
<br>
|
||||
</div>
|
||||
<div>
|
||||
<span style="font-weight: 400;"><b>email:</b>helpvidalhealthpa@gmail.com</span><span style="padding: 0px 5px 0px 5px ;">/</span><span style="font-weight: 400;"><b>website:</b>WWW.vidalhealthp.com</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
<div><img src="{QR_ANDROID_2}" alt="" width="60px" height="60px" style="position: absolute;top: 210px; right: 70px;"></div>
|
||||
<div><img src="{QR_IOS_2}" alt="" width="56px" height="60px" style="position: absolute;right: 10px;top:210px;"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||