Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
d238102462
@ -23,12 +23,6 @@ $routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmp
|
||||
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
||||
|
||||
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||
|
||||
|
||||
|
||||
$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "UserController::create");
|
||||
$routes->get("create", "UserController::create");
|
||||
@ -42,6 +36,9 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("view", "DashboardController::dashboard");
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||
});
|
||||
|
||||
|
||||
@ -236,6 +233,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1");
|
||||
$routes->get("get-client-branch/(:any)", "ClientController::getClientBranch/$1");
|
||||
$routes->get("get-client-details/(:any)", "ClientController::getClientAllDetailsByUsingClientID/$1");
|
||||
$routes->get("delete-additional-rack-rate/(:any)", "ClientController::deleteAdditionalRackRate/$1");
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
@ -243,6 +241,7 @@ $routes->cli('cli/processjobs', 'JobWorker::processJobs');
|
||||
$routes->get("processjob", "JobWorker::processJob");
|
||||
|
||||
|
||||
|
||||
//Employee login api's
|
||||
$routes->post("/employeeRest/verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
@ -255,15 +254,11 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
||||
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
||||
$routes->post("/calculatePremium", "EmployeeRestController::calculatePremium");
|
||||
|
||||
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
|
||||
@ -40,8 +40,7 @@ class Session extends BaseConfig
|
||||
* The number of SECONDS you want the session to last.
|
||||
* Setting to 0 (zero) means expire when the browser is closed.
|
||||
*/
|
||||
// public int $expiration = 7200;
|
||||
public int $expiration = 86400; //24 Hours
|
||||
public int $expiration = 7200;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
||||
@ -169,8 +169,9 @@ class ClientController extends AdminController
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
$data['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
|
||||
$data['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||
|
||||
// dd($data['placeHolders']);
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_onboarding', $data);
|
||||
@ -283,7 +284,7 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
|
||||
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
|
||||
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
@ -585,13 +586,13 @@ class ClientController extends AdminController
|
||||
|
||||
$this->myLogger->logme('error','Client policy CREATE function called');
|
||||
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
$policy_type_id = $this->request->getPost('policy_type_id');
|
||||
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||
|
||||
$policyCount = $this->clientPolicyModel
|
||||
->where('policy_id', $policy_id)
|
||||
->where('policy_type_id', $policy_type_id)
|
||||
->where('client_branch_id', $client_branch_id)
|
||||
->countAllResult();
|
||||
->countAllResults();
|
||||
|
||||
if($policyCount > 0 ){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
|
||||
@ -783,6 +784,9 @@ class ClientController extends AdminController
|
||||
|
||||
public function createClientPolicyPremium()
|
||||
{
|
||||
|
||||
// echo json_encode(['key' => $this->request->getPost()]); die;
|
||||
|
||||
try {
|
||||
$policy_type = $this->request->getPost('policy_type');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
@ -793,6 +797,24 @@ class ClientController extends AdminController
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
}
|
||||
$policy_grid_id = $this->request->getPost('policy_grid_id');
|
||||
$rack_rate_type = $this->request->getPost('rack_rate_type');
|
||||
|
||||
$self = $this->request->getPost('self') ? 1 : 0;
|
||||
$spouse = $this->request->getPost('spouse')? 1 : 0;
|
||||
$childrens = $this->request->getPost('childrens')? 1 : 0;
|
||||
$parents = $this->request->getPost('parents')? 1 : 0;
|
||||
$parents_in_law = $this->request->getPost('parents-in-law')? 1 : 0;
|
||||
$either_parents_pil = $this->request->getPost('either-parents-pil')? 1 : 0;
|
||||
|
||||
$relation_data['self'] = $self;
|
||||
$relation_data['spouse'] = $spouse;
|
||||
$relation_data['childrens'] = $childrens;
|
||||
$relation_data['parents'] = $parents;
|
||||
$relation_data['parents-in-law'] = $parents_in_law;
|
||||
$relation_data['either-parents-pil'] = $either_parents_pil;
|
||||
|
||||
|
||||
$jsonDataForRelation = json_encode($relation_data);
|
||||
|
||||
// if($policy_grid_id == 10 || $policy_grid_id == 11){
|
||||
// $premium_type = 1;
|
||||
@ -811,6 +833,11 @@ class ClientController extends AdminController
|
||||
$data['client_policy_id'] = $client_policy_id;
|
||||
$data['policy_grid_id'] = $policy_grid_id;
|
||||
$data['premium_type'] = $premium_type;
|
||||
$data['rack_rate_type'] = $rack_rate_type;
|
||||
|
||||
if($rack_rate_type == 1){
|
||||
$data['additional_relationship'] = $jsonDataForRelation;
|
||||
}
|
||||
|
||||
|
||||
$premium = [];
|
||||
@ -818,7 +845,7 @@ class ClientController extends AdminController
|
||||
if ($policy_grid_id == '1' || $policy_grid_id == '2') {
|
||||
$this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
} else {
|
||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->where('rack_rate_type', $rack_rate_type)->set('is_active', 0)->update();
|
||||
}
|
||||
|
||||
|
||||
@ -925,6 +952,9 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
$premium = $this->request->getPost('6_premium[]');
|
||||
|
||||
print_r($premium);
|
||||
|
||||
$sum_insure = $this->request->getPost('6_si');
|
||||
$age_from = $this->request->getPost('6_age_from[]');
|
||||
$age_to = $this->request->getPost('6_age_to[]');
|
||||
@ -1135,21 +1165,24 @@ class ClientController extends AdminController
|
||||
$self = $policy_terms_data->family_floaters;
|
||||
}
|
||||
|
||||
$emp_count = $this->employeeModel->join('client_policy cp', "employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
->where("employees.client_id", $record['client_id'])
|
||||
->where("employees.emp_status", 'active')
|
||||
->where("ep.status", 'active')
|
||||
->where("employees.is_active", 1)
|
||||
->where("ep.is_active", 1)
|
||||
// $emp_count = $this->employeeModel
|
||||
// ->join('client_policy cp', "employees.client_id = cp.client_id")
|
||||
// ->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
// ->where("employees.client_id", $record['client_id'])
|
||||
// ->where("employees.emp_status", 'active')
|
||||
// ->where("ep.status", 'active')
|
||||
// ->where("employees.is_active", 1)
|
||||
// ->where("ep.is_active", 1)
|
||||
// ->countAllResults();
|
||||
|
||||
|
||||
$emp_count = $this->employeePolicyModel
|
||||
->join('client_policy cp', "cp.id = employee_polices.client_policy_id")
|
||||
->where("employee_polices.client_policy_id", $client_policy_id)
|
||||
->where("employee_polices.status", 'active')
|
||||
->where("employee_polices.is_active", 1)
|
||||
->countAllResults();
|
||||
|
||||
|
||||
// $data = $this->employeePolicyModel->select('employee_polices.id')
|
||||
// ->where('employee_polices.is_active', 1)
|
||||
// ->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
// ->findAll();
|
||||
|
||||
// $emp_count = count($data);
|
||||
|
||||
// if($emp_count == 0){
|
||||
@ -1184,6 +1217,11 @@ class ClientController extends AdminController
|
||||
|
||||
$premiumData = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($premiumData); die;
|
||||
|
||||
@ -1240,19 +1278,28 @@ class ClientController extends AdminController
|
||||
$premiumDataa = $premiumData;
|
||||
}
|
||||
|
||||
// print_r($premiumData);die;
|
||||
// $premium1 = [];
|
||||
// $premium2 = [];
|
||||
|
||||
// print_r($data[0]->policy_type); die;
|
||||
// echo "hello";
|
||||
// return json_encode($premiumData);
|
||||
// foreach ($premiumDataa as $key => $item) {
|
||||
// if ($item['rack_rate_type'] == 0) {
|
||||
// $premium1[] = $item;
|
||||
// } elseif ($item['rack_rate_type'] == 1) {
|
||||
// $premium2[] = $item;
|
||||
// }
|
||||
// }
|
||||
|
||||
// print_r($premium1);
|
||||
// print_r($premium2); die;
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
} else if ($search_term === 'GPA') {
|
||||
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
||||
return $this->respond(['status' => false, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2047,5 +2094,31 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function deleteAdditionalRackRate($client_id, $client_policy_id, $rack_rate_type)
|
||||
{
|
||||
try {
|
||||
$result = $this->policyPremium2Model
|
||||
->where('client_id', $client_id)
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('rack_rate_type', $rack_rate_type)
|
||||
->set('is_active', 0)
|
||||
->update();
|
||||
|
||||
if (!$result) {
|
||||
|
||||
return $this->respond(['status' => false,'code' => 200, 'message' => 'Failed to update the record.'], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
log_message('error', $e->getMessage());
|
||||
return $this->respond(['status' => false,'code' => 200, 'message' => 'Failed to update the record.'], 200);
|
||||
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true,'code' => 200, 'message' => 'Additionaly Rack Rate Data Remove Successfully'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -18,11 +18,14 @@ class DashboardController extends AdminController
|
||||
use ResponseTrait;
|
||||
protected $messageModel;
|
||||
protected $userMessageModel;
|
||||
protected $myLogger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_session_context('Dashboard');
|
||||
$this->messageModel = new MessageModel();
|
||||
$this->userMessageModel = new UserMessageModel();
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
@ -34,15 +37,20 @@ class DashboardController extends AdminController
|
||||
|
||||
public function getDashboardNotifications()
|
||||
{
|
||||
//pull notofications to dashboard especially for file upload cases
|
||||
// Pull notifications for the dashboard, especially for file upload cases.
|
||||
$userId = get_session_userid();
|
||||
$roleId = 5;
|
||||
$teamId = 1;
|
||||
|
||||
$messages = $this->messageModel->getMessagesForUser($userId, $roleId, $teamId);
|
||||
|
||||
return $this->respond($messages);
|
||||
|
||||
if ($userId != null && $roleId != null && $teamId != null) {
|
||||
$messages = $this->messageModel->getMessagesForUser($userId, $roleId, $teamId);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $messages], 200);
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'The session is not set correctly. USER_ID : {user_id}, ROLE_ID : {role_id}, TEAM_ID : {team_id}', ['user_id' => $userId, 'role_id' => $roleId, 'team_id' => $teamId]);
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function acknowledgeMessage($messageId)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -373,7 +373,7 @@ class EmployeeController extends AdminController
|
||||
public function importExport()
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error', 'importExport function called');
|
||||
$this->myLogger->logme('error', 'Import Export -- Function called');
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
@ -385,10 +385,10 @@ class EmployeeController extends AdminController
|
||||
|
||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
||||
$policy_name_and_branch_name = $this->clientPolicyModel->select('policies.name, client_branch.branch_code')
|
||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->where('client_policy.id', $client_policy_id)
|
||||
->first();
|
||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->where('client_policy.id', $client_policy_id)
|
||||
->first();
|
||||
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name_and_branch_name['name'], $policy_name_and_branch_name['branch_code']);
|
||||
|
||||
$batch_data = [
|
||||
@ -401,20 +401,19 @@ class EmployeeController extends AdminController
|
||||
'file_name' => $file_name,
|
||||
];
|
||||
|
||||
// $event_type = 'si_enhancement';
|
||||
|
||||
if ($actions == 'export') {
|
||||
|
||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition') {
|
||||
|
||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||
|
||||
if($return == 0){
|
||||
|
||||
if ($return == 0) {
|
||||
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
@ -424,7 +423,6 @@ class EmployeeController extends AdminController
|
||||
session()->setFlashdata('error', "No data was found for this action. The UHID has already been updated.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'Successfully exported Excel file in {data}.', ['data' => $event_type]);
|
||||
}
|
||||
@ -440,6 +438,13 @@ class EmployeeController extends AdminController
|
||||
} else if ($event_type == 'si_enhancement') {
|
||||
|
||||
$return = $empDataServiceController->generateExcelForSIEnhancement($batch_data);
|
||||
|
||||
if ($return == 0) {
|
||||
|
||||
session()->setFlashdata('error', "Insufficient deposit amount.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
|
||||
if (!$return) {
|
||||
session()->setFlashdata('error', 'No data found about this action');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
@ -459,29 +464,25 @@ class EmployeeController extends AdminController
|
||||
} else if ($actions == 'import') {
|
||||
|
||||
$batch_data['file'] = $this->request->getFile('import_file_data');
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
$this->myLogger->logme('error', 'Inception Import file name : {data}', ['data' => $filename]);
|
||||
|
||||
$random_number_count = 4;
|
||||
$batch_data['batch_code'] = generate_random_string($random_number_count);
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['status'] = 'pending';
|
||||
$batch_data['file_name'] = $filename;
|
||||
|
||||
if ($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition') {
|
||||
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
$this->myLogger->logme('error', 'Inception Import file name : {data}', ['data' => $filename]);
|
||||
|
||||
|
||||
$random_number_count = 4;
|
||||
$batch_data['batch_code'] = generate_random_string($random_number_count);
|
||||
$batch_data['created_by'] = get_session_userid();
|
||||
$batch_data['status'] = 'pending';
|
||||
$batch_data['file_name'] = $filename;
|
||||
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importInceptionFileValidation','payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importInceptionFileValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importInceptionFileValidation(['file_id' => $file_id]);
|
||||
@ -489,71 +490,64 @@ class EmployeeController extends AdminController
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The TPA ID column is either partially or entirely empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 0) {
|
||||
session()->setFlashdata('error', 'Please upload the correct file.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 3) {
|
||||
session()->setFlashdata('error', 'The list of employees provided has already been updated with the TPA ID, or this is not the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 4) {
|
||||
session()->setFlashdata('error', 'The UHID column is either partially or entirely empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 5) {
|
||||
session()->setFlashdata('error', 'The list of employees provided has already been updated with the UHID, or this is not the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 6) {
|
||||
session()->setFlashdata('error', 'The Excel record count exceeds the DB record count.');
|
||||
} else {
|
||||
session()->setFlashdata($return['status'], $return['message']);
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else if ($event_type == 'correction') {
|
||||
|
||||
$return = $empDataServiceController->importExcelDataForCorrection($batch_data);
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importCorrectionValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importCorrectionValidation(['file_id' => $file_id]);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 0) {
|
||||
session()->setFlashdata('error', 'Please upload the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 3) {
|
||||
session()->setFlashdata('error', 'File already uploaded');
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else if ($event_type == 'si_enhancement') {
|
||||
|
||||
$return = $empDataServiceController->importExcelDataForSIEnhancement($batch_data);
|
||||
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importSIEnhancementValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importSIEnhancementValidation(['file_id' => $file_id]);
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 0) {
|
||||
session()->setFlashdata('error', 'Please upload the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 3) {
|
||||
session()->setFlashdata('error', 'File already uploaded');
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else if ($event_type == 'deletion') {
|
||||
|
||||
$return = $empDataServiceController->importExcelDataForDeletion($batch_data);
|
||||
$file_id = $this->batchFileModel->insert($batch_data);
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'importDeletionValidation', 'payload' => ['file_id' => $file_id]]);
|
||||
|
||||
$return = 1;
|
||||
|
||||
// $return = $empDataServiceController->importDeletionValidation(['file_id' => $file_id]);
|
||||
|
||||
|
||||
if ($return == 1) {
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
session()->setFlashdata('success', 'Data updated successfully. File is being validated.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 2) {
|
||||
session()->setFlashdata('error', 'The Endorsement ID columns are empty.');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 0) {
|
||||
session()->setFlashdata('error', 'Please upload the correct file');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($return == 3) {
|
||||
session()->setFlashdata('error', 'File already uploaded');
|
||||
} else {
|
||||
session()->setFlashdata('error', $return);
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
}
|
||||
@ -722,6 +716,9 @@ class EmployeeController extends AdminController
|
||||
|
||||
public function viewUploadedEmployeeList()
|
||||
{
|
||||
|
||||
$empDataServiceController = new EmpDataServiceController();
|
||||
|
||||
$file_id = $this->request->getGet('file_id');
|
||||
// $emp_data['employees'] = $this->employeePolicyModel->getViewEmpSuccessList($file_id);
|
||||
// $html = view('view_file_upload_emp_list', $emp_data);
|
||||
@ -733,20 +730,21 @@ class EmployeeController extends AdminController
|
||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||
->where('files.id', $file_id)->first();
|
||||
|
||||
// dd($file_name);
|
||||
|
||||
try {
|
||||
|
||||
$filePath = WRITEPATH . '/uploads/excel/' . $file_name['file_name'];
|
||||
|
||||
if (file_exists($filePath)) {
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filePath);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
|
||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||
// dd($excel_data);
|
||||
|
||||
$excel_data = $empDataServiceController->readExcelFileToArray($filePath);
|
||||
$emp_data['thead'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
$emp_data['tbody'] = $excel_data;
|
||||
$emp_data['count'] = count($excel_data);
|
||||
|
||||
// dd($emp_data);
|
||||
|
||||
$html = view('view_file_upload_emp_list', $emp_data);
|
||||
} else {
|
||||
@ -1055,6 +1053,34 @@ class EmployeeController extends AdminController
|
||||
{
|
||||
|
||||
$this->loadLayout('ecard_template/default_ecard');
|
||||
|
||||
// Load the session library if it's not autoloaded
|
||||
// $session = \Config\Services::session();
|
||||
|
||||
// Access session data
|
||||
$sessionData = session()->get();
|
||||
|
||||
// Check if session data exists and if expiration time is set
|
||||
if (!empty($sessionData) && isset($sessionData['isLoggedIn']) && isset($sessionData['session_expiration'])) {
|
||||
// Get the session expiration timestamp
|
||||
$expirationTimestamp = $sessionData['session_expiration'];
|
||||
|
||||
// Get the current timestamp
|
||||
$currentTimestamp = time();
|
||||
|
||||
// Check if the current time is greater than the expiration time
|
||||
if ($currentTimestamp > $expirationTimestamp) {
|
||||
// Session has expired
|
||||
echo "Session has expired";
|
||||
} else {
|
||||
// Session is active
|
||||
echo "Session is active";
|
||||
}
|
||||
} else {
|
||||
// Session data is not set or session is not started
|
||||
echo "Session is not started or data is not set";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1197,6 +1223,7 @@ class EmployeeController extends AdminController
|
||||
$client_id = $file['client_id'];
|
||||
$client_policy_id = $file['client_policy_id'];
|
||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||
$event_type = $file['event_type'];
|
||||
|
||||
$error_data = json_decode($file['error_data']);
|
||||
|
||||
@ -1212,8 +1239,10 @@ class EmployeeController extends AdminController
|
||||
$excel_data = $empDataServiceController->readExcelFileToArray($file_name_with_path);
|
||||
$excelErrorData['excel_header'] = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
|
||||
if($event_type == 'inception' || $event_type == 'deletion'){
|
||||
array_pop($excel_data);
|
||||
}
|
||||
|
||||
$finalArray = [];
|
||||
foreach ($error_data as $key => $values) {
|
||||
@ -1229,15 +1258,22 @@ class EmployeeController extends AdminController
|
||||
|
||||
}else{
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
if($event_type == 'inception'){
|
||||
|
||||
$error = 'Expected value : TPA ID';
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
$error = 'Expected value : UHID';
|
||||
$error = 'Expected value : TPA ID';
|
||||
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
|
||||
$error = 'Expected value : UHID';
|
||||
}
|
||||
|
||||
}else{
|
||||
$error = 'Expected value : ENDORSEMENT ID';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
$data = ['value' => $excel_data[$row][$column], 'error' => $error,];
|
||||
$excel_data[$row][$column] = $data;
|
||||
@ -1268,9 +1304,18 @@ class EmployeeController extends AdminController
|
||||
{
|
||||
$client_policy_id = $this->request->uri->getSegment(3);
|
||||
$policy_details = $this->clientPolicyModel->find($client_policy_id);
|
||||
// print_r($policy_details);die();
|
||||
$policy_terms = isset($policy_details['policy_terms']) ? true : false;
|
||||
|
||||
$si_enhancement_true_or_false = 1;
|
||||
if($policy_terms){
|
||||
$policyTermsData = json_decode($policy_details['policy_terms']);
|
||||
|
||||
if (isset($policyTermsData->suminsuredenhancement) && $policyTermsData->suminsuredenhancement !== null) {
|
||||
$si_enhancement_true_or_false = $policyTermsData->suminsuredenhancement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']);
|
||||
|
||||
$message = null;
|
||||
@ -1285,7 +1330,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
$message = isset($message) ? ($message . ' not defined for choosed policy') : null;
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message], 200);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -84,15 +84,22 @@ class EmployeeRestController extends AdminController
|
||||
try {
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||
if ($emp_code) {
|
||||
$relationship = 'self';
|
||||
$employee = $this->employeeModel->where('emp_code', $emp_code)
|
||||
->where('client_id', $client_id)
|
||||
->where('client_branch_id', $client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('relationship', $relationship)
|
||||
->first();
|
||||
$result = $employee;
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
$AccountManagerDetails = $this->clientRMModel->select('client_rm.* , user_profiles.*')
|
||||
->join('user_profiles', 'client_rm.user_id = user_profiles.id', 'left')
|
||||
->where('client_rm.client_id', $client_id )
|
||||
->where('client_rm.level', 3 )
|
||||
->findAll();
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result, 'AccountManagerDetails'=> isset($AccountManagerDetails[0]) ? $AccountManagerDetails[0] : null ],200);
|
||||
} else {
|
||||
$result = "No Match's";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404);
|
||||
@ -102,7 +109,7 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//not in use
|
||||
public function editEmployeeProfile()
|
||||
{
|
||||
try {
|
||||
@ -125,7 +132,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
//not in use
|
||||
public function getEmployeeAndDependence()
|
||||
{
|
||||
try {
|
||||
@ -152,7 +159,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
//not in use
|
||||
public function editEmployeeAndDependence()
|
||||
{
|
||||
try {
|
||||
@ -372,6 +379,7 @@ class EmployeeRestController extends AdminController
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteDependence()
|
||||
{
|
||||
try {
|
||||
@ -400,11 +408,78 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
// Get the RelationShip list
|
||||
public function createOrUpdateEmployeePolicySiAmount()
|
||||
{
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON();
|
||||
|
||||
foreach ($requestData as $key => $value) {
|
||||
|
||||
|
||||
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
||||
->where('client_policy_id', $value->client_policy_id)
|
||||
->where('is_active', 1 )
|
||||
->findAll();
|
||||
|
||||
|
||||
// dd($checkIfExist);
|
||||
if ($checkIfExist) {
|
||||
|
||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
|
||||
|
||||
}else{
|
||||
|
||||
$data['employee_id']= $value->employee_id;
|
||||
$data['client_policy_id']= $value->client_policy_id;
|
||||
$data['basic_cover_si']= $value->basic_cover_si;
|
||||
$data['status'] = 'draft';
|
||||
|
||||
$this->employeePolicyModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code);
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function findPremiumAmount($slabArray,$siAmount)
|
||||
{
|
||||
foreach ($slabArray as $key => $value) {
|
||||
if($value['si'] == $siAmount){
|
||||
return $value['premium'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function relationshipList()
|
||||
{
|
||||
try {
|
||||
|
||||
$relation_ships= $this->relationshipModel->findAll();
|
||||
|
||||
if(count($relation_ships) > 0){
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getEmployeeAndDependenceByClientId()
|
||||
{
|
||||
try {
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0);
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
|
||||
if ($empData) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
||||
@ -419,11 +494,11 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function exportDataByClientPolicyId()
|
||||
{
|
||||
try {
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0);
|
||||
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
|
||||
if(count($empData))
|
||||
{
|
||||
@ -496,6 +571,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
//not in use
|
||||
public function getClientPolicy()
|
||||
{
|
||||
try {
|
||||
@ -534,73 +610,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
|
||||
// Get the RelationShip list
|
||||
|
||||
public function createOrUpdateEmployeePolicySiAmount()
|
||||
{
|
||||
|
||||
try {
|
||||
$requestData = $this->request->getJSON();
|
||||
|
||||
foreach ($requestData as $key => $value) {
|
||||
|
||||
|
||||
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
||||
->where('client_policy_id', $value->client_policy_id)
|
||||
->where('is_active', 1 )
|
||||
->findAll();
|
||||
|
||||
|
||||
// dd($checkIfExist);
|
||||
if ($checkIfExist) {
|
||||
|
||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
|
||||
|
||||
}else{
|
||||
|
||||
$data['employee_id']= $value->employee_id;
|
||||
$data['client_policy_id']= $value->client_policy_id;
|
||||
$data['basic_cover_si']= $value->basic_cover_si;
|
||||
$data['status'] = 'draft';
|
||||
|
||||
$this->employeePolicyModel->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code);
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => []], 200);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function findPremiumAmount($slabArray,$siAmount)
|
||||
{
|
||||
foreach ($slabArray as $key => $value) {
|
||||
if($value['si'] == $siAmount){
|
||||
return $value['premium'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public function relationshipList()
|
||||
{
|
||||
try {
|
||||
|
||||
$relation_ships= $this->relationshipModel->findAll();
|
||||
|
||||
if(count($relation_ships) > 0){
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $relation_ships], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => "No Data..!"], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// Upload the Employee Detail in DB by Sheet Data
|
||||
public function employeeUpload()
|
||||
@ -614,6 +624,7 @@ class EmployeeRestController extends AdminController
|
||||
// die;
|
||||
$file = $this->request->getFile('file');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
|
||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
||||
@ -632,7 +643,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first();
|
||||
if ($client_policy) {
|
||||
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
|
||||
$policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
|
||||
@ -666,6 +677,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$extractData['file_name']= $filename;
|
||||
$extractData['client_id']= $client_id;
|
||||
$extractData['client_branch_id']= $client_branch_id;
|
||||
$extractData['status']= 'success';
|
||||
$extractData['policy_id']= $policy_id;
|
||||
$extractData['action']= 'enrollment';
|
||||
@ -772,6 +784,7 @@ class EmployeeRestController extends AdminController
|
||||
'client_id' => $client_id,
|
||||
'emp_status'=>'draft',
|
||||
'band'=> $extra['10'][$index],
|
||||
'client_branch_id' => $client_branch_id
|
||||
|
||||
];
|
||||
$basic_cover_si_value = null;
|
||||
@ -928,13 +941,15 @@ public function getAgeRange($terms,$familyFloatesValue)
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getEmployeePolicy()
|
||||
{
|
||||
try {
|
||||
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||
|
||||
// This is an array containing keys to be removed from the terms and conditions array
|
||||
$keysToRemove = ["removable_keys"];
|
||||
@ -942,8 +957,11 @@ public function getEmployeePolicy()
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id)
|
||||
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
|
||||
->where('client_id',$client_id)
|
||||
->where('client_branch_id',$client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('is_addon_value',0)->findAll();
|
||||
|
||||
|
||||
if ($empPolicy) {
|
||||
@ -1091,12 +1109,13 @@ public function getEmployeePolicy()
|
||||
->where('client_policy.policy_type_id', 3 )
|
||||
->where('client_policy.is_addon', 1 )
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->get()
|
||||
->getResult();
|
||||
if($checkGmcParentsPolicyExist)
|
||||
{
|
||||
$GmcParrentsData = $this->getGmcParrentsPolicy($checkGmcParentsPolicyExist,$emp_code,$client_id);
|
||||
$GmcParrentsData = $this->getGmcParrentsPolicy($checkGmcParentsPolicyExist,$emp_code,$client_id,$client_branch_id);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => [$array,$GmcParrentsData]], 200);
|
||||
|
||||
}
|
||||
@ -1122,11 +1141,14 @@ public function getEmployeePolicy()
|
||||
}
|
||||
|
||||
|
||||
public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||
public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$client_branch_id)
|
||||
{
|
||||
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('client_id',$client_id)
|
||||
->where('is_active', 1 )->where('is_addon_value',0)->findAll();
|
||||
$employeeData = $this->employeeModel->where('emp_code',$emp_code)
|
||||
->where('client_id',$client_id)
|
||||
->where('client_branch_id',$client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('is_addon_value',0)->findAll();
|
||||
foreach ($GmcParrentsPolicy as $key => $array) {
|
||||
|
||||
|
||||
@ -1163,9 +1185,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||
$array->eCardDownload = null;
|
||||
}
|
||||
|
||||
// if($array->tpa_id != null){
|
||||
// $array->eCardDownload = base_url('download-e-card/') . $array->rand_string;
|
||||
// }else{ $array->eCardDownload = null; }
|
||||
|
||||
$array->eCardDownload = null;
|
||||
|
||||
// Map family floaters that already exist in the employee table
|
||||
@ -1256,6 +1276,7 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function FloterConvertion($array){
|
||||
|
||||
$result = [];
|
||||
@ -1320,7 +1341,8 @@ public function getClientDetails()
|
||||
$client = $this->clientModel->where('id',$this->request->getGet('client_id'))->first();
|
||||
if($client) {
|
||||
$client['client_logo'] = base_url().'public/uploads/logo/'.$client['client_logo'];
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))->findAll();
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => ['client'=>$client,'client_policy'=>$clientPolicy]], 200);
|
||||
|
||||
}else{
|
||||
@ -1335,17 +1357,22 @@ public function getAddOnPolicy()
|
||||
{
|
||||
try {
|
||||
|
||||
$addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('is_addon_value',1)->findAll();
|
||||
$addOnEmployeeData = $this->employeeModel->where('is_active', 1 )
|
||||
->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('is_addon_value',1)->findAll();
|
||||
|
||||
|
||||
|
||||
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('policy_status', 1)
|
||||
->findAll();
|
||||
|
||||
if(count($clientPolicy))
|
||||
{
|
||||
$band = $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('family_floater_key','self')->get()->getRow()->band;
|
||||
$band = $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )->where('emp_code',$this->request->getGet('emp_code'))->where('client_id',$this->request->getGet('client_id'))->where('client_branch_id',$this->request->getGet('client_branch_id'))->where('family_floater_key','self')->get()->getRow()->band;
|
||||
$PolicyData = [];
|
||||
foreach ($clientPolicy as $key => $array) {
|
||||
$responce = [];
|
||||
@ -1768,6 +1795,7 @@ public function getCashDepositData()
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->groupBy('client_policy.insurer_id')
|
||||
@ -1789,6 +1817,7 @@ public function getCashDepositData()
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->where('client_policy.insurer_id', $value['insurerId'] )
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->findAll();
|
||||
@ -1797,7 +1826,7 @@ public function getCashDepositData()
|
||||
{
|
||||
|
||||
$value['type'] = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow()->policy_type;
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0);
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
$enrolledCount = 0;
|
||||
$draftCount = 0;
|
||||
if(count($employeeDetails))
|
||||
@ -1970,83 +1999,6 @@ public function removeEmpAndEmpPolicyData()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getEmployeeOldPolicy()
|
||||
{
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 0)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
->findAll();
|
||||
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('is_active', 1 )->findAll();
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
|
||||
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
|
||||
{
|
||||
$result = [];
|
||||
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
||||
|
||||
$terms = json_decode($ClientPolicyValue['policy_terms']);
|
||||
// dd($terms);
|
||||
$data['client_id'] = $ClientPolicyValue['client_id'];
|
||||
$data['client_policy_id'] = $ClientPolicyValue['id'];
|
||||
$data['policy_name'] = $ClientPolicyValue['policy_name'];
|
||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||
$data['policy_start_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_start_date']);
|
||||
$data['policy_end_date'] = $this->convertDateFormatDisplay($ClientPolicyValue['policy_end_date']);
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['heading'] = 'Group Personal Accident Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 2){ $data['heading'] = 'Group Medical Coverage'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 3){ $data['heading'] = 'Group Medical Coverage - Parents'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
|
||||
if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
|
||||
|
||||
if($ClientPolicyValue['policy_type_id'] == 1){ $data['floter_text_heading'] = 'Sum Insured'; }
|
||||
else
|
||||
{
|
||||
if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
|
||||
}
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->whereIn('employee_polices.employee_id',$whereArrayForId)
|
||||
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
$si_value = 0;
|
||||
$si_premium_value = 0;
|
||||
$si_gst_value = 0;
|
||||
foreach ($employee_policy as $key => $value) {
|
||||
if(isset($value['basic_cover_si'])){ $si_value = $value['basic_cover_si']; }
|
||||
if(isset($value['premium'])){ $si_premium_value = $si_premium_value + $value['premium'];}
|
||||
if(isset($value['gst'])){ $si_gst_value = $si_gst_value + $value['gst'];}
|
||||
}
|
||||
|
||||
$data['si_value'] = $si_value;
|
||||
$data['si_premium_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_premium_value;
|
||||
$data['si_gst_value'] = ($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 2) ? 0 : $si_gst_value;
|
||||
|
||||
$data['EmployeePolicy'] = $employee_policy;
|
||||
array_push($result, $data);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ], 200);
|
||||
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getEmployeeActiveOrInactivePolicy()
|
||||
{
|
||||
|
||||
@ -2055,6 +2007,7 @@ function getEmployeeActiveOrInactivePolicy()
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', $policy_status)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
@ -2063,9 +2016,11 @@ function getEmployeeActiveOrInactivePolicy()
|
||||
// Retrieve employee and dependents data by passing the employee code
|
||||
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('is_active', 1 )->findAll();
|
||||
$employeeName = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||
->where('client_id',$this->request->getGet('client_id'))
|
||||
->where('client_branch_id',$this->request->getGet('client_branch_id'))
|
||||
->where('family_floater_key','self')->where('is_active', 1 )
|
||||
->get()->getRow()->name;
|
||||
$whereArrayForId = [];
|
||||
|
||||
@ -16,10 +16,22 @@ class JobWorker extends AdminController
|
||||
|
||||
private static $event_class_mapping = [
|
||||
'add' => ['type' => 'HC', 'handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC', 'handler' => 'App\\Controllers\\Jobs\SubJob'], 'fancy_date_time_format' => ['type' => 'HF', 'handler' => 'fancy_date_time_format'], 'addNumber' => ['type' => 'HC', 'handler' => 'App\\Model\\HttpRequestHelper'], 'excelFileFormatValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'excelFileDataValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesOnboardPreprocess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeeDisembark' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesSIEnhanceProcess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'employeesCorrectionProcess' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmployeeServiceController'], 'send_email' => ['type' => 'HC', 'handler' => 'App\\Helpers\\MailHelper'], 'bulk_mail' => ['type' => 'HC', 'handler' => 'App\\Helpers\\MailHelper'], 'insertBatchList' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
|
||||
'importInceptionFileValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importInceptionUpdateTPAandUHID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'cashDepositCalculationForInception' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'sendMailForDownloadingECard' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
|
||||
'importCorrectionValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importCorrectionUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
|
||||
'cashDepositCalculationForSIEnhancement' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importSIEnhancementValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importSIEnhancementUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
|
||||
'cashDepositCalculationForDeletion' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importDeletionValidation' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
'importDeletionUpdateEndorsementID' => ['type' => 'CC', 'handler' => 'App\\Controllers\\EmpDataServiceController'],
|
||||
];
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@ -101,7 +101,7 @@ class RestAuthenticationController extends AdminController
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$data = [
|
||||
'user_id' => $employeeData['id'],
|
||||
'user_id' => $employeeData['id'],
|
||||
'user_type' => 'employee',
|
||||
'ip' => $auth['ip'],
|
||||
'platform' => $auth['platform'],
|
||||
|
||||
@ -24,9 +24,17 @@ class AuthJWT implements FilterInterface
|
||||
if (JWTToken::validateJWT($jwt)) {
|
||||
$data = JWTToken::validateJWT($jwt);
|
||||
$data = json_decode($data);
|
||||
|
||||
if ($data->status) {
|
||||
// $auth = $request->getHeader("Authorization");
|
||||
|
||||
// $decodedToken = $data->decoded;
|
||||
|
||||
// $decodedToken->exp += 30;
|
||||
// $newJwt = JWTToken::encode((array)$decodedToken);
|
||||
|
||||
// Set the new JWT in the response headers
|
||||
// $response = service('response');
|
||||
// $response->setHeader('Authorization', $newJwt);
|
||||
return true;
|
||||
}else{
|
||||
header('Content-Type: application/json');
|
||||
|
||||
@ -20,7 +20,7 @@ class JWTToken
|
||||
{
|
||||
$secret_Key="secret";
|
||||
$iat = time();
|
||||
$exp = $iat + 36000;
|
||||
$exp = $iat + 180;
|
||||
$request_data = [
|
||||
"iat" => $iat,
|
||||
"exp" => $exp,
|
||||
|
||||
@ -105,6 +105,7 @@ class sendMailNotification
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
$mail_content = $notification['mail_content'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
@ -114,8 +115,9 @@ class sendMailNotification
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("[[post_enrollment_app_link]]", "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
|
||||
|
||||
@ -10,6 +10,37 @@ if (!function_exists('check_session')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_last_visited_time')) {
|
||||
function set_last_visited_time()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->set('last_visited', date("Y-m-d H:i:s"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_last_visited_time')) {
|
||||
function get_last_visited_time()
|
||||
{
|
||||
// Get the session service
|
||||
$session = \Config\Services::session();
|
||||
|
||||
// Get the last visited time from session
|
||||
$lastVisitTime = $session->get('last_visited');
|
||||
|
||||
// Check if the last visited time is set
|
||||
if ($lastVisitTime) {
|
||||
// Calculate the time five minutes ago
|
||||
$fiveMinutesBefore = date("YmdHi", strtotime('-5 minutes'));
|
||||
|
||||
// Compare the last visited time with the time five minutes ago
|
||||
return date("YmdHi", strtotime($lastVisitTime)) > $fiveMinutesBefore ? 1 : 0;
|
||||
}
|
||||
|
||||
// If last visited time is not set, return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_session_userid')) {
|
||||
function get_session_userid()
|
||||
{
|
||||
|
||||
@ -42,7 +42,18 @@ class ClientModel extends Model
|
||||
|
||||
foreach ($clients as &$client) {
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$clientPolicies = $clientPolicyModel->select(['client_branch.id as branch_id','client_branch.branch_name','client_branch.branch_code', 'client_branch.client_id', 'client_policy.id as client_policy_id','p.name','pt.policy_type',])
|
||||
$clientPolicies = $clientPolicyModel
|
||||
->select(['
|
||||
|
||||
client_branch.id as branch_id',
|
||||
'client_branch.branch_name',
|
||||
'client_branch.branch_code',
|
||||
'client_branch.client_id',
|
||||
'client_policy.id as client_policy_id',
|
||||
'client_policy.policy_terms',
|
||||
'p.name',
|
||||
'pt.policy_type',
|
||||
])
|
||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||
->join('policies p', 'p.id = client_policy.policy_id')
|
||||
->join('policy_type pt','client_policy.policy_type_id = pt.id')
|
||||
|
||||
@ -143,7 +143,7 @@ class EmployeePolicyModel extends Model
|
||||
employees.relationship AS emp_relationship,
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
|
||||
'Has Define' as emp_type,
|
||||
employees.emp_type as emp_type,
|
||||
|
||||
employee_polices.id as primaryKey,
|
||||
employee_polices.tpa_id,
|
||||
@ -175,8 +175,13 @@ class EmployeePolicyModel extends Model
|
||||
) as batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '')
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
AND employee_polices.is_active = 1
|
||||
AND employees.client_branch_id = '{$client_branch_id}'";
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
|
||||
";
|
||||
|
||||
// Get the result set
|
||||
$query = $this->db->query($sql);
|
||||
@ -209,7 +214,7 @@ class EmployeePolicyModel extends Model
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.client_id AS emp_client_id,
|
||||
'Has Define' AS emp_type,
|
||||
employees.emp_type as emp_type,
|
||||
employee_polices.uhid,
|
||||
employees.relationship_code,
|
||||
batch_data.emp_policy_id,
|
||||
@ -235,12 +240,16 @@ class EmployeePolicyModel extends Model
|
||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||
) AS batch_data ON emp_endorsement.pk = batch_data.emp_policy_id
|
||||
|
||||
WHERE batch_data.bf IS NULL
|
||||
AND batch_data.bl IS NULL
|
||||
AND employees.client_id = '{$client_id}'
|
||||
WHERE employees.client_id = '{$client_id}'
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
AND emp_endorsement.actions = 'c'
|
||||
AND employee_polices.is_active = 1
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
AND (employee_polices.tpa_id IS NOT NULL AND employee_polices.tpa_id != '')
|
||||
AND (employee_polices.uhid IS NOT NULL AND employee_polices.uhid != '')
|
||||
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
||||
|
||||
// Execute the raw query
|
||||
@ -265,13 +274,14 @@ class EmployeePolicyModel extends Model
|
||||
$query = $this->db->query("
|
||||
SELECT
|
||||
a.id as endorsement_primarykey,
|
||||
a.group_key,
|
||||
employee_polices.id AS primaryKey,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code AS emp_code,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.relationship_code AS emp_relationship_code,
|
||||
'Has Define' AS emp_type,
|
||||
employees.emp_type as emp_type,
|
||||
employee_polices.uhid AS risk_id,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.policy_end_date,
|
||||
@ -283,10 +293,15 @@ class EmployeePolicyModel extends Model
|
||||
sidata.new_basic_cover_si,
|
||||
sidata.new_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
|
||||
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
|
||||
|
||||
sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
|
||||
|
||||
ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
|
||||
|
||||
ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
|
||||
|
||||
((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total
|
||||
|
||||
FROM
|
||||
@ -346,14 +361,16 @@ class EmployeePolicyModel extends Model
|
||||
AND batch_files.actions = 'export'
|
||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||
) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
WHERE
|
||||
batch_data.bf IS NULL
|
||||
AND batch_data.bl IS NULL
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employees.client_branch_id = '{$client_policy_id}'
|
||||
AND employee_polices.is_active = '1'
|
||||
|
||||
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND employees.client_branch_id = '{$client_branch_id}'
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||
AND a.field_name = 'si_enhancement_date'
|
||||
AND a.actions = 'si'
|
||||
AND employee_polices.is_active = 1
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
group by group_key
|
||||
");
|
||||
|
||||
// Get the result set
|
||||
@ -374,13 +391,14 @@ class EmployeePolicyModel extends Model
|
||||
$query = $this->db->query("
|
||||
SELECT DISTINCT
|
||||
a.id as endorsement_primarykey,
|
||||
a.group_key,
|
||||
employee_polices.id as primaryKey,
|
||||
employees.name AS emp_name,
|
||||
employees.emp_code AS emp_code,
|
||||
employees.dob AS emp_dob,
|
||||
employees.gender AS emp_gender,
|
||||
employees.relationship AS emp_relationship,
|
||||
'Has Define' as emp_type,
|
||||
employees.emp_type as emp_type,
|
||||
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.uhid as risk_id,
|
||||
@ -404,7 +422,7 @@ class EmployeePolicyModel extends Model
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN
|
||||
employees ON a.emp_code = employees.emp_code
|
||||
employees ON a.emp_code = employees.emp_code and a.pk = employees.id
|
||||
LEFT JOIN
|
||||
employee_polices ON employees.id = employee_polices.employee_id
|
||||
|
||||
@ -439,16 +457,20 @@ class EmployeePolicyModel extends Model
|
||||
AND batch_files.actions = 'export'
|
||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||
) AS batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
WHERE
|
||||
batch_data.bf IS NULL
|
||||
AND batch_data.bl IS NULL
|
||||
AND employee_polices.client_policy_id = {$client_policy_id}
|
||||
|
||||
WHERE employee_polices.client_policy_id = {$client_policy_id}
|
||||
AND employees.client_branch_id = {$client_branch_id}
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||
AND a.actions = 'd'
|
||||
AND employee_polices.is_active = 1
|
||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status'
|
||||
AND employee_polices.status = 'active'
|
||||
AND employees.is_active = 1
|
||||
AND employees.emp_status = 'active'
|
||||
group by group_key
|
||||
");
|
||||
|
||||
$result = $query->getResult();
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
@ -547,34 +569,62 @@ class EmployeePolicyModel extends Model
|
||||
|
||||
public function fetchEmpEndorsementData($fetch_data)
|
||||
{
|
||||
// dd($fetch_data);
|
||||
|
||||
$client_policy_id = $fetch_data['client_policy_id'];
|
||||
$client_branch_id = $fetch_data['client_branch_id'];
|
||||
$emp_name = $fetch_data['emp_name'];
|
||||
$emp_code = $fetch_data['emp_code'];
|
||||
|
||||
// Your raw SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
ep.id,
|
||||
MAX(CASE WHEN ee.field_name = 'date_of_exit' THEN ee.new_value END) AS date_of_exit,
|
||||
MAX(CASE WHEN ee.field_name = 'reason_for_exit' THEN ee.new_value END) AS reason_for_exit,
|
||||
MAX(CASE WHEN ee.field_name = 'status' THEN ee.new_value END) AS status
|
||||
FROM
|
||||
emp_endorsement AS ee
|
||||
JOIN
|
||||
employee_polices AS ep ON ep.id = ee.pk
|
||||
WHERE
|
||||
ee.emp_code = '$emp_code'
|
||||
AND ep.client_policy_id = $client_policy_id
|
||||
AND ee.name = '$emp_name'
|
||||
AND ee.field_name IN ('date_of_exit', 'reason_for_exit', 'status')
|
||||
GROUP BY
|
||||
ee.emp_code, ee.name, ep.id";
|
||||
SELECT
|
||||
ee.id as emp_endorsement_primarykey,
|
||||
ep.id as emp_policy_primarykey,
|
||||
e.id as employees_primarykey,
|
||||
ee.group_key,
|
||||
MAX(
|
||||
CASE
|
||||
WHEN ee.field_name = 'date_of_exit' THEN ee.new_value
|
||||
END
|
||||
) AS date_of_exit,
|
||||
MAX(
|
||||
CASE
|
||||
WHEN ee.field_name = 'reason_for_exit' THEN ee.new_value
|
||||
END
|
||||
) AS reason_for_exit,
|
||||
MAX(
|
||||
CASE
|
||||
WHEN ee.field_name = 'status' THEN ee.new_value
|
||||
END
|
||||
) AS status
|
||||
FROM
|
||||
emp_endorsement AS ee
|
||||
JOIN employee_polices AS ep ON ep.id = ee.pk
|
||||
JOIN employees AS e ON e.emp_code = ee.emp_code
|
||||
WHERE
|
||||
ee.emp_code = '$emp_code'
|
||||
AND ep.client_policy_id = '$client_policy_id'
|
||||
AND e.client_branch_id = '$client_branch_id'
|
||||
AND ee.name = '$emp_name'
|
||||
AND ee.field_name IN ('date_of_exit', 'reason_for_exit', 'status')
|
||||
AND ep.is_active = 1
|
||||
AND ep.status = 'active'
|
||||
AND e.is_active = 1
|
||||
AND e.emp_status = 'active'
|
||||
GROUP BY
|
||||
ee.group_key
|
||||
";
|
||||
|
||||
// dd($sql);
|
||||
|
||||
// Execute the raw SQL query
|
||||
$query = $this->db->query($sql);
|
||||
|
||||
// Fetch and return results
|
||||
return $row = $query->getRowArray();
|
||||
$row = $query->getRowArray();
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
@ -659,7 +709,7 @@ class EmployeePolicyModel extends Model
|
||||
$query2->join('insurers', 'insurers.id = policies.insurer_id');
|
||||
$query2->whereIn('e.actions', ['si', 'd']);
|
||||
$query2->where('ep.client_policy_id', $policy_id);
|
||||
$query2->where('employees.client_id', $policy_id);
|
||||
$query2->where('employees.client_id', $client_id);
|
||||
$query1->where('employees.client_branch_id', $branch_id);
|
||||
if($status != 0 && !empty($status)){
|
||||
|
||||
@ -931,7 +981,132 @@ class EmployeePolicyModel extends Model
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function bulkUpdateForEndorsement($endorsement_details)
|
||||
{
|
||||
|
||||
// Extract IDs, endorsement_ids, and statuses
|
||||
$ids = array_column($endorsement_details, 'group_key');
|
||||
$endorsement_ids = array_column($endorsement_details, 'endorsement_id');
|
||||
$statuses = array_column($endorsement_details, 'status');
|
||||
|
||||
// Escape values for SQL
|
||||
$escapedIds = array_map([$this->db, 'escape'], $ids);
|
||||
$escapedEndorsementIds = array_map([$this->db, 'escape'], $endorsement_ids);
|
||||
$escapedStatuses = array_map([$this->db, 'escape'], $statuses);
|
||||
|
||||
// Construct the CASE statements
|
||||
$caseEndorsementId = array_map(function ($id, $endorsement_id) {
|
||||
return "WHEN group_key = $id THEN $endorsement_id";
|
||||
}, $escapedIds, $escapedEndorsementIds);
|
||||
|
||||
$caseStatus = array_map(function ($id, $status) {
|
||||
return "WHEN status = $id THEN $status";
|
||||
}, $escapedIds, $escapedStatuses);
|
||||
|
||||
// Convert cases to a string
|
||||
$caseEndorsementIdString = implode(' ', $caseEndorsementId);
|
||||
$caseStatusString = implode(' ', $caseStatus);
|
||||
|
||||
// Convert ids to a string
|
||||
$idsString = implode(', ', $escapedIds);
|
||||
|
||||
// Construct the SQL query
|
||||
$sql = "
|
||||
UPDATE emp_endorsement
|
||||
SET
|
||||
endorsement_id = CASE {$caseEndorsementIdString} END,
|
||||
status = CASE {$caseStatusString} END
|
||||
WHERE group_key IN ({$idsString})
|
||||
";
|
||||
|
||||
// Begin a transaction
|
||||
$this->db->transBegin();
|
||||
|
||||
try {
|
||||
// Execute the query
|
||||
$this->db->query($sql);
|
||||
|
||||
// Commit the transaction
|
||||
if ($this->db->transStatus() === FALSE) {
|
||||
// If something went wrong, rollback
|
||||
$this->db->transRollback();
|
||||
throw new \Exception('Bulk update failed.');
|
||||
} else {
|
||||
// Otherwise, commit
|
||||
$this->db->transCommit();
|
||||
}
|
||||
|
||||
return $this->db->getLastQuery();
|
||||
} catch (\Exception $e) {
|
||||
// Rollback the transaction on error
|
||||
$this->db->transRollback();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function bulkUpdateForCorrection($emp_details){
|
||||
|
||||
foreach ($emp_details as $employee) {
|
||||
$id = $this->db->escape($employee['id']);
|
||||
$ids[] = $id;
|
||||
|
||||
foreach ($employee as $field => $value) {
|
||||
if ($field === 'id') continue;
|
||||
$escapedValue = $this->db->escape($value);
|
||||
|
||||
if (!isset($caseStatements[$field])) {
|
||||
$caseStatements[$field] = [];
|
||||
}
|
||||
|
||||
$caseStatements[$field][] = "WHEN id = $id THEN $escapedValue";
|
||||
}
|
||||
}
|
||||
|
||||
// Construct the CASE strings
|
||||
$caseStrings = [];
|
||||
foreach ($caseStatements as $field => $cases) {
|
||||
$caseStrings[] = "$field = CASE " . implode(' ', $cases) . " END";
|
||||
}
|
||||
|
||||
// Convert ids to a string
|
||||
$idsString = implode(', ', $ids);
|
||||
|
||||
// Construct the SQL query
|
||||
$sql = "
|
||||
UPDATE employees
|
||||
SET " . implode(', ', $caseStrings) . "
|
||||
WHERE id IN ($idsString)
|
||||
";
|
||||
|
||||
// Begin a transaction
|
||||
$this->db->transBegin();
|
||||
|
||||
try {
|
||||
// Execute the query
|
||||
$this->db->query($sql);
|
||||
|
||||
// Commit the transaction
|
||||
if ($this->db->transStatus() === FALSE) {
|
||||
// If something went wrong, rollback
|
||||
$this->db->transRollback();
|
||||
throw new \Exception('Bulk update failed.');
|
||||
} else {
|
||||
// Otherwise, commit
|
||||
$this->db->transCommit();
|
||||
}
|
||||
|
||||
return $this->db->getLastQuery();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
// Rollback the transaction on error
|
||||
$this->db->transRollback();
|
||||
throw $e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -25,6 +25,8 @@ class PolicyPremium2Model extends Model
|
||||
'is_active',
|
||||
'premium_type',
|
||||
'relationship',
|
||||
'additional_relationship',
|
||||
'rack_rate_type',
|
||||
|
||||
];
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ $(document).ready(function () {
|
||||
$("#branch_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
|
||||
console.log('branch_PrimaryKey', branch_PrimaryKey)
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<th>Policy</th>
|
||||
<th>TPA</th>
|
||||
<th>Date</th>
|
||||
<th>Enrollment Status</th>
|
||||
<th>Enrollment <br> Status</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -47,7 +47,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="client_branch">Client Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch" name="client_branch_id">
|
||||
<option value="" selected>Select Client Branch</option>
|
||||
<option selected >Select Client Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -252,7 +252,7 @@
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td>${(item.policy_start_date)} / <br> ${(item.policy_end_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -474,7 +474,7 @@
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${tpaValue}</td>
|
||||
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||
<td>${rearrangeDateFormat(item.policy_start_date)} / <br> ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
@ -1468,6 +1468,13 @@
|
||||
|
||||
$('#client_branch').empty();
|
||||
|
||||
|
||||
$('#client_branch').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Branch',
|
||||
selected: true
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
|
||||
@ -20,8 +20,8 @@ option:disabled {
|
||||
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form class="parsley-examples" id="emp-upload-form"
|
||||
action="<?php echo base_url().'employee/upload'?>" method="post">
|
||||
<form class="parsley-examples" id="emp-upload-form" action="<?php echo base_url().'employee/upload'?>" method="post" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>"
|
||||
id="csrf_token">
|
||||
|
||||
@ -38,14 +38,14 @@ option:disabled {
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Branch</label> <br />
|
||||
<select name="branch_id" class="form-control" id="branch_id">
|
||||
<select name="branch_id" class="form-control" id="branch_id" required>
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="policy_id" class="form-control" id="policy_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)">
|
||||
<select name="policy_id" class="form-control" id="policy_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)" required>
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -64,7 +64,7 @@ option:disabled {
|
||||
{
|
||||
foreach($actions as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -214,7 +214,21 @@ $(document).ready(function() {
|
||||
// console.log('submit called');
|
||||
|
||||
|
||||
if(!checkValues()){
|
||||
|
||||
toastr.warning('Form is Empty', 'warning')
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$('#client_id').val()
|
||||
$('#policy_id').val()
|
||||
$('#branch_id').val()
|
||||
$('#upload-action-type').val()
|
||||
|
||||
var isValid = $('#emp-upload-form').parsley().validate();
|
||||
|
||||
console.log('isValid', isValid)
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
@ -351,9 +365,10 @@ function fetchClientPolicies() {
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
// console.log(response);
|
||||
console.log(response);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data)
|
||||
@ -910,7 +925,7 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
{
|
||||
// console.log(event.target.id);
|
||||
var policy_id = (event.target.value);
|
||||
// console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
||||
console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
||||
if(policy_id != 0 && policy_id != " " && policy_id != undefined)
|
||||
{
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/has_policy_config_completed/' + policy_id;
|
||||
@ -930,11 +945,18 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
success: function(response) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 300);
|
||||
|
||||
console.log('check policy responce', response);
|
||||
|
||||
if (response.hasOwnProperty('si_enhancement') && response.si_enhancement == 0) {
|
||||
$('.si-enhancement-option').hide();
|
||||
} else {
|
||||
$('.si-enhancement-option').show();
|
||||
}
|
||||
|
||||
// console.log('check policy responce', response);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.message !== null) {
|
||||
toastr.error(response.message, 'Error');
|
||||
@ -957,7 +979,7 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
}, 300);
|
||||
// toastr.error('Something went wrong! Try Later', 'Error');
|
||||
console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error);
|
||||
return false;
|
||||
@ -968,5 +990,36 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
}
|
||||
|
||||
|
||||
function checkValues() {
|
||||
|
||||
var clientId = $('#client_id').val();
|
||||
var policyId = $('#policy_id').val();
|
||||
var branchId = $('#branch_id').val();
|
||||
var uploadActionType = $('#upload-action-type').val();
|
||||
|
||||
if (!clientId || clientId == '0') {
|
||||
// alert('Client ID is empty or zero');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!policyId || policyId == '0') {
|
||||
// alert('Policy ID is empty or zero');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!branchId || branchId == '0') {
|
||||
// alert('Branch ID is empty or zero');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!uploadActionType || uploadActionType == '0') {
|
||||
// alert('Upload action type is empty or zero');
|
||||
return false;
|
||||
}
|
||||
|
||||
// If all values are valid, return true
|
||||
return true;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
@ -81,7 +81,7 @@
|
||||
class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<?php if($file['status'] == 'failed') { ?>
|
||||
<a data-id="<?= htmlspecialchars(json_encode($file)) ?>" data-toggle="modal"
|
||||
<a data-id="<?= htmlspecialchars(json_encode(['client_id' => $file['client_id'], 'client_policy_id' => $file['client_policy_id'], 'action' => $file['action']])) ?>" data-toggle="modal"
|
||||
data-target="#file-upload-modal" class="dropdown-item upload_button" href="#"><i
|
||||
class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Re-Upload</a>
|
||||
<?php } ?>
|
||||
@ -136,7 +136,7 @@
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Reupload the file</h4>
|
||||
<h4 class="modal-title" id="myCenterModalLabel">ReUpload the file</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@ -158,7 +158,7 @@
|
||||
<script>
|
||||
$('body').on('click', '.view_emp_list', function() {
|
||||
|
||||
console.log('file_id');
|
||||
console.log('file_id', 'file_id');
|
||||
$('#emp_data_success').empty();
|
||||
$('#title').html(' ');
|
||||
var file_id = $(this).attr('data-id');
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
<?php
|
||||
if (isset($events) && count($events)) {
|
||||
foreach ($events as $key => $action) {
|
||||
echo "<option value=" . $key . ">" . $action . "</option>";
|
||||
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -155,27 +155,28 @@
|
||||
function fetchMessages() {
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('get-notification') ?>',
|
||||
url: '<?= base_url('dashboard/get-notification') ?>',
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
// $(document).ready(function() {
|
||||
// $("#playMusic").get(0).play();
|
||||
// });
|
||||
|
||||
|
||||
console.log('responce', response)
|
||||
|
||||
if(response.status == false){
|
||||
$('#notification_count').html('0')
|
||||
console.log('The session is not set correctly. ')
|
||||
return;
|
||||
}
|
||||
|
||||
let messagesList = $('#messages-list');
|
||||
messagesList.empty();
|
||||
|
||||
var html = "";
|
||||
|
||||
pullNotificationCount = response.length
|
||||
pullNotificationCount = response.message.length
|
||||
|
||||
localStorage.setItem('pullNotificationCount', pullNotificationCount)
|
||||
|
||||
response.forEach(message => {
|
||||
response.message.forEach(message => {
|
||||
|
||||
// if (!message.is_read) {
|
||||
// unreadCount++;
|
||||
@ -183,7 +184,6 @@
|
||||
|
||||
var jasonDecodeData = JSON.parse(message.message_text)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||
@ -247,7 +247,7 @@
|
||||
|
||||
function acknowledgeMessage(messageId) {
|
||||
$.ajax({
|
||||
url: '<?= base_url('acknowledge-notification/') ?>' + messageId,
|
||||
url: '<?= base_url('dashboard/acknowledge-notification/') ?>' + messageId,
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
fetchMessages();
|
||||
@ -260,11 +260,11 @@
|
||||
|
||||
$('#messages-list').on('click', 'li', function(event) {
|
||||
|
||||
console.log('messages-list click li')
|
||||
//console.log('messages-list click li')
|
||||
|
||||
if ($(event.target).closest('.rm_msg').length > 0) {
|
||||
|
||||
console.log('.rm_msg')
|
||||
//console.log('.rm_msg')
|
||||
|
||||
let messageId = $(this).data('id');
|
||||
let url = $(this).data('url');
|
||||
@ -276,11 +276,11 @@
|
||||
|
||||
} else if ($(event.target).closest('.redirect_page').length > 0) {
|
||||
|
||||
console.log('redirect_page')
|
||||
//console.log('redirect_page')
|
||||
|
||||
let messageId = $(this).data('id');
|
||||
let url = $(this).data('url');
|
||||
console.log('url : ', url)
|
||||
//console.log('url : ', url)
|
||||
acknowledgeMessage(messageId);
|
||||
|
||||
window.location.href = '<?= base_url() ?>' + url;
|
||||
@ -300,11 +300,11 @@
|
||||
|
||||
$.ajax({
|
||||
|
||||
url: '<?= base_url('get-pending-action') ?>',
|
||||
url: '<?= base_url('dashboard/get-pending-action') ?>',
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
console.log(response);
|
||||
//console.log(response);
|
||||
|
||||
if (response.length == 0) {
|
||||
|
||||
@ -332,7 +332,7 @@
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString
|
||||
//console.log(url)
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
@ -342,15 +342,15 @@
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
console.log(item.branch_name)
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
}
|
||||
|
||||
//console.log(item.branch_name);
|
||||
////console.log(item.branch_name);
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
|
||||
//console.log(toast_body_data);
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
@ -394,7 +394,7 @@
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
//console.log(url)
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
@ -407,12 +407,12 @@
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
console.log(item.branch_name)
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
//console.log(item.branch_name);
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
@ -420,7 +420,7 @@
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + ' - ' + item.branch_name;
|
||||
//console.log(toast_body_data);
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
@ -469,7 +469,7 @@
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
//console.log(url)
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
@ -481,12 +481,12 @@
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
console.log(item.branch_name)
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
//console.log(item.branch_name);
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
@ -494,7 +494,7 @@
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
//console.log(toast_body_data);
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
@ -541,7 +541,7 @@
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
//console.log(url)
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
@ -553,12 +553,12 @@
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
console.log(item.branch_name)
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
//console.log(item.branch_name);
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
@ -566,7 +566,7 @@
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
//console.log(toast_body_data);
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
@ -613,7 +613,7 @@
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
//console.log(url)
|
||||
////console.log(url)
|
||||
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
@ -624,12 +624,12 @@
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
console.log(item.branch_name)
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
//console.log(item.branch_name);
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
@ -637,7 +637,7 @@
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
//console.log(toast_body_data);
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
@ -684,7 +684,7 @@
|
||||
const queryString = objectToQueryString(queryParams);
|
||||
|
||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||
//console.log(url)
|
||||
////console.log(url)
|
||||
|
||||
var toast_body_css = 'background : #bfd7eb !important;';
|
||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||
@ -695,12 +695,12 @@
|
||||
|
||||
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||
|
||||
console.log(item.branch_name)
|
||||
//console.log(item.branch_name)
|
||||
item.branch_name += ' branch';
|
||||
|
||||
}
|
||||
|
||||
//console.log(item.branch_name);
|
||||
////console.log(item.branch_name);
|
||||
|
||||
// if (item.batch_export_count > 0) {
|
||||
|
||||
@ -708,7 +708,7 @@
|
||||
// }
|
||||
|
||||
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||
//console.log(toast_body_data);
|
||||
////console.log(toast_body_data);
|
||||
|
||||
var html = ` <li data-id="" data-url="${url}">
|
||||
<div class="p-3">
|
||||
@ -753,11 +753,11 @@
|
||||
|
||||
$('#messages-list-2').on('click', 'li', function(event) {
|
||||
|
||||
console.log('messages-list-2 click li')
|
||||
//console.log('messages-list-2 click li')
|
||||
|
||||
if ($(event.target).closest('.rm_msg').length > 0) {
|
||||
|
||||
console.log('.rm_msg')
|
||||
//console.log('.rm_msg')
|
||||
|
||||
$(this).delay(300).fadeOut('slow', function() {
|
||||
$(this).remove();
|
||||
@ -765,10 +765,10 @@
|
||||
|
||||
} else if ($(event.target).closest('.redirect_page').length > 0) {
|
||||
|
||||
console.log('redirect_page')
|
||||
//console.log('redirect_page')
|
||||
|
||||
let url = $(this).data('url');
|
||||
console.log('url : ', url);
|
||||
//console.log('url : ', url);
|
||||
|
||||
window.location.href = '<?= base_url() ?>' + url;
|
||||
}
|
||||
|
||||
@ -589,7 +589,8 @@
|
||||
$currentUrl = base_url();
|
||||
$parsedUrl = parse_url($currentUrl);
|
||||
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
||||
$redirectUrl = $baseUrl . 'Ticketing/staff/login?' . http_build_query(['token' => $sessionData]);
|
||||
$hashedEmail = hash('sha256', $sessionData->email);
|
||||
$redirectUrl = getenv('helpdeskURL') .'/staff/login?' . http_build_query(['token' => $hashedEmail]);
|
||||
?>
|
||||
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
||||
<i class="mdi mdi-lifebuoy"></i>
|
||||
|
||||
@ -370,7 +370,8 @@
|
||||
<select id="member_ecard_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $value): ?>
|
||||
<?php if($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'ecard_download_link'){ ?>
|
||||
|
||||
<?php if($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'post_enrollment_app_link' || $value == 'client_name' || $value == 'ecard_download_link'){ ?>
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,241 +1,412 @@
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
td, th {
|
||||
padding: 0.2rem; /* Adjust padding as needed */
|
||||
}
|
||||
.error {
|
||||
background-color: #f8d7da;
|
||||
}
|
||||
.duplicate {
|
||||
background-color: #fff3cd;
|
||||
}
|
||||
.container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.compact-table td, .compact-table th {
|
||||
padding: 0.1rem; /* Adjust padding as needed */
|
||||
}
|
||||
</style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
<div>
|
||||
|
||||
<!-- <div> -->
|
||||
<p>Paste excel data here: <a href="#" type="button" onclick="copyHeaders()">Copy Excel Headers</a></p>
|
||||
<textarea id="copied_excel_data" name="copied_excel_data" style="width:100%;height:200px;" oninput="generateTable()"></textarea><br>
|
||||
|
||||
<!-- </div> -->
|
||||
<hr>
|
||||
<div id="excel_table"></div>
|
||||
|
||||
<hr>
|
||||
<div>
|
||||
<input type="button" id="submitBtn" onclick="submitData()" value="Submit" disabled/>
|
||||
<br><br>
|
||||
<p>JSON output:</p>
|
||||
<div id="json_output"></div>
|
||||
</div>
|
||||
td,
|
||||
th {
|
||||
padding: 0.2rem;
|
||||
}
|
||||
|
||||
<script>
|
||||
const formatType = 0; // Specify the format type here
|
||||
const excel_headers = {
|
||||
3: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
4: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
5: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
6: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
7: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
8: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium"
|
||||
},
|
||||
9:
|
||||
{
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
10: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
11: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium",
|
||||
"max_si": "Max Si"
|
||||
},
|
||||
12: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"premium": "Premium"
|
||||
},
|
||||
13: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
.error {
|
||||
background-color: #f8d7da;
|
||||
}
|
||||
|
||||
.duplicate {
|
||||
background-color: #fff3cd;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.compact-table td,
|
||||
.compact-table th {
|
||||
padding: 0.1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
const formatType = 0; // Specify the format type here
|
||||
const excel_headers = {
|
||||
3: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
4: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
5: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
6: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
7: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
8: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium"
|
||||
},
|
||||
9: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"premium": "Premium"
|
||||
},
|
||||
10: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
},
|
||||
11: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"grade": "Grade",
|
||||
"premium": "Premium",
|
||||
"max_si": "Max Si"
|
||||
},
|
||||
12: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"premium": "Premium"
|
||||
},
|
||||
13: {
|
||||
"sum_insured": "Sum Insured",
|
||||
"relationship": "Relationship",
|
||||
"from_age": "From Age",
|
||||
"to_age": "To Age",
|
||||
"premium": "Premium"
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function slugify(text) {
|
||||
return text.toString().toLowerCase().replace(/\s+/g, '_').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '_')
|
||||
.replace(/^-+/, '').replace(/-+$/, '');
|
||||
}
|
||||
|
||||
function copyHeaders(rack_rate_type) {
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
if(rack_rate_type == 1){
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
console.log(obj)
|
||||
console.log(formatType)
|
||||
|
||||
if(!formatType && formatType == ""){
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
const headerString = Object.values(excel_headers[formatType]).join("\t"); // Using specified format type for copying headers
|
||||
navigator.clipboard.writeText(headerString).then(function() {
|
||||
toastr.success('Headers copied to clipboard', 'success');
|
||||
}, function(err) {
|
||||
toastr.error(err, 'Could not copy headers:');
|
||||
});
|
||||
}
|
||||
|
||||
function generateTable(rack_rate_type) {
|
||||
|
||||
var data = $('#copied_excel_data').val();
|
||||
let formatType = $('#grid').val();
|
||||
var obj = $('#grid');
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
data = $('#additional_copied_excel_data').val();
|
||||
formatType = $('#additional_grid').val();
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
console.log(obj);
|
||||
console.log(formatType);
|
||||
console.log(data);
|
||||
|
||||
if (!formatType || formatType == "") {
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Excel data is empty
|
||||
if (!data.trim()) {
|
||||
toastr.warning('Excel data is empty.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = data.split("\n");
|
||||
|
||||
// Filter out empty rows
|
||||
rows = rows.filter(rowText => rowText.split("\t").some(cell => cell.trim()));
|
||||
|
||||
if (rows.length === 0) {
|
||||
toastr.warning('All rows are empty after filtering.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var header = rows[0].split("\t");
|
||||
|
||||
// Determine the columns to keep (non-empty columns)
|
||||
var columnsToKeep = [];
|
||||
for (let i = 0; i < header.length; i++) {
|
||||
if (rows.some(rowText => rowText.split("\t")[i].trim())) {
|
||||
columnsToKeep.push(i);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function slugify(text) {
|
||||
return text.toString().toLowerCase().replace(/\s+/g, '_').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '_').replace(/^-+/, '').replace(/-+$/, '');
|
||||
}
|
||||
|
||||
function copyHeaders() {
|
||||
const headerString = Object.values(excel_headers[formatType]).join("\t"); // Using specified format type for copying headers
|
||||
navigator.clipboard.writeText(headerString).then(function() {
|
||||
alert('Headers copied to clipboard');
|
||||
}, function(err) {
|
||||
alert('Could not copy headers: ', err);
|
||||
// Filter header based on columns to keep
|
||||
header = columnsToKeep.map(i => slugify(header[i]));
|
||||
|
||||
if (!excel_headers[formatType]) {
|
||||
toastr.warning("Unknown format type. Please check the header columns.", 'Warning');
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
|
||||
var expectedHeader = Object.keys(excel_headers[formatType]);
|
||||
|
||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType]));
|
||||
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||
|
||||
Swal.fire({
|
||||
title: "Header Mismatch",
|
||||
html: `
|
||||
<p>Header columns do not match expected format:</p>
|
||||
<p><strong>Expected:</strong> ${expectedHeaders}</p>
|
||||
<p><strong>Received:</strong> ${receivedHeaders}</p>
|
||||
`,
|
||||
icon: "error"
|
||||
});
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
return;
|
||||
}
|
||||
|
||||
function generateTable() {
|
||||
var data = $('#copied_excel_data').val();
|
||||
const formatType = $('#grid').val();
|
||||
alert(formatType);
|
||||
// Check if Excel data is empty
|
||||
if (!data.trim()) {
|
||||
alert('Excel data is empty.');
|
||||
return;
|
||||
}
|
||||
|
||||
var rows = data.split("\n");
|
||||
var table = $('<table class="table table-striped compact-table" />');
|
||||
var header = rows[0].split("\t").map(cell => slugify(cell));
|
||||
var table = $('<table class="table table-striped compact-table" />');
|
||||
var uniqueRows = new Set();
|
||||
var emptyCellCount = 0;
|
||||
|
||||
if (!excel_headers[formatType]) {
|
||||
alert("Unknown format type. Please check the header columns.");
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
$('#excel_table').empty();
|
||||
rows.forEach((rowText, y) => {
|
||||
var cells = rowText.split("\t").filter((_, i) => columnsToKeep.includes(i));
|
||||
var row = $('<tr />');
|
||||
|
||||
// Skip empty rows after filtering columns
|
||||
if (cells.every(cell => !cell.trim())) {
|
||||
return;
|
||||
}
|
||||
|
||||
var expectedHeader = Object.keys(excel_headers[formatType]);
|
||||
|
||||
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||
alert("Header columns do not match expected format:\nExpected: " + JSON.stringify(Object.values(excel_headers[formatType])) + "\nReceived: " + JSON.stringify(rows[0].split("\t")));
|
||||
$('#submitBtn').prop('disabled', true);
|
||||
$('#excel_table').empty();
|
||||
return;
|
||||
}
|
||||
|
||||
var uniqueRows = new Set();
|
||||
var emptyCellCount = 0;
|
||||
|
||||
rows.forEach((rowText, y) => {
|
||||
var cells = rowText.split("\t");
|
||||
|
||||
// Skip empty rows
|
||||
if (cells.every(cell => !cell.trim())) {
|
||||
return;
|
||||
cells.forEach(cellText => {
|
||||
row.append('<td>' + cellText + '</td>');
|
||||
if (!cellText.trim()) {
|
||||
emptyCellCount++;
|
||||
}
|
||||
|
||||
var row = $('<tr />');
|
||||
cells.forEach(cellText => {
|
||||
row.append('<td>'+cellText+'</td>');
|
||||
if (!cellText.trim()) {
|
||||
emptyCellCount++;
|
||||
}
|
||||
});
|
||||
|
||||
var key;
|
||||
switch(formatType) {
|
||||
case 1:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, From Age, To Age
|
||||
break;
|
||||
case 2:
|
||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Grade
|
||||
break;
|
||||
case 3:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, Relationship, From Age, To Age
|
||||
break;
|
||||
case 4:
|
||||
key = cells[0]; // Sum Insured
|
||||
break;
|
||||
case 5:
|
||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Grade
|
||||
break;
|
||||
default:
|
||||
key = cells.join("|");
|
||||
}
|
||||
|
||||
if (y > 0 && uniqueRows.has(key)) {
|
||||
row.addClass('duplicate');
|
||||
} else {
|
||||
uniqueRows.add(key);
|
||||
}
|
||||
table.append(row);
|
||||
});
|
||||
|
||||
$('#submitBtn').prop('disabled', $('.duplicate').length > 0);
|
||||
var key;
|
||||
switch (formatType) {
|
||||
case 3:
|
||||
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||
break;
|
||||
case 4:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 5:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 6:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 7:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 8:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
||||
break;
|
||||
case 9:
|
||||
key = cells[0] + "|" + cells[1]; // Sum Insured, Premium
|
||||
break;
|
||||
case 10:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||
break;
|
||||
case 11:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, Grade, Premium, Max SI
|
||||
break;
|
||||
case 12:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
||||
break;
|
||||
case 13:
|
||||
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Sum Insured, Relationship, From Age, To Age, Premium
|
||||
break;
|
||||
default:
|
||||
key = cells.join("|");
|
||||
|
||||
}
|
||||
|
||||
if (y > 0 && uniqueRows.has(key)) {
|
||||
row.addClass('duplicate');
|
||||
} else {
|
||||
uniqueRows.add(key);
|
||||
}
|
||||
table.append(row);
|
||||
});
|
||||
|
||||
if (rack_rate_type == 1) {
|
||||
$('#additional_excel_table').empty();
|
||||
$('#additional_excel_table').html(table);
|
||||
} else if (rack_rate_type == 0) {
|
||||
$('#excel_table').empty();
|
||||
$('#excel_table').html(table);
|
||||
}
|
||||
|
||||
if ($('.duplicate').length > 0) {
|
||||
alert("Duplicate records found.");
|
||||
if ($('.duplicate').length > 0) {
|
||||
console.log('test');
|
||||
toastr.warning("Duplicates found!", "warning");
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
|
||||
if (emptyCellCount > 0) {
|
||||
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||
$('.excel_table_class').empty();
|
||||
$('.excel_textarea').val('');
|
||||
}
|
||||
submitData(rack_rate_type);
|
||||
}
|
||||
|
||||
|
||||
function submitData(rack_rate_type) {
|
||||
|
||||
let formatType = $('#grid').val();
|
||||
var table = $('#excel_table table');
|
||||
var obj = $('#grid');
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
|
||||
formatType = $('#additional_grid').val();
|
||||
table = $('#additional_excel_table table');
|
||||
obj = $('#additional_grid');
|
||||
}
|
||||
|
||||
|
||||
var headers = $(table).find('tr').first().find('td').map(function() {
|
||||
return slugify($(this).text());
|
||||
}).get();
|
||||
|
||||
var rows = $(table).find('tr:gt(0)').map(function() {
|
||||
return $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
}).get();
|
||||
|
||||
var jsonData = [];
|
||||
|
||||
$(table).find('tr:gt(0)').each(function(idx) {
|
||||
var row = $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
var rowData = {};
|
||||
row.forEach((cell, colIdx) => {
|
||||
rowData[headers[colIdx]] = cell;
|
||||
});
|
||||
jsonData.push(rowData);
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
jsonData.forEach(obj => {
|
||||
|
||||
if ('sum_insured' in obj) {
|
||||
obj.si = obj.sum_insured;
|
||||
delete obj.sum_insured;
|
||||
}
|
||||
|
||||
alert('Number of empty cells: ' + emptyCellCount);
|
||||
submitData();
|
||||
if ('from_age' in obj) {
|
||||
obj.age_from = obj.from_age;
|
||||
delete obj.from_age;
|
||||
}
|
||||
|
||||
if ('to_age' in obj) {
|
||||
obj.age_to = obj.to_age;
|
||||
delete obj.to_age;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(jsonData);
|
||||
|
||||
|
||||
if(rack_rate_type == 1){
|
||||
|
||||
$('#additional_grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcelforadditional').text() == "Manual entry") {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcelforadditional').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#additional_grid_content_input').toggle();
|
||||
$('#additional_grid_content_from_excel').toggle();
|
||||
|
||||
}else{
|
||||
|
||||
$('#grid_content_input').empty()
|
||||
|
||||
if ($('#copyfromexcel').text() == "Manual entry") {
|
||||
$('#copyfromexcel').text("Copy from excel")
|
||||
} else {
|
||||
$('#copyfromexcel').text("Copy from excel");
|
||||
}
|
||||
|
||||
$('#grid_content_input').toggle();
|
||||
$('#grid_content_from_excel').toggle();
|
||||
|
||||
|
||||
}
|
||||
|
||||
function submitData() {
|
||||
$('#json_output').empty(); // Clear existing JSON output
|
||||
$.each(jsonData, function(index, item) {
|
||||
appendGridtHtml(formatType, rack_rate_type, item)
|
||||
});
|
||||
|
||||
var table = $('#excel_table table');
|
||||
var headers = $(table).find('tr').first().find('td').map(function() {
|
||||
return slugify($(this).text());
|
||||
}).get();
|
||||
|
||||
var rows = $(table).find('tr:gt(0)').map(function() {
|
||||
return $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
}).get();
|
||||
$('input[name="11_max_si[]"]').each(function() {
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
var jsonData = [];
|
||||
|
||||
$(table).find('tr:gt(0)').each(function(idx) {
|
||||
var row = $(this).find('td').map(function() {
|
||||
return $(this).text();
|
||||
}).get();
|
||||
var rowData = {};
|
||||
row.forEach((cell, colIdx) => {
|
||||
rowData[headers[colIdx]] = cell;
|
||||
});
|
||||
jsonData.push(rowData);
|
||||
});
|
||||
$(`input[name="${formatType}_si[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
$('#json_output').text(JSON.stringify(jsonData, null, 2));
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
$(`input[name="${formatType}_premium[]"]`).each(function() {
|
||||
// console.log($(this));
|
||||
$(this).trigger('keyup');
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -22,7 +22,7 @@ table.dataTable tbody td {
|
||||
</thead>
|
||||
|
||||
<tbody class="font-12">
|
||||
<?php for ($i = 1; $i <= count($tbody); $i++): ?>
|
||||
<?php for ($i = 1; $i <= $count; $i++): ?>
|
||||
<tr>
|
||||
<?php foreach ($tbody[$i] as $data): ?>
|
||||
<td>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user