MERGE_TEST_AUTO_MAIL_HEADER&FOOTER

This commit is contained in:
Ubuntu 2025-10-11 18:29:21 +05:30
commit d460221f2f
19 changed files with 2042 additions and 424 deletions

View File

@ -99,5 +99,5 @@ class Autoload extends AutoloadConfig
* @var string[]
* @phpstan-var list<string>
*/
public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload', 'excel_import_export', 'file', 'drive','ExcelSanitizeHelper'];
public $helpers = ['uuid','session','utility', 'form', 'url', 'oauth', 'fileupload', 'excel_import_export', 'file', 'drive','ExcelSanitizeHelper','sms_helper'];
}

View File

@ -71,6 +71,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
$routes->post('wipe', 'ClientController::wipeDemoClient');
$routes->get("typeList/(:any)", "ClientController::typeList/$1");
// application/config/routes.php
// Add a route for the view_Deposit method
@ -97,6 +98,8 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
$routes->post("edit", "ClientController::editClientBranch");
$routes->get("list/(:any)", "ClientController::getSingleBranchDataById/$1");
$routes->get("remove/(:any)", "ClientController::removeClientBranch/$1");
$routes->post("auto_fetch_branch","ClientController::auto_fetch_branch");
$routes->post("auto_fetch_branch_details","ClientController::auto_fetch_branch_details");
});
$routes->group("relation", ["filter" => "authMVC"], function ($routes) {
@ -141,6 +144,7 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
$routes->group("others", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "ClientController::createOtherTabContent");
$routes->post('check-duplicate', 'ClientController::validateDuplicateByClientBranch');
});
});

View File

@ -151,6 +151,16 @@ class ClientController extends AdminController
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
}
public function validateDuplicateByClientBranch()
{
$value = $this->request->getPost('value');
$clientId = $this->request->getPost('client_id');
$branchId = $this->request->getPost('branch_id');
$field = $this->request->getPost('field');
$isDuplicate = $this->clientModel->isDuplicateByClientBranch($value, $field, $clientId, $branchId);
return $this->response->setJSON(['isDuplicate' => $isDuplicate]);
}
public function smapletest()
{
$headers = [
@ -337,7 +347,7 @@ class ClientController extends AdminController
{
$this->myLogger->logme('error', 'Client list function called');
$headerData['page_name'] = 'Client List';
$data['clientList'] = $this->clientModel->getCreatedByUserName();
$data['clientList'] = $this->clientModel->getCreatedByUserName(1);
$data['client_rm'] = $this->clientRMModel->getAllClientRM();
$data['lead_data'] = $this->leadsModel->getLeadForInsertClientList();
@ -349,6 +359,26 @@ class ClientController extends AdminController
// $this->loadLayout('client_onboarding', $data);
}
public function typeList($id = null)
{
try {
$data = $this->clientModel->getCreatedByUserName($id); // passing client_type
if (empty($data)) {
return $this->response
->setJSON(['status' => 'error', 'message' => 'No Records found'])
->setStatusCode(404);
}
return $this->response
->setJSON(['status' => 'success', 'data' => $data])
->setStatusCode(200);
} catch (\Throwable $e) {
return $this->response
->setJSON(['status' => 'error', 'message' => $e->getMessage()])
->setStatusCode(500);
}
}
public function updateEmpAndPolicyStatus()
{
@ -481,6 +511,10 @@ class ClientController extends AdminController
// dd($data['placeHolders']);
// auto fetch client list and branch list from pre
$data['auto_fetch_client_list'] = $this->getClientListFromPost();
echo view('layout/header', $headerData);
echo view('client_onboarding', $data);
echo view('layout/footer');
@ -620,6 +654,8 @@ class ClientController extends AdminController
$editData['client_policy']['role'] = get_role_id();
$editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll();
$editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
$editData['auto_fetch_client_list'] = $this->getClientListFromPost();
// dd($editData);
echo view('layout/header', $headerData);
@ -871,7 +907,29 @@ class ClientController extends AdminController
}
$data['created_by'] = get_session_userid();
// before updating check if post_branch_id is already existing in the current db
if(isset($data['post_branch_id']) && !empty($data['post_branch_id']))
{
$existing_pre_branch = $this->clientBranchModel
->where('post_branch_id',$data['post_branch_id'])
// ->where('id !=',$pre_branch_id)
->where('is_active',1)
->first();
if($existing_pre_branch)
{
return $this->respond([
'status' => false,
'code' => 409,
'message' => 'The branch is already mapped with another branch. Please check.',
], 409);
}
}
$insert = $this->clientBranchModel->insert($data);
$pre_branch_id = $insert;
if ($insert) {
$level_contact_data = $this->request->getPost('level_contect_data');
@ -879,6 +937,16 @@ class ClientController extends AdminController
$this->saveLevelContacts($level_contact_data, $insert);
}
if($pre_branch_id && isset($data['post_branch_id']) && !empty($data['post_branch_id']))
{
// need to update the client_branch in the pre
$result = $this->updatePostClientBranch($data['post_branch_id'],$pre_branch_id , "create");
log_message('error','Post client_branch update result for post_branch_id '.$data['post_branch_id'].' and pre_branch_id '.$pre_branch_id.' is '.json_encode($result));
}
// if ($insert) {
// for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
// // Prepare data to insert
@ -919,7 +987,11 @@ class ClientController extends AdminController
$this->myLogger->logme('error', 'Client branch EDIT function called');
$id = $this->request->getPost('branch_id_primarykey');
$client_id = $this->request->getPost('client_id');
$post_branch_id = $this->request->getPost('post_branch_id') ?? "";
$data = $this->request->getPost();
$data['post_branch_id'] = $post_branch_id;
$units = $this->request->getPost('units');
$emp_unit_count = 0;
@ -978,7 +1050,44 @@ class ClientController extends AdminController
}
$data['updated_by'] = get_session_userid();
$pre_branch_id = $id;
// before updating check if post_branch_id is already existing in the current db
if(isset($data['post_branch_id']) && !empty($data['post_branch_id']))
{
$existing_pre_branch = $this->clientBranchModel
->where('post_branch_id',$data['post_branch_id'])
->where('id !=',$pre_branch_id)
->where('is_active',1)
->first();
if($existing_pre_branch)
{
return $this->respond([
'status' => false,
'code' => 409,
'message' => 'The branch is already mapped with another branch. Please check.',
], 409);
}
}
$insert = $this->clientBranchModel->update($id, $data);
if($pre_branch_id && isset($data['post_branch_id']) && !empty($data['post_branch_id']))
{
// need to update the client_branch in the post
$result = $this->updatePostClientBranch($data['post_branch_id'],$pre_branch_id , "update");
log_message('error','Post client_branch update result for post_branch_id '.$data['post_branch_id'].' and pre_branch_id '.$pre_branch_id.' is '.json_encode($result));
}
$this->myLogger->logme('error', 'Client branch EDITED by {data}', ['data' => get_session_userid()]);
if ($insert) {
@ -5129,4 +5238,125 @@ class ClientController extends AdminController
return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200);
}
private function getClientListFromPost (){
$db2 = \Config\Database::connect('postDB');
$auto_fetch_client_list = $db2->table('clients')
->select('id,client_name')
->where('is_active',1)
->get()->getResultArray()??[];
return $auto_fetch_client_list;
}
public function auto_fetch_branch(){
$data = $this->request->getPost();
$db2 = \Config\Database::connect('postDB');
$auto_fetch_branch_list = $db2->table('client_branch')
->select('id,branch_name')
->where('client_id',$data['client_id'])
->where('is_active',1)
->get()->getResultArray()??[];
return
empty($auto_fetch_branch_list)
? $this->response->setJSON([
'status' => false,
'message' => 'branch list is empty',
'data' => []
])->setStatusCode(400)
: $this->response->setJSON([
'status' => true,
'message' => 'branch list is found' ,
'data' => $auto_fetch_branch_list
])->setStatusCode(200);
}
public function auto_fetch_branch_details(){
$data = $this->request->getPost();
$db2 = \Config\Database::connect('postDB');
$auto_fetch_branch_details = $db2->table('client_branch')
->where('client_id',$data['client_id'])
->where('id',$data['branch_id'])
->where('is_active',1)
->get()->getResultArray()??[];
return empty($auto_fetch_branch_details)
? $this->response->setJSON([
'status' => false,
'message' => 'branch details is empty',
'data' => []
])->setStatusCode(400)
: $this->response->setJSON([
'status' => true,
'message' => 'branch details found' ,
'data' => $auto_fetch_branch_details
])->setStatusCode(200);
}
public function updatePostClientBranch($post_branch_id,$pre_branch_id , $operation){
$postDB = \Config\Database::connect('postDB');
if($operation != 'create'){
$builder = $postDB->table('client_branch');
$builder->where('pre_branch_id', $pre_branch_id);
$builder->update(['pre_branch_id' => null]);
}
$builder = $postDB->table('client_branch');
$builder->where('id', $post_branch_id);
$builder->update(['pre_branch_id' => $pre_branch_id]);
return true;
}
}

View File

