MERGE_UAT_RR_ISSUE_FIXED
This commit is contained in:
commit
fc1d065499
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,12 @@ $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->cli('cli/processjob', 'JobWorker::processJob');
|
||||
$routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
$routes->cli('cli/enrollment_status', 'JobWorker::enrollment_status');
|
||||
$routes->cli('cli/enrollment_status', 'DashboardController::enrollment_status');
|
||||
$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'));
|
||||
@ -2161,7 +2166,8 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function getClientBranch($client_id){
|
||||
public function getClientBranch($client_id)
|
||||
{
|
||||
|
||||
$branchs = $this->clientBranchModel
|
||||
->select('*')
|
||||
@ -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
|
||||
@ -35,23 +40,26 @@ class DashboardController extends AdminController
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$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 +67,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 +100,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 info 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 +133,32 @@ 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 +187,90 @@ class DashboardController 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->findAll();
|
||||
$currentDate = date('d');
|
||||
|
||||
// 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']));
|
||||
if ($currentDate == $openDate) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
||||
}
|
||||
|
||||
if ($closeDate < $currentDate) {
|
||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
||||
}
|
||||
}
|
||||
|
||||
$reminder_whole_mail = [];
|
||||
|
||||
foreach ($client_policy_data as $client_policy) {
|
||||
// Fetch client data
|
||||
$client_data = $clientModel->find($client_policy['client_id']);
|
||||
|
||||
// Fetch notification settings
|
||||
$notification_data = $notificationModel->where('client_id', $client_policy['client_id'])
|
||||
->where('template_name', 'member_reminder_mail')
|
||||
->first();
|
||||
|
||||
// Check if notification should be sent
|
||||
if ($notification_data && $notification_data['enabled'] == 1 && $currentDate == date('d', strtotime($client_policy['reminder_date'])) ) {
|
||||
// Fetch all employees related to the client policy
|
||||
$employees = $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('employee_polices.status', 'draft')
|
||||
->where('employees.relationship', 'Self')
|
||||
->findAll();
|
||||
// Process each employee
|
||||
foreach ($employees as $employee) {
|
||||
if($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self'){
|
||||
$params['emp_data'] = $employee;
|
||||
$params['client_data'] = $client_data;
|
||||
$params['notification_data'] = $notification_data;
|
||||
|
||||
// Send the mail notification
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(count($temp_whole_data) > 0){
|
||||
Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $temp_whole_data]);
|
||||
}
|
||||
|
||||
return json_encode(true);
|
||||
}
|
||||
|
||||
public function featch_dashboard_data($type)
|
||||
{
|
||||
$pendingActionsController = new PendingActionsController;
|
||||
|
||||
@ -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);
|
||||
@ -1163,21 +1164,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 +1495,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,26 +1546,99 @@ 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);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -954,7 +954,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
public function getEmployeePolicy()
|
||||
{
|
||||
// try {
|
||||
try {
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
@ -1114,21 +1114,21 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
// Add family floter buttons placement data for FE validation
|
||||
if(count($floters)){
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
|
||||
$temp2['is_value_exist'] = false;
|
||||
$temp2['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
|
||||
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
|
||||
|
||||
$temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
||||
$temp2['is_value_exist'] = false;
|
||||
$temp2['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
|
||||
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
|
||||
|
||||
$temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
||||
|
||||
array_push($data,$temp2);
|
||||
array_push($data,$temp2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$array->mapped_family_floaters = $data;
|
||||
$array->type = "Group Medical Coverage";
|
||||
@ -1164,9 +1164,9 @@ class EmployeeRestController extends AdminController
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
|
||||
}
|
||||
// } catch (\Exception $e) {
|
||||
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
// }
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1178,6 +1178,7 @@ class EmployeeRestController extends AdminController
|
||||
->where('client_branch_id',$client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('is_addon_value',0)->findAll();
|
||||
// return $employeeData;
|
||||
foreach ($GmcParrentsPolicy as $key => $array) {
|
||||
|
||||
|
||||
@ -1241,6 +1242,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
// Convert familyFloaters terms data to plain array
|
||||
$floters = $this->FloterConvertion($familyFloates);
|
||||
|
||||
$data = [];
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
@ -1386,8 +1388,18 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$first_two_chars = substr($result, 0, 3);
|
||||
|
||||
if($first_two_chars == " +"){
|
||||
$modified_string = substr($result, 3);
|
||||
return "Can Add ".$modified_string;
|
||||
}else{
|
||||
return $result;
|
||||
}
|
||||
return substr($result, 0, 2) !== " +";
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
public function getClientDetails()
|
||||
|
||||
@ -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,9 @@
|
||||
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;
|
||||
|
||||
class JobWorker extends AdminController
|
||||
{
|
||||
const STATUS_DONE = 'done';
|
||||
@ -330,70 +325,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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1086,6 +1086,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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
@ -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;
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@ -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 {
|
||||
@ -105,7 +108,7 @@
|
||||
}
|
||||
|
||||
.carousel-control-prev-icon, .carousel-control-next-icon {
|
||||
background-color: rgba(0,0,0,0.5); /* Change color as needed */
|
||||
/* background-color: rgba(0,0,0,0.5); Change color as needed */
|
||||
}
|
||||
|
||||
.carousel-control-prev-icon {
|
||||
@ -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 Enrollment</option>
|
||||
<option value="close">Closed Enrollment</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>
|
||||
|
||||
@ -140,7 +140,7 @@
|
||||
|
||||
<script>
|
||||
toastr.options = {
|
||||
"timeOut": 2000,
|
||||
"timeOut": 5000,
|
||||
"closeButton": true,
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -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">
|
||||
@ -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">
|
||||
@ -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>
|
||||
@ -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 |
@ -146,7 +146,7 @@ class PremiumCalculationTestNew extends CIUnitTestCase
|
||||
foreach ($value['slab_rates'] as $skey => $svalue) {
|
||||
$svalue['rack_rate_name'] = $key;
|
||||
$svalue['grid_master'] = $value['grid_master'];
|
||||
$all_rack_rates[] = $svalue;
|
||||
$all_rack_rates['slab_rates'][] = $svalue;
|
||||
}
|
||||
// dd($value['slab_rates']);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user