Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2024-07-30 11:37:31 +05:30
commit c981cc20df
18 changed files with 1155 additions and 507 deletions

View File

@ -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

View File

@ -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');
@ -272,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");

View File

@ -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);
}
}
}

View File

@ -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,89 @@ 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
->where('id', 21)
->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['open_date']) {
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
}
if ($client_policy['close_date'] < $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 == $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'])
->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;

View File

@ -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()

View File

@ -3,13 +3,8 @@
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
{
@ -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);
}

View File

@ -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,
];

View File

@ -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",

View File

@ -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();
}
},

View File

@ -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">Close 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>

View File

@ -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');

View File

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B