@ -761,36 +761,45 @@ class EmployeeController extends AdminController
}
public function empby_client_clientbranch($client_id, $branch_id)
{
$results = $this->clientModel->select('employees.id as employee_id, employees.name as employee_name,
employees.relationship, employees.emp_code,
employees.emp_status, auth_history.user_type')
->join('employees', $client_id .'= employees.client_id AND ' . $branch_id . '= employees.client_branch_id', 'left')
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
->where('employees.is_active', 1)
->where('employees.emp_status !=', 'truncated')
->groupBy('employees.id')
->findAll();
public function empby_client_clientbranch($client_id, $branch_id, $client_policy_id)
{
$results = $this->clientModel->select('
employees.id as employee_id,
employees.name as employee_name,
employees.relationship,
employees.emp_code,
employees.emp_status,
auth_history.user_type
')
->join('employees', $client_id . '= employees.client_id AND ' . $branch_id . '= employees.client_branch_id', 'left')
->join('employee_polices', 'employees.id = employee_polices.employee_id')
->join('auth_history', 'employees.id = auth_history.user_id AND "employee" = auth_history.user_type', 'left')
->where('employees.is_active', 1)
->where('employees.emp_status !=', 'truncated')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.is_active', 1)
->where('employee_polices.status !=', 'truncated')
->groupBy('employees.id')
->findAll();
$groupedData = [];
$employeeId = '';
foreach ($results as $row) {
if($employeeId != $row['employee_id']){
if ($employeeId != $row['employee_id']) {
$employeeId = $row['employee_id'];
}else{
} else {
$employeeId = null;
}
$employeeName = $row['employee_name'] ;
$employeeRelationship = $row['relationship'] ;
$employeeEmpCode = $row['emp_code'] ;
$employeeName = $row['employee_name'];
$employeeRelationship = $row['relationship'];
$employeeEmpCode = $row['emp_code'];
$employeeEmpStatus = $row['emp_status'];
$employeeUserType = $row['user_type'];
// if ($employeeId !== null && $employeeRelationship == 'Self') {
if ($employeeId !== null) {
// Append employee info to the branch's employees list
@ -802,16 +811,16 @@ class EmployeeController extends AdminController
'emp_status' => $employeeEmpStatus,
'user_type' => $employeeUserType
];
}
$employeeId = $row['employee_id'];
}
return json_encode($groupedData);
}
// print_r($groupedData); die;
return json_encode($groupedData);
}
/**

View File

@ -275,6 +275,7 @@ class EmployeeRestController extends AdminController
$item->gender = $this->GenderMap($item->relationship , $item->emp_code);
$item->dob = $this->convertDateFormatYMD($item->dob);
$item->emp_status = 'draft';
$item->band = $this->getSelfBand($item->emp_code,$item->client_id,$item->client_branch_id);
// dd($item);
$employee = $this->employeeModel->insert($item);
@ -312,6 +313,22 @@ class EmployeeRestController extends AdminController
}
public function getSelfBand(string $emp_code, int $client_id, int $client_branch_id): ?string
{
$employee = $this->employeeModel
->where('emp_code', $emp_code)
->where('client_id', $client_id)
->where('client_branch_id', $client_branch_id)
->whereIn('emp_status', ['draft', 'enrolled'])
->where('is_active', 1)
->where('relationship','Self')
->first();
return $employee['band'] ?? null;
}
public function getEmployeePayableValue($client_policy_id,$relationship)
{
$terms = $this->clientPolicyModel->where('id',$client_policy_id)->get()->getRow()->policy_terms;
@ -1757,53 +1774,28 @@ class EmployeeRestController extends AdminController
public function getClientDetails()
{
log_message('error', 'STEP 1: getClientDetails called');
try {
// STEP 2: Extract Authorization header
$jwt = $this->request->getHeaderLine('Authorization');
log_message('error', 'STEP 2: Authorization header: ' . $jwt);
$pre_client_id = $this->request->getGet('pre_client_id');
$pre_branch_id = $this->request->getGet('pre_branch_id');
$post_client_id = $this->request->getGet('post_client_id');
$post_branch_id = $this->request->getGet('post_branch_id');
$jwtParts = explode(' ', $jwt);
if (count($jwtParts) < 2) {
log_message('error', 'STEP 2.1: Invalid Authorization header format');
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => 'Invalid Authorization header'], 400);
}
if ($pre_client_id != null) {
$token = $jwtParts[1];
log_message('error', 'STEP 3: Extracted JWT token');
$tokenParts = explode('.', $token);
if (count($tokenParts) !== 3) {
log_message('error', 'STEP 3.1: Invalid JWT structure');
return $this->respond(['status' => 'failed', 'code' => 400, 'data' => 'Invalid JWT token'], 400);
}
$decodedPayload = json_decode(base64_decode($tokenParts[1]), true);
log_message('error', 'STEP 4: Decoded JWT payload: ' . json_encode($decodedPayload));
$token_type = $decodedPayload['token_type'] ?? null;
log_message('error', 'STEP 5: Token type = ' . $token_type);
$client_id = $this->request->getGet('client_id');
$client_branch_id = $this->request->getGet('client_branch_id');
log_message('error', 'STEP 6: Query params - client_id: ' . $client_id . ', client_branch_id: ' . $client_branch_id);
if ($token_type === 'pre') {
log_message('error', 'STEP 7: Handling "pre" token type');
$client = $this->clientModel->where('id', $client_id)->first();
$client = $this->clientModel->where('id', $pre_client_id)->first();
if ($client) {
log_message('error', 'STEP 8: Found client: ' . json_encode($client));
$client['client_logo'] = base_url() . 'public/uploads/logo/' . $client['client_logo'];
$clientPolicy = $this->clientPolicyModel
->where('client_id', $client_id)
->where('client_branch_id', $client_branch_id)
->where('client_id', $pre_client_id)
->where('client_branch_id', $pre_branch_id)
->findAll();
log_message('error', 'STEP 9: Found client policy count: ' . count($clientPolicy));
return $this->respond([
'status' => 'success',
@ -1814,33 +1806,34 @@ class EmployeeRestController extends AdminController
]
], 200);
} else {
log_message('error', 'STEP 10: No client found for client_id: ' . $client_id);
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
}
} elseif ($token_type === 'post') {
log_message('error', 'STEP 11: Handling "post" token type');
} elseif ($post_client_id != null) {
$restAuthController = new RestAuthenticationController;
$queryParams = [
'client_id' => $client_id,
'client_branch_id' => $client_branch_id
'client_id' => $post_client_id,
'client_branch_id' => $post_branch_id
];
log_message('error', 'STEP 12: Calling post enrollment API with params: ' . json_encode($queryParams));
return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails');
return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails', ['token' => $jwt]);
} else {
log_message('error', 'STEP 13: Unknown token_type: ' . $token_type);
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
}
} catch (\Exception $e) {
log_message('error', 'STEP 14: Exception occurred - ' . $e->getMessage());
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
}
}
public function getSiMappedArray($policy_id,$base_policy_id)
{
$selfGMC = $this->employeeModel->select('employees.name , employee_polices.basic_cover_si')

View File

@ -74,18 +74,7 @@ class RestAuthenticationController extends AdminController
return $response->getBody();
}
// public function callThirdPartyGETAPI($queryParams, $endPoint)
// {
// $client = \Config\Services::curlrequest();
// $url = env('POST_ENROLLMENT_BASEURL') . $endPoint;
// $response = $client->get($url, [
// 'query' => $queryParams, // pass as query parameters
// 'http_errors' => false // prevent exception on non-200 status
// ]);
// return $response->getBody();
// }
public function callThirdPartyGETAPI($queryParams, $endPoint, $params = [])
{
@ -114,7 +103,19 @@ class RestAuthenticationController extends AdminController
// employee auth api's start
public function verifyEmployeeWithMobileNumber()
@ -124,7 +125,9 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - Verify Employee With Mobile Number: Function called");
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$data = $this->request->getJSON();
$mobile_number = $data->mobile_number;
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Received mobile_number = " . $mobile_number);
$empdata = RestAuthHelper::getPreAndPostDataByEmailOrMobile(['mobile_number' => $mobile_number]);
@ -137,49 +140,97 @@ class RestAuthenticationController extends AdminController
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: employee data both PRE & POST = " . json_encode($empdata));
$employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id')
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
->where('employees.is_active', 1)
->where('employees.relationship', 'self')
->where('employees.emp_status !=', 'truncated')
->where('employees.mobile', $mobile_number)
->where('EP.is_active', 1)
->whereIn('EP.status', ['draft', 'enrolled', 'expired'])
->first();
$employeeData = [];
if (isset($empdata['pre']) && !empty($empdata['pre'])) {
$employeeData = $empdata['pre'];
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Using PRE data");
} elseif (isset($empdata['post']) && !empty($empdata['post'])) {
$employeeData = $empdata['post'];
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Using POST data");
}
$otp = random_int(100000, 999999);
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Final employee data to verify = " . json_encode($employeeData));
if (isset($employeeData['employee_id']))
{
{
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Employee verified with ID = " . $employeeData['employee_id']);
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
$result = ['user_verification' => true ,'message' => "Verified Successfully" ];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
$sql = "
UPDATE employees
INNER JOIN employee_polices ON employee_polices.employee_id = employees.id
SET employees.otp = ?
WHERE employees.id = ?
AND employees.relationship = 'self'
AND employees.is_active = 1
AND employee_polices.is_active = 1
AND employee_polices.status IN ('draft', 'enrolled')
";
$db = db_connect();
$update = $db->query($sql, [$otp, $employeeData['employee_id']]);
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: OTP update query executed. SQL = " . $db->getLastQuery());
if($update)
{
//If post-enrollment data exist update the same otp generated from pre-enrollment.
if (isset($empdata['post']['client_id']) && !empty($empdata['post']['client_id'])) {
$data->otp = $otp;
$data->client_id = $empdata['post']['client_id'];
$data->employee_id = $empdata['post']['employee_id'];
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Attached otp, client_id and employee_id from POST data to update the otp");
$this->callThirdPartyAPI($data, 'updateEmpOTP');
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Calling callThirdPartyAPI for updateEmpOTP");
}
//send sms
$SMSResult = sendOtpSms($mobile_number, $otp);
if ($SMSResult['status'] == 'success')
{
$result = ['user_verification' => true ,'message' => "Verified Successfully" ];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
}else{
$result = ['user_verification' => false, 'message' => "SMS sending failed , try again"];
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
}
}else{
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: OTP update query Failed. SQL = " . $db->getLastQuery());
$result = ['user_verification' => false, 'message' => "Try again. , try again"];
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
}
} else {
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Employee ID not found, calling third-party API to POST");
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
// Call the third-party API function
return $this->callThirdPartyAPI($this->request->getJSON(),'verifyEmployeeNumber');
$reqData = $this->request->getJSON();
$reqData->otp = $otp;
return $this->callThirdPartyAPI($reqData,'verifyEmployeeNumber');
}
} catch (\Throwable $th) {
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => $th],500);
}
}
@ -208,22 +259,7 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: employee data both PRE & POST = " . json_encode($empdata));
$employeeData = $this->employeeModel->select('
employees.relationship,
EP.employee_id,
employees.client_id,
employees.client_branch_id,
employees.email_corporate
')
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
->where('employees.is_active', 1)
->where('employees.relationship', 'Self')
->where('employees.emp_status !=', 'truncated')
->where('employees.email_corporate', $email)
->where('EP.is_active', 1)
->whereIn('EP.status', ['draft', 'enrolled', 'expired'])
->first();
$employeeData = [];
if (isset($empdata['pre']) && !empty($empdata['pre'])) {
@ -231,15 +267,12 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Using PRE data");
}
$otp = random_int(100000, 999999);
if (isset($employeeData['employee_id'])) {
if (isset($employeeData['employee_id']))
{
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Valid employee found, generating OTP");
$otp = random_int(100000, 999999);
// $update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self')
// ->where('is_active', 1)->set(array('otp' => $otp ))
// ->update();
$sql = "
UPDATE employees
@ -253,7 +286,7 @@ class RestAuthenticationController extends AdminController
";
$db = db_connect();
// $update = $db->query($sql, [$otp, $email]);
$update = $db->query($sql, [$otp, $employeeData['employee_id']]);
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: OTP update query executed. SQL = " . $db->getLastQuery());
@ -261,17 +294,20 @@ class RestAuthenticationController extends AdminController
if($update)
{
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: OTP updated successfully in PRE DATABASE");
$data->otp = $otp;
//If post-enrollment data exist update the same otp generated from pre-enrollment.
if (isset($empdata['post']['client_id']) && !empty($empdata['post']['client_id'])) {
$data->otp = $otp;
$data->client_id = $empdata['post']['client_id'];
$data->employee_id = $empdata['post']['employee_id'];
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Attached otp, client_id and employee_id from POST data to update the otp");
$this->callThirdPartyAPI($data, 'updateEmpOTP');
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Calling callThirdPartyAPI for updateEmpOTP");
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Calling callThirdPartyAPI for updateEmpOTP");
$this->callThirdPartyAPI($data, 'updateEmpOTP');
//send Email
$common = [
'client_id' => $employeeData['client_id'],
'client_branch_id' => $employeeData['client_branch_id'],
@ -309,21 +345,22 @@ class RestAuthenticationController extends AdminController
} else {
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Employee not found with email in the PRE DATABASE, falling back to third-party API");
// Call the third-party API function
$apiParams = $this->request->getJSON();
if (!empty($empdata['post']['client_id'])) {
$apiParams->client_id = $empdata['post']['client_id'];
}
// print_r($apiParams); die;
// Call the third-party API function
$apiParams->otp = $otp;
return $this->callThirdPartyAPI($apiParams, 'verifyEmployeeEmailId');
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->callThirdPartyAPI($apiParams, 'verifyEmployeeEmailId');
}
} catch (\Throwable $th) {
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $th], 500);
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => "", 'message' => $th], 500);
}
}
@ -336,79 +373,42 @@ class RestAuthenticationController extends AdminController
try {
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
$email_id = isset($this->request->getJSON()->email_id) ? $this->request->getJSON()->email_id : null;
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
if (isset($this->request->getJSON()->login_by_hr))
{
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: login_by_hr detected, fetching employee data directly");
$employeeData = $this->employeeModel->where('id', $this->request->getJSON()->employee_id)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: employeeData (login_by_hr) = " . json_encode($employeeData));
}else{
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Fetching empdata via RestAuthHelper");
$empdata = RestAuthHelper::getPreAndPostDataByEmailOrMobile(['email_id' => $email_id, 'otp' => $otp, 'mobile_number' => $mobile_number ]);
// print_r($empdata); die;
if(empty($empdata)){
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: empdata is empty");
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'failed','code' => 404,'data' => []],200);
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: empdata = " . json_encode($empdata));
if (isset($mobile_number))
{
// $employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
$employeeData = $this->employeeModel
->select('employees.*')
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
->where('employees.is_active', 1)
->where('employees.relationship', 'self')
->where('employees.emp_status !=', 'truncated')
->where('employees.mobile', $mobile_number)
->where('EP.is_active', 1)
->whereIn('EP.status', ['draft', 'enrolled'])
->first();
} else {
// $employeeData = $this->employeeModel->where('email_corporate', $email_id)->where('otp', $otp)->where('relationship', 'self')->where('emp_status !=', 'truncated')->where('is_active', 1)->first();
$employeeData = $this->employeeModel
->select('employees.*')
->join('employee_polices', 'employees.id = employee_polices.employee_id')
->where('employees.email_corporate', $email_id)
->where('employees.relationship', 'Self')
->where('employee_polices.is_active', 1)
->whereIn('employee_polices.status', ['draft', 'enrolled'])
->where('employees.is_active', 1)
->whereIn('employees.emp_status', ['draft', 'enrolled'])
->where('employees.otp', $otp)
->orderBy('id', 'desc')
->first();
}
$employeeData = [];
if (isset($empdata['pre']) && !empty($empdata['pre'])) {
$employeeData = $empdata['pre'];
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Using PRE data from empdata");
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Fetching empdata via RestAuthHelper");
$empdata = RestAuthHelper::getPreAndPostDataByEmailOrMobile(['email_id' => $email_id, 'otp' => $otp, 'mobile_number' => $mobile_number ]);
if(empty($empdata)){
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: empdata is empty");
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'Invalid OTP','code' => 404,'data' => "", 'message' => "Invalid OTP"],200);
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: empdata = " . json_encode($empdata));
$employeeData = [];
if (isset($empdata['pre']) && !empty($empdata['pre'])) {
$employeeData = $empdata['pre'];
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Using PRE data from empdata");
}
$requestData = $this->request->getJSON();
if (isset($empdata['post']['client_id']) && !empty($empdata['post']['client_id'])) {
$requestData->client_id = $empdata['post']['client_id'];
$requestData->employee_id = $empdata['post']['employee_id'];
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Added client_id and employee_id to requestData for to get the POST employee data");
}
// print_r($requestData); die;
if ($employeeData && $otp_verification == true || $employeeData && isset($this->request->getJSON()->login_by_hr) || $employeeData && isset($this->request->getJSON()->otp) )
if ( $employeeData && isset($this->request->getJSON()->otp) )
{
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - getVerifiedUserData: Verified employee found");
$auth = HttpRequestHelper::getRequestInfo();
@ -447,41 +447,91 @@ class RestAuthenticationController extends AdminController
log_message('error', '************************ PRE END ********************************');
// Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($requestData,'getVerifiedUserData');
return $this->respond(['status' => 'failed','code' => 404,'data' => [] , 'post_enrollment'=> json_decode($apiResponse, true)],200);
return $this->respond(['status' => 'failed','code' => 404,'data' => '' , 'post_enrollment'=> json_decode($apiResponse, true)],200);
}
} catch (\Exception $e) {
$this->myLogger->logme("error", "Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString());
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'failed','code' => 500,'data' =>[], 'error' => $e->getMessage()],500);
return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => "Invalid OTP", 'error' => $e->getMessage()],500);
}
}
// employee auth api's end
// HR auth api's start
public function verifyHrWithMobileNumber()
{
try {
$mobile_number = $this->request->getJSON()->mobile_number;
$data = $this->request->getJSON();
$mobile_number = $data->mobile_number;
$HrData = $this->hrModel->where('mobile', $mobile_number)
->where('contact_type', 'client')
->where('is_active', 1)
->first();
if ($HrData) {
$otp = random_int(100000, 999999);
if ($HrData)
{
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
} else {
// Call the third-party API function
return $this->callThirdPartyAPI($this->request->getJSON(),'verifyHrWithMobileNumber');
$sql = "UPDATE level_contacts SET otp = ? WHERE mobile = ? AND contact_type = 'client' AND is_active = 1";
$db = db_connect();
$update = $db->query($sql, [$otp, $mobile_number]);
if($update)
{
//update otp in post-enrollment
$data->otp = $otp;
$this->callThirdPartyAPI($data, 'updateHROTP');
//send sms
$SMSResult = sendOtpSms($mobile_number, $otp);
if ($SMSResult['status'] == 'success')
{
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
} else {
$result = ['user_verification' => false, 'message' => "SMS sending failed , try again"];
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
}
}else {
$result = ['user_verification' => false, 'message' => "SMS sending failed , try again"];
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
}
}else {
// Call the third-party API function
$reqData = $this->request->getJSON();
$reqData->otp = $otp;
return $this->callThirdPartyAPI($reqData,'verifyHrWithMobileNumber');
}
} catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
}
@ -500,9 +550,11 @@ class RestAuthenticationController extends AdminController
->where('is_active', 1)
->first();
$otp = random_int(100000, 999999);
if ($HrData) {
$otp = random_int(100000, 999999);
$sql = "
UPDATE level_contacts
@ -545,6 +597,8 @@ class RestAuthenticationController extends AdminController
} else {
// Call the third-party API function
$reqData = $this->request->getJSON();
$reqData->otp = $otp;
return $this->callThirdPartyAPI($this->request->getJSON(),'verifyHrWithEmail');
}
@ -556,21 +610,19 @@ class RestAuthenticationController extends AdminController
public function getVerifiedHrData()
{
try {
// mobile number
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
$mobile_number = isset($this->request->getJSON()->mobile_no) ? $this->request->getJSON()->mobile_no : null;
// email id
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
$email = isset($this->request->getJSON()->email) ? $this->request->getJSON()->email : null;
$mobile_number = isset($this->request->getJSON()->mobile_no) ? $this->request->getJSON()->mobile_no : null;
if (isset($mobile_number))
{
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->where('otp', $otp)->first();
}else{
$hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('otp', $otp)->first();
}
if ($hrData && $otp_verification == true || $hrData && isset($this->request->getJSON()->otp) )
if ($hrData)
{
$auth = HttpRequestHelper::getRequestInfo();
@ -590,45 +642,75 @@ class RestAuthenticationController extends AdminController
if(isset($this->request->getJSON()->mobile_no)){
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
$getAllhrData = $this->hrModel->select('level_contacts.id ,level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name , client_branch.post_branch_id')
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
->join('clients', 'client_branch.client_id = clients.id', 'left')
->where('level_contacts.mobile', $mobile_number )
->where('level_contacts.contact_type', 'client')
->find();
->findAll();
//set otp value null
$this->hrModel->where('mobile', $mobile_number)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
}else if(isset($this->request->getJSON()->otp)){
}else if(isset($this->request->getJSON()->email)){
$getAllhrData = $this->hrModel->select('level_contacts.id ,level_contacts.mobile , level_contacts.email , clients.id as client_id, clients.client_name, clients.short_name , client_branch.id as client_branch_id,client_branch.branch_name , client_branch.post_branch_id')
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
->join('clients', 'client_branch.client_id = clients.id', 'left')
->where('level_contacts.email', $email )
->where('level_contacts.contact_type', 'client')
->findAll();
//set otp value null
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
->where('level_contacts.email', $email )
->where('level_contacts.contact_type', 'client')
->find();
}
//call and get allowed module data from post enrollment
$queryParams = [
'hr_id' => $hrData['0']['id'],
'request_for' => 'pre_enrollment'
];
$HRAccessRes = $this->callThirdPartyGETAPI($queryParams,'getHRAccessData');
$HRAccessData = json_decode($HRAccessRes,true);
if(isset($HRAccessData['data']['allowed_modules'])){ $hrData['0']['allowed_modules'] = json_decode($HRAccessData['data']['allowed_modules'],true)['pre']; }else{ $hrData['0']['allowed_modules'] = []; }
$hrData['0']['token_type'] = 'pre';
$result = JWTToken::encode($hrData['0']);
// Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData');
return $this->respond(['status' => 'success','code' => 200,'data' => $result , 'post_enrollment'=> json_decode($apiResponse, true)],200);
if(count($getAllhrData))
{
$db2 = \Config\Database::connect('postDB');
foreach ($getAllhrData as $key => $value) {
$HRAccessData = $db2->table('hr_access_control hr')
->where('hr.pre_client_id',$value['client_id'])
->where('hr.pre_branch_id', $value['client_branch_id'])
->where('hr.pre_hr_id', $value['id'])
->get()->getRowArray();
if (!empty($HRAccessData) && isset($HRAccessData['allowed_modules'])) {
$decoded = json_decode($HRAccessData['allowed_modules'], true);
$getAllhrData[$key]['allowed_modules'] = $decoded;
$token = JWTToken::encode($HRAccessData);
$getAllhrData[$key]['token'] = $token;
} else {
$getAllhrData[$key]['allowed_modules'] = [];
$getAllhrData[$key]['token'] = "";
}
}
// Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData');
return $this->respond(['status' => 'success','code' => 200,'data' => $getAllhrData , 'post_enrollment'=> json_decode($apiResponse, true)],200);
}else {
// Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData');
return $this->respond(['status' => 'failed','code' => 404,'data' => "" , 'post_enrollment'=> json_decode($apiResponse, true)],200);
}
} else {
// Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData');
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" , 'post_enrollment'=> json_decode($apiResponse, true)],200);
return $this->respond(['status' => 'failed','code' => 404,'data' => "" , 'post_enrollment'=> json_decode($apiResponse, true)],200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
@ -761,7 +843,7 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => $th],500);
}
}
@ -870,7 +952,7 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - Exception: " . $th->getMessage() . " --- Line: " . $th->getLine() . " --- Trace: " . $th->getTraceAsString());
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => $th],500);
}
}
@ -896,7 +978,7 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyMpin: No employee data found both PRE and POST");
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200);
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => ""], 200);
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyMpin: empdata = " . json_encode($empdata));
@ -979,10 +1061,10 @@ class RestAuthenticationController extends AdminController
// Call the third-party API function
$apiResponse = $this->callThirdPartyAPI($requestData, 'verifyMpin');
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "Invalid OTP", 'post_enrollment' => json_decode($apiResponse, true)], 200);
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => "", 'post_enrollment' => json_decode($apiResponse, true)], 200);
//$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'/getVerifiedUserData');
// return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP", 'post_enrollment'=> json_decode($apiResponse, true)],200);
// return $this->respond(['status' => 'failed','code' => 404,'data' => "", 'post_enrollment'=> json_decode($apiResponse, true)],200);
}
@ -990,7 +1072,7 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString());
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => "", 'message' => $e->getMessage()], 500);
return $this->respond(['status' => 'failed', 'code' => 200, 'post_enrollment' => json_decode($apiResponse, true)], 200);
}
}
@ -1068,7 +1150,7 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - checkMpin: Mpin - Exist");
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'success','code' => 200,'data' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"], 'is_mpin_skipped' => $employeeData['is_mpin_skipped'], 'is_biometric_enabled' => $employeeData['is_biometric_enabled']],200);
return $this->respond(['status' => 'success','code' => 200,'data' => "", 'message' => "Mpin - exist" , 'Mpin' =>$employeeData["mpin"], 'is_mpin_skipped' => $employeeData['is_mpin_skipped'], 'is_biometric_enabled' => $employeeData['is_biometric_enabled']],200);
} else {
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - checkMpin: Mpin - not found in PRE so call the thirdpartapi to the POST to check the MPIN");
log_message('error', ' ');
@ -1081,7 +1163,7 @@ class RestAuthenticationController extends AdminController
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - Exception: " . $e->getMessage() . " --- Line: " . $e->getLine() . " --- Trace: " . $e->getTraceAsString());
log_message('error', ' ');
log_message('error', '************************ PRE END ********************************');
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
return $this->respond(['status' => 'failed','code' => 500,'data' => "", 'message' => $e->getMessage()],500);
}
}

View File

@ -285,6 +285,10 @@ class RestAuthHelper
->where('EP.is_active', 1)
->whereIn('EP.status', ['draft', 'enrolled']);
if (!empty($otp)) {
$builder->where('employees.otp', $otp);
}
if (!empty($old_mpin)) {
$builder->where('employees.mpin', $old_mpin);
}

View File

@ -875,7 +875,7 @@ class sendMailNotification
// $client_id = $params['client_id'];
// $client_policy_id = $params['client_policy_id'];
// $common = $params['common'];
data: name: name:
// data: name: name:
// $clientModel = new ClientModel();
// $clientPolicyModel = new ClientPolicyModel();
// $PolicyPremium1Model = new PolicyPremium1Model();

View File

@ -0,0 +1,44 @@
<?php
use CodeIgniter\Database\BaseConnection;
if (!function_exists('sendOtpSms')) {
function sendOtpSms(string $mobile, string $otp)
{
$apiKey = env('SMS_API_KEY');
$senderId = env('SMS_SENDER_ID');
$templateId = env('SMS_TEMPLATE_ID');
$serviceName = env('SMS_SERVICE_NAME');
$appName = env('SMS_APP_NAME');
// Replace variables {#var#}
$message = "Hi, Your One Time Code for logging into Nhance {$appName} App is {$otp}. Valid for 3 minutes. Please do not share this with anyone. -NHANCE";
log_message('info' , 'SMS - Message '.$message);
// Build the API URL
$url = "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?" . http_build_query([
'APIKEY' => $apiKey,
'MobileNo' => $mobile,
'SenderID' => $senderId,
'Message' => $message,
'ServiceName' => $serviceName,
'DLTTemplateID' => $templateId,
]);
// Send request
$response = @file_get_contents($url);
log_message('info' , 'SMS - Response '.$response);
// If response failed
if ($response === FALSE) {
return ['status' => 'failed', 'message' => 'Failed to send SMS.'];
}
return ['status' => 'success', 'message' => 'OTP sent successfully', 'api_response' => $response];
}
}

View File

@ -25,6 +25,7 @@ class ClientBranchModel extends Model
"gst",
"sez",
"units",
"post_branch_id"
];
public function getBranchAndContactByBranchId($branch_id){

View File

@ -105,13 +105,21 @@ class ClientModel extends Model
}
public function getCreatedByUserName(){
public function getCreatedByUserName($client_type = null){
return $this->db->table('clients')
// return $this->db->table('clients')
// ->select('clients.*')
// ->where('is_active', 1)
// ->get()
// ->getResult();
$query = $this->db->table('clients')
->select('clients.*')
->where('is_active', 1)
->get()
->getResult();
->where('clients.is_active', 1);
if (!empty($client_type)) {
$query->where('clients.client_type', $client_type);
}
$data = $query->get()->getResult();
return $data;
}
@ -206,5 +214,19 @@ class ClientModel extends Model
return $result;
}
public function isDuplicateByClientBranch($value, $field, $clientId, $branchId)
{
$builder = $this->db->table('level_contacts lc')
->select('lc.id')
->join('client_branch cb', 'lc.ref_id = cb.id', 'left')
->where('lc.'.$field, $value)
->where('lc.contact_type', 'client')
->where('cb.client_id', $clientId)
->where('lc.ref_id', $branchId)
->get();
return $builder->getNumRows() > 0 ? true : false;
}
}

View File

@ -91,13 +91,14 @@ input:checked + .slider:before {
<div class="form-group col-md-6">
<label for="client_name">Client Name<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="client_name"
<input type="text" class="form-control" id="client_name" data-old-name="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>"
placeholder="Enter Client Name" value="<?= isset($client['client_name']) ? $client['client_name'] : '' ?>" name="client_name" required>
</div>
<div class="form-group col-md-6">
<label for="short_name">Client Short Name<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="short_name"
data-old-short="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>"
placeholder="Enter Short Name" value="<?= isset($client['short_name']) ? $client['short_name'] : '' ?>" name="short_name" onkeyup="validateInput(this, 'clients', 'short_name', 'clientBtnSubmit')" required>
</div>
</div>

View File

@ -70,6 +70,12 @@
<div class="row" id="add_branch">
<div class="col-12">
<div class="card-body">
<div class="row float-left" style="position: relative; bottom: 20px; left: 13px;">
<button type="button" id="btnAutoBranchFetch"
class="btn btn-primary waves-effect waves-light btn-sm "> Fetch Client Branch (Post-Enrolment)</button>
</div>
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
<button type="button" id="btnBranchBack"
class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="fa fa-list"
@ -79,10 +85,26 @@
<hr>
<form role="form" class="parsley-examples" method="post" id="branch_form" enctype="multipart/form-data">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<!-- pre_client_id as client_id -->
<input type="hidden" name="client_id" id="client_id_branch"
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
<!-- post_branch_id -->
<input type="hidden" name="post_branch_id" id="post_branch_id"
value="<?= isset($post_branch_id) ? $post_branch_id : '' ?>" />
<!-- pre_branch_id as branch_id_primarykey -->
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
@ -185,12 +207,12 @@
<div class="form-group col-md-6">
<label for="last_name">Email<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Contact Email"
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateDuplicateByClientBranch(this, 'email','branchBtnSubmit')" required>
</div>
<div class="form-group col-md-6">
<label for="mobile">Mobile<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Contact Mobile"
name="mobile[]" id="mobile" onkeyup="validateInput(this, 'level_contacts', 'mobile', 'branchBtnSubmit')"
name="mobile[]" id="mobile" onchange="validateDuplicateByClientBranch(this, 'mobile', 'branchBtnSubmit')"
onkeypress="return onlyNumbers(event)" maxlength="10" minlength="10"
data-parsley-type-message="Please enter a valid 10-digit mobile number."
data-parsley-required-message="Please enter a valid 10-digit mobile number."
@ -290,7 +312,10 @@ $('#btnBranchAdd').click(function() {
$('#district').val('');
$('#branch_city').val('');
$('#branch_form')[0].reset();
$('#branch_form').parsley().reset();
$('.ac').css('display', 'block');
$('#post_branch_id').val('');
$('#branch_id_primarykey').val('');
contactCount = 1
var addButton = document.getElementById('add');
@ -354,6 +379,8 @@ $("#branch_form").submit(function(event) {
var selectedValues = $("#selected").val();
console.log(selectedValues, selectedValues);
console.log("branch_id_primarykey", $('#branch_id_primarykey').val());
let level_contect_data = getContactsData();
console.log('level_contect_data', level_contect_data);
@ -361,7 +388,7 @@ $("#branch_form").submit(function(event) {
event.preventDefault();
branch_PrimaryKey = $('#client_id_branch').val();
console.log('branch_PrimaryKey', branch_PrimaryKey)
console.log('branch_PrimaryKey', branch_PrimaryKey);
if (branch_PrimaryKey === '') {
toastr.error('Client is required', 'Error');
@ -380,6 +407,7 @@ $("#branch_form").submit(function(event) {
var formData = new FormData($('#branch_form')[0]);
const jsonString = JSON.stringify(selectedValues);
const level_contect_data_json_string = JSON.stringify(level_contect_data);
console.log('jsonString', jsonString);
@ -470,6 +498,10 @@ $("#branch_form").submit(function(event) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.log('Something Wrong!', 'warning');
if(xhr.status === 409){
alert('The Current Branch is Already Existing..!!');
}
}, 300);
}
});
@ -622,11 +654,11 @@ function appendContactHtml(contact = false, reset = false) {
<div class="form-row">
<div class="form-group col-md-6">
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
<input value="${contact !== undefined && contact !== false ? contact.email : ''}" type="text" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" data-parsley-trigger="change" data-parsley-type="email" onchange="validateDuplicateByClientBranch(this, 'email','branchBtnSubmit')" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onkeyup="validateInput(this, 'level_contacts', 'mobile', 'branchBtnSubmit')" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
<input value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="text" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" onchange="validateDuplicateByClientBranch(this, 'mobile', 'branchBtnSubmit')" onkeypress = "return onlyNumbers(event)" maxlength="10" min="10" data-parsley-type-message="Please enter a valid 10-digit mobile number." data-parsley-required-message="Please enter a valid 10-digit mobile number." required>
</div>
</div>
<div class="form-group" style="display: flex;">
@ -829,6 +861,71 @@ function checkMobileNumber(input) {
}
let shortNameTimer;
$("#client_name").on("input change keyup", function() {
clearTimeout(shortNameTimer); // cancel previous call
shortNameTimer = setTimeout(() => {
generateShortName(); // only runs after 200ms pause
}, 200); // adjust debounce delay as needed
});
function generateShortName() {
let clientInput = $("#client_name");
let shortInput = $("#short_name");
let oldClientName = clientInput.data("old-name"); // from DB
let oldShortName = shortInput.data("old-short"); // from DB
let newClientName = clientInput.val().trim();
console.log(`LN 866 : NEW - ${newClientName} | OLD - ${oldClientName} | OLD SN - ${oldShortName}`);
if (newClientName.toUpperCase() === (oldClientName || '').toUpperCase()) {
shortInput.val(oldShortName);
return;
}
if (newClientName.length == 0) {
shortInput.val('');
return;
}
if (newClientName.length > 0) {
let shortName = newClientName.substring(0, 10).replace(/\s+/g, '').toUpperCase();
shortInput.val(shortName);
makeUniqueShortName(shortName);
}
}
function makeUniqueShortName(baseName) {
let input = $("#short_name")[0]; // input element
checkDuplicateTableFieldValue("clients", "short_name", baseName, function(isDuplicate) {
if (isDuplicate) {
// Append sequence until unique
let counter = 1;
function tryNext() {
let padded = String(counter).padStart(3, '0'); // 001, 002, 003
let newName = baseName + padded;
checkDuplicateTableFieldValue("clients", "short_name", newName, function(exists) {
if (exists) {
counter++;
tryNext(); // keep checking
} else {
$("#short_name").val(newName);
validateInput(input, "clients", "short_name", "clientBtnSubmit");
}
});
}
tryNext();
} else {
$("#short_name").val(baseName);
validateInput(input, "clients", "short_name", "clientBtnSubmit");
}
});
}
function validateInput(input, table, field, submitBtnId){
let value = $(input).val();
@ -851,6 +948,66 @@ function validateInput(input, table, field, submitBtnId){
}
function validateDuplicateByClientBranch(input, field, submitButId) {
let value = $(input).val().trim();
let clientId = $('#client_id_branch').val();
let branchId = $('#branch_id_primarykey').val();
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
let message = label ? label + " is duplicate!" : "Value is duplicate!";
console.log(`cId: ${clientId} | bId: ${branchId}`);
// Don't forgot be careful
// 1 Local duplication check (User entered)
let isLocalDuplicate = false;
$('input[name="' + field + '[]"]').each(function(index) {
console.log(`Entered value: ${value} | Contact ${index+1} value: ${$(this).val()}`);
if (this !== input && $(this).val().trim() === value) {
isLocalDuplicate = true;
return false; // break loop
}
});
if (isLocalDuplicate) {
console.log(`r u n Local`);
console.log(`btn Dis - true`);
toastr.warning(message, 'WARNING');
$('#' + submitButId).prop('disabled', true);
return; // dont call server if duplicate in UI
}
// Don't forgot be careful
// 2 Server-side duplicate check (DB)
if (!isLocalDuplicate && value !== '') {
$.ajax({
url: '<?= base_url("client/others/check-duplicate") ?>',
type: 'POST',
data: {
client_id: clientId,
branch_id: branchId,
value: value,
field: field
},
dataType: 'json',
success: function(response) {
if (response.isDuplicate) {
console.log(`r u n Server`);
console.log(`btn Dis - true`);
toastr.warning(message, 'WARNING');
$('#' + submitButId).prop('disabled', true);
} else {
console.log(`btn Dis - false`);
$('#' + submitButId).prop('disabled', false);
}
},
error: function(xhr, status, error) {
console.error('AJAX Error:', error);
}
});
}
}
function getContactsData() {
const contacts = [];

View File

@ -81,7 +81,8 @@
<?php $account_managers .= $client->account_manager . ', '; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php echo rtrim($account_managers, ', '); ?>
<?php $account_managers = rtrim($account_managers, ', ');
echo $account_managers !== '' ? $account_managers : 'N/A'; ?>
</td>
<td>
<div class="btn-group dropdown">
@ -261,9 +262,9 @@
$(document).ready(function(){
$('#lead_id').select2();
})
var table;
$(document).ready(function(){
$('#tickets-table').DataTable({
table = $('#tickets-table').DataTable({
dom: "<'row'<'col-sm-0'f><'col-sm-7 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
@ -271,6 +272,11 @@
extend: 'csv',
text: 'CSV',
title: 'ClientList',
// title: function() {
// return $('#toggleButtons').is(':checked')
// ? 'GC-Client-List'
// : 'RC-Client-List';
// },
className: 'my_class',
exportOptions: {
columns: ':not(:last-child)'
@ -278,13 +284,91 @@
}],
language: {
search: "_INPUT_",
searchPlaceholder: "Search..."
searchPlaceholder: "Search...",
emptyTable: '<div class="text-center text-muted">No Data found</div>'
},
paging: true ,
// pagingType: 'full_numbers'
});
})
$(".dt-buttons").prepend(`
<span id="statusSwitchWrapper" class="dt-switch-wrapper">
<span class="custom-switch mr-2" style="text-align: left;">
<input type="checkbox" class="custom-control-input" id="toggleButtons" checked>
<label class="custom-control-label" for="toggleButtons" style="vertical-align: sub !important;">Group Client</label>
</span>
</span>
`);
$('#toggleButtons').on('change', function() {
let type = $(this).is(':checked') ? 1 : 2;
// $('div.col-6 h4').text(
// $(this).is(':checked')
// ? "GC Client List"
// : "RC Client List"
// );
let url = '<?= base_url('client/typeList/') ?>' + type;
$.ajax({
url: url,
method: 'GET',
success: function(response) {
if (response.status === "success" && Array.isArray(response.data)) {
renderRows(response.data);
} else {
renderRows([]);
}
},
error: function(xhr, status, error) {
console.error("Error loading:", error);
renderRows([]);
}
});
});
});
function renderRows(data) {
table.clear();
if (Array.isArray(data) && data.length) {
data.forEach((row, index) => {
let clientrm = <?= json_encode($client_rm) ?>;
let account_managers = "";
clientrm.forEach(client => {
if (client.client_id == row.id) {
account_managers += client.account_manager + ", ";
}
});
account_managers = account_managers.replace(/,\s*$/, "");
if (account_managers === "") account_managers = "N/A";
let rowData = [
`<span> ${row.client_name} (${row.short_name})</span>`,
account_managers,
`<div class="btn-group dropdown">
<a href="javascript:void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false">
<i class="mdi mdi-dots-horizontal"></i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="<?= base_url("client/list/") ?>${row.id}">
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
</a>
<?php if(in_array(get_role_id(), [1, 5])) { ?>
<a class="dropdown-item" data-id="${row.id}" onclick="removeClient(this)">
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
</a>
<?php } ?>
</div>
</div>`
];
let newRow = table.row.add(rowData);
$(newRow.node()).find('td:eq(0)').addClass('client_info').attr('data-id', row.id);
});
}
table.draw();
}
//DO NOT REMOVE THIS FUNCTION >>> THI FUNCTION FOR CLIENT SOFT DELETE
// function removeClient(element)
// {

View File

@ -110,6 +110,57 @@ body {
</div>
<div class="modal fade" id="autoFetchBranchModal" tabindex="-1" role="dialog" aria-labelledby="autoFetchBranchModalLabel" accesskey=""
aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" style="margin-left: 400px !important;">
<div class="modal-content modal-lg">
<div class="modal-header">
<h5 class="modal-title" id="autoFetchBranchModalLabel">Fetch Client Branch (Post-Enrolment)</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body" style="min-height:auto !important;">
<div class="row">
<div class="col-md-6">
<div class="form-group col-md-12">
<label for="auto_fetch_client">Client List<span class="text-danger">*</span></label>
<select class="form-control select2" id="auto_fetch_client" name="auto_fetch_client" required>
<option value="">Select Client</option>
<?php if (!empty($auto_fetch_client_list)): ?>
<?php foreach ($auto_fetch_client_list as $client_list): ?>
<option value="<?= esc($client_list['id']) ?>">
<?= esc($client_list['client_name']) ?>
</option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group col-md-12">
<label for="auto_fetch_branch">Branch List<span class="text-danger">*</span></label>
<select class="form-control select2" id="auto_fetch_branch" name="auto_fetch_branch" required>
<option value="">Select Branch</option>
</select>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn cancel-btn" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary submit-btn" id="submitAutoFetch">Submit</button>
</div>
</div>
</div>
</div>
</div>
<script>
// $(document).ready(function(){
@ -250,3 +301,149 @@ body {
</script>
<script>
$('#btnAutoBranchFetch').click(function() {
var myModal = new bootstrap.Modal(document.getElementById('autoFetchBranchModal'));
myModal.show();
})
</script>
<script>
$(document).ready(function() {
$('#auto_fetch_client').select2();
$('#auto_fetch_branch').select2();
$('#auto_fetch_client').change(function() {
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: "<?php echo base_url('client/branch/auto_fetch_branch'); ?>",
type: "POST",
data: {
client_id: $('#auto_fetch_client').val()
},
dataType: "json",
success: function(response, textStatus, xhr) {
if (xhr.status === 200) {
let options = `<option value="">Select Branch</option>`;
response.data.forEach((data) => {
options += `<option value="${data.id}">${data.branch_name}</option>`;
});
$('#auto_fetch_branch').html(options);
} else {
$('#auto_fetch_branch').html('<option value="">No Branch Found</option>');
}
},
error: function(xhr, status, error) {
console.error("Error occurred:", status, error);
},
complete: function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.log("auto_fetch_client call is completed..!!");
}
});
});
});
</script>
<script>
$('#submitAutoFetch').click(function() {
let client_id = $('#auto_fetch_client').val();
let branch_id = $('#auto_fetch_branch').val();
if (client_id == "" || branch_id == "") {
Swal.fire({
icon: 'warning',
title: 'Missing Data',
text: 'Please select both Client and its Branch!',
confirmButtonText: 'OK'
});
return;
}
$.ajax({
url: "<?php echo base_url('client/branch/auto_fetch_branch_details'); ?>",
type: "POST",
data: {
client_id,
branch_id
},
dataType: "json",
success: function(response, textStatus, xhr) {
if (xhr.status === 200) {
let result = response.data[0]??[];
if(response.data[0] == []){
console.log("Empty array ..!!!");
return;
}
let units = JSON.parse(result['units']);
let $select = $('#selected');
$select.empty();
units.forEach(unit => {
// If you want to mark them as selected, set 'selected' attribute
$select.append(`<option value="${unit}" selected>${unit}</option>`);
});
$('#post_branch_id').val(branch_id);
$('#branch_name').val(result['branch_name']??'');
$('#branch_code').val(result['branch_code']??'');
$('#address1').val(result['address1']??'');
$('#address2').val(result['address2']??'');
$('#state').val(result['state']??'');
$('#district').val(result['district']??'');
$('#branch_city').val(result['city']??'');
$('#pincode').val(result['pincode']??'');
$('#gst').val(result['gst']??'');
$('#sez').val(result['sez']??'');
} else {
console.log("User Error thrown");
console.log("status" + xhr.status);
}
closeModalById('autoFetchBranchModal');
},
error: function(xhr, status, error) {
console.error("Error occurred:", status, error);
},
complete: function() {
console.log("auto_fetch_branch_details call is completed..!!");
}
})
})
</script>

View File

@ -314,17 +314,18 @@
var client_id = $('#clients').val();
var branch_id = $('#branch_id').val();
if (client_id == '0' || branch_id == '0') {
var client_policy_id = $('#client_policy_id').val();
if (client_id == '0' || branch_id == '0' || client_policy_id == '0') {
Swal.fire({
title: "warning!",
text: 'Please select the Client and Client Branch.',
text: 'Please select the Client, Client Branch and Client Policy.',
icon: "warning"
});
return false;
}
$.ajax({
url: '<?php echo base_url(); ?>' + '/employee/empby_client_clientbranch/' + client_id + '/' + branch_id,
url: '<?php echo base_url(); ?>' + '/employee/empby_client_clientbranch/' + client_id + '/' + branch_id + '/' + client_policy_id,
method: 'GET',
headers: {
"Content-Type": "application/json",
@ -359,7 +360,7 @@
var loggedIn_count = 0;
data.forEach(function(employee, index) {
if(employee.emp_status !== 'draft'){
if(employee.emp_status === 'enrolled'){
var enrolled = 'Yes';
enrolled_count++;
}else{
@ -369,8 +370,13 @@
if(employee.user_type === 'employee'){
var loggedIn = 'Yes';
loggedIn_count++;
}else{
var loggedIn = 'No';
}else{
if (employee.relationship && employee.relationship.toLowerCase() === "self") {
var loggedIn = 'No';
}else{
var loggedIn = '-';
}
}
table.row.add([
@ -485,6 +491,8 @@
$('#emp_enrolled_view_click').on('click', function() {
console.log($(this).hasClass('click_hover'));
if ($(this).hasClass('click_hover')) {
// $(this).removeClass('click_hover');
$('.click_hover').each(function() {
@ -496,7 +504,7 @@
$(this).removeClass('click_hover');
});
$('#emp_enrolled_view_click').addClass('click_hover');
filterTable(3, 'Yes'); // Filter "Enrolled" column (4th column, index 3)
filterTable(4, 'Yes'); // Filter "Enrolled" column (4th column, index 3)
}
});
@ -512,7 +520,7 @@
$(this).removeClass('click_hover');
});
$('#emp_not_enrolled_view_click').addClass('click_hover');
filterTable(3, 'No'); // Filter "Enrolled" column (4th column, index 3)
filterTable(4, 'No'); // Filter "Enrolled" column (4th column, index 3)
}
});
@ -528,7 +536,7 @@
$(this).removeClass('click_hover');
});
$('#emp_logged_in_view_click').addClass('click_hover');
filterTable(4, 'Yes'); // Filter "Logged-In" column (5th column, index 4)
filterTable(5, 'Yes'); // Filter "Logged-In" column (5th column, index 4)
}
});
@ -544,7 +552,7 @@
$(this).removeClass('click_hover');
});
$('#emp_not_logged_in_view_click').addClass('click_hover');
filterTable(4, 'No'); // Filter "Logged-In" column (5th column, index 4)
filterTable(5, 'No'); // Filter "Logged-In" column (5th column, index 4)
}
});
@ -738,7 +746,6 @@
});
});
function sendManualReminder(input)
{
console.log('sendManualReminder function called');
@ -779,44 +786,45 @@
return false;
}
Swal.fire({
title: "Do you want to send reminder mail?",
showDenyButton: true,
showCancelButton: false,
confirmButtonText: "Yes,Send",
denyButtonText: "Don't Send"
}).then((result) => {
Swal.fire({
title: "Do you want to send reminder mail?",
showDenyButton: true,
showCancelButton: false,
confirmButtonText: "Yes,Send",
denyButtonText: "Don't Send"
}).then((result) => {
if (result.isConfirmed) {
if (result.isConfirmed) {
$.ajax({
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id + '/' + client_policy_id,
type: "GET",
dataType: 'json',
success: function(res) {
$.ajax({
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id + '/' + client_policy_id,
type: "GET",
dataType: 'json',
success: function(res) {
console.log('send_manual_reminder', res)
console.log('send_manual_reminder', res)
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if(res.status == false){
toastr.info(res.message, 'INFO');
}else{
toastr.success(res.message, 'SUCCESS');
if(res.status == false){
toastr.info(res.message, 'INFO');
}else{
toastr.success(res.message, 'SUCCESS');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
// Swal.fire("Saved!", "", "success");
}
});
});
// Swal.fire("Saved!", "", "success");
}
});
}
</script>

View File

@ -932,6 +932,29 @@ function confirmActionSweertAlert(message = "Are you sure?", confirmText = "Yes,
</script>
<script>
function closeModalById(modalId) {
// Get the modal element
var modal = document.getElementById(modalId);
if (!modal) return; // Exit if no modal found
// Hide it by removing "show" or "in" classes and setting display:none
modal.style.display = 'none';
modal.classList.remove('in', 'show'); // 'in' for BS3, 'show' for BS4/5
modal.setAttribute('aria-hidden', 'true');
modal.removeAttribute('aria-modal'); // optional
modal.removeAttribute('role'); // optional
// Remove backdrop if present
var backdrop = document.querySelector('.modal-backdrop');
if (backdrop) backdrop.remove();
// Allow page scrolling again
document.body.classList.remove('modal-open');
}
</script>
</body>
</html>

View File

@ -329,84 +329,8 @@
});
</script>
<style>
#side-menu .menu-logo a:hover {
background-color: transparent !important;
color: inherit !important;
text-decoration: none !important;
box-shadow: none !important;
}
#side-menu .menu-logo img {
height: 24px ;
display: inline-block ;
}
.ul-flex{
display:flex;
flex-flow: column nowrap;
justify-content: center;
align-content: space-evenly;
}
.top-navbar-div{
display:flex;
flex-flow:row nowrap;
justify-content:space-between;
}
.nav-flex{
display:flex;
flex-flow: row nowrap;
justify-content:end;
margin-right:20px;
}
.card-body{
background-color:white;
padding-left:50px !important;
margin-top: 5px;
}
.content-page{
background-color: white !important;
color:white !important;
padding: 0px !important;
}
.footer{
background-color:white !important;
color:black;
margin: 30px !important;
}
html{
background-color: white !important;
}
.footer{
margin-left:150px;
}
.left-side-menu{
margin-left:30px;
margin-top:20px;
margin-bottom:5px;
border-radius:25px;
background-color:#D4F5F6;
z-index:700;
padding:0px !important;
height:90%;
}
label{
color:#000;
}
</style>
</head>
<body class="loading" data-layout-mode="" data-layout='{"mode": "light", "width": "fluid", "menuPosition": "fixed", "sidebar": { "color": "light", "size": "condensed", "showuser": false}, "topbar": {"color": "dark"}, "showRightSidebarOnPageLoad": false}'></body>
@ -420,24 +344,219 @@
<!-- <img src="<?= base_url() . "public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading..."> -->
<!-- Begin page -->
<div id="wrapper" style="background-color:white;">
<div id="wrapper">
<!-- Topbar Start -->
<div class="navbar-custom">
<div class="container-fluid">
<ul class="list-unstyled topnav-menu float-right mb-0">
<!-- <li class="d-none d-lg-block">
<form class="app-search">
<div class="app-search-box dropdown">
<div class="input-group">
<input type="search" class="form-control" placeholder="Search..." id="top-search">
<div class="input-group-append">
<button class="btn" type="submit">
<i class="fe-search"></i>
</button>
</div>
</div> -->
<!-- <div class="dropdown-menu dropdown-lg" id="search-dropdown">
<div class="dropdown-header noti-title">
<h5 class="text-overflow mb-2">Found <span class="text-danger">09</span> results</h5>
</div>
<a href="javascript:void(0);" class="dropdown-item notify-item">
<i class="fe-home mr-1"></i>
<span>Analytics Report</span>
</a>
<a href="javascript:void(0);" class="dropdown-item notify-item">
<i class="fe-aperture mr-1"></i>
<span>How can I help you?</span>
</a>
<a href="javascript:void(0);" class="dropdown-item notify-item">
<i class="fe-settings mr-1"></i>
<span>User profile settings</span>
</a>
<div class="dropdown-header noti-title">
<h6 class="text-overflow mb-2 text-uppercase">Users</h6>
</div>
<div class="notification-list">
<a href="javascript:void(0);" class="dropdown-item notify-item">
<div class="media">
<img class="d-flex mr-2 rounded-circle" src="<?= base_url() . "public"; ?>/assets/images/users/avatar-2.jpg" alt="Generic placeholder image" height="32">
<div class="media-body">
<h5 class="m-0 font-14">Erwin E. Brown</h5>
<span class="font-12 mb-0">UI Designer</span>
</div>
</div>
</a>
<a href="javascript:void(0);" class="dropdown-item notify-item">
<div class="media">
<img class="d-flex mr-2 rounded-circle" src="<?= base_url() . "public"; ?>/assets/images/users/avatar-5.jpg" alt="Generic placeholder image" height="32">
<div class="media-body">
<h5 class="m-0 font-14">Jacob Deo</h5>
<span class="font-12 mb-0">Developer</span>
</div>
</div>
</a>
</div>
</div> -->
<!-- </div>
</form>
</li> -->
<!-- <li class="dropdown notification-list topbar-dropdown">
<a class="nav-link dropdown-toggle right-bar-toggle waves-effect waves-light">
<i class="fe-bell noti-icon"></i>
<span class="badge badge-danger rounded-circle noti-icon-badge" id="notification_count">0</span>
</a>
</li> -->
<li class="dropdown notification-list topbar-dropdown">
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<img src="<?php echo (get_userProfile() != null && !empty(get_userProfile())) ? get_userProfile() : base_url() . 'public/assets/images/avatar_2x.png'; ?>" alt="user-image" class="rounded-circle">
<span class="pro-user-name ml-1" style="font-size: 16px;">
<?= (isset(get_session_userdata()->first_name) ? get_session_userdata()->first_name : 'NOT SET') ?>
<!-- <i class="mdi mdi-chevron-down"></i> -->
</span>
</a>
<!--<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
<div class="dropdown-header noti-title">
<h6 class="text-overflow m-0">Welcome !</h6>
</div>
<a href="javascript:void(0);" class="dropdown-item notify-item">
<i class="ri-account-circle-line"></i>
<span>My Account</span>
</a>
<a href="javascript:void(0);" class="dropdown-item notify-item">
<i class="ri-settings-3-line"></i>
<span>Settings</span>
</a>
<a href="javascript:void(0);" class="dropdown-item notify-item">
<i class="ri-wallet-line"></i>
<span>My Wallet <span class="badge badge-success float-right">3</span> </span>
</a>
<a href="javascript:void(0);" class="dropdown-item notify-item">
<i class="ri-lock-line"></i>
<span>Lock Screen</span>
</a>
<a href="<?= base_url('/logout'); ?>" class="dropdown-item notify-item">
<i class="ri-logout-box-line"></i>
<span>Logout</span>
</a>
</div>
<!-- </li> -->
<!-- <li class="dropdown notification-list">
<a href="javascript:void(0);" class="nav-link right-bar-toggle waves-effect waves-light">
<i class="fe-settings noti-icon"></i>
</a>
</li> -->
<li class="dropdown notification-list">
<a href="<?= base_url('/logout'); ?>" class="nav-link waves-effect waves-light">
<i class="ri-logout-box-r-line" style="font-size: 25px;"></i>
</a>
</li>
</ul>
<!-- LOGO -->
<div class="logo-box">
<a href="https://localhost/nhance-enrollment/dashboard/view" class="logo logo-dark text-center">
<span class="logo-sm">
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="24">
<!-- <span class="logo-lg-text-light">NHANCE</span> -->
</span>
<span class="logo-lg">
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="20">
<!-- <span class="logo-lg-text-light">M</span> -->
</span>
</a>
<a href="https://localhost/nhance-enrollment/dashboard/view" class="logo logo-light text-center">
<span class="logo-sm">
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg" alt="" height="24">
</span>
<!-- <span class="logo-lg">
<img src="<?= base_url() . "public"; ?>/assets/images/logo-light.png" alt="" height="20">
</span> -->
</a>
</div>
<ul class="list-unstyled topnav-menu topnav-menu-left m-0">
<li>
<button class="button-menu-mobile waves-effect waves-light">
<i class="fe-menu"></i>
</button>
</li>
<li>
<!-- Mobile menu toggle (Horizontal Layout)-->
<a class="navbar-toggle nav-link" data-toggle="collapse" data-target="#topnav-menu-content">
<div class="lines">
<span></span>
<span></span>
<span></span>
</div>
</a>
<!-- End mobile menu toggle-->
</li>
</ul>
<div class="clearfix"></div>
</div>
</div>
<!-- end Topbar -->
<!-- ========== Left Sidebar Start ========== -->
<div class="left-side-menu">
<!-- LOGO -->
<div class="logo-box">
<a href="<?= base_url('/dashboard/view') ?>" class="logo logo-dark text-center">
<span class="logo-sm">
<img src="<?= base_url() . "public"; ?>/assets/images/logo-sm-dark.png" alt="" height="24">
<!-- <span class="logo-lg-text-light">nHance</span> -->
</span>
<span class="logo-lg">
<img src="<?= base_url() . "public"; ?>/assets/images/logo-dark.png" alt="" height="20">
<!-- <span class="logo-lg-text-light">N</span> -->
</span>
</a>
<a href="<?= base_url('/dashboard/view') ?>" class="logo logo-light text-center">
<span class="logo-sm">
<img src="<?= base_url() . "public"; ?>/assets/images/nhance_white_logo.svg" alt="" width="130" height="30">
</span>
<!-- <span class="logo-lg">
<img src="<?= base_url() . "public"; ?>./assets/images/logo-light.png" alt="" height="20">
</span> -->
</a>
</div>
<div class="h-100" data-simplebar>
<!--- Sidemenu -->
<div id="sidebar-menu">
<ul class="ul-flex" id="side-menu">
<li class="menu-logo" >
<a href="<?= base_url('/dashboard/view') ?>">
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.png" alt="Logo" height="24">
</a>
</li>
<ul id="side-menu">
<li>
<a href="<?= base_url('/dashboard/view') ?>">
@ -448,16 +567,15 @@
<li>
<a href="<?= base_url('/client/list') ?>">
<img
src="<?= base_url() . "public"; ?>/assets/images/clients_sb.png" alt="Logo" height="24">
<span>Clients</span>
<i class="mdi mdi-domain"></i>
<span> Clients </span>
</a>
</li>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<img
src="<?= base_url() . "public"; ?>/assets/images/action_on_policies_sb.png" alt="Logo" height="20">
<i class="fas fa-user-tie"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Action on Policies </span>
</a>
<div class="collapse" id="sidebarDashboards">
@ -486,8 +604,8 @@
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<img
src="<?= base_url() . "public"; ?>/assets/images/masters_sb.png" alt="Logo" height="20">
<i class="ri-database-2-line"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Masters </span>
</a>
<div class="collapse" id="sidebarDashboards">
@ -630,31 +748,6 @@
</div>
<!-- Left Sidebar End -->
<!-- Top Bar -->
<div class="top-navbar-div" style="margin-left:150px; margin-top:20px;" >
<div>
<h5>Welcome <?= (isset(get_session_userdata()->first_name) ? get_session_userdata()->first_name : 'NOT SET') ?> </h5>
</div>
<div class="nav-flex">
<div>
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false"
>
<img
style="color: black;"
src="<?php echo (get_userProfile() != null && !empty(get_userProfile())) ? get_userProfile() : base_url() . 'public/assets/images/avatar_2x.png'; ?>" alt="user-image"
class="rounded-circle">
</a>
</div>
<div>
<a href="<?= base_url('/logout'); ?>" style="font-size: 16px; color:#000;background-color:#D4F5F6 !important;border-radius:25px;padding:7px;">
<i class="ri-logout-box-r-line" style="font-size: 20px; color:#000;padding:0px;"></i>
</a>
</div>
</div>
</div>
<!-- End of Top -->
<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
@ -663,4 +756,4 @@
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<div class="container-fluid"></div>

View File

@ -0,0 +1,666 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?= isset($page_name) ? $page_name : 'NHance'; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="" name="description" />
<meta content="NHANCE" name="NHANCE" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.svg">
<!-- plugin css -->
<link href="<?= base_url() . "public"; ?>/assets/libs/admin-resources/jquery.vectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" />
<!-- third party css -->
<link href="<?= base_url() . "public"; ?>/assets/libs/datatables.net-bs4/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<link href="<?= base_url() . "public"; ?>/assets/libs/datatables.net-responsive-bs4/css/responsive.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<link href="<?= base_url() . "public"; ?>/assets/libs/datatables.net-buttons-bs4/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<link href="<?= base_url() . "public"; ?>/assets/libs/datatables.net-select-bs4/css//select.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<!-- third party css end -->
<!-- App css -->
<link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-creative.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
<link href="<?= base_url() . "public"; ?>/assets/css/app-creative.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
<link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-creative-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
<link href="<?= base_url() . "public"; ?>/assets/css/app-creative-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<!-- icons -->
<link href="<?= base_url() . "public"; ?>/assets/css/icons.min.css" rel="stylesheet" type="text/css" />
<link href="<?= base_url() . "public"; ?>/assets/libs/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css" />
<link href="<?= base_url() . "public"; ?>/assets/libs/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet" type="text/css">
<link href="<?= base_url() . "public"; ?>/assets/libs/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet" type="text/css">
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-material.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" /> -->
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/app-material.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" /> -->
<!-- <link href="<?= base_url() . "public"; ?>/assets/css/bootstrap-editable.css" rel="stylesheet" type="text/css" /> -->
<link href="https://cdn.jsdelivr.net/npm/remixicon/fonts/remixicon.css" rel="stylesheet">
<!-- Jodit Css -->
<link href="<?= base_url() . "public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
<!-- JQuery CDN -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Sweet Alert CDN -->
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.10.4/dist/sweetalert2.all.min.js"></script>
<!-- select2 -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-beta.1/dist/css/select2.min.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
<link rel="manifest" href="../manifest.json">
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('../service-worker.js').then(function(registration) {
// console.log('Service Worker registration successful with scope:', registration.scope);
}, function(err) {
// console.log('Service Worker registration failed:', err);
});
});
}
</script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick-theme.min.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.min.js"></script>
<!-- srinivas -->
<script src="https://editor.unlayer.com/embed.js"></script>
<!-- <script src="<?= base_url('public/unlayer/js/embed.js') . '' ?>"></script> -->
<!-- srinivas -->
<style>
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
min-height: 0;
}
body[data-sidebar-size=condensed] .navbar-custom {
left: 155px !important;
}
body[data-sidebar-size=condensed] .logo-box {
width: 155px !important;
}
.navbar-custom {
top: -10px !important;
height: 61px !important;
}
.logo-box {
top: -10px !important;
height: 61px !important;
}
.content-page {
padding: 80px 15px 65px 15px !important;
}
/* Media query for small screens */
@media screen and (min-width: 768px) {
/* Styles for screens with a minimum width of 768px (e.g., tablets and larger devices) */
.navbar-custom .button-menu-mobile {
display: none;
/* Hide the button on larger screens */
}
}
.loader-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #00000069;
z-index: 99999;
}
.loader {
position: absolute;
left: 50%;
top: 50%;
width: 50px;
height: 50px;
font-size: 0;
color: #00c9d0;
display: inline-block;
margin: -25px 0 0 -25px;
text-indent: -9999em;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
}
.lead {
font-size: 13px;
}
.loader div {
background-color: #6ad9cf;
display: inline-block;
float: none;
position: absolute;
top: 0;
left: 0;
width: 50px;
height: 50px;
opacity: .5;
border-radius: 50%;
-webkit-animation: ballPulseDouble 2s ease-in-out infinite;
animation: ballPulseDouble 2s ease-in-out infinite;
}
.loader div:last-child {
-webkit-animation-delay: -1s;
animation-delay: -1s;
}
@-webkit-keyframes ballPulseDouble {
0%,
100% {
-webkit-transform: scale(0);
transform: scale(0);
}
50% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes ballPulseDouble {
0%,
100% {
-webkit-transform: scale(0);
transform: scale(0);
}
50% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
.toast-success {
background-color: #009688 !important;
color: #FFFFFF !important;
}
/* .dataTables_wrapper .text-right {
position: relative;
} */
.dataTables_wrapper .dt-buttons .buttons-csv,
.dataTables_wrapper .dt-buttons .buttons-html5 {
background-color: #02a8b5;
color: #fff;
border-color: #02a8b5;
}
.dataTables_wrapper .dt-buttons .buttons-csv:hover,
.dataTables_wrapper .dt-buttons .buttons-html5:hover {
background-color: #028291;
border-color: #028291;
}
.modal-full-width {
width: 80% !important;
/* width: 95% !important; */
/* max-width: none; */
}
.modal-body {
/* position: relative;
flex: 1 1 auto; */
padding: 2rem !important;
}
</style>
<style>
.text-danger-2 {
font-style: italic;
color: black !important;
/* color: #02a8b5 !important; */
font-size: 12px;
}
/* .form-group {
margin-bottom: -0.2rem !important;
}
.form-row{
width: 84%;
} */
</style>
<style>
.select2-container--default .select2-selection--single {
height: 37px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
top: 7px !important;
}
</style>
<style>
.toast-body {
padding: .75rem;
background: aliceblue !important;
}
#messages-list li {
margin-top: 0;
margin-bottom: -25px;
/* Adjust this value to reduce the space */
}
.toast-footer {
text-align: right;
color: #000;
border-top: 1px solid aliceblue;
margin-top: 11px;
margin-bottom: -6px;
}
.right-bar {
width: 300px;
/* Adjust as needed */
overflow: hidden;
}
.fixed-header {
position: relative;
top: 0;
z-index: 1000;
background-color: #f8f9fa !important;
}
.scrollable-content {
max-height: 42vh;
overflow-y: auto;
padding-top: 0px;
}
/* Additional styles to enhance appearance */
.header-title {
position: relative;
bottom: 5px;
left: 60px;
}
#app_content_management:hover {
color: red;
}
</style>
<script>
$(window).on('load', function() {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').fadeOut('slow');
}, 1000);
});
</script>
<style>
#side-menu .menu-logo a:hover {
background-color: transparent !important;
color: inherit !important;
text-decoration: none !important;
box-shadow: none !important;
}
#side-menu .menu-logo img {
height: 24px ;
display: inline-block ;
}
.ul-flex{
display:flex;
flex-flow: column nowrap;
justify-content: center;
align-content: space-evenly;
}
.top-navbar-div{
display:flex;
flex-flow:row nowrap;
justify-content:space-between;
}
.nav-flex{
display:flex;
flex-flow: row nowrap;
justify-content:end;
margin-right:20px;
}
.card-body{
background-color:white;
padding-left:50px !important;
margin-top: 5px;
}
.content-page{
background-color: white !important;
color:white !important;
padding: 0px !important;
}
.footer{
background-color:white !important;
color:black;
margin: 30px !important;
}
html{
background-color: white !important;
}
.footer{
margin-left:150px;
}
.left-side-menu{
margin-left:30px;
margin-top:20px;
margin-bottom:5px;
border-radius:25px;
background-color:#D4F5F6;
z-index:700;
padding:0px !important;
height:90%;
}
label{
color:#000;
}
</style>
</head>
<body class="loading" data-layout-mode="" data-layout='{"mode": "light", "width": "fluid", "menuPosition": "fixed", "sidebar": { "color": "light", "size": "condensed", "showuser": false}, "topbar": {"color": "dark"}, "showRightSidebarOnPageLoad": false}'></body>
<!-- Preloader -->
<div class="loader-mask">
<div class="loader">
<img src="<?= base_url() . "public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading...">
</div>
</div>
<!-- <img src="<?= base_url() . "public" ?>/assets/images/nhance-loader-fast.gif" height="40" width="40" alt="Loading..."> -->
<!-- Begin page -->
<div id="wrapper" style="background-color:white;">
<!-- ========== Left Sidebar Start ========== -->
<div class="left-side-menu">
<div class="h-100" data-simplebar>
<!--- Sidemenu -->
<div id="sidebar-menu">
<ul class="ul-flex" id="side-menu">
<li class="menu-logo" >
<a href="<?= base_url('/dashboard/view') ?>">
<img src="<?= base_url() . "public"; ?>/assets/images/Nhance_Favi.png" alt="Logo" height="24">
</a>
</li>
<li>
<a href="<?= base_url('/dashboard/view') ?>">
<i class="ri-dashboard-line"></i>
<span> Dashboard </span>
</a>
</li>
<li>
<a href="<?= base_url('/client/list') ?>">
<img
src="<?= base_url() . "public"; ?>/assets/images/clients_sb.png" alt="Logo" height="24">
<span>Clients</span>
</a>
</li>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<img
src="<?= base_url() . "public"; ?>/assets/images/action_on_policies_sb.png" alt="Logo" height="20">
<span> Action on Policies </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/employee/upload') ?>">View Inception</a>
</li>
<li>
<a href="<?= base_url('/employee/list') ?>">View Members</a>
</li>
<!-- <li>
<a href="<?= base_url('/employee/endorsement-list') ?>">View Endorsement</a>
</li> -->
<li>
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrolment</a>
</li>
<li>
<a href="<?= base_url('/employee/test_members_list') ?>">Test Members List</a>
</li>
</ul>
</div>
</li>
<?php if(get_role_id() == 1 || get_role_id() == 5) { ?>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<img
src="<?= base_url() . "public"; ?>/assets/images/masters_sb.png" alt="Logo" height="20">
<span> Masters </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<!-- <li>
<a href="<?= base_url('/master/insurer/list') ?>">Insurer</a>
</li> -->
<!-- <li>
<a href="<?= base_url('/master/tpa/list') ?>">TPA</a>
</li> -->
<!-- <li>
<a href="<?= base_url('/master/kyc/list') ?>">KYC</a>
</li> -->
<!-- <li>
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
</li> -->
<!-- <li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
</li> -->
<li>
<a href="<?= base_url('/user/list') ?>"> Users </a>
</li>
</ul>
</div>
</li>
<?php } ?>
<!-- <li>
<?php /*
$sessionData = get_session_userdata();
$currentUrl = base_url();
$parsedUrl = parse_url($currentUrl);
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
$hashedEmail = hash('sha256', $sessionData->email);
$redirectUrl = getenv('helpdeskURL') .'/staff/login?' . http_build_query(['token' => $hashedEmail]);
*/?>
<a href="<?php //echo $redirectUrl; ?>" target="_blank">
<i class="mdi mdi-lifebuoy"></i>
<span> Tickets </span>
</a>
</li> -->
<!-- <li>
<a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;">
<i class="fa fa-info-circle" aria-hidden="true"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> App Content Management </span>
</a>
<div class="collapse" id="sidebarDashboardsmenu">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/add_image_index') ?>"> Advertisement Images </a>
</li>
<li>
<a href="<?= base_url('/frontend_content') ?>">Front-end Content</a>
</li>
</ul>
</div>
</li> -->
<!-- leads -->
<!-- <li>
<a href="<?= base_url('/leads/list') ?>">
<i class="mdi mdi-chart-bar"></i>
<span> Leads </span>
</a>
</li> -->
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<!-- <li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Policy Transactions </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
</li>
<?php if (in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-outstanding-list') ?>">Outstanding</a>
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
</li>
<?php } ?>
<?php if (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
</li>
<?php } ?>
<li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
</li>
<li>
<a href="<?= base_url('/dmsSearch') ?>">Documents</a>
</li>
</ul>
</div>
</li> -->
<?php } ?>
</ul>
</div>
<!-- End Sidebar -->
</div>
<!-- Sidebar -left -->
</div>
<!-- Left Sidebar End -->
<!-- Top Bar -->
<div class="top-navbar-div" style="margin-left:150px; margin-top:20px;" >
<div>
<h5>Welcome <?= (isset(get_session_userdata()->first_name) ? get_session_userdata()->first_name : 'NOT SET') ?> </h5>
</div>
<div class="nav-flex">
<div>
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false"
>
<img
style="color: black;"
src="<?php echo (get_userProfile() != null && !empty(get_userProfile())) ? get_userProfile() : base_url() . 'public/assets/images/avatar_2x.png'; ?>" alt="user-image"
class="rounded-circle">
</a>
</div>
<div>
<a href="<?= base_url('/logout'); ?>" style="font-size: 16px; color:#000;background-color:#D4F5F6 !important;border-radius:25px;padding:7px;">
<i class="ri-logout-box-r-line" style="font-size: 20px; color:#000;padding:0px;"></i>
</a>
</div>
</div>
</div>
<!-- End of Top -->
<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid"></div>