Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
5c4012b59c
83
.env.sample
83
.env.sample
@ -14,13 +14,14 @@
|
||||
# ENVIRONMENT
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
CI_ENVIRONMENT = development
|
||||
# CI_ENVIRONMENT = development
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# APP
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
app.baseURL = 'http://localhost/nhance/'
|
||||
app.baseURL = 'http://localhost/client_changes/nhance/'
|
||||
app.appTimezone = 'Asia/Kolkata'
|
||||
# If you have trouble with `.`, you could also use `_`.
|
||||
# app_baseURL = ''
|
||||
# app.forceGlobalSecureRequests = false
|
||||
@ -31,19 +32,74 @@ app.baseURL = 'http://localhost/nhance/'
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
|
||||
# Dev DB Connection
|
||||
|
||||
database.default.hostname = 119.18.54.85
|
||||
database.default.database = venbaehn_nhance
|
||||
database.default.username = venbaehn_nhance_user1
|
||||
database.default.password = 'iM~X7(cR+}A-'
|
||||
database.default.DBDriver = MySQLi
|
||||
database.default.DBPrefix =
|
||||
database.default.port = 3306
|
||||
|
||||
database.tests.hostname = 119.18.54.85
|
||||
database.tests.database = venbaehn_nhance
|
||||
database.tests.username = venbaehn_nhance_user1
|
||||
database.tests.password = 'iM~X7(cR+}A-'
|
||||
database.tests.DBDriver = MySQLi
|
||||
database.tests.DBPrefix =
|
||||
database.tests.port = 3306
|
||||
|
||||
# Test DB Connection
|
||||
|
||||
# database.default.hostname = 119.18.54.85
|
||||
# database.default.database = venbaehn_nhance_test
|
||||
# database.default.username = venbaehn_nhance_user1
|
||||
# database.default.password = 'iM~X7(cR+}A-'
|
||||
# database.default.DBDriver = MySQLi
|
||||
# database.default.DBPrefix =
|
||||
# database.default.port = 3306
|
||||
|
||||
database.default.hostname = 119.18.54.85
|
||||
database.default.database = venbaehn_nhance
|
||||
database.default.username = venbaehn_nhance_user1
|
||||
database.default.password = 'iM~X7(cR+}A-'
|
||||
# database.tests.hostname = 119.18.54.85
|
||||
# database.tests.database = venbaehn_nhance_test
|
||||
# database.tests.username = venbaehn_nhance_user1
|
||||
# database.tests.password = 'iM~X7(cR+}A-'
|
||||
# database.tests.DBDriver = MySQLi
|
||||
# database.tests.DBPrefix =
|
||||
# database.tests.port = 3306
|
||||
|
||||
# UAT DB Connection
|
||||
|
||||
# database.default.hostname = 119.18.54.85
|
||||
# database.default.database = venbaehn_nhance_uat
|
||||
# database.default.username = venbaehn_nhance_user1
|
||||
# database.default.password = 'iM~X7(cR+}A-'
|
||||
# database.default.DBDriver = MySQLi
|
||||
# database.default.DBPrefix =
|
||||
# database.default.port = 3306
|
||||
|
||||
# database.tests.hostname = 119.18.54.85
|
||||
# database.tests.database = venbaehn_nhance_uat
|
||||
# database.tests.username = venbaehn_nhance_user1
|
||||
# database.tests.password = 'iM~X7(cR+}A-'
|
||||
# database.tests.DBDriver = MySQLi
|
||||
# database.tests.DBPrefix =
|
||||
# database.tests.port = 3306
|
||||
|
||||
# Local PhpMyAdmin DB Connection
|
||||
|
||||
# database.default.hostname = localhost
|
||||
# database.default.database = nhance
|
||||
# database.default.username = root
|
||||
# database.default.password = ''
|
||||
# database.default.DBDriver = MySQLi
|
||||
# database.default.DBPrefix =
|
||||
# database.default.port = 3306
|
||||
|
||||
# database.tests.hostname = localhost
|
||||
# database.tests.database = nhance
|
||||
# database.tests.username = root
|
||||
# database.tests.password = ''
|
||||
# database.tests.DBDriver = MySQLi
|
||||
# database.tests.DBPrefix =
|
||||
# database.tests.port = 3306
|
||||
@ -125,12 +181,12 @@ database.default.password = 'iM~X7(cR+}A-'
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
|
||||
# session.cookieName = 'ci_session'
|
||||
# session.expiration = 7200
|
||||
session.cookieName = 'ci_session_dev'
|
||||
session.expiration = 86400
|
||||
# session.savePath = null
|
||||
# session.matchIP = false
|
||||
# session.timeToUpdate = 300
|
||||
# session.regenerateDestroy = false
|
||||
session.timeToUpdate = 300
|
||||
session.regenerateDestroy = true
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# LOGGER
|
||||
@ -151,5 +207,10 @@ database.default.password = 'iM~X7(cR+}A-'
|
||||
GOOGLE_OAUTH_APP_NAME = 'OAuth'
|
||||
GOOGLE_OAUTH_CLIENT_ID = '696241936560-m2mr272ge7vr2n4q36c22l3d2gdgi90l.apps.googleusercontent.com'
|
||||
GOOGLE_OAUTH_CLIENT_SECRET = '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'
|
||||
GOOGLE_OAUTH_REDIRECT_URI = 'http://localhost/nhance/oauth2callback'
|
||||
GOOGLE_OAUTH_REDIRECT_URI = 'http://localhost/client_changes/nhance/oauth2callback'
|
||||
GOOGLE_OAUTH_SCOPES = "https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile"
|
||||
|
||||
|
||||
App_Url = https://venbait.in/nhance/app/dev/
|
||||
POST_ENROLLMENT_APP_LINK = https://venbait.in/nhance/employee/dev/
|
||||
NHANCE_LOGO = https://venbait.in/nhance/dev/public/assets/images/Nhance_Favi.png
|
||||
@ -49,7 +49,7 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
|
||||
$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("view", "DashboardController::dashboard");
|
||||
$routes->match(['get','post'],'view','DashboardController::dashboard');
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||
@ -146,6 +146,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("truncate/(:any)", "EmployeeController::truncateFileData/$1");
|
||||
$routes->get("test-rack-rate", "EmployeeController::testRackRate");
|
||||
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||
$routes->post("test-dependent", "EmployeeController::testCheckDependentConflict");
|
||||
});
|
||||
|
||||
|
||||
@ -271,11 +272,16 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("get_policy_type_for_base_policy/(:any)", "ClientController::getPolicyTypeForBasePolicy/$1");
|
||||
$routes->get("get_client_details/(:any)", "ClientController::getClientDetails/$1");
|
||||
$routes->get("featch_dashboard_data/(:any)", "DashboardController::featch_dashboard_data/$1");
|
||||
$routes->get("remove_rack_rate/(:any)", "ClientController::removeRackRate/$1");
|
||||
$routes->get("get_client_policy_list_for_remainder/(:any)", "EmployeeController::get_client_policy_list_for_remainder/$1");
|
||||
$routes->get("send_manual_remainder/(:any)", "DashboardController::sendManualRemainder/$1");
|
||||
$routes->get("get_insurer_by_export_templete", "MasterController::getInsurerByExportTemplete");
|
||||
$routes->get("copy_insurer_templete/(:any)", "MasterController::copyInsurerTemplete/$1");
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
$routes->cli('cli/enrollment_status', 'JobWorker::enrollment_status');
|
||||
$routes->cli('cli/updatePolicyEnrollmentStatus', 'DashboardController::updatePolicyEnrollmentStatus');
|
||||
$routes->get("processjob", "JobWorker::processJob");
|
||||
|
||||
|
||||
|
||||
@ -415,7 +415,9 @@ class ClientController extends AdminController
|
||||
foreach ($clientPoliceData as $key => $value) {
|
||||
|
||||
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
|
||||
$clientPoliceData[$key]->open_date = date('d-M-Y', strtotime($value->open_date));
|
||||
$clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
|
||||
$clientPoliceData[$key]->close_date = date('d-M-Y', strtotime($value->close_date));
|
||||
}
|
||||
|
||||
$editData['client_policy'] = $clientPoliceData;
|
||||
@ -766,8 +768,8 @@ class ClientController extends AdminController
|
||||
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
|
||||
$data['policy_status'] = $this->request->getPost('policy_status');
|
||||
$data['no_of_employees'] = $this->request->getPost('no_of_employees');
|
||||
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d') ?? null;
|
||||
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d') ?? null;
|
||||
$data['incurred_claims_ratio'] = $this->request->getPost('incurred_claims_ratio');
|
||||
$data['no_lives_at_inception'] = $this->request->getPost('no_lives_at_inception');
|
||||
$data['premium_paid_at_inception'] = $this->request->getPost('premium_paid_at_inception');
|
||||
@ -823,16 +825,17 @@ class ClientController extends AdminController
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_no'] = $this->request->getPost('policy_no');
|
||||
if($data['inception_type'] == 2){
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d');
|
||||
|
||||
}else{
|
||||
$data['policy_start_date'] = null;
|
||||
$data['policy_end_date'] = null;
|
||||
$data['open_date'] = null;
|
||||
$data['closedate'] = null;
|
||||
$data['reminder_date'] = null;
|
||||
}
|
||||
|
||||
@ -879,8 +882,8 @@ class ClientController extends AdminController
|
||||
$data['no_of_lives'] = $this->request->getPost('no_of_lives');
|
||||
$data['policy_status'] = $this->request->getPost('policy_status');
|
||||
$data['no_of_employees'] = $this->request->getPost('no_of_employees');
|
||||
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['earned_premium_date'] = change_date_format($this->request->getPost('earned_premium_date'), 'd-m-Y', 'Y-m-d') ?? null;
|
||||
$data['claims_incurred_date'] = change_date_format($this->request->getPost('claims_incurred_date'), 'd-m-Y', 'Y-m-d') ?? null;
|
||||
$data['incurred_claims_ratio'] = $this->request->getPost('incurred_claims_ratio');
|
||||
$data['no_lives_at_inception'] = $this->request->getPost('no_lives_at_inception');
|
||||
$data['premium_paid_at_inception'] = $this->request->getPost('premium_paid_at_inception');
|
||||
@ -894,14 +897,16 @@ class ClientController extends AdminController
|
||||
$data['client_branch_id'] = $this->request->getPost('client_branch_id');
|
||||
$data['cd_ac_no'] = $this->request->getPost('cd_ac_no');
|
||||
$data['gst'] = $this->request->getPost('gst');
|
||||
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
|
||||
if($data['inception_type'] == 2){
|
||||
$data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['open_date'] = change_date_format($this->request->getPost('open_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['close_date'] = change_date_format($this->request->getPost('close_date'), 'd-m-Y', 'Y-m-d');
|
||||
$data['reminder_date'] = change_date_format($this->request->getPost('reminder_date'), 'd-m-Y', 'Y-m-d');
|
||||
}else{
|
||||
$data['policy_start_date'] = null;
|
||||
$data['policy_end_date'] = null;
|
||||
$data['open_date'] = null;
|
||||
$data['close_date'] = null;
|
||||
$data['reminder_date'] = null;
|
||||
}
|
||||
|
||||
@ -944,7 +949,7 @@ class ClientController extends AdminController
|
||||
|
||||
// dd($data);
|
||||
$data['updated_by'] = get_session_userid();
|
||||
// print_r($data);die;
|
||||
// print_r(json_encode($data));die;
|
||||
$insert = $this->clientPolicyModel->update($id,$data);
|
||||
$lastQuery = $this->clientPolicyModel->getLastQuery();
|
||||
|
||||
@ -1021,28 +1026,28 @@ class ClientController extends AdminController
|
||||
$policy_grid_id = $this->request->getPost('policy_grid_id');
|
||||
$rack_rate_name = $this->request->getPost('rack_rate_name');
|
||||
|
||||
$self = $this->request->getPost('self') ? 1 : 0;
|
||||
$spouse = $this->request->getPost('spouse');
|
||||
$childrens = $this->request->getPost('childrens');
|
||||
$parents = $this->request->getPost('parents');
|
||||
$parents_in_law = $this->request->getPost('parents-in-law');
|
||||
$relation_data = [
|
||||
'self' => $this->request->getPost('self'),
|
||||
'spouse' => $this->request->getPost('spouse'),
|
||||
'childrens' => $this->request->getPost('childrens'),
|
||||
'parents' => $this->request->getPost('parents'),
|
||||
'parents-in-law'=> $this->request->getPost('parents-in-law'),
|
||||
];
|
||||
|
||||
if($policy_grid_id == 1 || $policy_grid_id == 2){
|
||||
$self = 1;
|
||||
$spouse = 'NA';
|
||||
$childrens = 'NA';
|
||||
$parents = 'NA';
|
||||
$parents_in_law = 'NA';
|
||||
if ($policy_grid_id == 1 || $policy_grid_id == 2 || $policy_grid_id == 6 || $policy_grid_id == 7) {
|
||||
$relation_data = [
|
||||
'self' => 1,
|
||||
'spouse' => 'NA',
|
||||
'childrens' => 'NA',
|
||||
'parents' => 'NA',
|
||||
'parents-in-law'=> 'NA',
|
||||
];
|
||||
}
|
||||
|
||||
$relation_data['self'] = $self;
|
||||
$relation_data['spouse'] = $spouse;
|
||||
$relation_data['childrens'] = $childrens;
|
||||
$relation_data['parents'] = $parents;
|
||||
$relation_data['parents-in-law'] = $parents_in_law;
|
||||
|
||||
// Convert to JSON
|
||||
$jsonDataForRelation = json_encode($relation_data);
|
||||
|
||||
|
||||
$si_or_bp = $this->request->getPost('si_or_bp');
|
||||
$basic_multiplier = str_replace(',', '', $this->request->getPost('basic_multiplier'));
|
||||
$premium_multiplier = str_replace(',', '', $this->request->getPost('premium_multiplier'));
|
||||
@ -2033,10 +2038,10 @@ class ClientController extends AdminController
|
||||
|
||||
if ($record['open_for_enrollment'] == 0) {
|
||||
$open_for_enrollment_update_value = 1;
|
||||
$message = 'Enrollment Opened Successfully';
|
||||
$message = 'Enrolment Opened Successfully';
|
||||
} else if ($record['open_for_enrollment'] == 1) {
|
||||
$open_for_enrollment_update_value = 0;
|
||||
$message = 'Enrollment Closed Successfully';
|
||||
$message = 'Enrolment Closed Successfully';
|
||||
}
|
||||
|
||||
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
||||
@ -2161,7 +2166,8 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function getClientBranch($client_id){
|
||||
public function getClientBranch($client_id)
|
||||
{
|
||||
|
||||
$branchs = $this->clientBranchModel
|
||||
->select('*')
|
||||
@ -2213,7 +2219,7 @@ class ClientController extends AdminController
|
||||
|
||||
CASE
|
||||
WHEN client_policy.inception_type = 1 THEN "File Upload"
|
||||
WHEN client_policy.inception_type = 2 THEN "Enrollment"
|
||||
WHEN client_policy.inception_type = 2 THEN "Enrolment"
|
||||
ELSE "n/a"
|
||||
END as inception_type,
|
||||
|
||||
@ -2822,4 +2828,38 @@ class ClientController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function removeRackRate($rack_rate_name = null, $client_policy_id = null)
|
||||
{
|
||||
$this->myLogger->logme('error', 'Rack Rate Remove function called');
|
||||
|
||||
$data = [
|
||||
'updated_by' => get_session_userid(),
|
||||
'is_active' => 0
|
||||
];
|
||||
|
||||
$rackRateData = $this->policyPremium2Model
|
||||
->where('rack_rate_name', $rack_rate_name)
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('is_active',1)
|
||||
->countAllResults();
|
||||
|
||||
if($rackRateData > 0){
|
||||
$update = $this->policyPremium2Model
|
||||
->where('rack_rate_name', $rack_rate_name)
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->set($data)->update();
|
||||
|
||||
if ($update) {
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Rack Rate removed successfully', 'rr_count' => $rackRateData], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy', 'rr_count' => $rackRateData], 200);
|
||||
}
|
||||
}else{
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Rack Rate not available', 'rr_count' => $rackRateData], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,6 +6,7 @@ use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
@ -13,6 +14,10 @@ use App\Models\MessageModel;
|
||||
use App\Models\UserMessageModel;
|
||||
use App\Models\ClientModel;
|
||||
|
||||
use App\Models\JobModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Controllers\PendingActionsContrller;
|
||||
|
||||
class DashboardController extends AdminController
|
||||
@ -22,6 +27,10 @@ class DashboardController extends AdminController
|
||||
protected $messageModel;
|
||||
protected $clientModel;
|
||||
protected $userMessageModel;
|
||||
protected $clientPolicyModel;
|
||||
protected $notificationModel;
|
||||
protected $employeePolicyModel;
|
||||
|
||||
protected $myLogger;
|
||||
|
||||
public function __construct()
|
||||
@ -29,29 +38,37 @@ class DashboardController extends AdminController
|
||||
set_session_context('Dashboard');
|
||||
$this->messageModel = new MessageModel();
|
||||
$this->userMessageModel = new UserMessageModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
$this->clientModel = new ClientModel();
|
||||
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
|
||||
$data = [];
|
||||
|
||||
$results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name,
|
||||
client_branch.id as client_branch_id, client_branch.branch_name,
|
||||
client_branch.branch_code, employees.id as employee_id,
|
||||
employees.name as employee_name, employees.relationship,
|
||||
employees.emp_code, employees.emp_status, auth_history.user_type, client_policy.policy_type_id, client_policy.id as client_policy_id')
|
||||
->join('client_branch', 'clients.id = client_branch.client_id', 'left')
|
||||
->join('client_policy', 'client_branch.id = client_policy.client_branch_id', 'left')
|
||||
->join('employees', 'client_branch.id = employees.client_branch_id', 'left')
|
||||
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
||||
->findAll();
|
||||
|
||||
$pendingActionsController = new PendingActionsController;
|
||||
$pendingActionsData = $pendingActionsController->getPendingActionsForDashBoard();
|
||||
|
||||
$results = $this->clientModel->select('clients.id as client_id, clients.client_name, clients.short_name,
|
||||
client_branch.id as client_branch_id, client_branch.branch_name,
|
||||
client_branch.branch_code, employees.id as employee_id,
|
||||
employees.name as employee_name, employees.relationship,
|
||||
employees.emp_code, employees.emp_status, auth_history.user_type')
|
||||
->join('client_branch', 'clients.id = client_branch.client_id', 'left')
|
||||
->join('employees', 'client_branch.id = employees.client_branch_id', 'left')
|
||||
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
|
||||
->findAll();
|
||||
|
||||
$groupedData = [];
|
||||
$employeeId = '';
|
||||
|
||||
foreach ($results as $row) {
|
||||
$clientId = $row['client_id'];
|
||||
$clientName = $row['client_name'];
|
||||
@ -59,6 +76,10 @@ class DashboardController extends AdminController
|
||||
$branchId = $row['client_branch_id'];
|
||||
$branchName = $row['branch_name'];
|
||||
$branchCode = $row['branch_code'];
|
||||
|
||||
$clientPolicyId = $row['client_policy_id'];
|
||||
$policyTypeId = $row['policy_type_id'];
|
||||
$employeeId = '';
|
||||
if ($employeeId != $row['employee_id']) {
|
||||
$employeeId = $row['employee_id'];
|
||||
} else {
|
||||
@ -88,12 +109,23 @@ class DashboardController extends AdminController
|
||||
'branch_code' => $branchCode,
|
||||
'emp_login' => 0,
|
||||
'emp_enroll' => 0,
|
||||
'client_policies' => [],
|
||||
'employees' => []
|
||||
];
|
||||
}
|
||||
if ($employeeId !== null && $employeeRelationship == 'Self') {
|
||||
// Append employee info to the branch's employees list
|
||||
$groupedData[$clientId]['branches'][$branchId]['employees'][] = [
|
||||
|
||||
// Add the client policy to the branch's policies list if it exists, not already added, and policyTypeId is not equal to 1
|
||||
if ($clientPolicyId !== null && $policyTypeId != 1 && !in_array(['client_policy_id' => $clientPolicyId, 'policy_type_id' => $policyTypeId], $groupedData[$clientId]['branches'][$branchId]['client_policies'])) {
|
||||
$groupedData[$clientId]['branches'][$branchId]['client_policies'][] = [
|
||||
'client_policy_id' => $clientPolicyId,
|
||||
'policy_type_id' => $policyTypeId
|
||||
];
|
||||
}
|
||||
|
||||
// Append employee error to the branch's employees list if relationship is 'Self' and not already added
|
||||
$employeeKey = $employeeId . '-' . $employeeName; // unique key to identify an employee
|
||||
if ($employeeId !== null && $employeeRelationship == 'Self' && !isset($groupedData[$clientId]['branches'][$branchId]['employees'][$employeeKey])) {
|
||||
$groupedData[$clientId]['branches'][$branchId]['employees'][$employeeKey] = [
|
||||
'employee_id' => $employeeId,
|
||||
'employee_name' => $employeeName,
|
||||
'relationship' => $employeeRelationship,
|
||||
@ -110,22 +142,29 @@ class DashboardController extends AdminController
|
||||
$groupedData[$clientId]['branches'][$branchId]['emp_enroll']++;
|
||||
}
|
||||
}
|
||||
$employeeId = $row['employee_id'];
|
||||
}
|
||||
|
||||
// Re-index the arrays to match the expected structure
|
||||
foreach ($groupedData as &$client) {
|
||||
foreach ($client['branches'] as &$branch) {
|
||||
$branch['employees'] = array_values($branch['employees']);
|
||||
}
|
||||
$client['branches'] = array_values($client['branches']);
|
||||
}
|
||||
// echo "<pre>";
|
||||
|
||||
$data['client_branch_emp_list'] = $groupedData;
|
||||
$session = \Config\Services::session();
|
||||
$session->set('enrollment_data', json_encode($data));
|
||||
// echo "<pre>";
|
||||
$data['pendingActionsData'] = $pendingActionsData;
|
||||
// print_r($data);die;
|
||||
|
||||
|
||||
echo view('layout/header');
|
||||
echo view('DashBoard', $data);
|
||||
echo view('layout/footer');
|
||||
}
|
||||
|
||||
|
||||
public function getDashboardNotifications()
|
||||
{
|
||||
@ -154,6 +193,62 @@ class DashboardController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function updatePolicyEnrollmentStatus()
|
||||
{
|
||||
$clientModel = new ClientModel();
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$notificationModel = new NotificationModel();
|
||||
$employeePolicyModel = new EmployeePolicyModel();
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
|
||||
// $myLogger->logme('error', 'enrollment_status function called');
|
||||
|
||||
$client_policy_data = $clientPolicyModel->getPolicyDetailsForRemainder();
|
||||
$myLogger->logme('error', 'Fetched client policy data');
|
||||
|
||||
// dd($client_policy_data);
|
||||
|
||||
$currentDate = date('d');
|
||||
// $myLogger->logme('error', 'Current date: ' . $currentDate);
|
||||
|
||||
// Update policy status based on start and end dates
|
||||
foreach ($client_policy_data as $client_policy) {
|
||||
|
||||
$id = $client_policy['id'];
|
||||
$openDate = date('d', strtotime($client_policy['open_date']));
|
||||
$closeDate = date('d', strtotime($client_policy['close_date']));
|
||||
|
||||
// $myLogger->logme('error', 'Processing client policy ID: ' . $id);
|
||||
// $myLogger->logme('error', 'Open date: ' . $openDate . ', Close date: ' . $closeDate);
|
||||
|
||||
if ($currentDate == $openDate) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
||||
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to open for enrollment.');
|
||||
}
|
||||
|
||||
if ($closeDate < $currentDate) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
||||
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to close for enrollment.');
|
||||
}
|
||||
}
|
||||
|
||||
// Mail send function
|
||||
// $myLogger->logme('error', 'Calling sendRemainderMail function');
|
||||
if( $currentDate == date('d', strtotime($client_policy['reminder_date']))){
|
||||
$result = $this->sendRemainderMail($client_policy_data);
|
||||
}else{
|
||||
$result = false;
|
||||
}
|
||||
|
||||
// $myLogger->logme('error', 'enrollment_status function completed');
|
||||
if($result){
|
||||
return json_encode(['status' => true, 'message' => 'Mail send successfully']);
|
||||
}else{
|
||||
return json_encode(['status' => false, 'message' => 'There is no data to send']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function featch_dashboard_data($type)
|
||||
{
|
||||
$pendingActionsController = new PendingActionsController;
|
||||
@ -191,4 +286,128 @@ class DashboardController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function sendRemainderMail($client_policy_data)
|
||||
{
|
||||
// $this->myLogger->logme('error', 'sendRemainderMail function called');
|
||||
|
||||
$reminder_whole_mail = [];
|
||||
|
||||
foreach ($client_policy_data as $client_policy) {
|
||||
|
||||
// Fetch client data
|
||||
$client_data = $this->clientModel->find($client_policy['client_id']);
|
||||
|
||||
// Fetch notification settings
|
||||
$notification_data = $this->notificationModel
|
||||
->where('client_id', $client_policy['client_id'])
|
||||
->where('template_name', 'member_reminder_mail')
|
||||
->first();
|
||||
|
||||
// $this->myLogger->logme('error', 'Notification data fetched: ' . json_encode($notification_data));
|
||||
|
||||
// Check if notification should be sent
|
||||
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
|
||||
$this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']);
|
||||
|
||||
// Fetch all employees related to the client policy
|
||||
$employees = $this->employeePolicyModel
|
||||
->select('employees.*')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->where('employee_polices.client_policy_id', $client_policy['id'])
|
||||
->where('employees.emp_status', 'draft')
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.status', 'draft')
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.relationship', 'Self')
|
||||
->findAll();
|
||||
|
||||
// Process each employee
|
||||
foreach ($employees as $employee) {
|
||||
|
||||
if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') {
|
||||
$this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']);
|
||||
|
||||
// Mail params
|
||||
$params['emp_data'] = $employee;
|
||||
$params['client_data'] = $client_data;
|
||||
$params['notification_data'] = $notification_data;
|
||||
|
||||
// Send the mail notification
|
||||
$mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
||||
$reminder_whole_mail[] = $mail_result;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'Notification not sent for client policy ID: ' . $client_policy['id']);
|
||||
}
|
||||
}
|
||||
|
||||
$this->myLogger->logme('error', 'Whole email, count: ' . $reminder_whole_mail);
|
||||
|
||||
// Process and queue bulk emails
|
||||
$temp_whole_data = [];
|
||||
$count = 0;
|
||||
|
||||
foreach ($reminder_whole_mail as $whole_index => $values) {
|
||||
foreach ($values as $index => $value) {
|
||||
$temp_whole_data[] = $value;
|
||||
$count++;
|
||||
$this->myLogger->logme('error', 'Queueing email, count: ' . $count);
|
||||
|
||||
if ($count == 20 || ($whole_index == count($reminder_whole_mail) - 1 && $index == count($values) - 1)) {
|
||||
if (!empty($temp_whole_data)) {
|
||||
Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
|
||||
$this->myLogger->logme('error', 'Added bulk mail job: ' . json_encode($temp_whole_data));
|
||||
$temp_whole_data = [];
|
||||
$count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($temp_whole_data) > 0) {
|
||||
Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
|
||||
$this->myLogger->logme('error', 'Added final bulk mail job: ' . json_encode($temp_whole_data));
|
||||
return true;
|
||||
}
|
||||
|
||||
if(count($reminder_whole_mail) > 0){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function sendManualRemainder($client_id, $client_branch_id)
|
||||
{
|
||||
$this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}");
|
||||
|
||||
$client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id, $client_branch_id);
|
||||
// print_r($client_policy_data); die;
|
||||
// print_r($this->clientPolicyModel->getLastQuery()); die;
|
||||
// $this->myLogger->logme('error', "Policy details fetched: " . json_encode($client_policy_data));
|
||||
|
||||
if ($client_policy_data) {
|
||||
$result = $this->sendRemainderMail($client_policy_data);
|
||||
$this->myLogger->logme('error', "Manual Remainder Mail sending result: " . ($result ? 'success' : 'failure'));
|
||||
|
||||
if ($result) {
|
||||
$this->myLogger->logme('error', 'Manual Remainder Mail sent successfully');
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Mail sent successfully'], 200);
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'Failed to send manual remainder mail, no data to send');
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send','message2' => 'Failed' ], 200);
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'No policy data found to send');
|
||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send', 'message2' => 'No policy data found to send'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1816,7 +1816,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
//Endorsement Correction
|
||||
|
||||
public function importCorrectionValidation($params)
|
||||
{
|
||||
|
||||
@ -2232,7 +2231,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
//Endorsement SIEnhancement
|
||||
|
||||
public function importSIEnhancementValidation($params)
|
||||
{
|
||||
$file_id = $params['file_id'];
|
||||
@ -2844,12 +2842,14 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
//Endorsement Deletion
|
||||
|
||||
public function importDeletionValidation($params)
|
||||
{
|
||||
{
|
||||
|
||||
$file_id = $params['file_id'];
|
||||
$file = $this->batchFileModel->where('id', $file_id)->first();
|
||||
|
||||
// dd($file);
|
||||
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$client_branch_id = $file['client_branch_id'];
|
||||
@ -2954,6 +2954,7 @@ class EmpDataServiceController extends BaseController
|
||||
$query = $db->query($sql);
|
||||
$endorsement_data = $query->getResultArray();
|
||||
|
||||
// dd($endorsement_data);
|
||||
|
||||
if ($endorsement_data == null || empty($endorsement_data)) {
|
||||
|
||||
@ -3255,7 +3256,7 @@ class EmpDataServiceController extends BaseController
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
// array_pop($excel_data);
|
||||
|
||||
$emp_count = count($excel_data); //excel file count
|
||||
|
||||
@ -3279,6 +3280,7 @@ class EmpDataServiceController extends BaseController
|
||||
$fetch_data = [
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'client_id' => $client_id,
|
||||
'emp_name' => $emp_name,
|
||||
'emp_code' => $emp_code
|
||||
];
|
||||
@ -3289,8 +3291,8 @@ class EmpDataServiceController extends BaseController
|
||||
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
||||
|
||||
$employee_policy_table_primaryKey[] = $result['emp_policy_primarykey']; //for cash deposite
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status'], 'is_active' => 0);
|
||||
$employees_table_data[] = array('id' => $result['employees_primarykey'], 'emp_status' => $result['status'], 'is_active' => 0);
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status']);
|
||||
$employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
||||
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
||||
}
|
||||
|
||||
@ -3843,7 +3845,7 @@ class EmpDataServiceController extends BaseController
|
||||
FROM employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
WHERE employees.unit = '$unit'
|
||||
AND id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
")->getRow();
|
||||
|
||||
if($amount){
|
||||
@ -3903,7 +3905,7 @@ class EmpDataServiceController extends BaseController
|
||||
FROM employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
WHERE employees.unit = '$unit'
|
||||
AND id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
AND employee_polices.id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||
")->getRow();
|
||||
|
||||
if($amount){
|
||||
|
||||
@ -98,6 +98,7 @@ class EmployeeController extends AdminController
|
||||
emp_name : $filterData['emp_name'],
|
||||
status : $filterData['status'],
|
||||
);
|
||||
// dd($this->employeePolicyModel->getLastQuery());
|
||||
|
||||
$data['getData'] = $filterData;
|
||||
}
|
||||
@ -162,7 +163,7 @@ class EmployeeController extends AdminController
|
||||
// dd($res);
|
||||
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '38']);
|
||||
// $res = $empServiceController->employeeDisembark(['file_id' => '586']);
|
||||
// dd($res);
|
||||
// $existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: '2');
|
||||
// dd($existing_famility_details);
|
||||
@ -191,6 +192,7 @@ class EmployeeController extends AdminController
|
||||
// }
|
||||
|
||||
if ($this->request->getMethod() == 'post') {
|
||||
|
||||
//validate uploaded file
|
||||
$filename = '';
|
||||
$validated = $this->validate([
|
||||
@ -254,7 +256,7 @@ class EmployeeController extends AdminController
|
||||
//for TPA/insurer upload
|
||||
$data['events'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
|
||||
//for inception upload
|
||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addtion' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrollment'];
|
||||
$data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addtion' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement','enrollment' => 'Enrolment'];
|
||||
|
||||
$data['import_or_export'] = ['import' => 'Import', 'export' => 'Export'];
|
||||
$data['insurer_or_tpa'] = ['insurer' => 'Insurer', 'tpa' => 'TPA'];
|
||||
@ -1163,21 +1165,8 @@ class EmployeeController extends AdminController
|
||||
|
||||
// $this->loadLayout('ecard_template/default_ecard');
|
||||
|
||||
$data = [
|
||||
'employeeIds' => [6,8,10],
|
||||
'client_id' => 12,
|
||||
'client_policy_id' => 12,
|
||||
'client_branch_id' => 1,
|
||||
'cd_ac_no' => '34567834567892',
|
||||
'endorsement_no' => null,
|
||||
'count' => 3,
|
||||
'event_name' =>'inception',
|
||||
'policy_name' => 'new policy',
|
||||
'user_id' => 1,
|
||||
];
|
||||
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
$empData= $empDataServiceController->cashDepositCalculationForInception($data);
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
$return = $empDataServiceController->importDeletionValidation(['file_id' => 130]);
|
||||
|
||||
}
|
||||
|
||||
@ -1507,6 +1496,7 @@ class EmployeeController extends AdminController
|
||||
|
||||
public function testRackRate()
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
if ($this->request->getMethod() == 'get') {
|
||||
$filterData = $this->request->getGet('client_policy_id');
|
||||
//just load UI only
|
||||
@ -1557,27 +1547,119 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
// print_r($family_details);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200);
|
||||
// return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200);
|
||||
//get policy details
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($file['client_id'],$file['policy_id']);
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id);
|
||||
$policy_details = (array)$policy_details[0];
|
||||
// ~dd($policy_details[0]->policy_start_date);
|
||||
//get rack rates
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($policy_id,$client_id);
|
||||
//get file array or construnct dummy file array here
|
||||
$file = ['id' => null,'client_id' => 10,'policy_id' => 10,'action' => 'inception','client_branch_id' => 1,'created_by' => 1];
|
||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $policy_id,'action' => 'inception','client_branch_id' => $branch_id,'created_by' => 1];
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $client_id,client_branch_id: $branch_id);
|
||||
//get familiy details in inception file format array from post method
|
||||
$family_details = [
|
||||
[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, '', '', '', '', '', '', '', '', '',''],
|
||||
];
|
||||
$data = calculate_premimum_new($family_details,$policy_details,$all_rack_rates,$file);
|
||||
$data = calculate_premium_new(family_data: $family_details,policy_terms:$policy_details,slab_details:$slab_details,fileArr: $file,existing_units: $existing_units);
|
||||
|
||||
foreach($data as $key => $member )
|
||||
{
|
||||
// ~dd($member);
|
||||
if(is_array($member))
|
||||
{
|
||||
$data[$key]['policy_details']['no_of_days'] = $member['policy_details']['date_coverage'] ? (calculate_days_bw_dates($member['policy_details']['date_coverage'],$member['policy_details']['policy_end_date'])->days + 1) : '';
|
||||
}
|
||||
}
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $data], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function testCheckDependentConflict()
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
if ($this->request->getMethod() == 'get') {
|
||||
$filterData = $this->request->getGet('client_policy_id');
|
||||
//just load UI only
|
||||
$this->loadLayout('rack_rate_test');
|
||||
}
|
||||
|
||||
|
||||
if ($this->request->getMethod() == 'post') {
|
||||
$json = $this->request->getJSON();
|
||||
// return $this->respond(['dataStatus' => false, 'code' => 200, 'data' => $data], 200);
|
||||
// $data = (json_decode(json_encode($data),true));
|
||||
$client_id = $json->client_id;
|
||||
$policy_id = $json->policy_id;
|
||||
$branch_id = $json->branch_id;
|
||||
$tabledata = $json->data;
|
||||
|
||||
if(count($tabledata))
|
||||
{
|
||||
$family_details = [];
|
||||
foreach($tabledata as $key => $row)
|
||||
{
|
||||
$row = (array)$row;
|
||||
if(!$row['column12'])
|
||||
{
|
||||
|
||||
$temp[0] = $row['column1'];//sno
|
||||
$temp[1] = $row['column2'];//emp code
|
||||
$temp[2] = $row['column3'];//name
|
||||
$temp[3] = $row['column4'];//DOB
|
||||
$temp[4] = strtoupper($row['column5']);//Gender
|
||||
$temp[5] = $row['column6'];//relation
|
||||
$temp[6] = $row['column7'];//SI
|
||||
$temp[7] = $row['column8'];//DOC
|
||||
$temp[8] = '';//DOJ
|
||||
$temp[9] = $row['column9'];//BP
|
||||
$temp[10] = $row['column10'];//band
|
||||
$temp[11] = '';//designation
|
||||
$temp[12] = '';//mobile
|
||||
$temp[13] = '';//EMail
|
||||
$temp[14] = '';//CE
|
||||
$temp[15] = '';//RFE
|
||||
$temp[16] = '';//DOE
|
||||
$temp[17] = '';//Unit
|
||||
$temp[18] = $row['column11'];//unit
|
||||
$family_details[] = $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// print_r($family_details);
|
||||
// return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => $family_details], 200);
|
||||
//get policy details
|
||||
$policy_details = $this->clientPolicyModel->getPolicyDetails($client_id,$policy_id);
|
||||
$policy_terms = (array)$policy_details[0];
|
||||
// dd($policy_terms);
|
||||
$policy_terms = json_decode($policy_terms['policy_terms']);
|
||||
$policy_terms = (array) $policy_terms;// convert obj to array
|
||||
|
||||
//get file array or construnct dummy file array here
|
||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $policy_id,'action' => 'inception','client_branch_id' => $branch_id,'created_by' => 1];
|
||||
//get familiy details in inception file format array from post method
|
||||
$result = check_dependent_conflict($family_details, $policy_terms, $file['action']);
|
||||
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'data' => ['policy_terms' => $policy_terms['family_floaters'],'result' => $result] ], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function get_client_policy_list_for_remainder($client_id, $client_branch_id)
|
||||
{
|
||||
$policies = $this->clientPolicyModel
|
||||
->select('client_policy.*, policy_type.policy_type as policy_name')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->where('client_policy.client_id', $client_id)
|
||||
->where('client_policy.client_branch_id', $client_branch_id)
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('client_policy.policy_status', 1)
|
||||
->whereIn('client_policy.policy_type_id', [2, 3])
|
||||
->findAll();
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $policies], 200);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -560,7 +560,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
// Set the header for download
|
||||
$filename = $empData[0]['policy_name'].'-Enrollment.xlsx';
|
||||
$filename = $empData[0]['policy_name'].'-Enrolment.xlsx';
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="' . $filename . '"');
|
||||
header('Cache-Control: max-age=0');
|
||||
|
||||
@ -906,8 +906,8 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
|
||||
//proceed next data level validation in JOB queue
|
||||
// $job_details = new Jobs();
|
||||
// $r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||
// $jobWorker = new JobWorker();
|
||||
// JobWorker::processJob($r);
|
||||
|
||||
@ -1024,7 +1024,7 @@ class EmployeeServiceController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
if(($policy_details['base_policy'] == null || $policy_details['base_policy'] == 0 && ($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment')) || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
||||
if(($file['action'] == 'inception' || $file['action'] == 'missed_inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment') || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms) && ($policy_details['base_policy'] == null || $policy_details['base_policy'] == 0)) // 3 is GMC parents dep addon)
|
||||
{
|
||||
$res = check_self_available_in_family($family,$file['action']);
|
||||
if(!$res['is_self_found'])
|
||||
@ -1248,12 +1248,11 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(client_id: $client_id,client_policy_id: $client_policy_id,emp_status: ['enrolled','draft'],policy_status:['enrolled','draft']);
|
||||
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||
|
||||
|
||||
// $file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception'];
|
||||
$file = ['id' => null,'client_id' => $client_id,'policy_id' => $client_policy_id,'action' => 'inception','created_by' => get_session_userid(),'client_branch_id' => $params['client_branch_id']];
|
||||
|
||||
//get existing units in the current branch
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||
// dd($this->employeeModel->getLastQuery());
|
||||
// Kint::dump($existing_famility_details);die();
|
||||
$employee_data_group_by_family = data_group_by_family($existing_famility_details,$data_source = 'db');
|
||||
@ -1273,7 +1272,7 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
|
||||
// die();
|
||||
return (($employee_data_group_by_family));
|
||||
return (count($employee_data_group_by_family));
|
||||
|
||||
}
|
||||
|
||||
@ -1500,14 +1499,14 @@ class EmployeeServiceController extends AdminController
|
||||
//get applicable slab rate for current member relation
|
||||
$pre_rack_rate_name = '';
|
||||
$applicable_rack_rate_name = '';
|
||||
$applicable_rack_rate_master = '';
|
||||
$applicable_rack_rate_master = [];
|
||||
foreach ($slab_details['slab_rates'] as $skey => $slab_value)
|
||||
{
|
||||
if($pre_rack_rate_name != $slab_value['rack_rate_name'])
|
||||
{
|
||||
$pre_rack_rate_name = $slab_value['rack_rate_name'];
|
||||
$rack_rate_json = json_decode($slab_value['additional_relationship']);
|
||||
if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != NA)
|
||||
if(in_array(strtolower($employee['relationship']), $rack_rate_json) && $rack_rate_json[ strtolower($employee['relationship']) ] != 0 && $rack_rate_json[ strtolower($employee['relationship']) ] != 'NA')
|
||||
{
|
||||
$applicable_rack_rate_name = $slab_value['rack_rate_name'];
|
||||
$applicable_rack_rate_master = $slab_value['grid_master'];
|
||||
|
||||
@ -3,14 +3,10 @@
|
||||
namespace App\Controllers;
|
||||
|
||||
|
||||
|
||||
|
||||
use App\Models\JobModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
|
||||
use App\Models\FileModel;
|
||||
class JobWorker extends AdminController
|
||||
{
|
||||
const STATUS_DONE = 'done';
|
||||
@ -292,23 +288,24 @@ class JobWorker extends AdminController
|
||||
try
|
||||
{
|
||||
$response = $jobHandler($payload,$job->id);
|
||||
$job_status = self::STATUS_DONE;
|
||||
}
|
||||
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()];
|
||||
$response = ['file_name' => $e->getFile(),'error' => $e->getMessage(),'line_no' => $e->getLine(),'info' => $e->getTraceAsString(),'scope' => 'task failed'];
|
||||
}
|
||||
|
||||
$runtime = microtime(true) - $start;
|
||||
$job_status = self::STATUS_DONE;
|
||||
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
//die();
|
||||
$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()];
|
||||
$response = ['file_name' => $e->getFile(),'error' => $e->getMessage(),'line_no' => $e->getLine(),'info' => $e->getTraceAsString(),'scope' => 'worker failed'];
|
||||
}
|
||||
|
||||
$db->query("UPDATE jobs SET status=?, run_time=?, response=? WHERE id=? AND uuid=?", [
|
||||
@ -318,6 +315,21 @@ class JobWorker extends AdminController
|
||||
$job->id,$job->uuid
|
||||
]);
|
||||
|
||||
//update file status if this job is directly linked with a file id
|
||||
|
||||
if($job_status == self::STATUS_FAILED)
|
||||
{
|
||||
//get file from job payload
|
||||
if(array_key_exists('file_id', $payload) && $payload['file_id'] != NULL && $payload['file_id'] != "" && is_numeric($payload['file_id']) && count($payload) == 1)
|
||||
{
|
||||
$fileModel = new FileModel();
|
||||
$fileModel->where('id', $payload['file_id'])
|
||||
->set(['status' => 'failed','reason' => json_encode(['error_type' => 0,'error_summary' => [0],'error_data' => 'System Error, please contact Admin/Support team']) ])
|
||||
->update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// echo "Job $job->id $job_status. Response - $response \n";
|
||||
// echo "Job $job->id $job_status \n";
|
||||
SELF::streamOutput("Job $job->id $job_status \n");
|
||||
@ -330,70 +342,7 @@ class JobWorker extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public static function enrollment_status() {
|
||||
$clientModel = new ClientModel();
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$notificationModel = new NotificationModel();
|
||||
$employeePolicyModel = new EmployeePolicyModel();
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
|
||||
$client_policy_data = $clientPolicyModel->where('is_active', 1)
|
||||
->where('policy_status', 1)
|
||||
->where('inception_type', 2)
|
||||
->findAll();
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
// Update policy status based on start and end dates
|
||||
foreach ($client_policy_data as $client_policy) {
|
||||
$id = $client_policy['id'];
|
||||
|
||||
if ($currentDate == $client_policy['policy_start_date']) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
||||
}
|
||||
if ($client_policy['policy_end_date'] < $currentDate) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
$reminder_whole_mail = [];
|
||||
foreach ($client_policy_data as $client_policy) {
|
||||
$employee = $employeePolicyModel->select('employees.*')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->where('employee_polices.client_policy_id', $client_policy['id'])
|
||||
->first();
|
||||
$client_data = $clientModel->find($client_policy['client_id']);
|
||||
$notification_data = $notificationModel->where('client_id', $client_policy['client_id'])
|
||||
->where('template_name', 'member_reminder_mail')
|
||||
->first();
|
||||
|
||||
if ($notification_data && $notification_data['enabled'] == 1 && $currentDate == $client_policy['reminder_date']) {
|
||||
$params['emp_data'] = $employee;
|
||||
$params['client_data'] = $client_data;
|
||||
$params['notification_data'] = $notification_data;
|
||||
$reminder_whole_mail[] = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||
|
||||
}
|
||||
}
|
||||
// Process and queue bulk emails
|
||||
$temp_whole_data = [];
|
||||
$count = 0;
|
||||
foreach ($reminder_whole_mail as $whole_index => $values) {
|
||||
foreach ($values as $index => $value) {
|
||||
$temp_whole_data[] = $value;
|
||||
$count++;
|
||||
|
||||
if ($count == 20 || ($whole_index == count($reminder_whole_mail) - 1 && $index == count($values) - 1)) {
|
||||
if (!empty($temp_whole_data)) {
|
||||
Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
|
||||
$temp_whole_data = [];
|
||||
$count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ use App\Models\StateModel;
|
||||
use App\Models\PolicyTypeModel;
|
||||
use App\Models\CDMasterModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
use App\Models\InsurerExcelExportTemplateModel;
|
||||
|
||||
class MasterController extends AdminController
|
||||
{
|
||||
@ -52,6 +53,7 @@ class MasterController extends AdminController
|
||||
protected $CDMasterModel;
|
||||
protected $clientModel;
|
||||
protected $clientDepositModel;
|
||||
protected $insurerTemplateModel;
|
||||
|
||||
|
||||
|
||||
@ -60,7 +62,7 @@ class MasterController extends AdminController
|
||||
set_session_context('Master');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
$this->insurerModel = new ClientModel();
|
||||
// $this->insurerModel = new ClientModel();
|
||||
$this->userModel = new UserModel();
|
||||
// $this->insurerBranchModel = new ClientBranchModel();
|
||||
$this->insurerKYCDocsModel = new ClientKYCDocsModel();
|
||||
@ -79,6 +81,7 @@ class MasterController extends AdminController
|
||||
$this->CDMasterModel = new CDMasterModel();
|
||||
$this->clientModel = new ClientModel();
|
||||
$this->clientDepositModel = new ClientDepositModel();
|
||||
$this->insurerTemplateModel = new InsurerExcelExportTemplateModel();
|
||||
|
||||
}
|
||||
|
||||
@ -150,6 +153,7 @@ class MasterController extends AdminController
|
||||
|
||||
$editData['insurer'] = $this->insurerModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['insurer_templete_count'] = $this->insurerTemplateModel->where(['insurer_id' => $id, 'is_active' => 1])->countAllResults();
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
@ -209,7 +213,8 @@ class MasterController extends AdminController
|
||||
$insert = $this->insurerModel->insert($data);
|
||||
if($insert){
|
||||
$insurer_data = $this->insurerModel->where(['id' => $insert, 'is_active' => 1])->first();
|
||||
echo json_encode(array("status" => true , 'data' => $insurer_data));
|
||||
$insurer_templete_count = $this->insurerTemplateModel->where(['insurer_id' => $insert, 'is_active' => 1])->countAllResults();
|
||||
echo json_encode(array("status" => true , 'data' => $insurer_data, 'templete_count' => $insurer_templete_count));
|
||||
}else{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
@ -337,6 +342,44 @@ class MasterController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function getInsurerByExportTemplete()
|
||||
{
|
||||
$insurer_data = $this->insurerModel
|
||||
->select('insurers.name as insurer_name, insurers.id, insurers.is_multi_event')
|
||||
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = insurers.id')
|
||||
->groupBy('insurers.id')
|
||||
->findAll();
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $insurer_data], 200);
|
||||
}
|
||||
|
||||
public function copyInsurerTemplete($existing_insurer_id, $copy_insurer_id)
|
||||
{
|
||||
$insurer_templete_data = $this->insurerTemplateModel->where('insurer_id', $existing_insurer_id)->findAll();
|
||||
$existing_insurer_templete_data = $this->insurerTemplateModel->where('insurer_id', $copy_insurer_id)->delete();
|
||||
|
||||
$data_to_insert = [];
|
||||
foreach ($insurer_templete_data as $value) {
|
||||
$data_to_insert[] = [
|
||||
"insurer_id" => $copy_insurer_id,
|
||||
"policy_type_id" => $value['policy_type_id'],
|
||||
"event_name" => $value['event_name'],
|
||||
"type_name" => $value['type_name'],
|
||||
"jsoncolumns" => $value['jsoncolumns'],
|
||||
"created_by" => get_session_user(),
|
||||
"is_active" => 1,
|
||||
];
|
||||
}
|
||||
|
||||
$insert_result = $this->insurerTemplateModel->insertBatch($data_to_insert);
|
||||
if($insert_result){
|
||||
return $this->respond(['status' => true, 'message' => 'Template added successfully', $insurer_templete_data]);
|
||||
}else{
|
||||
return $this->respond(['status' => true, 'message' => 'Failed to add template', $insurer_templete_data]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// Insurer Ends
|
||||
|
||||
|
||||
@ -1086,6 +1129,7 @@ class MasterController extends AdminController
|
||||
'insurer_id' => $data['insurer_id'],
|
||||
'description' => 'opening Amount',
|
||||
'transaction_type' => 'Credit',
|
||||
'event_name' => null,
|
||||
'updated_by' => 1,
|
||||
];
|
||||
|
||||
|
||||
@ -227,11 +227,14 @@ if(!function_exists('check_si'))
|
||||
{
|
||||
function check_si($row,$policy_details,$slab_details)
|
||||
{
|
||||
// Kint::dump($policy_details);
|
||||
$policy_details = (array)$policy_details[0];
|
||||
// dd($policy_details);
|
||||
$return_array = array('status' => true,'error' => '');
|
||||
$is_si_found = false;
|
||||
$is_age_slab_found = false;
|
||||
|
||||
if($policy_details[0]['policy_type_id'] == 1 && $slab_details[0]['policy_grid_id'] == 1 && $slab_details[0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
||||
if($policy_details['policy_type_id'] == 1 && $slab_details[0]['policy_grid_id'] == 1 && $slab_details[0]['si_or_bp'] == 2) // GPA && grid type 1 for GPA && sub type is basic pay
|
||||
{
|
||||
$is_si_found = true;
|
||||
$is_age_slab_found = true;
|
||||
@ -1008,7 +1011,7 @@ if (!function_exists('transform_excel_data_to_db'))
|
||||
// $policy['reason_for_exit'] = $memArr[17];
|
||||
|
||||
$policy['client_policy_id'] = $actionArr['policy_id'];
|
||||
$policy['date_coverage'] = isset($memArr[7]) ? convert_string_to_date($memArr[7],'Y-m-d') : NULL;
|
||||
$policy['date_coverage'] = isset($memArr[7]) && $memArr[7] != '' ? convert_string_to_date($memArr[7],'Y-m-d') : NULL;
|
||||
$policy['policy_end_date'] = null;
|
||||
$policy['days'] = null;
|
||||
$policy['premium'] = null;
|
||||
@ -1986,13 +1989,14 @@ if(!function_exists('check_unit'))
|
||||
{
|
||||
function check_unit($row,$existing_units)
|
||||
{
|
||||
|
||||
$temp = $row[18];
|
||||
$temp = empty($row[18]) ? $row[18] : trim($row[18]);
|
||||
|
||||
if(in_array($row['current_action'], ['I','A','MI']) )
|
||||
{
|
||||
if(count($existing_units) == 1)
|
||||
{
|
||||
if(empty(trim($row[18])))
|
||||
if(empty($temp))
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
@ -2000,11 +2004,11 @@ if(!function_exists('check_unit'))
|
||||
|
||||
if(strtolower($row[5]) == 'self')
|
||||
{
|
||||
if(in_array(trim($row[18]),$existing_units)) //18 is unit name
|
||||
if(in_array($temp,$existing_units)) //18 is unit name
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
else if(!empty(trim($row[18])))
|
||||
else if(!empty($temp))
|
||||
{
|
||||
return array('status' => false,'error' => 'wrong unit name');
|
||||
}
|
||||
@ -2015,13 +2019,13 @@ if(!function_exists('check_unit'))
|
||||
}
|
||||
else
|
||||
{
|
||||
if(empty(trim($row[18])))
|
||||
if(empty($temp))
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(in_array(trim($row[18]),$existing_units)) //18 is unit name
|
||||
if(in_array($temp,$existing_units)) //18 is unit name
|
||||
{
|
||||
return array('status' => true);
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ class ClientModel extends Model
|
||||
$client['policies'] = $clientPolicies;
|
||||
|
||||
$clientBranchModel = new ClientBranchModel();
|
||||
$clientBranchs = $clientBranchModel->select(['client_branch.id','client_branch.branch_name','client_branch.branch_code', 'client_branch.client_id'])
|
||||
$clientBranchs = $clientBranchModel->select(['client_branch.id','client_branch.branch_name','client_branch.branch_code', 'client_branch.client_id','client_branch.units'])
|
||||
->where('client_branch.client_id',$client['id'])
|
||||
->findAll();
|
||||
|
||||
|
||||
@ -20,6 +20,9 @@ class ClientPolicyModel extends Model
|
||||
"policy_start_date",
|
||||
"policy_end_date",
|
||||
"reminder_date",
|
||||
"open_date",
|
||||
"close_date",
|
||||
"close_date",
|
||||
"insured",
|
||||
"no_of_employees",
|
||||
"no_of_lives",
|
||||
@ -385,5 +388,26 @@ public function getCliendDataForExcelFileName($client_policy_id){
|
||||
|
||||
}
|
||||
|
||||
//for this using in CRONE JOB
|
||||
public function getPolicyDetailsForRemainder($client_id = null, $branch_id = null)
|
||||
{
|
||||
$builder = $this->table('client_policy')
|
||||
->where('client_policy.is_addon', 1)
|
||||
->where('client_policy.open_for_enrollment', 1)
|
||||
->where('client_policy.inception_type', 2)
|
||||
->where('client_policy.is_active', 1)
|
||||
->where('client_policy.policy_status', 1)
|
||||
->whereIn('client_policy.policy_type_id', [2, 3]);
|
||||
|
||||
if ($client_id && $branch_id) {
|
||||
$builder->where('client_policy.client_id', $client_id)
|
||||
->where('client_policy.client_branch_id', $branch_id);
|
||||
}
|
||||
|
||||
return $builder->get()->getResultArray();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -109,7 +109,7 @@ class EmployeeModel extends Model
|
||||
$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','employees.unit','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')
|
||||
->join('policies', 'policies.id = client_policy.policy_id','left')
|
||||
->where('employees.is_active',1)
|
||||
->when($client_policy_id, function($query) use ($client_policy_id){
|
||||
return $query->where('employee_polices.client_policy_id',$client_policy_id);
|
||||
|
||||
@ -81,7 +81,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
$result = $this->select([
|
||||
'employee_polices.*',
|
||||
'pm.name as policy_name',
|
||||
'policy_type.policy_type as policy_name',
|
||||
'im.short_name as insurer_short_name',
|
||||
'ib.branch_name as insurer_branch_name',
|
||||
'ib.branch_code as insurer_branch_code',
|
||||
@ -109,8 +109,8 @@ class EmployeePolicyModel extends Model
|
||||
])
|
||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
|
||||
->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master
|
||||
->join('policy_type', 'policy_type.id = pm.policy_type_id')
|
||||
->join('policies pm', 'cp.policy_id = pm.id', 'left') //pm - policy master
|
||||
->join('policy_type', 'policy_type.id = cp.policy_type_id')
|
||||
->join('insurers im', 'cp.insurer_id = im.id') //im - insurer master
|
||||
->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurer branch
|
||||
->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master
|
||||
@ -511,6 +511,7 @@ class EmployeePolicyModel extends Model
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
employees.emp_type as emp_type,
|
||||
'D' as event_type_data,
|
||||
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||
|
||||
employees.doj AS emp_doj,
|
||||
employees.mobile AS emp_mobile,
|
||||
@ -604,6 +605,7 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
$client_policy_id = $fetch_data['client_policy_id'];
|
||||
$client_branch_id = $fetch_data['client_branch_id'];
|
||||
$client_id = $fetch_data['client_id'];
|
||||
$emp_name = $fetch_data['emp_name'];
|
||||
$emp_code = $fetch_data['emp_code'];
|
||||
|
||||
@ -614,6 +616,18 @@ class EmployeePolicyModel extends Model
|
||||
ep.id as emp_policy_primarykey,
|
||||
e.id as employees_primarykey,
|
||||
ee.group_key,
|
||||
(
|
||||
SELECT employees.id
|
||||
FROM employees
|
||||
WHERE client_id = '$client_id'
|
||||
AND client_branch_id = '$client_branch_id'
|
||||
AND is_active = 1
|
||||
AND emp_status = 'active'
|
||||
AND emp_code = '$emp_code'
|
||||
AND name = '$emp_name'
|
||||
LIMIT 1
|
||||
) AS employees_id,
|
||||
|
||||
MAX(
|
||||
CASE
|
||||
WHEN ee.field_name = 'date_of_exit' THEN ee.new_value
|
||||
|
||||
@ -59,7 +59,7 @@ body {
|
||||
<li class="nav-item">
|
||||
<a href="#enrollment-dash-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="enrollemnt_tab">
|
||||
<span class="mr-1"><i class="fa fa-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Enrollment</span>
|
||||
<span class="d-none d-sm-inline-block">Enrolment</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -129,7 +129,7 @@
|
||||
<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> Enrolment Status </label></th>
|
||||
<th class="font-weight-medium"><label> Policy Status </label></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -58,7 +58,7 @@ table.dataTable thead th {
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a class="dropdown-item" href="<?= base_url("client/list/"); ?><?= $row->id;?>"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>CD Tranctions</a>
|
||||
<a class="dropdown-item" href="<?= base_url("client/deposit/{$row->id}"); ?>"><i class="mdi mdi-cash mr-2 text-muted font-18 vertical-middle"></i>CD Transactions</a>
|
||||
<?php if(get_role_id() != 3 && get_role_id() != 4) { ?>
|
||||
<a class="dropdown-item" data-id="<?= $row->id;?>" onclick="removeClient(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<?php } ?>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<th>Client Branch</th>
|
||||
<th>TPA</th>
|
||||
<th>Date</th>
|
||||
<th>Enrollment Status</th>
|
||||
<th>Enrolment Status</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -112,10 +112,7 @@
|
||||
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Reminder Date " name="reminder_date" id="reminder_date" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4" id="policy_status_field">
|
||||
<label for="policy_status">Policy Status</label>
|
||||
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
||||
@ -146,7 +143,18 @@
|
||||
<label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Enable
|
||||
Employee Enrolment Process</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label for="open_date">Open Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter OpenS Date " name="open_date" id="open_date" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="close_date">Close Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Close Date " name="close_date" id="close_date" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Reminder Date " name="reminder_date" id="reminder_date" >
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||
<input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked>
|
||||
@ -180,16 +188,16 @@
|
||||
<script>
|
||||
|
||||
$('#inception_type').change(function () {
|
||||
var start_data = $('#start_date').parent();
|
||||
var end_data = $('#end_date').parent();
|
||||
var open_data = $('#open_date').parent();
|
||||
var close_data = $('#close_date').parent();
|
||||
var reminder_data = $('#reminder_date').parent();
|
||||
if($(this).prop('checked')){
|
||||
$(start_data).show();
|
||||
$(end_data).show();
|
||||
$(open_data).show();
|
||||
$(close_data).show();
|
||||
$(reminder_data).show();
|
||||
}else{
|
||||
$(start_data).hide();
|
||||
$(end_data).hide();
|
||||
$(open_data).hide();
|
||||
$(close_data).hide();
|
||||
$(reminder_data).hide();
|
||||
}
|
||||
})
|
||||
@ -214,7 +222,6 @@
|
||||
// Get today's date
|
||||
var today = new Date();
|
||||
|
||||
// Initialize Flatpickr for the start date with today's date
|
||||
var startDatePicker = flatpickr("#start_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: today,
|
||||
@ -227,21 +234,42 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate the end date (today + 1 year)
|
||||
var endDate = new Date(today);
|
||||
endDate.setFullYear(endDate.getFullYear() + 1);
|
||||
endDate.setDate(endDate.getDate() - 1); // Set end date to last day of next year
|
||||
|
||||
// Initialize Flatpickr for the end date with the calculated end date
|
||||
|
||||
// Initialize Flatpickr for the start date with today's date
|
||||
var openDatePicker = flatpickr("#open_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: today,
|
||||
allowInput: false,
|
||||
onChange: function(selectedDates, dateStr, instance) {
|
||||
var closeDate = new Date(selectedDates[0]);
|
||||
closeDate.setFullYear(closeDate.getFullYear() + 1);
|
||||
closeDate.setDate(closeDate.getDate() - 1); // Set end date to last day of selected year
|
||||
closeDatePicker.setDate(closeDate);
|
||||
}
|
||||
});
|
||||
|
||||
// Calculate the end date (today + 1 year)
|
||||
var closeDate = new Date(today);
|
||||
closeDate.setFullYear(closeDate.getFullYear() + 1);
|
||||
closeDate.setDate(closeDate.getDate() - 1); // Set end date to last day of next year
|
||||
|
||||
var endDatePicker = flatpickr("#end_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: endDate,
|
||||
defaultDate: closeDate,
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
// Initialize Flatpickr for the end date with the calculated end date
|
||||
var closeDatePicker = flatpickr("#close_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: closeDate,
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
var reminderDatePicker = flatpickr("#reminder_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
defaultDate: endDate,
|
||||
defaultDate: closeDate,
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
@ -256,8 +284,9 @@
|
||||
console.log('client_policy_data',data)
|
||||
var role = data.role
|
||||
delete data.role;
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
// //console.log(item.open_for_enrollment);
|
||||
console.log('step 1');
|
||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
var subject = item.policy_type_name;
|
||||
@ -283,13 +312,13 @@
|
||||
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>'
|
||||
'" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrolment">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="' +
|
||||
'<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" data-id="' +
|
||||
item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||
|
||||
}
|
||||
@ -304,16 +333,15 @@
|
||||
|
||||
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
||||
|
||||
var role = data.role;
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
|
||||
policyTable += `
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td>${(item.open_date)} / ${(item.close_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -336,7 +364,6 @@
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -367,8 +394,10 @@
|
||||
$('#insurer').val('').change();
|
||||
$('#tpa').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#start_date').val('').change();
|
||||
$('#end_date').val('').change();
|
||||
$('#close_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()
|
||||
@ -397,8 +426,10 @@
|
||||
$('#insurer').val('').change();
|
||||
$('#tpa').val('').change();
|
||||
$('#policy_no').val('').change();
|
||||
$('#start_date').val('').change();
|
||||
$('#start_no').val('').change();
|
||||
$('#end_date').val('').change();
|
||||
$('#open_date').val('').change();
|
||||
$('#close_date').val('').change();
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
$('#base_policy_id').hide();
|
||||
$('#client_branch').val('').change();
|
||||
@ -490,8 +521,11 @@
|
||||
|
||||
$('#policy_table tr').remove();
|
||||
var policyTable = '';
|
||||
$.each(res.data, function(index, item) {
|
||||
var role = res.data.role
|
||||
delete res.data.role;
|
||||
|
||||
$.each(res.data, function(index, item) {
|
||||
console.log(item);
|
||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||
var subject = item.policy_type_name;
|
||||
@ -517,7 +551,7 @@
|
||||
if (item.open_for_enrollment == 1) {
|
||||
|
||||
enrollmentStatus =
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' +
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
|
||||
item.id + '" id="' + item.policy_id +
|
||||
'" class="btnOpenEnroll">Open</a>'
|
||||
|
||||
@ -525,7 +559,7 @@
|
||||
} else if (item.open_for_enrollment == 0) {
|
||||
|
||||
enrollmentStatus =
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' +
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
|
||||
item.id + '" id="' + item.policy_id +
|
||||
'" class="btnOpenEnroll">Closed</a>'
|
||||
|
||||
@ -545,9 +579,10 @@
|
||||
<tr>
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${policy_name_data}</td>
|
||||
<td>${item.branch_name}</td>
|
||||
<td>${item.branch_name ? item.branch_name : ' - '}</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${rearrangeDateFormat(item.policy_start_date)} / ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -556,8 +591,15 @@
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick = "removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>`;
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role !== 3 && role !== 4) {
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -571,8 +613,8 @@
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
$('#policy_no').val('');
|
||||
$('#start_date').val('');
|
||||
$('#end_date').val('');
|
||||
$('#open_date').val('');
|
||||
$('#close_date').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@ -705,6 +747,7 @@
|
||||
// get the client policy data for edit
|
||||
$('body').on('click', '.btnPolicyEdit', function() {
|
||||
|
||||
|
||||
var policy_form_action = '';
|
||||
var policy_id = $(this).attr('data-id');
|
||||
|
||||
@ -755,18 +798,25 @@
|
||||
$('#policy_PrimaryKey').val(res.data.id);
|
||||
$('#insurer_policy_id').val(res.data.policy_id);
|
||||
$('#policy_no').val(res.data.policy_no);
|
||||
$('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||
// $('#start_date').val(rearrangeDateFormat(res.data.policy_start_date));
|
||||
$('#open_date').val(rearrangeDateFormat(res.data.open_date));
|
||||
// $('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||
$('#close_date').val(rearrangeDateFormat(res.data.close_date));
|
||||
$('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date));
|
||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||
$('#gst_no').val(gst);
|
||||
$('#policy_status_field').show();
|
||||
|
||||
|
||||
if (res.data.inception_type == 2) {
|
||||
$('#inception_type').prop('checked', true);
|
||||
$('#open_date').parent().show();
|
||||
$('#close_date').parent().show();
|
||||
$('#reminder_date').parent().show();
|
||||
} else {
|
||||
$('#inception_type').prop('checked', false);
|
||||
$('#open_date').parent().hide();
|
||||
$('#close_date').parent().hide();
|
||||
$('#reminder_date').parent().hide();
|
||||
}
|
||||
|
||||
|
||||
@ -894,7 +944,7 @@
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to approve this!",
|
||||
text: "Do you want to approve this!",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
@ -932,7 +982,7 @@
|
||||
$('.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="' +
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrolment" href="#" data-id="' +
|
||||
res.client_policy_data.id +
|
||||
'" id="' + res.client_policy_data
|
||||
.policy_id +
|
||||
@ -945,7 +995,7 @@
|
||||
$('.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="' +
|
||||
'<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrolment" href="#" data-id="' +
|
||||
res.client_policy_data.id +
|
||||
'" id="' + res.client_policy_data
|
||||
.policy_id +
|
||||
@ -993,15 +1043,26 @@
|
||||
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
||||
function rearrangeDateFormat(inputDate) {
|
||||
|
||||
if (inputDate !== null) {
|
||||
console.log('inputDate', inputDate)
|
||||
// Check if inputDate is a string and not empty
|
||||
if (typeof inputDate === 'string' && inputDate.trim() !== '') {
|
||||
var dateComponents = inputDate.split("-");
|
||||
var rearrangedDate = dateComponents[2] + "-" + dateComponents[1] + "-" + dateComponents[0];
|
||||
return rearrangedDate;
|
||||
|
||||
// Check if dateComponents has the expected number of parts
|
||||
if (dateComponents.length === 3) {
|
||||
var rearrangedDate = dateComponents[2] + "-" + dateComponents[1] + "-" + dateComponents[0];
|
||||
return rearrangedDate;
|
||||
} else {
|
||||
// Handle unexpected date format
|
||||
return '00-00-0000';
|
||||
}
|
||||
} else {
|
||||
// Handle the case where inputDate is not a valid string
|
||||
return '00-00-0000';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDateStatus(inputDate, bg = false) {
|
||||
|
||||
var givenDate = new Date(inputDate);
|
||||
@ -1234,8 +1295,8 @@
|
||||
$('#insurer').val('').change();
|
||||
$('#tpa').val('').change();
|
||||
$('#policy_no').val('');
|
||||
$('#start_date').val('');
|
||||
$('#end_date').val('');
|
||||
$('#open_date').val('');
|
||||
$('#close_date').val('');
|
||||
$('#reminder_date').val('');
|
||||
$('#base_policy').val('').change();
|
||||
|
||||
@ -1341,8 +1402,8 @@
|
||||
if($('#inception_type').prop('checked')){
|
||||
|
||||
}else{
|
||||
$('#start_date').parent().hide();
|
||||
$('#end_date').parent().hide();
|
||||
$('#open_date').parent().hide();
|
||||
$('#close_date').parent().hide();
|
||||
$('#reminder_date').parent().hide();
|
||||
}
|
||||
})
|
||||
@ -1453,8 +1514,8 @@
|
||||
$('#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();
|
||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date)).change();
|
||||
// $('#open_date').val(rearrangeDateFormat(res.data.open_date)).change();
|
||||
// $('#close_date').val(rearrangeDateFormat(res.data.close_date)).change();
|
||||
}
|
||||
|
||||
},
|
||||
@ -1600,7 +1661,7 @@
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this Policy.",
|
||||
text: "Do you want to remove this Policy.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
<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">Risk ID</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>
|
||||
|
||||
@ -476,6 +476,10 @@ function fetchFileError(file_id) {
|
||||
var err_id = parseInt(key);
|
||||
var err_count = file_error_data['error_summary'][key];
|
||||
switch (err_id) {
|
||||
case 0:
|
||||
file_error_html +=
|
||||
"<strong>"+file_error_data['error_data']+"</strong>";
|
||||
break;
|
||||
case 1:
|
||||
file_error_html +=
|
||||
"<strong>Mandatory values missing</strong> <span class='badge badge-danger float-right'>" +
|
||||
@ -562,7 +566,7 @@ function fetchFileError(file_id) {
|
||||
// console.log('file_error_html_2', file_error_html)
|
||||
|
||||
}
|
||||
if (err_id != 5 && err_id != 6) {
|
||||
if (err_id != 5 && err_id != 6 && err_id != 0) {
|
||||
file_error_html += (file_error_html != "" ?
|
||||
"<a href ='<?php echo base_url()?>" +
|
||||
"employee/excel_error/" + file_id +
|
||||
|
||||
@ -9,12 +9,15 @@
|
||||
|
||||
<!-- Bootstrap JS (ensure this is included) -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.6.0/js/bootstrap.min.js"></script>
|
||||
<!-- Remove one of these -->
|
||||
|
||||
|
||||
<style>
|
||||
/* Existing CSS ... */
|
||||
|
||||
.carousel-control-next {
|
||||
right: -18px;
|
||||
}
|
||||
.carousel-control-prev {
|
||||
left: -38px;
|
||||
left: -24px;
|
||||
}
|
||||
|
||||
.status-option {
|
||||
@ -48,14 +51,14 @@
|
||||
|
||||
.scroll-item {
|
||||
flex: 0 0 auto;
|
||||
width: 33%; /* Adjust based on the number of items you want to show */
|
||||
width: 30%; /* Adjust based on the number of items you want to show */
|
||||
box-sizing: border-box;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.col-xl-3 {
|
||||
max-width: 32% !important;
|
||||
max-width: 30% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +95,7 @@
|
||||
|
||||
.carousel-item {
|
||||
height: auto; /* Adjust if needed */
|
||||
/* margin-left: 80px; */
|
||||
margin-left: 57px;
|
||||
}
|
||||
|
||||
.card {
|
||||
@ -104,9 +107,9 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.carousel-control-prev-icon, .carousel-control-next-icon {
|
||||
background-color: rgba(0,0,0,0.5); /* Change color as needed */
|
||||
}
|
||||
/* .carousel-control-prev-icon, .carousel-control-next-icon {
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
} */
|
||||
|
||||
.carousel-control-prev-icon {
|
||||
background-image: url('data:image/svg+xml;charset=utf8,%3Csvg xmlns%3D"http://www.w3.org/2000/svg" fill%3D"%23000000" viewBox%3D"0 0 8 8"%3E%3Cpath d%3D"M2.5 0L4 1.5 1.5 4 4 6.5 2.5 8 0 4 2.5 0z"/%3E%3C/svg%3E');
|
||||
@ -139,14 +142,14 @@
|
||||
<div class="tab-pane fade" id="enrollment-dash-tab">
|
||||
<div class="row visa_status_count_view">
|
||||
<div class="col-12">
|
||||
<div class="card" style="border: 0px;">
|
||||
<div class="card" style="border: 0px;height: 470px;">
|
||||
<div class="card-body status-option" id="statusContent" style="padding: 0.5rem !important;background-color: white;">
|
||||
<!-- Search Input Field -->
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<select class="form-control" name="" id="">
|
||||
<option value="">Open Enrollment</option>
|
||||
<option value="">Close Enrollment</option>
|
||||
<select class="form-control" name="" id="enrollment_status_open_close">
|
||||
<option value="open">Open Enrolment</option>
|
||||
<option value="close">Closed Enrolment</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-5"></div>
|
||||
@ -166,86 +169,86 @@
|
||||
// Start a new carousel item if needed
|
||||
if ($currentItem % $itemsPerSlide == 0) {
|
||||
if (!$isActive) echo '</div>'; // Close previous carousel item
|
||||
echo '<div class="carousel-item' . ($isActive ? ' active' : '') . '">';
|
||||
$isActive = false;
|
||||
echo '<div class="carousel-item' . ($isActive ? ' active' : '') . '">';
|
||||
$isActive = false;
|
||||
}
|
||||
if(count($branches['client_policies']) != 0){ ?>
|
||||
<!-- New Card Layout for each item -->
|
||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="<?php echo $clients['short_name']; ?>" data-branch="<?php echo $branches['branch_name']; ?>">
|
||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||
<div class="card-header add_card_background_random" >
|
||||
<div class="row">
|
||||
<div class="col-8 emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 " >
|
||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')"><?php echo isset($branches['employees']) ? count($branches['employees']) : '0'; ?></span></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100" >
|
||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;"><?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?> - <?php echo isset($branches['branch_name']) ? $branches['branch_name'] : 'N/A'; ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-3 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 text-center" >
|
||||
<p class="mb-0 text-muted">
|
||||
<span class="text-success mr-2"></span>
|
||||
<span class="text-nowrap">Emp Count</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body" >
|
||||
<input type="text" class="client_id" value="<?php echo $clients['client_id']; ?>" hidden>
|
||||
<input type="text" class="client_branch_id" value="<?php echo $branches['client_branch_id'] ?>" hidden>
|
||||
<div class="row emp-status" style="margin-top: -9px;">
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? $branches['emp_login'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||
</div>
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? count($branches['employees']) - $branches['emp_login'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row emp-status" style="margin-top: 5px;">
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? count($branches['employees']) - $branches['emp_enroll'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||
</div>
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? $branches['emp_enroll'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$currentItem++;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!-- New Card Layout for each item -->
|
||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="<?php echo $clients['short_name']; ?>" data-branch="<?php echo $branches['branch_name']; ?>">
|
||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||
<div class="card-header" >
|
||||
<div class="row">
|
||||
<div class="col-8 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 text-center" >
|
||||
<h3 class="my-2 py-1 number_css" ><span data-plugin="counterup" style="margin-left: 113px;font-size: 2.0rem;" onclick="enrollment_list(this, 'emp_count_view_click')"><?php echo isset($branches['employees']) ? count($branches['employees']) : '0'; ?></span></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<div class="w-100 text-center" >
|
||||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Branch Info" style="text-align: center;"><?php echo isset($clients['short_name']) ? $clients['short_name'] : 'N/A'; ?> - <?php echo isset($branches['branch_name']) ? $branches['branch_name'] : 'N/A'; ?></h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-3 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 text-center" >
|
||||
<p class="mb-0 text-muted">
|
||||
<span class="text-success mr-2"></span>
|
||||
<span class="text-nowrap">Emp Count</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body add_card_background_random" >
|
||||
|
||||
<input type="text" class="client_id" value="<?php echo $clients['client_id']; ?>" hidden>
|
||||
<input type="text" class="client_branch_id" value="<?php echo $branches['client_branch_id'] ?>" hidden>
|
||||
<div class="row emp-status" style="margin-top: -9px;">
|
||||
<div class="col-6 center_text emp-count-view-click" >
|
||||
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? $branches['emp_login'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||
</div>
|
||||
<div class="col-6 center_text emp-count-view-click" >
|
||||
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"><?php echo isset($branches['emp_login']) ? count($branches['employees']) - $branches['emp_login'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row emp-status" style="margin-top: -9px;">
|
||||
|
||||
<div class="col-6 center_text emp-count-view-click" >
|
||||
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? count($branches['employees']) - $branches['emp_enroll'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||
</div>
|
||||
<div class="col-6 center_text emp-count-view-click" >
|
||||
<span style="font-size: large;color: white !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')"><?php echo isset($branches['emp_enroll']) ? $branches['emp_enroll'] : '0'; ?></span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$currentItem++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($currentItem % $itemsPerSlide != 0) echo '</div>'; // Close the last carousel item
|
||||
?>
|
||||
</div>
|
||||
<a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"/></svg> <!-- <img src="<?php echo base_url()?>public/assets/images/left_arrow.png" alt="<"> -->
|
||||
<!-- <span class="carousel-control-prev-icon" aria-hidden="true"></span> -->
|
||||
<!-- <span class="sr-only">Previous</span> -->
|
||||
<i class="fas fa-angle-left"></i>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
|
||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512" style="width: 28px;"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"/></svg>
|
||||
<!-- <span class="carousel-control-next-icon" aria-hidden="true"></span> -->
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
@ -257,6 +260,8 @@
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var lastDirection = ''; // Variable to keep track of the last direction
|
||||
|
||||
// Scroll functionality
|
||||
$('.scroll-container').on('wheel', function(e) {
|
||||
if (e.originalEvent.deltaY < 0) {
|
||||
@ -300,9 +305,68 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
|
||||
function navigateCarousel(direction) {
|
||||
lastDirection = direction; // Track the direction
|
||||
var $carousel = $('#carouselExampleControls');
|
||||
var $activeItem = $carousel.find('.carousel-item.active');
|
||||
|
||||
if (direction === 'next') {
|
||||
if ($activeItem.find('.scroll-item').length === 0) {
|
||||
$carousel.carousel('next');
|
||||
setTimeout(checkEmptyCarouselItem, 100); // Check after slide transition
|
||||
} else {
|
||||
$carousel.carousel('next');
|
||||
}
|
||||
} else if (direction === 'prev') {
|
||||
if ($activeItem.find('.scroll-item').length === 0) {
|
||||
$carousel.carousel('prev');
|
||||
setTimeout(checkEmptyCarouselItem, 100); // Check after slide transition
|
||||
} else {
|
||||
$carousel.carousel('prev');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkEmptyCarouselItem() {
|
||||
var $carousel = $('#carouselExampleControls');
|
||||
var $activeItem = $carousel.find('.carousel-item.active');
|
||||
|
||||
// Check if the active item is empty
|
||||
if ($activeItem.find('.scroll-item').length === 0) {
|
||||
// If empty, move to the next item
|
||||
$carousel.carousel(lastDirection === 'next' ? 'next' : 'prev');
|
||||
}
|
||||
}
|
||||
|
||||
// Attach click handlers to carousel controls
|
||||
$('.carousel-control-next').on('click', function() {
|
||||
navigateCarousel('next');
|
||||
$('.carousel-item').each(function(index, element) {
|
||||
if ($.trim($(element).html()) === '') {
|
||||
$(element).remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.carousel-control-prev').on('click', function() {
|
||||
navigateCarousel('prev');
|
||||
$('.carousel-item').each(function(index, element) {
|
||||
if ($.trim($(element).html()) === '') {
|
||||
$(element).remove();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Check the carousel item when the slide changes
|
||||
$('#carouselExampleControls').on('slid.bs.carousel', function() {
|
||||
checkEmptyCarouselItem();
|
||||
});
|
||||
|
||||
// Initial check for empty carousel items
|
||||
checkEmptyCarouselItem();
|
||||
});
|
||||
|
||||
|
||||
function enrollment_list(current_element, type) {
|
||||
var clientId = $(current_element).closest('.carousel-slide-item').find('.client_id').val();
|
||||
var branchId = $(current_element).closest('.carousel-slide-item').find('.client_branch_id').val();
|
||||
@ -320,17 +384,310 @@ function enrollment_list(current_element, type) {
|
||||
window.location.href = `${url}?${params.toString()}`;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Array of predefined colors
|
||||
var colors = ['yellowgreen', 'indianred', 'cadetblue', 'burlywood', 'darkolivegreen'];
|
||||
|
||||
// Counter to keep track of the current color index
|
||||
var colorIndex = 0;
|
||||
|
||||
// Apply a color from the array to each card-header in sequence
|
||||
document.querySelectorAll('.add_card_background_random').forEach(function(header) {
|
||||
header.style.backgroundColor = colors[colorIndex];
|
||||
colorIndex = (colorIndex + 1) % colors.length; // Move to the next color, cycling back to 0 if needed
|
||||
});
|
||||
|
||||
|
||||
$('#enrollment_status_open_close').change(function () {
|
||||
if ($(this).val() === 'open') {
|
||||
var enrollment_data = '<?php echo addslashes($_SESSION['enrollment_data']); ?>';
|
||||
try {
|
||||
// Parse JSON data
|
||||
var data = JSON.parse(enrollment_data);
|
||||
console.log('Parsed data:', data);
|
||||
|
||||
// Ensure data is an object and client_branch_emp_list is treated as an array
|
||||
if (data && typeof data === 'object') {
|
||||
if (Array.isArray(data.client_branch_emp_list)) {
|
||||
console.log('client_branch_emp_list:', data.client_branch_emp_list);
|
||||
updateCarouselWithData(data, 1);
|
||||
} else {
|
||||
// Convert client_branch_emp_list to an array if it's not already
|
||||
if (data.client_branch_emp_list && typeof data.client_branch_emp_list === 'object') {
|
||||
// If it's an object but not an array, wrap it in an array
|
||||
data.client_branch_emp_list = [data.client_branch_emp_list];
|
||||
} else {
|
||||
// Handle the case where it's neither an array nor an object
|
||||
console.error('client_branch_emp_list is not an array or object:', data.client_branch_emp_list);
|
||||
data.client_branch_emp_list = []; // Ensure it is at least an empty array
|
||||
}
|
||||
|
||||
console.log('Converted client_branch_emp_list:', data.client_branch_emp_list);
|
||||
updateCarouselWithData(data, 1);
|
||||
}
|
||||
} else {
|
||||
console.error('Parsed data is not an object:', data);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error parsing JSON:', e);
|
||||
}
|
||||
} else {
|
||||
// Fetch the session data from PHP
|
||||
var enrollment_data = '<?php echo addslashes($_SESSION['enrollment_data']); ?>';
|
||||
try {
|
||||
// Parse JSON data
|
||||
var data = JSON.parse(enrollment_data);
|
||||
console.log('Parsed data:', data);
|
||||
|
||||
// Ensure data is an object and client_branch_emp_list is treated as an array
|
||||
if (data && typeof data === 'object') {
|
||||
if (Array.isArray(data.client_branch_emp_list)) {
|
||||
console.log('client_branch_emp_list:', data.client_branch_emp_list);
|
||||
updateCarouselWithData(data, 2);
|
||||
} else {
|
||||
// Convert client_branch_emp_list to an array if it's not already
|
||||
if (data.client_branch_emp_list && typeof data.client_branch_emp_list === 'object') {
|
||||
// If it's an object but not an array, wrap it in an array
|
||||
data.client_branch_emp_list = [data.client_branch_emp_list];
|
||||
} else {
|
||||
// Handle the case where it's neither an array nor an object
|
||||
console.error('client_branch_emp_list is not an array or object:', data.client_branch_emp_list);
|
||||
data.client_branch_emp_list = []; // Ensure it is at least an empty array
|
||||
}
|
||||
|
||||
console.log('Converted client_branch_emp_list:', data.client_branch_emp_list);
|
||||
updateCarouselWithData(data, 2);
|
||||
}
|
||||
} else {
|
||||
console.error('Parsed data is not an object:', data);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error parsing JSON:', e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function updateCarouselWithData(data, open_close) {
|
||||
var itemsPerSlide = 3; // Number of items per slide
|
||||
var currentItem = 0; // Counter for items
|
||||
var isActive = true; // Variable to set the first item as active
|
||||
var carouselInner = $('.carousel-inner');
|
||||
|
||||
// Clear existing carousel items
|
||||
carouselInner.empty();
|
||||
|
||||
// Check if data.client_branch_emp_list is valid
|
||||
if (Array.isArray(data.client_branch_emp_list) && data.client_branch_emp_list.length > 0) {
|
||||
console.log("Processing array...");
|
||||
// Handle the case where data.client_branch_emp_list is an array
|
||||
var items = data.client_branch_emp_list[0];
|
||||
console.log("Items data:", items);
|
||||
|
||||
// Convert items object to an array
|
||||
var client_list = Object.values(items);
|
||||
|
||||
// Validate if client_list is an array
|
||||
if (Array.isArray(client_list)) {
|
||||
console.log(client_list);
|
||||
for (var i = 0; i < client_list.length; i++) {
|
||||
var client = client_list[i];
|
||||
// console.log(item.branches);
|
||||
var branch_list = client.branches;
|
||||
for (var j = 0; j < branch_list.length; j++) {
|
||||
var branch = branch_list[j];
|
||||
console.log(branch);
|
||||
|
||||
if(open_close == 1){
|
||||
if(branch.client_policies.length > 0){
|
||||
if (currentItem % itemsPerSlide === 0) {
|
||||
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
||||
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
||||
isActive = false;
|
||||
}
|
||||
// Generate HTML for each item
|
||||
var itemHtml = `
|
||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${branch.branch_name }">
|
||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||
<div class="card-header add_card_background_random" >
|
||||
<div class="row">
|
||||
<div class="col-8 emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 " >
|
||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${branch.employees.length}</span></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100" >
|
||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${branch.branch_name} </h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-3 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 text-center" >
|
||||
<p class="mb-0 text-muted">
|
||||
<span class="text-success mr-2"></span>
|
||||
<span class="text-nowrap">Emp Count</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body" >
|
||||
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
||||
<input type="text" class="client_branch_id" value="${branch.client_branch_id}" hidden>
|
||||
<div class="row emp-status" style="margin-top: -9px;">
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${branch.emp_login}</span><br>
|
||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||
</div>
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${branch.employees.length - (branch.emp_login || 0)}</span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row emp-status" style="margin-top: 5px;">
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${branch.employees.length - (branch.emp_enroll || 0)}</span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||
</div>
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(branch.emp_enroll || 0)}</span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
carouselInner.find('.carousel-item').last().append(itemHtml);
|
||||
currentItem++;
|
||||
}
|
||||
}else{
|
||||
if(branch.client_policies.length == 0){
|
||||
if (currentItem % itemsPerSlide === 0) {
|
||||
if (!isActive) carouselInner.append('</div>'); // Close previous carousel item
|
||||
carouselInner.append('<div class="carousel-item' + (isActive ? ' active' : '') + '">');
|
||||
isActive = false;
|
||||
}
|
||||
// Generate HTML for each item
|
||||
var itemHtml = `
|
||||
<div class="col-xl-3 col-md-6 d-inline-block scroll-item carousel-slide-item" data-client="${client.short_name}" data-branch="${branch.branch_name }">
|
||||
<div class="card" style="box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
|
||||
<div class="card-header add_card_background_random" >
|
||||
<div class="row">
|
||||
<div class="col-8 emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 " >
|
||||
<h3 class="my-2 py-1" ><span data-plugin="counterup" style="font-size: 2.0rem;background-color: white;border-radius: 6px;height: 30;padding: 4px 11px 4px 11px;" onclick="enrollment_list(this, 'emp_count_view_click')">${branch.employees.length}</span></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12 emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100" >
|
||||
<h5 class="mt-0 text-truncate" title="Branch Info" style="font-weight: 400 !important;font-size: 20px !important;line-height: 36px;color: black !important;">${client.short_name} - ${branch.branch_name} </h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-3 center_text emp-count-view-click" >
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="w-100 text-center" >
|
||||
<p class="mb-0 text-muted">
|
||||
<span class="text-success mr-2"></span>
|
||||
<span class="text-nowrap">Emp Count</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body" >
|
||||
<input type="text" class="client_id" value="${client.client_id}" hidden>
|
||||
<input type="text" class="client_branch_id" value="${branch.client_branch_id}" hidden>
|
||||
<div class="row emp-status" style="margin-top: -9px;">
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_logged_in_view_click')">${branch.emp_login}</span><br>
|
||||
<span class="text-nowrap " style="color: currentColor;font-size: 15px;">Logged-In</span>
|
||||
</div>
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_logged_in_view_click')"> ${branch.employees.length - (branch.emp_login || 0)}</span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;margin-left: -13px;">Not Logged-In</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row emp-status" style="margin-top: 5px;">
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_not_enrolled_view_click')">${branch.employees.length - (branch.emp_enroll || 0)}</span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Draft</span>
|
||||
</div>
|
||||
<div class="col-6 emp-count-view-click" >
|
||||
<span style="font-size: large;color: black !important;" class="number_css" onclick="enrollment_list(this, 'emp_enrolled_view_click')">${(branch.emp_enroll || 0)}</span><br>
|
||||
<span class="text-nowrap" style="color: currentColor;font-size: 15px;">Enrolled</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
carouselInner.find('.carousel-item').last().append(itemHtml);
|
||||
currentItem++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create a new carousel item every `itemsPerSlide` items
|
||||
|
||||
}
|
||||
|
||||
// Close the last carousel item if it was opened
|
||||
if (currentItem % itemsPerSlide !== 0) carouselInner.append('</div>');
|
||||
} else {
|
||||
console.error('Expected an array for items, but got:', client_list);
|
||||
}
|
||||
} else if (typeof data.client_branch_emp_list === 'object') {
|
||||
console.error('client_branch_emp_list is an object, not an array:', data.client_branch_emp_list);
|
||||
} else {
|
||||
console.error('client_branch_emp_list is missing or not in the expected format:', data.client_branch_emp_list);
|
||||
}
|
||||
random_color_set();
|
||||
|
||||
// Initialize or refresh carousel if needed
|
||||
$('#carouselExampleControls').carousel('dispose').carousel();
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
random_color_set();
|
||||
});
|
||||
|
||||
function remove_empty_carousel() {
|
||||
|
||||
}
|
||||
|
||||
function random_color_set() {
|
||||
// Array of predefined colors
|
||||
var colors = ['#EBE8FF', '#FFECE5', '#FFE8F5'];
|
||||
// '#6ADBE3'
|
||||
// Array of predefined background images
|
||||
var images = [
|
||||
'/public/assets/images/mask_group.png',
|
||||
'/public/assets/images/mask_group_orange.png',
|
||||
'/public/assets/images/mask_group_pink.png',
|
||||
];
|
||||
// '/public/assets/images/mask_group_blue.png'
|
||||
|
||||
// Counter to keep track of the current index
|
||||
var index = 0;
|
||||
|
||||
// Base URL for the images
|
||||
var baseUrl = '<?php echo base_url() ?>';
|
||||
|
||||
// Apply a color and image from the arrays to each card-header in sequence
|
||||
document.querySelectorAll('.add_card_background_random').forEach(function(header) {
|
||||
header.style.backgroundColor = colors[index % colors.length];
|
||||
header.style.backgroundImage = `url(${baseUrl + images[index % images.length]})`;
|
||||
header.style.backgroundSize = 'cover'; // Ensure the image covers the entire div
|
||||
header.style.backgroundPosition = 'center'; // Center the image within the div
|
||||
index++;
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="row" style="margin-bottom: -22px;">
|
||||
<div class="col-3">
|
||||
<div id="categoryFilter" style="display: flex;">
|
||||
<select class="form-control" id="clients" onchange="populateBranches()">
|
||||
@ -64,24 +64,35 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<div class="col-1">
|
||||
<div id="categoryFilter_11">
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Search</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-3 text-right view-status-btn">
|
||||
|
||||
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()">
|
||||
<div class="col-2">
|
||||
<div id="categoryFilter_12">
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<div id="categoryFilter_13">
|
||||
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" >Upload File</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
|
||||
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;">
|
||||
Status <i id="toggleIcon" class="fas fa-minus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body status-option" id="statusContent" style="padding: 0.5rem !important;background-color: darkgrey;">
|
||||
<div class="card-body status-option" id="statusContent" style="padding: 1.5rem !important;background-color: darkgrey;">
|
||||
|
||||
<div class="text-center">
|
||||
<div class="row" style="margin-right: -261px;margin-left: 5px;">
|
||||
<div class="col-xl-2 col-md-3">
|
||||
<div class="card">
|
||||
|
||||
<div class="row" style="margin-left: 125px; margin-bottom: -11px;">
|
||||
<div class="col-xl-2 col-md-2">
|
||||
<div class="card cardWidth">
|
||||
<div class="card-body" id="emp_count_view_click">
|
||||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||
<div>
|
||||
@ -93,12 +104,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
<div class="col-xl-2 col-md-3">
|
||||
<div class="col-xl-2 col-md-2">
|
||||
<div class="card">
|
||||
<div class="card-body" id="emp_enrolled_view_click">
|
||||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||
<div>
|
||||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Enrolled">Enrolled</h5>
|
||||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Enrolled">Enroled</h5>
|
||||
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_enrolled_view">0</span></h3>
|
||||
</div>
|
||||
|
||||
@ -106,12 +117,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
<div class="col-xl-2 col-md-3">
|
||||
<div class="col-xl-2 col-md-2">
|
||||
<div class="card">
|
||||
<div class="card-body" id="emp_not_enrolled_view_click">
|
||||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||
<div>
|
||||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Not Enrolled">Not Enrolled</h5>
|
||||
<h5 class="text-muted font-weight-normal mt-0 text-truncate" title="Not Enrolled">Not Enroled</h5>
|
||||
<h3 class="my-2 py-1"><span data-plugin="counterup" id="emp_not_enrolled_view">0</span></h3>
|
||||
</div>
|
||||
|
||||
@ -119,7 +130,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
<div class="col-xl-2 col-md-3">
|
||||
<div class="col-xl-2 col-md-2">
|
||||
<div class="card">
|
||||
<div class="card-body" id="emp_logged_in_view_click">
|
||||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||
@ -132,7 +143,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
<div class="col-xl-2 col-md-3">
|
||||
<div class="col-xl-2 col-md-2">
|
||||
<div class="card">
|
||||
<div class="card-body" id="emp_not_logged_in_view_click">
|
||||
<div class="d-flex justify-content-between" style="justify-content: center !important;">
|
||||
@ -146,7 +157,9 @@
|
||||
</div>
|
||||
</div><!-- end col -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -154,7 +167,7 @@
|
||||
|
||||
<div class="row" id="client_list">
|
||||
<div class="col-12">
|
||||
<div class="card" style="">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="tickets-table">
|
||||
<thead class="bg-light">
|
||||
@ -162,7 +175,7 @@
|
||||
<th class="font-weight-medium">SNO</th>
|
||||
<th class="font-weight-medium">Name</th>
|
||||
<th class="font-weight-medium">Emp Code</th>
|
||||
<th class="font-weight-medium">Enrolled</th>
|
||||
<th class="font-weight-medium">Enroled</th>
|
||||
<th class="font-weight-medium">Logged-In</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -175,10 +188,48 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Center modal content omitted for brevity -->
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="upload_enrollment_model" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Upload Enrolment File</h4>
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="parsley-examples" method="post" 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_branch_id" name="branch_id">
|
||||
<input type="hidden" id="file_upload_actions" name="upload-action-type" value="enrollment">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="policy_id">Client Policy<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="policy_id" name="policy_id" required>
|
||||
<option selected >Select Client Policy</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
<label for="file">File<span class="text-danger">*</span></label>
|
||||
<input type="file" id="fileInput" name="emplist" required
|
||||
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Upload</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
<script>
|
||||
function populateBranches() {
|
||||
function populateBranches()
|
||||
{
|
||||
var clientId = document.getElementById('clients').value;
|
||||
var branchDropdown = document.getElementById('branch_id');
|
||||
|
||||
@ -200,7 +251,8 @@
|
||||
});
|
||||
}
|
||||
|
||||
function filterTable(columnIndex, filterValue) {
|
||||
function filterTable(columnIndex, filterValue)
|
||||
{
|
||||
var table = $('#tickets-table').DataTable();
|
||||
|
||||
// Reset the search filter for all columns
|
||||
@ -209,14 +261,20 @@
|
||||
// Apply the filter to the specified column
|
||||
table.column(columnIndex).search(filterValue).draw();
|
||||
}
|
||||
function fetchEmpolyeeList(event) {
|
||||
|
||||
function fetchEmpolyeeList(event)
|
||||
{
|
||||
event.preventDefault();
|
||||
|
||||
var client_id = $('#clients').val();
|
||||
var branch_id = $('#branch_id').val();
|
||||
if (client_id == '0' || branch_id == '0') {
|
||||
alert('Please select values in both dropdowns.');
|
||||
return;
|
||||
Swal.fire({
|
||||
title: "warning!",
|
||||
text: 'Please select the Client and Client Branch.',
|
||||
icon: "warning"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
@ -226,7 +284,15 @@
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
beforeSend: function() {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
var data = JSON.parse(response);
|
||||
console.log(data);
|
||||
var table = $('#tickets-table').DataTable();
|
||||
@ -286,12 +352,16 @@
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function()
|
||||
{
|
||||
|
||||
function getUrlParameter(name) {
|
||||
var params = new URLSearchParams(window.location.search);
|
||||
@ -312,8 +382,6 @@
|
||||
$('#branch_id').val(branch_id).trigger('change');
|
||||
if($('#branch_id').val() != 0){
|
||||
$('#get-emp-list').click().trigger();
|
||||
|
||||
|
||||
}
|
||||
}, 500);
|
||||
|
||||
@ -331,6 +399,7 @@
|
||||
}, 1000);
|
||||
|
||||
$('#clients').select2();
|
||||
$('#policy_id').select2();
|
||||
$('#branch_id').select2();
|
||||
var table = $('#tickets-table').DataTable({
|
||||
dom: 'fBrtip',
|
||||
@ -339,25 +408,25 @@
|
||||
extend: 'copy',
|
||||
text: '<i class="fa fa-copy"></i>',
|
||||
titleAttr: 'Copy',
|
||||
filename: 'Enrollment List'
|
||||
filename: 'Enrolment List'
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
text: '<i class="fa fa-print"></i>',
|
||||
titleAttr: 'Print',
|
||||
filename: 'Enrollment List'
|
||||
filename: 'Enrolment List'
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
text: '<i class="fa fa-file-pdf"></i>',
|
||||
titleAttr: 'PDF',
|
||||
filename: 'Enrollment List'
|
||||
filename: 'Enrolment List'
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="fa fa-file-csv"></i>',
|
||||
titleAttr: 'CSV',
|
||||
filename: 'Enrollment List'
|
||||
filename: 'Enrolment List'
|
||||
}
|
||||
],
|
||||
initComplete: function() {
|
||||
@ -450,7 +519,8 @@
|
||||
toggleContent();
|
||||
});
|
||||
|
||||
function toggleContent() {
|
||||
function toggleContent()
|
||||
{
|
||||
var content = document.getElementById("statusContent");
|
||||
var toggleIcon = document.getElementById("toggleIcon");
|
||||
if (content.style.display === "none") {
|
||||
@ -463,4 +533,211 @@
|
||||
toggleIcon.classList.add("fa-plus");
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function uploadEnrollmentFile(input)
|
||||
{
|
||||
console.log('uploadEnrollmentFile called');
|
||||
|
||||
var client_id = $('#clients').val()
|
||||
var client_branch_id = $('#branch_id').val()
|
||||
|
||||
console.log('input', input);
|
||||
console.log('client_id', client_id);
|
||||
console.log('client_branch_id', client_branch_id);
|
||||
|
||||
if(client_id == 0 && client_branch_id == 0){
|
||||
|
||||
Swal.fire({
|
||||
title: "warning!",
|
||||
text: 'Please select the Client and Client Branch.',
|
||||
icon: "warning"
|
||||
});
|
||||
return false
|
||||
}
|
||||
|
||||
// $('#upload_enrollment_model').modal('show');
|
||||
var myModal = new bootstrap.Modal(document.getElementById('upload_enrollment_model'));
|
||||
myModal.show();
|
||||
|
||||
$('#file_client_id').val(client_id);
|
||||
$('#file_branch_id').val(client_branch_id);
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/get_client_policy_list_for_remainder/") ?>' + client_id + '/' + client_branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('uploadEnrollmentFile policy list', res)
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
return;
|
||||
}
|
||||
|
||||
appendpolicy(res.data)
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendpolicy(data)
|
||||
{
|
||||
|
||||
$('#policy_id').empty();
|
||||
$('#policy_id').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select',
|
||||
selected: true
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text:`${item.policy_name ?? ''} - ${item.policy_no ?? ''}`
|
||||
});
|
||||
$('#policy_id').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#uploadForm").submit(function(event) {
|
||||
event.preventDefault(); // Prevent the default form submission
|
||||
|
||||
var client_id = $('#clients').val()
|
||||
var client_branch_id = $('#branch_id').val()
|
||||
|
||||
var isValid = $('#uploadForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if(client_id == 0 && client_branch_id == 0){
|
||||
toastr.warning('Select Client and Client Branch');
|
||||
return false;
|
||||
}
|
||||
|
||||
var formData = new FormData($(this)[0]);
|
||||
|
||||
$.ajax({
|
||||
url: $(this).attr("action"),
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false, // Prevent jQuery from automatically processing the data
|
||||
contentType: false, // Let jQuery handle the content type
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
beforeSend: function() {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
},
|
||||
success: function(response) {
|
||||
// Request successful, handle response
|
||||
console.log('Enrollment list:', response);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
toastr.success('File upload success, Data validation is in-progress', 'success');
|
||||
setTimeout(function() {
|
||||
window.location.href = '<?= base_url("employee/upload/") ?>';
|
||||
}, 600);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('No data found', response);
|
||||
toastr.error(response.message, 'error');
|
||||
setTimeout(function() {
|
||||
window.location.href = '<?= base_url("employee/upload/") ?>';
|
||||
}, 600);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
// toastr.error('Something went wrong! Try later', 'Error');
|
||||
setTimeout(function() {
|
||||
window.location.href = '<?= base_url("employee/upload/") ?>';
|
||||
}, 600);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Request failed, handle error
|
||||
console.error("Request failed:", status, error);
|
||||
console.error('Response:', xhr.responseText);
|
||||
// toastr.error('Something went wrong! Try later', 'Error');
|
||||
setTimeout(function() {
|
||||
window.location.href = '<?= base_url("employee/upload/") ?>';
|
||||
}, 1000);
|
||||
},
|
||||
complete: function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function sendManualReminder(input)
|
||||
{
|
||||
console.log('sendManualReminder function called');
|
||||
|
||||
var client_id = $('#clients').val()
|
||||
var client_branch_id = $('#branch_id').val()
|
||||
|
||||
console.log('input', input);
|
||||
console.log('client_id', client_id);
|
||||
console.log('client_branch_id', client_branch_id);
|
||||
|
||||
if(client_id == 0 && client_branch_id == 0)
|
||||
{
|
||||
Swal.fire({
|
||||
title: "warning!",
|
||||
text: 'Please select the Client and Client Branch.',
|
||||
icon: "warning"
|
||||
});
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/send_manual_remainder/") ?>' + client_id + '/' + client_branch_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('send_manual_remainder', res)
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if(res.status == false){
|
||||
toastr.info(res.message, 'INFO');
|
||||
}else{
|
||||
toastr.success(res.message, 'SUCCESS');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -150,16 +150,12 @@ input:checked + .slider:before {
|
||||
$("#insurer_general_form").submit(function(events) {
|
||||
|
||||
events.preventDefault();
|
||||
// var isValid = validateForm();
|
||||
|
||||
var isValid = true;
|
||||
jQuery.each(events.target, function(index, event) {
|
||||
if (event.validity.valid) {
|
||||
|
||||
} else {
|
||||
isValid = false;
|
||||
}
|
||||
});
|
||||
var isValid = $('#insurer_General_PrimaryKey').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
var PrimaryKey = $('#insurer_General_PrimaryKey').val();
|
||||
var form_action = '';
|
||||
@ -193,29 +189,25 @@ input:checked + .slider:before {
|
||||
$('#insurer_id').val(res.data.id);
|
||||
$('#insurer_General_PrimaryKey').val(res.data.id);
|
||||
$('#insurer_id_branch').val(res.data.id);
|
||||
$('#insurer_branch_contacts_id').click();
|
||||
// $('#insurer_branch_contacts_id').click();
|
||||
|
||||
$('#btnBranchAdd').show();
|
||||
var message = "Insurer General Info";
|
||||
toastr.success(message, 'Success');
|
||||
|
||||
// $.toast({
|
||||
// text: 'Insurer General Info',
|
||||
// heading: "Submitted Sucessfully",
|
||||
// position: 'top-right',
|
||||
// icon: 'success',
|
||||
// bgColor: !1,
|
||||
// });
|
||||
|
||||
if (PrimaryKey === '') {
|
||||
setTimeout(function(){
|
||||
window.location.href = '<?= base_url('master/insurer/list/')?>' + res.data.id
|
||||
}, 100)
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning'); }, 1000);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -252,7 +244,8 @@ input:checked + .slider:before {
|
||||
|
||||
});
|
||||
|
||||
function PreviewImage() {
|
||||
function PreviewImage()
|
||||
{
|
||||
var oFReader = new FileReader();
|
||||
oFReader.readAsDataURL(document.getElementById("insurer_logo").files[0]);
|
||||
|
||||
@ -260,4 +253,9 @@ input:checked + .slider:before {
|
||||
document.getElementById("uploadPreview").src = oFREvent.target.result;
|
||||
};
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
152
app/Views/insurer_export_templete.php
Normal file
152
app/Views/insurer_export_templete.php
Normal file
@ -0,0 +1,152 @@
|
||||
<div class="tab-pane fade" id="template-tab">
|
||||
|
||||
<input type="hidden" id="insurer_templete_count" value="<?= isset($insurer_templete_count) ? $insurer_templete_count : ''?>">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="email">Existing Insurer Export<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer" name="insurer" required>
|
||||
<option value="">Select Insurer</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="position: relative;top: 28px;">
|
||||
<label for="email"><span class="text-danger"></span></label>
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="checkInsurerTemplete(this)">Copy</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#insurer').select2();
|
||||
featchInsurerList()
|
||||
})
|
||||
|
||||
function featchInsurerList()
|
||||
{
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/get_insurer_by_export_templete") ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('featchInsurerList list', res)
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
appendInsurer(res.data)
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function appendInsurer(data)
|
||||
{
|
||||
|
||||
$('#insurer').empty();
|
||||
$('#insurer').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select',
|
||||
selected: true
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.insurer_name
|
||||
});
|
||||
$('#insurer').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function checkInsurerTemplete(input)
|
||||
{
|
||||
var existing_insurer_id = $('#insurer').val();
|
||||
var copy_insurer_id = $('#insurer_General_PrimaryKey').val()
|
||||
var insurer_templete_count = $('#insurer_templete_count').val()
|
||||
|
||||
if(existing_insurer_id == '')
|
||||
{
|
||||
Swal.fire({
|
||||
title: "warning!",
|
||||
text: 'Please select the Insurer',
|
||||
icon: "warning"
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log('existing_insurer_id', existing_insurer_id)
|
||||
console.log('copy_insurer_id', copy_insurer_id)
|
||||
console.log('insurer_templete_count', insurer_templete_count)
|
||||
|
||||
$('#insurer').val('').change();
|
||||
|
||||
if(insurer_templete_count == 0){
|
||||
copyTemplateAJAX(existing_insurer_id, copy_insurer_id)
|
||||
|
||||
}else{
|
||||
|
||||
Swal.fire({
|
||||
title: "The insurer already have export template?",
|
||||
text: "If you want to approve this the existing template will be deleted!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
|
||||
if (result.isConfirmed) {
|
||||
copyTemplateAJAX(existing_insurer_id, copy_insurer_id)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function copyTemplateAJAX(existing_insurer_id, copy_insurer_id)
|
||||
{
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/copy_insurer_templete/") ?>' + existing_insurer_id + '/' + copy_insurer_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('checkInsurerTemplete response', res)
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if(res.status == false){
|
||||
toastr.error(res.message, 'ERROR');
|
||||
}else{
|
||||
toastr.success(res.message, 'SUCCESS');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -1,35 +1,3 @@
|
||||
<style>
|
||||
|
||||
body {
|
||||
.multiselect-native-select {
|
||||
position: relative;
|
||||
/* bottom: 32px; */
|
||||
select {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
height: 1px !important;
|
||||
margin: -1px -1px -1px -3px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
left: 50%;
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.multiselect-container{
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.multiselect-selected-text{
|
||||
float: left !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="insurer_add">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
@ -59,10 +27,24 @@ body {
|
||||
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php if(isset($insurer['id'])){ ?>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="#template-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="insurer_export_templete">
|
||||
<span class="mr-1"><i class="mdi mdi-file-export font-16"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Insurer Export Templete</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('insurer_basic_info.php'); ?>
|
||||
<?php include('insurer_branch.php'); ?>
|
||||
<?php include('insurer_export_templete.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -140,7 +140,7 @@
|
||||
|
||||
<script>
|
||||
toastr.options = {
|
||||
"timeOut": 2000,
|
||||
"timeOut": 5000,
|
||||
"closeButton": true,
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -572,7 +572,7 @@
|
||||
<a href="<?= base_url('/employee/endorsement-list') ?>">View Endorsement</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrollment</a>
|
||||
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrolment</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -1254,13 +1254,15 @@
|
||||
|
||||
<!-- Jodit RTE -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var editor = new Jodit('#additionalsicknessbenefit', {
|
||||
$(document).ready(function()
|
||||
{
|
||||
var editor = new Jodit('#additionalsicknessbenefit',
|
||||
{
|
||||
buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
|
||||
});
|
||||
|
||||
|
||||
var editor = new Jodit('#Wellness', {
|
||||
var editor = new Jodit('#Wellness',
|
||||
{
|
||||
buttons: 'bold,italic,underline,|,align,alignCenter,alignRight,alignJustify',
|
||||
});
|
||||
});
|
||||
@ -1270,16 +1272,15 @@
|
||||
|
||||
<!-- Policy terms Add Special Condition -->
|
||||
<script>
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event)
|
||||
{
|
||||
//console.log('specialCondition callback clicked')
|
||||
event.preventDefault();
|
||||
specialCondition();
|
||||
|
||||
});
|
||||
|
||||
|
||||
function specialCondition(count = 0) {
|
||||
function specialCondition(count = 0)
|
||||
{
|
||||
|
||||
//console.log('specialCondition function called')
|
||||
|
||||
@ -1307,12 +1308,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '.specialConditionClose', function() {
|
||||
$(document).on('click', '.specialConditionClose', function()
|
||||
{
|
||||
$(this)[0].parentNode.parentNode.remove();
|
||||
});
|
||||
|
||||
|
||||
// Close the Policy terms
|
||||
$(document).on('click', '#policyGMCTermsClose', function() {
|
||||
$('#policyGMCTerms').css('display', 'none');
|
||||
@ -1336,17 +1336,17 @@
|
||||
// }
|
||||
|
||||
|
||||
$('#self').change(function () {
|
||||
$('#self').change(function ()
|
||||
{
|
||||
if ($(this).prop('checked')) {
|
||||
$('.self-age').css('display','');
|
||||
}else{
|
||||
$('.self-age').css('display','none');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#spouse').change(function () {
|
||||
$('#spouse').change(function ()
|
||||
{
|
||||
if ($(this).prop('checked')) {
|
||||
$('.spouse-age').css('display','');
|
||||
if($('#spouse_min_age').val() < 17 || $('#spouse_min_age').val() == '' ){
|
||||
@ -1358,10 +1358,10 @@
|
||||
}else{
|
||||
$('.spouse-age').css('display','none');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
$('#children').change(function () {
|
||||
$('#children').change(function ()
|
||||
{
|
||||
if ($(this).val() != 0) {
|
||||
$('.child-age').css('display','');
|
||||
|
||||
@ -1374,10 +1374,10 @@
|
||||
}else{
|
||||
$('.child-age').css('display','none');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
$('#family_floaters').change(function () {
|
||||
$('#family_floaters').change(function ()
|
||||
{
|
||||
|
||||
checkAdditionPremiumJSON()
|
||||
|
||||
@ -1410,10 +1410,10 @@
|
||||
}else if(family_floaters == '4EPORPIL'){
|
||||
$('#member_count').val(4);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
function lowerIsEighteen(params) {
|
||||
function lowerIsEighteen(params)
|
||||
{
|
||||
var value = $(params).val();
|
||||
|
||||
if (value < 18) {
|
||||
@ -1423,8 +1423,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function appendGMCSIAddMore(data = null){
|
||||
function appendGMCSIAddMore(data = null)
|
||||
{
|
||||
|
||||
console.log('function called')
|
||||
|
||||
@ -1450,13 +1450,14 @@
|
||||
$('#gmc_si_add_more').append(html);
|
||||
}
|
||||
|
||||
function removeGMCAdditionalSI(button) {
|
||||
function removeGMCAdditionalSI(button)
|
||||
{
|
||||
console.log('remove clicked');
|
||||
$(button).closest('.row').remove();
|
||||
}
|
||||
|
||||
|
||||
function checkAdditionPremiumJSON(){
|
||||
function checkAdditionPremiumJSON()
|
||||
{
|
||||
|
||||
var client_id = $('#Client_id').val();
|
||||
var client_policy_id = $('#gmc_client_policy_id').val();
|
||||
@ -1469,8 +1470,8 @@
|
||||
console.log(response.data);
|
||||
|
||||
if (response.data > 0) {
|
||||
console.log('Please change the additional premium relation');
|
||||
Swal.fire("Please change the additional premium relation");
|
||||
console.log('Any changes made in the policy term for family floater, please update the rack rate configuration.');
|
||||
Swal.fire("Any changes made in the policy term for family floater, please update the rack rate configuration.");
|
||||
}
|
||||
console.log('outer');
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<h4 class="modal-title" id="myLargeModalLabel">Rack Rate <span id="PolicyNameForTitle"></span></h4>
|
||||
</div>
|
||||
<div class="col-md-5" style="position: relative;left: 20px;" id="add_new_rack_rate_tab_div">
|
||||
<button class="btn btn-info waves-effect waves-light mr-1 float-right" id="add_new_rack_rate_tab" onclick="appendNewTab()">Add Tab</button>
|
||||
<button class="btn btn-info waves-effect waves-light mr-1 float-right" id="add_new_rack_rate_tab" onclick="appendNewTab()">Add Rack Rate</button>
|
||||
</div>
|
||||
<div class="col-md-1" style="position: relative;top: 10px;">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
@ -155,7 +155,6 @@ $(document).on('click', '.close', function() {
|
||||
console.log("Tab panes removed");
|
||||
});
|
||||
|
||||
|
||||
var rarc_rate_json_array = [];
|
||||
|
||||
$(document).on('submit', 'form[id^="GridForm_"]', function(event) {
|
||||
@ -193,9 +192,9 @@ $(document).on('submit', 'form[id^="GridForm_"]', function(event) {
|
||||
|
||||
// Create FormData object
|
||||
var formData = new FormData(form[0]);
|
||||
// for (var pair of formData.entries()) {
|
||||
// console.log(pair[0] + ': ' + pair[1]);
|
||||
// }
|
||||
for (var pair of formData.entries()) {
|
||||
console.log(pair[0] + ': ' + pair[1]);
|
||||
}
|
||||
|
||||
let desiredKeys = ["self", "spouse", "childrens", "parents", "parents-in-law"];
|
||||
|
||||
@ -289,6 +288,7 @@ var client_policy_for_additional_rack_rate = '';
|
||||
var terms_si_amount_array = [];
|
||||
var unit_length = 0;
|
||||
|
||||
|
||||
$('body').on('click', '.btnPolicyModel', function()
|
||||
{
|
||||
$('#tab_content .tab-pane').not('#primary_rack_rate_tab').remove();
|
||||
@ -314,6 +314,9 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
$('#rack_rate_one').show()
|
||||
}
|
||||
|
||||
$('#rack_rate_one').click();
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/policy-premium") ?>',
|
||||
type: "GET",
|
||||
@ -326,7 +329,9 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
// console.log('rack rate responce.premium data parsed', JSON.parse(res.premiumData));
|
||||
|
||||
var data_for_the_rack_rate = JSON.parse(res.premiumData) ?? [];
|
||||
var groupedData = groupByRackRateName(data_for_the_rack_rate);
|
||||
var groupedData = groupByRackRateName(data_for_the_rack_rate) ?? [];
|
||||
|
||||
console.log('groupedData', groupedData)
|
||||
|
||||
if(policy_type_string == 'GMC'){
|
||||
if (res.self == "") {
|
||||
@ -363,24 +368,10 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
var premium_type_for_primary_rr = [];
|
||||
var first = 0;
|
||||
|
||||
premiumData = []
|
||||
if(policy_type_string == 'GMC'){
|
||||
$.each(groupedData, function(index, item){
|
||||
if(index !== 'Primary'){
|
||||
appendNewTab(index, item)
|
||||
}else{
|
||||
premiumData = item;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.each(groupedData, function(index, item){
|
||||
if(index == 'Primary'){
|
||||
premiumData = item;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (premiumData.length > 0) {
|
||||
var premiumData = groupedData.Primary ?? [];
|
||||
console.log('----- premiumData for primary rack rate -----', premiumData);
|
||||
|
||||
if (premiumData.length > 0 && premiumData != 'undefined') {
|
||||
$.each(premiumData, function(index, item) {
|
||||
|
||||
policy_grid_id_value = item.policy_grid_id;
|
||||
@ -396,6 +387,7 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
console.log('premiumData for primary rack rate', premiumData);
|
||||
console.log('additional_relationship for primary rack rate', additional_relationship);
|
||||
|
||||
@ -413,6 +405,7 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
|
||||
checkboxdata = checkboxDataObject;
|
||||
}
|
||||
console.log('before create checkbox')
|
||||
createCheckboxes(checkboxdata, additional_relationship, null, policy_type_id);
|
||||
appendGridData(res.data, policy_grid_id_value);
|
||||
if(premiumData[0]){
|
||||
@ -433,7 +426,7 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
premiumData.shift();
|
||||
$.each(premiumData, function(index, item) {
|
||||
if (item.si_or_bp == '1') {
|
||||
console.log('gpa basic pay items', item)
|
||||
console.log('gpa basic pay items', item);
|
||||
appendGridtHtml('1', null, item);
|
||||
} else {
|
||||
appendGridtHtml(item.policy_grid_id, null, item);
|
||||
@ -444,6 +437,24 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
console.log("res.premiumData is undefined, null, or empty.");
|
||||
}
|
||||
|
||||
try {
|
||||
if (policy_type_string == 'GMC') {
|
||||
$.each(groupedData, function(index, item) {
|
||||
if (index !== 'Primary') {
|
||||
appendNewTab(index, item);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('An error occurred:', error);
|
||||
console.error('Error Name:', error.name);
|
||||
console.error('Error Message:', error.message);
|
||||
console.error('Error Stack:', error.stack);
|
||||
|
||||
// Optional: handle the error in a user-friendly way
|
||||
console.error('An error occurred while processing the data. Please try again.');
|
||||
}
|
||||
|
||||
$('#bs-example-modal-lg').modal('show');
|
||||
$("#gpa_si").trigger("keyup");
|
||||
$("#gpa_si_9").trigger("keyup");
|
||||
@ -452,7 +463,7 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
$('#4_si').trigger('keyup');
|
||||
|
||||
$('input[name="gpa_si"]').each(function() {
|
||||
console.log('gpa_si[]', $(this));
|
||||
// console.log('gpa_si[]', $(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
@ -485,7 +496,6 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(`input[name="${first}_si[]"]`).each(function() {
|
||||
// console.log(first+'_si[]', $(this));
|
||||
$(this).trigger('keyup');
|
||||
@ -518,6 +528,8 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
|
||||
});
|
||||
|
||||
console.log(rarc_rate_json_array);
|
||||
|
||||
$(document).on('change', 'select[id^="grid_"]', function(event)
|
||||
{
|
||||
|
||||
@ -543,6 +555,7 @@ $(document).on('change', 'select[id^="grid_"]', function(event)
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('change response', res)
|
||||
|
||||
if (res.data[0].policy_type == "GPA") {
|
||||
$('#si_or_bp').val('2');
|
||||
@ -564,6 +577,8 @@ $(document).on('change', 'select[id^="grid_"]', function(event)
|
||||
});
|
||||
})
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
|
||||
$('#grid').change(function()
|
||||
{
|
||||
console.log('unit_length', unit_length)
|
||||
@ -590,6 +605,7 @@ $('#grid').change(function()
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('change response', res)
|
||||
|
||||
if (res.data[0].policy_type == "GPA") {
|
||||
$('#si_or_bp').val('2');
|
||||
@ -616,29 +632,19 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
console.log('addGridHTML si_or_bp', si_or_bp);
|
||||
console.log('addGridHTML event', event);
|
||||
console.log('addGridHTML ui_type', ui_type);
|
||||
var secondaryValue = unique_id;
|
||||
|
||||
secondaryValue = unique_id;
|
||||
// console.log('typeof secondaryValue');
|
||||
// console.log(typeof secondaryValue);
|
||||
|
||||
// if(event.id){
|
||||
// var unique_id = event.id.split('_');
|
||||
// if (unique_id.length > 1) {
|
||||
// secondaryValue = unique_id[1];
|
||||
// secondaryValue = String(secondaryValue);
|
||||
// }
|
||||
// }
|
||||
|
||||
// console.log('unique_id', unique_id)
|
||||
// console.log('secondaryValue', secondaryValue)
|
||||
|
||||
var grid_container = document.getElementById('grid_content_input');
|
||||
// console.log(grid_container);
|
||||
console.log('step 1', grid_container);
|
||||
|
||||
if (secondaryValue != false) {
|
||||
grid_container_id = 'grid_content_input_' + secondaryValue;
|
||||
grid_container_id = 'grid_content_input_for_additional_' + secondaryValue;
|
||||
grid_container = document.getElementById(grid_container_id);
|
||||
console.log('step 2', grid_container);
|
||||
|
||||
}
|
||||
console.log('step 3', grid_container);
|
||||
|
||||
var id_var = 'grid_';
|
||||
|
||||
@ -649,8 +655,6 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
var dataIdValue = event.value;
|
||||
}
|
||||
|
||||
$(grid_container).empty();
|
||||
|
||||
if (dataIdValue == '1') {
|
||||
for (var i = 1; i <= 13; i++) {
|
||||
$('#' + id_var + i).remove();
|
||||
@ -814,8 +818,8 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
} else if (dataIdValue == '3') {
|
||||
|
||||
console.log('secondaryValue type 3 step 1', secondaryValue)
|
||||
console.log('secondaryValue type 3', secondaryValue)
|
||||
// console.log('secondaryValue type 3 step 1', secondaryValue)
|
||||
// console.log('secondaryValue type 3', secondaryValue)
|
||||
|
||||
for (var i = 1; i <= 13; i++) {
|
||||
$('#' + id_var + i).remove();
|
||||
@ -927,13 +931,13 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="${id_var}6" style="/*width:84%*/">
|
||||
<div class="form-group col-md-4 unitDiv">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="6_si" id="6_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-4 unitDiv">
|
||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="6_unit[]" id="6_unit" required>
|
||||
</div>
|
||||
@ -1230,9 +1234,15 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
}
|
||||
|
||||
// console.log('grid_container', grid_container)
|
||||
console.log('grid_container step 4', grid_container)
|
||||
// console.log('grid_html', grid_html)
|
||||
if(data == false){
|
||||
$(grid_container).empty();
|
||||
}
|
||||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||
console.log('grid_container step 5');
|
||||
console.log('grid_container step 6', grid_container);
|
||||
|
||||
|
||||
if (dataIdValue == '1') {
|
||||
$('#gpa_sum_si').trigger('keyup');
|
||||
@ -1244,7 +1254,7 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
// });
|
||||
}
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
@ -1268,24 +1278,24 @@ var Count = 1
|
||||
function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
{
|
||||
console.log('appendGridtHtml function data', data);
|
||||
console.log('appendGridtHtml ui_type', ui_type);
|
||||
|
||||
console.log('secondary', secondary)
|
||||
console.log('typeof secondary', typeof secondary)
|
||||
console.log('appendGridtHtml function ui_type', ui_type);
|
||||
console.log('appendGridtHtml function secondary', secondary);
|
||||
console.log('appendGridtHtml function typeof secondary', typeof secondary)
|
||||
|
||||
var html = '';
|
||||
Count++;
|
||||
|
||||
var container = document.getElementById('grid_content_input');
|
||||
// console.log('container', container);
|
||||
console.log('appendGridtHtml function container step 1', container);
|
||||
|
||||
if (secondary != false && secondary != 'false' && secondary != null && secondary != 'null') {
|
||||
container_id = 'grid_content_input_' + secondary;
|
||||
console.log('container', container_id);
|
||||
container_id = 'grid_content_input_for_additional_' + secondary;
|
||||
container = document.getElementById(container_id);
|
||||
console.log('container', container);
|
||||
console.log('appendGridtHtml function container step 2', container);
|
||||
}
|
||||
|
||||
console.log('appendGridtHtml function container step 3', container);
|
||||
|
||||
if (ui_type == '1') {
|
||||
|
||||
// console.log('step 1')
|
||||
@ -1429,7 +1439,7 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="4_age_to[]" id="4_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="4_age_to[]" id="4_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
@ -1568,16 +1578,16 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
<div class="form-row" id="removeChild_${Count}" style="/*width:84%*/">
|
||||
<div class="form-group col-md-4 unitDiv">
|
||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="unit" id="9_unit_${Count}" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter unit" name="gpa_unit" id="9_unit_${Count}" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="9_si[]" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="gpa_si" id="9_si_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="9_premium[]" id="9_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="gpa_premium" id="9_premium_${Count}" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='premium_number_word_${Count}' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>`;
|
||||
@ -1712,7 +1722,7 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
<option value="father" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father' ? 'selected' : ''}>Father</option>
|
||||
<option value="mother" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother' ? 'selected' : ''}>Mother</option>
|
||||
<option value="father-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'father-in-law' ? 'selected' : ''}>Father in Law</option>
|
||||
<option value="mother-in-law" ${dappendGridtHtmlata !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
|
||||
<option value="mother-in-law" ${data !== false && data !== undefined && data !== '' && data.relationship === 'mother-in-law' ? 'selected' : ''}>Mother in Law</option>
|
||||
<option value="child" ${data !== false && data !== undefined && data !== '' && data.relationship === 'child' ? 'selected' : ''}>Child</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -1728,8 +1738,9 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
</div>`;
|
||||
}
|
||||
|
||||
console.log('container', container);
|
||||
console.log('appendGridtHtml function container step 4', container);
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
console.log('appendGridtHtml function container step 5', container);
|
||||
|
||||
// $('#gmc_add_more').hide();
|
||||
// $('#gmc_add_more2').hide();
|
||||
@ -1761,10 +1772,11 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
|
||||
}
|
||||
|
||||
|
||||
function removebutton(index, type)
|
||||
{
|
||||
|
||||
console.log('remove button function called')
|
||||
|
||||
if (index == 0) {
|
||||
var inputs = document.querySelectorAll('#grid_' + type + ' input');
|
||||
inputs.forEach(function(input) {
|
||||
@ -1803,7 +1815,7 @@ function checkDuplicate(unique_id = null)
|
||||
|
||||
if (unique_id) {
|
||||
id = $('#grid_'+unique_id)[0];
|
||||
container = $('#grid_content_input_'+unique_id);
|
||||
container = $('#grid_content_input_for_additional_'+unique_id);
|
||||
|
||||
console.log('checkDuplicate id 2', id);
|
||||
console.log('checkDuplicate container 2', container);
|
||||
@ -1824,11 +1836,17 @@ function checkDuplicate(unique_id = null)
|
||||
|
||||
// Extract values from input arrays
|
||||
siInputs.each(function() {
|
||||
siValues.push($(this).val());
|
||||
var value = $(this).val();
|
||||
var cleanedValue = value.replace(/,/g, '');
|
||||
var numericValue = parseFloat(cleanedValue);
|
||||
siValues.push(numericValue);
|
||||
});
|
||||
|
||||
premiumInputs.each(function() {
|
||||
premiumValues.push($(this).val());
|
||||
var value = $(this).val();
|
||||
var cleanedValue = value.replace(/,/g, '');
|
||||
var numericValue = parseFloat(cleanedValue);
|
||||
premiumValues.push(numericValue);
|
||||
});
|
||||
|
||||
for (var i = 0; i < siValues.length; i++) {
|
||||
@ -2580,8 +2598,8 @@ function getCurrentTime()
|
||||
|
||||
function createCheckboxes(obj, additional_relationship = [], unique_id = null, policy_type = null)
|
||||
{
|
||||
console.log('object', obj);
|
||||
console.log('additional_relationship', additional_relationship);
|
||||
console.log('createCheckboxes function object', obj);
|
||||
console.log('createCheckboxes function additional_relationship', additional_relationship);
|
||||
|
||||
if (typeof additional_relationship === 'string') {
|
||||
additional_relationship = JSON.parse(additional_relationship);
|
||||
@ -2607,7 +2625,7 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
<label>Choose applicable family members</label>`;
|
||||
|
||||
if (obj['self'] > 0) {
|
||||
let selfValue = additional_relationship['self'] || 'NA';
|
||||
let selfValue = additional_relationship['self'] || '1';
|
||||
console.log('selfValue', selfValue);
|
||||
|
||||
html += `
|
||||
@ -2633,7 +2651,7 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
}
|
||||
|
||||
if (obj['spouse'] > 0) {
|
||||
let spouseValue = additional_relationship['spouse'] || 'NA';
|
||||
let spouseValue = additional_relationship['spouse'] || 'any';
|
||||
|
||||
html += `
|
||||
<div class="radio-group">
|
||||
@ -2658,7 +2676,8 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
}
|
||||
|
||||
if (obj['childrens'] > 0) {
|
||||
let childrensValue = additional_relationship['childrens'] || 'NA';
|
||||
|
||||
let childrensValue = additional_relationship['childrens'] || 'any';
|
||||
|
||||
html += `
|
||||
<div class="radio-group">
|
||||
@ -2679,14 +2698,14 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
<input class="form-check-input" type="radio" name="childrens" id="children-1" value="1" ${childrensValue === '1' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="children-1">1</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="childrens" id="children-any" value="any" ${childrensValue === 'any' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="children-any">Any</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="childrens" id="children-no" value="0" ${childrensValue === '0' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="children-unset">No</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="childrens" id="children-any" value="any" ${childrensValue === 'any' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="children-any">Any</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="childrens" id="children-unset" value="NA" ${childrensValue === 'NA' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="children-unset">NA</label>
|
||||
@ -2695,7 +2714,7 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
}
|
||||
|
||||
if (obj['parents'] > 0) {
|
||||
let parentsValue = additional_relationship['parents'] || 'NA';
|
||||
let parentsValue = additional_relationship['parents'] || 'any';
|
||||
|
||||
html += `
|
||||
<div class="radio-group">
|
||||
@ -2708,14 +2727,14 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
<input class="form-check-input" type="radio" name="parents" id="parents-double" value="2" ${parentsValue === '2' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-double">2</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="parents" id="parents-any" value="any" ${parentsValue === 'any' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-any">Any</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="parents" id="parents-no" value="0" ${parentsValue === '0' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-no">No</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="parents" id="parents-any" value="any" ${parentsValue === 'any' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-any">Any</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="parents" id="parents-unset" value="NA" ${parentsValue === 'NA' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-unset">NA</label>
|
||||
@ -2724,7 +2743,7 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
}
|
||||
|
||||
if (obj['parents-in-law'] > 0) {
|
||||
let parentsInLawValue = additional_relationship['parents-in-law'] || 'NA';
|
||||
let parentsInLawValue = additional_relationship['parents-in-law'] || 'any';
|
||||
html += `
|
||||
<div class="radio-group">
|
||||
<label class="col-lg-1">Parents-in-law:</label>
|
||||
@ -2736,14 +2755,14 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-double" value="2" ${parentsInLawValue === '2' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-in-law-double">2</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-any" value="any" ${parentsInLawValue === 'any' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-in-law-any">Any</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-no" value="0" ${parentsInLawValue === '0' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-in-law-no">No</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-any" value="any" ${parentsInLawValue === 'any' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-in-law-any">Any</label>
|
||||
</div>
|
||||
<div class="form-check col-lg-1">
|
||||
<input class="form-check-input" type="radio" name="parents-in-law" id="parents-in-law-unset" value="NA" ${parentsInLawValue === 'NA' ? 'checked' : ''}>
|
||||
<label class="form-check-label radioalign" for="parents-in-law-unset">NA</label>
|
||||
@ -2763,86 +2782,11 @@ function createCheckboxes(obj, additional_relationship = [], unique_id = null, p
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function formatString(str)
|
||||
{
|
||||
return str.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
||||
}
|
||||
|
||||
$('#del_btn').click(function()
|
||||
{
|
||||
//console.log('delete btn clicked');
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to Delete this!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
//console.log('after then entered');
|
||||
|
||||
if (result.isConfirmed) {
|
||||
//console.log('isConfirmed entered');
|
||||
|
||||
var client_policy_id = $('#client_policy_id_2').val();
|
||||
//console.log('client_policy_id', client_policy_id)
|
||||
|
||||
var rack_rate_type = $('#rack_rate_type_2').val();
|
||||
//console.log('rack_rate_type', rack_rate_type)
|
||||
|
||||
var client_id = $('#Client_id_2').val();
|
||||
//console.log('client_id', client_id)
|
||||
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/delete-additional-rack-rate/'); ?>' + client_id + '/' + client_policy_id + '/' + rack_rate_type,
|
||||
type: 'GET',
|
||||
success: function(res) {
|
||||
|
||||
//console.log('ajax success entered');
|
||||
//console.log(res);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (res.status === true) {
|
||||
|
||||
$('#additional_grid_content_input').empty();
|
||||
$('#additional_grid').val('');
|
||||
$('#individual_2').prop('checked', true)
|
||||
$('#single_2').prop('checked', false)
|
||||
$('input[type="checkbox"]').prop('checked', false);
|
||||
|
||||
|
||||
toastr.success(res.message, 'Success');
|
||||
|
||||
} else if (res.status === false) {
|
||||
toastr.warning(res.message, 'Warning');
|
||||
return;
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
//console.log('ajax error entered');
|
||||
console.error(xhr.responseText);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
// Removed the duplicated loader hiding code here
|
||||
}
|
||||
|
||||
//console.log('after then entered end or cancel');
|
||||
});
|
||||
|
||||
//console.log('delete btn clicked end');
|
||||
});
|
||||
|
||||
function checkCheckboxes()
|
||||
{
|
||||
|
||||
@ -2916,7 +2860,7 @@ function checkPolicyTermsSI(unique_id = null)
|
||||
|
||||
if (unique_id) {
|
||||
id = $('#grid_'+unique_id)[0];
|
||||
container = $('#grid_content_input_'+unique_id);
|
||||
container = $('#grid_content_input_for_additional_'+unique_id);
|
||||
}
|
||||
|
||||
console.log(id);
|
||||
@ -3018,6 +2962,9 @@ function checkPolicyTermsSI(unique_id = null)
|
||||
function appendNewTab(tabNameData = null, data = null)
|
||||
{
|
||||
console.log('appendNewTab function called');
|
||||
console.log('appendNewTab function tabNameData', tabNameData);
|
||||
console.log('appendNewTab function data', data);
|
||||
|
||||
let tabName = tabNameData;
|
||||
|
||||
if(tabNameData == null){
|
||||
@ -3049,6 +2996,7 @@ function appendNewTab(tabNameData = null, data = null)
|
||||
newTabLink.classList.add('nav-link', 'nav-link', 'px-3', 'py-2');
|
||||
newTabLink.setAttribute('data-toggle', 'tab');
|
||||
newTabLink.setAttribute('href', `#${tabId}`);
|
||||
newSpan.setAttribute('id', `link_${tabId}`);
|
||||
// newTabLink.textContent = tabName;
|
||||
newTabLink.appendChild(newSpan);
|
||||
|
||||
@ -3101,7 +3049,7 @@ function appendNewTab(tabNameData = null, data = null)
|
||||
<a href="#" id="copyfromexcel_${tabId}" onclick="copyFromExcel(this, '${tabId}')">Copy from excel</a>
|
||||
<hr>
|
||||
|
||||
<div class="form-row" id="grid_content_input_${tabId}" style="display: true;">
|
||||
<div class="form-row" id="grid_content_input_for_additional_${tabId}" style="display: true;">
|
||||
</div>
|
||||
|
||||
|
||||
@ -3116,7 +3064,7 @@ function appendNewTab(tabNameData = null, data = null)
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn_${tabId}">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnGridSubmit_2_${tabId}">Submit</button>
|
||||
<a class="btn btn-danger waves-effect waves-light mr-1" id="btnGridremove_2_${tabId}" onclick="removeTab(this)">Delete</a>
|
||||
<a class="btn btn-danger waves-effect waves-light mr-1" id="btnGridremove_2_${tabId}" onclick="removeTab(this, '${tabId}', '${tabName}')">Delete</a>
|
||||
<a class="btn btn-secondary waves-effect waves-light mr-1" id="btnGridrename_${tabId}" onclick="renameRackRateTab(this)">Rename</a>
|
||||
</div>
|
||||
</form>`;
|
||||
@ -3126,15 +3074,29 @@ function appendNewTab(tabNameData = null, data = null)
|
||||
var policy_grid_id = null;
|
||||
var additional_relationship = [];
|
||||
var premium_type = null;
|
||||
var si_or_bp_value = ''
|
||||
if(data){
|
||||
|
||||
addGridHTML(false, data[0], data[0].policy_grid_id, false, tabId);
|
||||
// data.shift();
|
||||
console.log('appendNewTab function first index data', data[0])
|
||||
console.log('appendNewTab function first index data[0].policy_grid_id', data[0].policy_grid_id)
|
||||
|
||||
if (data[0].policy_grid_id == 4 || data[0].policy_grid_id == 6) {
|
||||
|
||||
appendFourthAndSixthRackRate(data[0], tabId);
|
||||
policy_grid_id = data[0].policy_grid_id
|
||||
additional_relationship = data[0].additional_relationship;
|
||||
premium_type = data[0].premium_type;
|
||||
|
||||
data.shift();
|
||||
}
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
// console.log(item)
|
||||
|
||||
console.log('appendNewTab function index', index)
|
||||
policy_grid_id = item.policy_grid_id
|
||||
additional_relationship = item.additional_relationship;
|
||||
premium_type = item.premium_type;
|
||||
|
||||
appendGridtHtml(item.policy_grid_id, tabId, item);
|
||||
});
|
||||
}
|
||||
@ -3145,14 +3107,18 @@ function appendNewTab(tabNameData = null, data = null)
|
||||
hideShowSubmitButton(employee_count, tabId);
|
||||
editPolicyPremiumCalculationSetValue(premium_type, tabId);
|
||||
|
||||
if(data == null){
|
||||
$('#link_'+tabId).click();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function appendGridData(data, policy_grid_id_value = null, unique_id = null)
|
||||
{
|
||||
console.log('policy_grid_id_value', policy_grid_id_value)
|
||||
console.log(data)
|
||||
{
|
||||
console.log('appendGridData function called');
|
||||
console.log('appendGridData policy_grid_id_value', policy_grid_id_value)
|
||||
console.log('appendGridData data', data)
|
||||
|
||||
var rack_rate_id = $('#grid');
|
||||
|
||||
@ -3217,19 +3183,18 @@ function hideShowSubmitButton(emp_count, unique_id = null)
|
||||
|
||||
}
|
||||
|
||||
function removeTab(input)
|
||||
{
|
||||
console.log(input)
|
||||
secondaryValue = ''
|
||||
if(input.id){
|
||||
var unique_id = input.id.split('_');
|
||||
if (unique_id.length > 1) {
|
||||
secondaryValue = unique_id[2];
|
||||
}
|
||||
}
|
||||
function removeTab(input, tabID, tabName)
|
||||
{
|
||||
var client_policy_id = $('#client_policy_id_'+tabID).val();
|
||||
console.log('removeTab input', input)
|
||||
console.log('removeTab tabID', tabID)
|
||||
console.log('removeTab tabName', tabName)
|
||||
console.log('removeTab client_policy_id', client_policy_id)
|
||||
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to remove this Tab.",
|
||||
text: "Do you want to remove this Rack Rate.",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
@ -3238,9 +3203,63 @@ function removeTab(input)
|
||||
|
||||
if (result.isConfirmed) {
|
||||
|
||||
$('#'+secondaryValue).remove();
|
||||
$('#list_'+secondaryValue).remove();
|
||||
$('#'+tabID).remove();
|
||||
$('#list_'+tabID).remove();
|
||||
$('#rack_rate_one').click();
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var form_action = '<?= base_url("util/remove_rack_rate/") ?>' + tabName + '/' + client_policy_id;
|
||||
console.log(form_action)
|
||||
$.ajax({
|
||||
url: form_action,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
console.log(res)
|
||||
|
||||
if(res){
|
||||
if (res.status == true) {
|
||||
Swal.fire({
|
||||
title: "Success",
|
||||
text: res.message,
|
||||
icon: "success"
|
||||
});
|
||||
// toastr.success('Policy removed successfully.', 'success');
|
||||
} else {
|
||||
if(res.rr_count > 0){
|
||||
Swal.fire({
|
||||
title: "warning!",
|
||||
text: res.message,
|
||||
icon: "warning"
|
||||
});
|
||||
}else{
|
||||
Swal.fire({
|
||||
title: "Success",
|
||||
text: 'Rack Rate removed successfully',
|
||||
icon: "success"
|
||||
});
|
||||
}
|
||||
|
||||
// toastr.warning('Failed to remove policy', 'warning');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log('Something Wrong!', 'warning');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
@ -3256,7 +3275,7 @@ function copyFromExcel(input, unique_id = null)
|
||||
var grid_content_from_excel = $('#grid_content_from_excel');
|
||||
|
||||
if(unique_id){
|
||||
grid_content_input = $('#grid_content_input_'+unique_id);
|
||||
grid_content_input = $('#grid_content_input_for_additional_'+unique_id);
|
||||
grid_content_from_excel = $('#grid_content_from_excel_'+unique_id);
|
||||
}
|
||||
|
||||
@ -3276,7 +3295,7 @@ function renameRackRateTab(input)
|
||||
{
|
||||
console.log(input)
|
||||
console.log(input.id)
|
||||
var newTabName = prompt('Enter the tab name')
|
||||
var newTabName = prompt('Enter rack rate name:')
|
||||
console.log(newTabName)
|
||||
secondaryValue = '';
|
||||
if(input.id){
|
||||
@ -3317,56 +3336,46 @@ function editPolicyPremiumCalculationSetValue(premium_type, unique_id = null)
|
||||
if(unique_id){
|
||||
|
||||
// console.log('editPolicyPremiumCalculationSetValue step 1');
|
||||
|
||||
|
||||
if (premium_type === '2') {
|
||||
// console.log('editPolicyPremiumCalculationSetValue step 2');
|
||||
|
||||
$('#individual_'+unique_id).prop('checked', true);
|
||||
$('#single_'+unique_id).prop('checked', false);
|
||||
|
||||
} else if (premium_type === '1') {
|
||||
// console.log('editPolicyPremiumCalculationSetValue step 3');
|
||||
|
||||
$('#single_'+unique_id).prop('checked', true);
|
||||
$('#individual_'+unique_id).prop('checked', false);
|
||||
|
||||
} else {
|
||||
// console.log('editPolicyPremiumCalculationSetValue step 4');
|
||||
|
||||
$('#single_'+unique_id).prop('checked', false);
|
||||
$('#individual_'+unique_id).prop('checked', true);
|
||||
|
||||
}
|
||||
}else{
|
||||
|
||||
// console.log('editPolicyPremiumCalculationSetValue step 5');
|
||||
|
||||
if (premium_type === '2') {
|
||||
// console.log('editPolicyPremiumCalculationSetValue step 6');
|
||||
|
||||
$('#individual').prop('checked', true);
|
||||
$('#single').prop('checked', false);
|
||||
|
||||
} else if (premium_type === '1') {
|
||||
// console.log('editPolicyPremiumCalculationSetValue step 7');
|
||||
|
||||
$('#single').prop('checked', true);
|
||||
$('#individual').prop('checked', false);
|
||||
|
||||
} else {
|
||||
// console.log('editPolicyPremiumCalculationSetValue step 8');
|
||||
|
||||
$('#single').prop('checked', false);
|
||||
$('#individual').prop('checked', true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function hideUnitFieldInABranchHaveSingleUnit()
|
||||
{
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
$(this)
|
||||
});
|
||||
}
|
||||
|
||||
function checkFamiliFloatersKeysDuplicate(rarc_rate_json_array, formObject)
|
||||
{
|
||||
|
||||
@ -3395,4 +3404,58 @@ function checkFamiliFloatersKeysDuplicate(rarc_rate_json_array, formObject)
|
||||
|
||||
}
|
||||
|
||||
|
||||
function appendFourthAndSixthRackRate(data = null, uniqueId = null)
|
||||
{
|
||||
console.log('appendFourthAndSixthRackRate function called');
|
||||
console.log('appendFourthAndSixthRackRate function uniqueId', uniqueId);
|
||||
console.log('appendFourthAndSixthRackRate function data', data);
|
||||
|
||||
|
||||
grid_html = `
|
||||
<div class="form-row" id="grid_4">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.si : ''}" type="text" class="form-control" placeholder="Enter Sum Insured" name="4_si" id="4_si" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='sum_insured_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4 unitDiv">
|
||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}" type="text" class="form-control" placeholder="Enter Unit" name="4_unit[]" id="4_unit" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">From Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_from : ''}" type="text" class="form-control" placeholder="Age" name="4_age_from[]" id="4_age_from" onkeypress = "return onlyNumbers(event)" required>
|
||||
</div>
|
||||
<div class="form-group col-md-2">
|
||||
<label for="mobile">To Age<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.age_to : ''}" type="text" class="form-control" placeholder="Age" name="4_age_to[]" id="4_age_to" onkeypress = "return onlyNumbers(event)" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3">
|
||||
<label for="mobile">Premium<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.premium : ''}" type="text" class="form-control" placeholder="Enter Premium" name="4_premium[]" id="4_premium" onkeypress = "return onlyNumbers(event)" onchange="formatNumber(this)" required>
|
||||
<div id='premium_number_word' class="text-danger-2" ></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-danger" id="gmc_remove" onclick="removebutton(0,4)">x</button>
|
||||
<button style="margin-top: 44px;" type="button" class="btn btn-primary" id="gmc_add_more" onclick="appendGridtHtml(4, '${uniqueId}')">+</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
grid_container_id = 'grid_content_input_for_additional_' + uniqueId;
|
||||
console.log('appendFourthAndSixthRackRate function', grid_container_id);
|
||||
grid_container = document.getElementById(grid_container_id);
|
||||
console.log('appendFourthAndSixthRackRate function', grid_container);
|
||||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -46,7 +46,7 @@
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-3">
|
||||
<label>Client</label> <br />
|
||||
<select class="form-control" id="clients">
|
||||
<option value="0">Select</option>
|
||||
@ -54,14 +54,20 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-3">
|
||||
<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-3">
|
||||
<label>Unit</label> <br />
|
||||
<select name="branch_id" class="form-control" id="unit_id">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<div class="form-group col-md-3">
|
||||
<label>Policy</label> <br />
|
||||
<select class="form-control" id="policies">
|
||||
<option value="0">Select</option>
|
||||
@ -76,7 +82,8 @@
|
||||
<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 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="calculatePremium(event);" >calc</a>
|
||||
<a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="checkDependentConflict(event);" >Check Dependent conflict</a>
|
||||
<a href="<?= base_url("#"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="calculatePremium(event);" >calc premium</a>
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="addRowToTable();">+</a>
|
||||
</div>
|
||||
<!-- <button onclick="addRowToTable()">Add Row</button> -->
|
||||
@ -136,13 +143,61 @@
|
||||
<div class="modal-dialog modal-dialog-centered" style="max-width:80%;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Center modal</h4>
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Premium Calculation Test Data</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h5>Overflowing text to show scroll behavior</h5>
|
||||
<p>Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
|
||||
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</p>
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="restable">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="small-width">SNO</th>
|
||||
<th class="small-width">Emp code</th>
|
||||
<th class="large-width">Name</th>
|
||||
<th class="medium-width">DOB</th>
|
||||
<th class="medium-width">Relation</th>
|
||||
<th class="large-width">Rack rate name</th>
|
||||
<th class="small-width">Grid ID</th>
|
||||
<th class="small-width">Is Self</th>
|
||||
<th class="small-width">Premium type</th>
|
||||
<th class="large-width">SI</th>
|
||||
<th class="medium-width">premium</th>
|
||||
<th class="small-width">Policy days</th>
|
||||
|
||||
<th class="small-width">no of days</th>
|
||||
<th class="medium-width">Rata premium</th>
|
||||
<th class="medium-width">GST</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id='restablebody'>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<div class="modal fade" id="centermodal2" tabindex="-1" role="dialog" aria-hidden="true" >
|
||||
<div class="modal-dialog modal-dialog-centered" style="max-width:80%;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Dependent Conflict Test Data</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<table class="table table-hover m-0 table-centered dt-responsive w-100" cellspacing="0" id="restable">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
|
||||
<th class="small-width">Column</th>
|
||||
<th class="large-width">Error</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody id='dependenttablebody'>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
@ -151,6 +206,19 @@
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
let mouseX = 0;
|
||||
let mouseY = 0;
|
||||
|
||||
document.addEventListener('mousemove', function(event) {
|
||||
mouseX = event.clientX;
|
||||
mouseY = event.clientY;
|
||||
});
|
||||
|
||||
function getMouseCoordinates() {
|
||||
return { x: mouseX, y: mouseY };
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Initialize select2
|
||||
$("#clients").select2();
|
||||
@ -161,7 +229,8 @@
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var clientPoliciesWithBranch = {
|
||||
policies: []
|
||||
policies: [],
|
||||
units:[]
|
||||
};
|
||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||
@ -172,7 +241,11 @@
|
||||
fetchClientPolicies();
|
||||
|
||||
addRowToTable(['Ram Kumar','01-Apr-1990','M','Self','500000','',450000,'A','unit1']);
|
||||
addRowToTable(['Sita','01-Apr-1993','F','Spouse','500000','','','A','unit1']);
|
||||
addRowToTable(['Sita','01-Apr-1993','F','Spouse','','','','','']);
|
||||
addRowToTable(['Gugan','01-Apr-2005','M','Son','','','','','']);
|
||||
addRowToTable(['Selvi','01-Apr-2010','F','Daughter','','','','','']);
|
||||
addRowToTable(['Suresh','01-Apr-1960','M','Father','','','','','']);
|
||||
addRowToTable(['Jamuna','01-Apr-1965','F','Mother','','','','','']);
|
||||
|
||||
});
|
||||
|
||||
@ -303,7 +376,7 @@
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||
text: `${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||
});
|
||||
if (PolicyID == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
@ -312,6 +385,60 @@
|
||||
});
|
||||
}
|
||||
|
||||
function appendUnits(data) {
|
||||
|
||||
$('#unit_id').empty();
|
||||
$('#unit_id').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,
|
||||
text: item
|
||||
});
|
||||
if (index == 0) {
|
||||
option.attr('selected', true);
|
||||
setUnitInFirstRow(item);
|
||||
}
|
||||
$('#unit_id').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
function setUnitInFirstRow(text) {
|
||||
var cellIndex = 10;
|
||||
// Get the tbody element by its ID
|
||||
var tbody = document.getElementById('emptablebody');
|
||||
|
||||
// Check if the tbody exists
|
||||
if (!tbody) {
|
||||
console.error('Tbody element not found with id:', tbodyId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the first row of the tbody
|
||||
var firstRow = tbody.rows[0];
|
||||
|
||||
// Check if the first row exists
|
||||
if (!firstRow) {
|
||||
console.error('No rows found in tbody with id:', tbodyId);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the specified cell index exists in the first row
|
||||
if (cellIndex >= firstRow.cells.length) {
|
||||
console.error('Cell index', cellIndex, 'out of bounds for the first row');
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the text content of the specified cell in the first row
|
||||
firstRow.cells[cellIndex].textContent = text;
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
@ -334,30 +461,64 @@
|
||||
appendBranch(foundPolicies.branchs);
|
||||
});
|
||||
|
||||
$('#unit_id').on('change', function() {
|
||||
|
||||
var selectedUnit = $(this).val();
|
||||
setUnitInFirstRow(selectedUnit);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#branch_id').on('change', function() {
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
console.log(clientPolicies);
|
||||
console.log(clientPoliciesWithBranch);
|
||||
var selectedBranch = $(this).val();
|
||||
var current_client_id = $('#clients').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;
|
||||
return item.branch_id === selectedBranch;
|
||||
});
|
||||
|
||||
var foundUnits = [];
|
||||
|
||||
clientPolicies.forEach(function(client) {
|
||||
if (client.id == current_client_id) {
|
||||
console.log('inside ' + current_client_id);
|
||||
console.log(client.client_name + ' first if');
|
||||
var branches = client.branchs;
|
||||
branches.forEach(function(branch) {
|
||||
if (branch.id == selectedBranch) {
|
||||
console.log('inside branch check');
|
||||
console.log(branch.branch_name);
|
||||
console.log(branch.units);
|
||||
foundUnits = (JSON.parse(branch.units));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
console.log('final');
|
||||
console.log(foundUnits);
|
||||
|
||||
if (Array.isArray(foundUnits) && foundUnits.length === 0) {
|
||||
// appendPolicies(foundPolicies);
|
||||
toastr.warning('No Units found for the selected client branch.');
|
||||
} else {
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendUnits(foundUnits);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@ -378,11 +539,12 @@
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').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 unit_id = $('#unit_id').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0') {
|
||||
alert('Please select all values in dropdowns.');
|
||||
return;
|
||||
}
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
@ -392,7 +554,7 @@
|
||||
};
|
||||
|
||||
|
||||
// $('#loader').show();
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url(); ?>' + 'employee/test-rack-rate';
|
||||
console.log('calculatePremium');
|
||||
// console.log(apiURL);
|
||||
@ -406,17 +568,13 @@
|
||||
data: JSON.stringify(queryParams),
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
|
||||
var myModal = new bootstrap.Modal(document.getElementById('centermodal'), { keyboard: true });
|
||||
|
||||
// Show the modal
|
||||
myModal.show();
|
||||
// return;
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
console.log(response.dataStatus);
|
||||
console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
// $("#centermodal").modal('show');
|
||||
console.log('success');
|
||||
|
||||
displayData(response.data);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
@ -428,7 +586,67 @@
|
||||
}
|
||||
});
|
||||
|
||||
// $('#loader').hide();
|
||||
$('#loader').hide();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function checkDependentConflict() {
|
||||
event.preventDefault(); // Prevent default action
|
||||
let table = document.getElementById('emptable');
|
||||
let tabledata = getTableDataAsJson(table);
|
||||
// return;
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').val();
|
||||
var branch_id = $('#branch_id').val();
|
||||
console.log(client_id + '-' + policy_id);
|
||||
if (client_id == '0' || policy_id == '0' || branch_id == '0') {
|
||||
alert('Please select all values');
|
||||
return;
|
||||
}
|
||||
|
||||
var queryParams = {
|
||||
client_id: client_id,
|
||||
policy_id: policy_id,
|
||||
branch_id: branch_id,
|
||||
data: tabledata,
|
||||
};
|
||||
|
||||
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url(); ?>' + 'employee/test-dependent';
|
||||
console.log('calculatePremium');
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
data: JSON.stringify(queryParams),
|
||||
success: function(response) {
|
||||
console.log(response);
|
||||
console.log(response.dataStatus);
|
||||
console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
// $("#centermodal").modal('show');
|
||||
console.log('success');
|
||||
|
||||
displayDependentData(response.data);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
|
||||
$('#loader').hide();
|
||||
|
||||
|
||||
}
|
||||
@ -439,6 +657,144 @@
|
||||
icon.classList.toggle('mdi-chevron-up');
|
||||
});
|
||||
|
||||
function displayData(data)
|
||||
{
|
||||
const tableBody = document.getElementById("restablebody");
|
||||
$("#restablebody").empty();
|
||||
const existingRowCount = tableBody.rows.length;
|
||||
for(i = 0; i < data.length; i++)
|
||||
{
|
||||
const newRow = document.createElement("tr");
|
||||
|
||||
let newCell;
|
||||
|
||||
// SNO with auto-increment
|
||||
newCell = document.createElement("td");
|
||||
newCell.textContent = i + 1;
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
// Emp code (assuming you want an input field)
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = data[i]['emp_code'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
// newCell.innerHTML = data[i]['name'] ;
|
||||
newCell.innerHTML = data[i]['name'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = data[i]['dob'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = data[i]['relationship'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = data[i]['temp']['grid_name'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = data[i]['temp']['grid_id'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = (data[i]['temp']['acting_self'] ? 'Yes' : 'No');
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = (data[i]['temp']['premium_type'] == 1 ? 'S' : 'I');
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = (data[i]['policy_details']['basic_cover_si']);
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = (data[i]['policy_details']['premium']);
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = data[i]['policy_details']['days'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = data[i]['policy_details']['no_of_days'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = (data[i]['policy_details']['rata_premimum']);
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = (data[i]['policy_details']['gst']);
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
|
||||
tableBody.appendChild(newRow);
|
||||
}
|
||||
var myModal = new bootstrap.Modal(document.getElementById('centermodal'), { keyboard: true });
|
||||
// Show the modal
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function displayDependentData(data)
|
||||
{
|
||||
const tableBody = document.getElementById("dependenttablebody");
|
||||
$("#dependenttablebody").empty();
|
||||
|
||||
if(!data['result']['status'])
|
||||
{
|
||||
for(i = 0; i < data['result']['error_data'].length; i++)
|
||||
{
|
||||
|
||||
|
||||
const newRow = document.createElement("tr");
|
||||
|
||||
let newCell;
|
||||
|
||||
// SNO with auto-increment
|
||||
newCell = document.createElement("td");
|
||||
newCell.textContent = data['result']['error_data'][i]['col_name'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
// Emp code (assuming you want an input field)
|
||||
newCell = document.createElement("td");
|
||||
newCell.innerHTML = data['result']['error_data'][i]['msg'];
|
||||
newCell.style.border = "1px solid";
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
tableBody.appendChild(newRow);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const newRow = document.createElement("div");
|
||||
newRow.innerHTML = '<h2>All Good...!</h2>';
|
||||
tableBody.appendChild(newRow);
|
||||
|
||||
}
|
||||
var myModal = new bootstrap.Modal(document.getElementById('centermodal2'), { keyboard: true });
|
||||
// Show the modal
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function formatNumberToIndianLocale(value, field_name, action) {
|
||||
|
||||
@ -541,6 +897,7 @@ const suggestionsList = document.getElementById("suggestions");
|
||||
newCell.contentEditable = "true"; // Make the cell editable (if needed)
|
||||
newCell.style.border = "1px solid";
|
||||
newCell.addEventListener("input", handleInput);
|
||||
newCell.addEventListener("blur", function(){ hideSuggestions(); });
|
||||
newRow.appendChild(newCell);
|
||||
|
||||
// SI (assuming you want a date input field)
|
||||
@ -640,10 +997,13 @@ const suggestionsList = document.getElementById("suggestions");
|
||||
|
||||
// Position the suggestion box near the input field (optional)
|
||||
const cellRect = focusedCell.parentNode.getBoundingClientRect();
|
||||
// console.log(cellRect.left);
|
||||
// console.log(cellRect.right);
|
||||
suggestionBox.style.left = 170 + "px";
|
||||
suggestionBox.style.top = 50 + "px";
|
||||
|
||||
const coords = getMouseCoordinates();
|
||||
console.log(coords.x);
|
||||
console.log(coords.y);
|
||||
|
||||
suggestionBox.style.left = (coords.x - 100) + "px";
|
||||
suggestionBox.style.top = (coords.y - 300) + "px";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
public/assets/images/left_arrow.png
Normal file
BIN
public/assets/images/left_arrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 383 B |
BIN
public/assets/images/mask_group.png
Normal file
BIN
public/assets/images/mask_group.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
BIN
public/assets/images/mask_group_blue.png
Normal file
BIN
public/assets/images/mask_group_blue.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
public/assets/images/mask_group_orange.png
Normal file
BIN
public/assets/images/mask_group_orange.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
BIN
public/assets/images/mask_group_pink.png
Normal file
BIN
public/assets/images/mask_group_pink.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
BIN
public/assets/images/right_arrow.png
Normal file
BIN
public/assets/images/right_arrow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 362 B |
@ -1,236 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Tests;
|
||||
|
||||
use CodeIgniter\Test\CIUnitTestCase;
|
||||
use Config\App;
|
||||
use Config\Services;
|
||||
use Tests\Support\Libraries\ConfigReader;
|
||||
|
||||
use App\Controllers\EmployeeServiceController;
|
||||
use CodeIgniter\Test\DatabaseTestTrait;
|
||||
use Kint\Kint;
|
||||
|
||||
class PremiumCalculationTestNew extends CIUnitTestCase
|
||||
{
|
||||
use DatabaseTestTrait;
|
||||
protected $migrate = false;
|
||||
|
||||
//primary, single parent, double parent, and double parent in law
|
||||
public function testPremiumCalculation($MY_PARAM = 'default')
|
||||
{
|
||||
helper('excel_util_helper');
|
||||
$param = getenv('MY_PARAM');
|
||||
// echo isset($param) && $param != NULL ? $param : $MY_PARAM;
|
||||
|
||||
//first slab
|
||||
$primary_relationship = '{"self":1,"spouse":"any","childrens":"any","parents":"NA","parents-in-law":"NA","either-parents-pil":0}';
|
||||
$primary_grid_id = 7;
|
||||
$primary_unit = 'unit1';
|
||||
$primary_grid_type = 2;
|
||||
$primary_max_si = 35000000;
|
||||
$primary_grid_name = 'dependent + age + SI';
|
||||
$primary_grid_master = ['id' => 4,'policy_type' => 'GMC','ui_type' => $primary_grid_id,'policy_grid_type' => $primary_grid_name,'is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0];
|
||||
$primary_slabs = [
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit],
|
||||
[ '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,'additional_relationship' => $primary_relationship,'unit' => $primary_unit]
|
||||
];
|
||||
|
||||
//second slab
|
||||
$second_relationship = '{"self":"NA","spouse":"NA","childrens":"NA","parents":"any","parents-in-law":"NA","either-parents-pil":0}';
|
||||
$second_grid_id = 10;
|
||||
$second_unit = 'unit1';
|
||||
$second_grid_type = 1;
|
||||
$second_max_si = 35000000;
|
||||
$second_grid_name = 'max age';
|
||||
$second_grid_master = ['id' => 4,'policy_type' => 'GMC','ui_type' => $second_grid_id,'policy_grid_type' => $second_grid_name,'is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0];
|
||||
$second_slabs = [
|
||||
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 700, 'max_si' => 2500000,'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit ],
|
||||
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 1400, 'max_si' => 2000000, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 2300, 'max_si' => 1800000, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 2750, 'max_si' => 150000, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 3500, 'max_si' => 130000, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 4250, 'max_si' => 10, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 4950, 'max_si' => 5, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $second_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 5500, 'max_si' => 5, 'premium_type' => $second_grid_type, 'relationship' => null,'additional_relationship' => $second_relationship,'unit' => $second_unit]
|
||||
|
||||
];
|
||||
|
||||
// third slab
|
||||
$third_relationship = '{"self":"NA","spouse":"NA","childrens":"NA","parents":1,"parents-in-law":"NA","either-parents-pil":0}';
|
||||
$third_grid_id = 7;
|
||||
$third_unit = 'unit1';
|
||||
$third_grid_type = 1;
|
||||
$third_max_si = 35000000;
|
||||
$third_grid_name = 'age band';
|
||||
$third_grid_master = ['id' => 4,'policy_type' => 'GMC','ui_type' => $third_grid_id,'policy_grid_type' => $third_grid_name,'is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0];
|
||||
$third_slabs = [
|
||||
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 701, 'max_si' => 2500000,'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit ],
|
||||
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 1401, 'max_si' => 2000000, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 2301, 'max_si' => 1800000, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 2751, 'max_si' => 150000, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 3501, 'max_si' => 130000, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 4251, 'max_si' => 10, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 4951, 'max_si' => 5, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $third_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 5501, 'max_si' => 5, 'premium_type' => $third_grid_type, 'relationship' => null,'additional_relationship' => $third_relationship,'unit' => $third_unit]
|
||||
|
||||
];
|
||||
|
||||
|
||||
// fourth slab
|
||||
$fourth_relationship = '{"self":"NA","spouse":"NA","childrens":"NA","parents":"NA","parents-in-law":2,"either-parents-pil":0}';
|
||||
$fourth_grid_id = 11;
|
||||
$fourth_unit = 'unit1';
|
||||
$fourth_grid_type = 2;
|
||||
$fourth_max_si = 8000000;
|
||||
$fourth_grid_name = 'age band';
|
||||
$fourth_grid_master = ['id' => 4,'policy_type' => 'GMC','ui_type' => $fourth_grid_id,'policy_grid_type' => $fourth_grid_name,'is_dependent_allowed' => 1,'max_dependent_age' => 0,'max_dependent_count' => 1,'basicpay' => 0,'emp_band' => 0];
|
||||
$fourth_slabs = [
|
||||
[ 'id' => 322, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 0, 'age_to' => 18, 'grade' => 'A', 'si' => 5000000, 'premium' => 1111, 'max_si' => $fourth_max_si,'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit ],
|
||||
[ 'id' => 323, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 19, 'age_to' => 25, 'grade' => 'B', 'si' => 5000000, 'premium' => 2222, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 26, 'age_to' => 35, 'grade' => 'C', 'si' => 5000000, 'premium' => 3333, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 36, 'age_to' => 45, 'grade' => 'D', 'si' => 5000000, 'premium' => 4444, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 46, 'age_to' => 55, 'grade' => 'E', 'si' => 5000000, 'premium' => 5555, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 56, 'age_to' => 75, 'grade' => 'F', 'si' => 5000000, 'premium' => 6666, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 76, 'age_to' => 85, 'grade' => 'G', 'si' => 5000000, 'premium' => 7777, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 5000000, 'premium' => 8888, 'max_si' => $fourth_max_si, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit],
|
||||
[ 'id' => 324, 'client_id' => 61, 'client_policy_id' => 63, 'policy_grid_id' => $fourth_grid_id, 'age_from' => 86, 'age_to' => 100, 'grade' => 'G', 'si' => 8000000, 'premium' => 9999, 'max_si' => 0, 'premium_type' => $fourth_grid_type, 'relationship' => null,'additional_relationship' => $fourth_relationship,'unit' => $fourth_unit]
|
||||
|
||||
];
|
||||
|
||||
//overall rack rate
|
||||
$over_all_rack_details = [ 'primary' => [ "slab_rates" => $primary_slabs,'grid_master' => $primary_grid_master],
|
||||
'two parent' => ["slab_rates" => $second_slabs,'grid_master' => $second_grid_master],
|
||||
'single parent' => ["slab_rates" => $third_slabs,'grid_master' => $third_grid_master],
|
||||
'double_parent_in_law' => ["slab_rates" => $fourth_slabs,'grid_master' => $fourth_grid_master]
|
||||
|
||||
];
|
||||
|
||||
// Sample family data
|
||||
$family_details = [
|
||||
[2,'TEST001','John Doe', '01-Jan-1988', 'M', 'Self', '5000000', NULL, '', '', 'G', '', '', '', '', '', '','','unit1'],
|
||||
[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,
|
||||
'spouse' => 1,
|
||||
'childrens' => 2,
|
||||
'either-parents-pil' => 0,
|
||||
'parents' => 2,
|
||||
'parents-in-law' => 2,
|
||||
],
|
||||
];
|
||||
//re organize over_all_rack_details
|
||||
$all_rack_rates = [];
|
||||
foreach ($over_all_rack_details as $key => $value) {
|
||||
foreach ($value['slab_rates'] as $skey => $svalue) {
|
||||
$svalue['rack_rate_name'] = $key;
|
||||
$svalue['grid_master'] = $value['grid_master'];
|
||||
$all_rack_rates[] = $svalue;
|
||||
}
|
||||
// dd($value['slab_rates']);
|
||||
}
|
||||
|
||||
// dd($all_rack_rates);
|
||||
$policy_details = ['base_policy' => null,"policy_start_date" => "2023-02-02","policy_end_date" => "2024-02-02","policy_terms" => json_encode($policy_terms),'gst' => 5];
|
||||
$file = ['id' => null,'client_id' => 10,'policy_id' => 10,'action' => 'inception','client_branch_id' => 1,'created_by' => 1];
|
||||
$existing_units = ['unit1'];
|
||||
$data = calculate_premium_new(family_data:$family_details,policy_terms: $policy_details,slab_details : $all_rack_rates,fileArr: $file, existing_units:$existing_units);
|
||||
|
||||
//****************************onboard process*******************
|
||||
// $empServiceController = new EmployeeServiceController();
|
||||
// $empServiceController->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||
|
||||
// dd();
|
||||
//******************************** onboard process****************
|
||||
$policy_created_count = 0;
|
||||
echo "\n";
|
||||
$result_to_display = [];
|
||||
foreach ($data as $key => $value)
|
||||
{
|
||||
if(is_array($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 = ($value['temp']['grid_name']);
|
||||
$temp_grid_type = ($value['temp']['premium_type']);
|
||||
$temp_grid_type = ($temp_grid_type == 1 ? 'S' : 'I');
|
||||
$result_to_display[$key]['premium_type'] = $temp_grid.'#'.$value['temp']['grid_id'].'#'.
|
||||
($value['temp']['acting_self'] == true ? 'Self' : 'No' ) .'#'. ($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 + 1);
|
||||
$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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user