Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
VENKATESHWARAN 2024-07-03 14:44:43 +05:30
commit feaacf0e63
14 changed files with 1367 additions and 119 deletions

View File

@ -10,8 +10,16 @@ use CodeIgniter\Router\RouteCollection;
$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
// Reminder Mail Notification
$routes->get("reminder_mail", "NotificationController::reminder_mail");
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
$routes->get("add_image_index", "AppContentManagementController::add_image_index");
$routes->get("getAdvertiseImage/(:any)", "AppContentManagementController::getAdvertiseImage/$1");
$routes->get("frontend_content", "AppContentManagementController::frontend_content");
// $routes->get('/', 'LoginController::index');
$routes->get('/test', 'Home::index');
$routes->get('/login', 'LoginController::index'); ///auth/google
@ -272,7 +280,8 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->get("getChatResponse", "ChatBotController::getChatResponse");

View File

@ -0,0 +1,96 @@
<?php
// declare(strict_types=1);
namespace App\Controllers;
use Psr\Log\LoggerInterface;
use CodeIgniter\API\ResponseTrait;
use App\Models\AddImgModel;
use App\Models\FEContentModel;
class AppContentManagementController extends AdminController
{
use ResponseTrait;
protected $myLogger;
protected $addImgModel;
protected $feContentModel;
public function __construct()
{
$this->myLogger = \Config\Services::mylogger();
$this->addImgModel = new AddImgModel();
$this->feContentModel = new FEContentModel();
}
public function add_image_index()
{
$this->myLogger->logme('error','Addvertisement Image list function called');
$headerData['page_name'] = 'Addvertisement Image List';
$data['addImageList'] = $this->addImgModel->findAll();
// dd($data);
echo view('layout/header', $headerData);
echo view('add_image_list', $data);
echo view('layout/footer');
// $this->loadLayout('client_onboarding', $data);
}
public function add_advertise_image(){
// print_r($this->request->getPost());die;
$uploadFilePath = ROOTPATH . 'public/uploads/advertiseImage/';
$file_name = file_Upload($this->request->getFile('advertise_image'), $uploadFilePath);
$data['id'] = $this->request->getPost('add_image_id');
// $data['created_by'] = get_session_userid();
$data['name'] = $file_name;
if($data['id'] == 0){
$insert = $this->addImgModel->insert($data);
if($insert){
return $this->respond(['status' => true,'code' => 200,'data' => "success"], 200);
}else{
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
}
}else{
$id = $data['id'];
$update = $this->addImgModel->update($id,$data);
if($update){
return $this->respond(['status' => true,'code' => 200,'data' => "success"], 200);
}else{
return $this->respond(['status' => false,'code' => 404,'message' => 'no data found'], 200);
}
}
}
public function getAdvertiseImage($image_id){
$image_data = $this->addImgModel->select('name')->where(['id' => $image_id])->first();
if($image_data){
return $image_data['name'];
}else{
return ;
}
}
// Front End Content Area
public function frontend_content(){
$data['test'] = $this->feContentModel->findAll();
$headerData['page_name'] = 'Front-End Content';
echo view('layout/header', $headerData);
echo view('frontend_content_list', $data);
echo view('layout/footer');
}
}

View File

@ -73,31 +73,69 @@ class ChatBotController extends AdminController
public function getChatResponse()
{
// try {
try {
$request_for = $this->request->getGet('request_for');
$option = $this->request->getGet('option');
$is_option = $this->request->getGet('is_option');
$custom_options = $this->request->getGet('custom_options');
$requestData = $this->ChatBotModel->where('request', $request_for)
$responseData = $this->ChatBotModel->where('request', $request_for)
->where('is_active', 1 )
->first();
if ($requestData) {
if ($responseData) {
if($option != 0){
if(isset($option) && $option != 0){
$decodedData = json_decode($requestData['options'],true);
$decodedData = json_decode($responseData['options'],true);
$requestFor = $decodedData[$request_for][$option];
$requestFor = $decodedData[$option];
$requestData = $this->ChatBotModel->where('request', $requestFor)
$responseData = $this->ChatBotModel->where('request', $requestFor)
->where('is_active', 1 )
->first();
}
if(isset($custom_options))
{
$result = ['request_for'=>$requestData['request'],'options'=>json_decode($requestData['options'],true)];
}
if(isset($is_option) && $is_option == 0){
$text = $this->request->getGet('text');
$value = $this->request->getGet('value');
$Data = $this->ChatBotModel->where('options', $text)->where('is_active', 1 )->first();
if($Data){
if($Data['options'] == 'Please Enter Your Mobile Number To View Your Policies')
{
$result = $this->getAllPolicyByMobileNumber($value,'text');
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
}else if($Data['options'] == 'Please Enter Your Mobile Number To Raise Ticket'){
$result = $this->getAllPolicyByMobileNumber($value,'options');
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
}
}else{
$result = $this->sendDefaultMessage();
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
}
}
$result = [
'request_for' => $responseData['request'],
'options' => json_decode($responseData['options'], true),
'text' => $responseData['is_option'] != 1 ? $responseData['options'] : null,
'is_option' => $responseData['is_option']
];
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
@ -107,12 +145,123 @@ class ChatBotController extends AdminController
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
}
// } catch (\Throwable $th) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
// }
} catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
}
}
public function sendDefaultMessage()
{
$responseData = $this->ChatBotModel->where('id', 1)->where('is_active', 1 )->first();
return [
'request_for' => $responseData['request'],
'options' => json_decode($responseData['options'], true),
'text' => $responseData['is_option'] != 1 ? $responseData['options'] : null,
'is_option' => $responseData['is_option']
];
}
public function getAllPolicyByMobileNumber($mobileNo,$action)
{
$employee = $this->employeeModel->where('mobile', $mobileNo)->where('is_active', 1 )->first();
if($employee){
$employeeData = $this->employeeModel->where('emp_code', $employee['emp_code'])
->where('client_id',$employee['client_id'])
->where('client_branch_id',$employee['client_branch_id'])
->where('is_active', 1 )->findAll();
$whereArrayForId = [];
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
->join('policies', 'client_policy.policy_id = policies.id', 'left')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
->where('client_policy.client_id', $employee['client_id'] )
->where('client_policy.client_branch_id', $employee['client_branch_id'] )
->where('client_policy.is_active', 1 )
->where('client_policy.policy_status', 1)
->orderby('client_policy.id' , 'ASC')
->findAll();
$options = [];
$text = '';
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
{
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
$data['policy_name'] = $ClientPolicyValue['policy_name'];
$data['policy_type'] = $ClientPolicyValue['policy_type'];
$data['policy_no'] = $ClientPolicyValue['policy_no'];
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->whereIn('employee_polices.employee_id',$whereArrayForId)
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
->where('employee_polices.is_active', 1 )->findAll();
if(count($employee_policy) > 0)
{
$policy[$ClientPolicyValue['id']] = $ClientPolicyValue['policy_name']."(".$ClientPolicyValue['policy_type'].")";
array_push($options, $policy);
$text .= $ClientPolicyValue['policy_name']."(".$ClientPolicyValue['policy_type'].") % ";
}else{
$text .= "There is no any active policies ";
}
}
if($action == 'options'){
return [
'request_for' => $this->request->getGet('request_for'),
'options' => $options[count($options) - 1],
'text' => null,
'is_option' => "1",
'custom_options'=>'create_ticket'
];
}else{
return [
'request_for' => $this->request->getGet('request_for'),
'options' => null,
'text' => $text,
'is_option' => "0"
];
}
}else{
return [
'request_for' => $this->request->getGet('request_for'),
'options' => null,
'text' => "Dear ".$employee['name'].", % Policy not yet bound for you.",
'is_option' => "0"
];
}
}else{
return [
'request_for' => $this->request->getGet('request_for'),
'options' => null,
'text' => "Invalid Mobile Number",
'is_option' => "0"
];
}
}
}

View File

@ -27,7 +27,6 @@ use App\Models\NotificationModel;
use App\Models\UserModel;
use App\Models\FEContentModel;
use App\Models\AddImgModel;
use App\Models\FileModel;
use App\Controllers\Jobs ;
@ -435,7 +434,7 @@ class EmployeeRestController extends AdminController
->findAll();
// dd($checkIfExist);
if ($checkIfExist) {
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
@ -626,13 +625,7 @@ class EmployeeRestController extends AdminController
// Upload the Employee Detail in DB by Sheet Data
public function employeeUpload()
{
try {
// echo $this->request->getPost('client_id');
// die;
$file = $this->request->getFile('file');
$client_id = $this->request->getPost('client_id');
$client_branch_id = $this->request->getPost('client_branch_id');
@ -643,17 +636,12 @@ class EmployeeRestController extends AdminController
$jwt = $this->request->getHeader('Authorization');
$jwtParts = explode(' ', $jwt);
// print_r($jwtParts);die;
$token = $jwtParts[2];
// return "hello";
$token = $jwtParts[2];
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
// get the employee id from token
$employee_id = $decodedPayload['id'];
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->where('client_branch_id', $client_branch_id)->first();
if ($client_policy) {
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
@ -668,12 +656,12 @@ class EmployeeRestController extends AdminController
$file_name_with_path = WRITEPATH."/uploads/excel/".$filename;
//make an entry in DB
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $employee_id, 'status' => 'draft', 'action' => 'enrollment', 'client_branch_id' => $client_branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
$this->myLogger->logme("error", '{file_id} - client uploaded success', ['file_id' => $file_id]);
$empServiceController = new EmployeeServiceController();
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
// dd($result);
if(isset($result['error_summary']) && count($result['error_summary']))
{
$result = $empServiceController->getExcelErrorData($file_id);
@ -701,34 +689,34 @@ class EmployeeRestController extends AdminController
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
$data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
$extractData['file_name']= $filename;
$extractData['client_id']= $client_id;
$extractData['client_branch_id']= $client_branch_id;
$extractData['status']= 'success';
$extractData['policy_id']= $policy_id;
$extractData['action']= 'enrollment';
$extractData['created_by']=$employee_id;
// $extractData['file_name']= $filename;
// $extractData['client_id']= $client_id;
// $extractData['client_branch_id']= $client_branch_id;
// $extractData['status']= 'success';
// $extractData['policy_id']= $policy_id;
// $extractData['action']= 'enrollment';
// $extractData['created_by']=$employee_id;
$file_data =$this->fileModel->insert($extractData);
// $file_data =$this->fileModel->insert($extractData);
$extra = [];
if (count($data[0]) == 11) {
$value = ['Sno','Emp_Code','Name','DOJ','Gender','Relation','DOB','Mail','Mobile','SI','Grade'];
$check_miss_match = [];
for ($i=0; $i <count($value) ; $i++) {
if ($data[0][$i] != $value[$i]) {
$check_miss_match[]=$data[0][$i];
}
}
// $extra = [];
// if (count($data[0]) == 11) {
// $value = ['Sno','Emp_Code','Name','DOJ','Gender','Relation','DOB','Mail','Mobile','SI','Grade'];
// $check_miss_match = [];
// for ($i=0; $i <count($value) ; $i++) {
// if ($data[0][$i] != $value[$i]) {
// $check_miss_match[]=$data[0][$i];
// }
// }
// if (count($check_miss_match) > 0) {
// return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Column Name's are miss Match's!", 'data'=> $check_miss_match], 200);
// }
// }
if (count($check_miss_match) > 0) {
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Column Name's are miss Match's!", 'data'=> $check_miss_match], 200);
}
}
if(count($data[0]) != 11){
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 200);
}
// if(count($data[0]) != 11){
// return json_encode($data[0]);
// return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Uploaded file row count is Not Match!" ], 200);
// }
//this change the column name into index number
for ($i = 0; $i < count($data[0]); $i++) {
@ -753,18 +741,6 @@ class EmployeeRestController extends AdminController
}
$dataToInsert = [];
$basic_cover_si= [];
// if ($extra[9]) {
// $new_array = [];
// for ($i=0; $i < count($extra[9]); $i++) {
// if ($sum_insured_amount_for_check_employee_2 != $extra[9][$i] || $sum_insured_amount_for_check_employee_1 != $extra[9][$i]) {
// $new_array[] = $i+1;
// }
// }
// if (count($new_array) > 0) {
// $count =count($new_array);
// return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "$count Employee Sum Insured is Not Match.. " , 'data' => $new_array], 200);
// }
// }
foreach ($extra['0'] as $index => $id) {
$relation ='';
if ($extra['5'][$index] === 'Mother' || $extra['5'][$index] === 'Father') {
@ -956,6 +932,7 @@ class EmployeeRestController extends AdminController
//-------------------------------------
public function getAgeRange($terms,$familyFloatesValue)
{
$ageRangeArray = ['self' => ['min' => 18, 'max' => 60] , 'spouse' => ['min' => 18, 'max' => 60] , 'child' => ['min' => 0, 'max' => 25] , 'elders' => ['min' => 18, 'max' => 60] ];
$ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue);
@ -970,7 +947,7 @@ public function getAgeRange($terms,$familyFloatesValue)
public function getEmployeePolicy()
{
try {
// try {
$id = $this->request->getGet('id');
$emp_code = $this->request->getGet('emp_code');
@ -989,7 +966,7 @@ public function getEmployeePolicy()
->where('is_active', 1 )
->where('is_addon_value',0)->findAll();
if ($empPolicy) {
$result = [];
@ -1058,12 +1035,17 @@ public function getEmployeePolicy()
$array->floter_text_description = '';
}
// Convert familyFloaters terms data to plain array
// remove parent and parent-in-law from familyFloaters
if($familyFloates->{'either-parents-pil'} != 0){
unset($familyFloates->parents);
unset($familyFloates->parents_in_law);
}
$floters = $this->FloterConvertion($familyFloates);
$data = [];
foreach ($floters as $familyFloatesValue) {
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
if(count($empData)){
foreach ($empData as $key => $value) {
if ($value['family_floater_key'] === $dependent) {
@ -1089,8 +1071,8 @@ public function getEmployeePolicy()
}
}
}
// Remove Unwanted floter key from floters array based on either-parents-pil term value
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
@ -1108,7 +1090,21 @@ public function getEmployeePolicy()
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
}
}
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
{
$count_parent = 0;
$count_parent_in_law = 0;
foreach ($floters as $value) {
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
}
if(($count_parent + $count_parent_in_law) == 2) {
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
}
}
// Add family floter buttons placement data for FE validation
if(count($floters)){
foreach ($floters as $familyFloatesValue) {
@ -1161,9 +1157,9 @@ public function getEmployeePolicy()
}else{
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
}
// } catch (\Exception $e) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
// }
}
@ -1229,6 +1225,13 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl
$array->floter_text_description = '';
}
// remove parent and parent-in-law from familyFloaters
if($familyFloates->{'either-parents-pil'} != 0){
unset($familyFloates->parents);
unset($familyFloates->parents_in_law);
}
// Convert familyFloaters terms data to plain array
$floters = $this->FloterConvertion($familyFloates);
$data = [];
@ -1278,6 +1281,19 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
}
}
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
{
$count_parent = 0;
$count_parent_in_law = 0;
foreach ($floters as $value) {
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
}
if(($count_parent + $count_parent_in_law) == 2) {
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
}
}
// Add family floter buttons placement data for FE validation
if(count($floters)){
@ -1306,8 +1322,9 @@ public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$cl
public function FloterConvertion($array){
$result = [];
foreach ($array as $key => $value) {
if ($value > 0) {
if ($value > 0 && $key != 'elders_count') {
if ($value != 0 && $key === 'childrens') {
for ($i = 1; $i <= $value; $i++) {
$result[] = "child" . $i;
@ -1477,6 +1494,11 @@ public function getAddOnPolicy()
// Map family floaters that already exist in the employee table
$familyFloates = $policy_terms->family_floaters;
// remove parent and parent-in-law from familyFloaters
if($familyFloates->{'either-parents-pil'} != 0){
unset($familyFloates->parents);
unset($familyFloates->parents_in_law);
}
// Convert familyFloaters terms data to plain array
$floters = $this->FloterConvertion($familyFloates);
@ -1551,6 +1573,34 @@ public function getAddOnPolicy()
}
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
{
if(count($addOnEmployeeData) == 0)
{
$GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
->where('is_addon_value',0)
->where('is_active', 1 )
->where('family_floater_key','parent')
->findAll();
if(count($GMCEmpData) > 0){
$floters = array_diff($floters, ["parent1","parent2"]);
}else{
$floters = array_diff($floters, ["parent_in_law1","parent_in_law2"]);
}
}else{
$count_parent = 0;
$count_parent_in_law = 0;
foreach ($floters as $value) {
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
}
if(($count_parent + $count_parent_in_law) == 2) {
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
}
}
}

View File

@ -873,7 +873,7 @@ class EmployeeServiceController extends AdminController
$job_details = new Jobs();
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
// $jobWorker = new JobWorker();
// JobWorker::processJob($r);s
// JobWorker::processJob($r);
}
return $result;
@ -987,8 +987,7 @@ class EmployeeServiceController extends AdminController
}
}
//check self availbale in uploaded file
if(($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment') || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
if(($policy_details['base_policy'] == null && ($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'enrollment')) || ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
{
$res = check_self_available_in_family($family,$file['action']);
if(!$res['is_self_found'])

View File

@ -92,11 +92,12 @@ class RestAuthenticationController extends AdminController
public function getVerifiedUserData()
{
try {
// try {
$mobile_number = $this->request->getJSON()->mobile_number;
$otp = $this->request->getJSON()->otp;
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
if ($employeeData && $otp == $employeeData["otp"] || $employeeData && isset($this->request->getJSON()->login_by_hr)) {
$auth = HttpRequestHelper::getRequestInfo();
if ($auth) {
@ -120,9 +121,9 @@ class RestAuthenticationController extends AdminController
} else {
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
}
} catch (\Exception $e) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
}
// } catch (\Exception $e) {
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
// }
}
public function verifyHrWithMobileNumber()

View File

@ -71,7 +71,8 @@ class UserController extends AdminController
$admin = 0;
}
foreach ($temp_team as $key => $value) {
if($value == 2){
$team = $this->teamModel->where('id' , $value)->first();
if($team['name'] == 'Claims'){
$hdz_staff = [
'emp_code' => $userData['emp_code'],
'fullname' => $userData['first_name'],

View File

@ -13,6 +13,7 @@ use ReflectionClass;
require_once('../vendor/autoload.php');
use App\Models\EmployeeModel;
use App\Models\LevelContactModel;
class AuthJWT implements FilterInterface
@ -20,7 +21,6 @@ class AuthJWT implements FilterInterface
public function before(RequestInterface $request, $arguments = null)
{
$jwt = $request->getHeader('Authorization');
$model = new EmployeeModel();
if ($jwt) {
if (JWTToken::validateJWT($jwt)) {
@ -28,22 +28,44 @@ class AuthJWT implements FilterInterface
$data = json_decode($data);
$id = $data->decoded->id;
$user_data = $model->where('id', $id)->first();
if(isset($data->decoded->emp_code)){
$model = new EmployeeModel();
$user_data = $model->where('id', $id)->first();
if($user_data['token_time_out'] > time()){
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
$model->update($id, $data);
return true;
if($user_data['token_time_out'] > time()){
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
$model->update($id, $data);
return true;
}else{
$data =["token_time_out" => ''];
$model->update($id, $data);
header('Content-Type: application/json');
http_response_code(401);
// $error = json_encode(["status" => 401, "message" => $data->message]);
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
echo $error;
exit;
}
}else{
$data =["token_time_out" => ''];
$model->update($id, $data);
header('Content-Type: application/json');
http_response_code(401);
// $error = json_encode(["status" => 401, "message" => $data->message]);
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
echo $error;
exit;
$model = new LevelContactModel();
$hr_data = $model->where('id', $id)->first();
if($hr_data['token_time_out'] > time()){
$data =["token_time_out" => time() + getenv('TOKENTIMEOUT') ];
$model->update($id, $data);
return true;
}else{
$data =["token_time_out" => ''];
$model->update($id, $data);
header('Content-Type: application/json');
http_response_code(401);
// $error = json_encode(["status" => 401, "message" => $data->message]);
$error = json_encode(["status" => 401, "message" => "Token is Invalid"]);
echo $error;
exit;
}
}
}
} else {
header('Content-Type: application/json');

View File

@ -13,6 +13,7 @@ use CodeIgniter\HTTP\RequestInterface;
use ReflectionClass;
use App\Models\EmployeeModel;
use App\Models\LevelContactModel;
class JWTToken
@ -25,13 +26,19 @@ class JWTToken
try{
$token = JWT::encode($request_data ,$secret_Key,'HS512');
$model = new EmployeeModel();
$id = $request_data['id'];
$data =[
"token_time_out" => time() + getenv('TOKENTIMEOUT')
];
$model->update($id, $data);
$data["token_time_out"] = time() + getenv('TOKENTIMEOUT');
if(isset($data['emp_code'])){
$model = new EmployeeModel();
$model->update($id, $data);
}else{
$models = new LevelContactModel();
$models->update($id, $data);
}
return $token;
}

View File

@ -632,7 +632,7 @@ if (!function_exists('check_dependent_conflict'))
}
}
//check for any cross parents but not more than two
if($allowed_adults == 0 && $allowed_parents_count == 1 && $allowed_parent_in_laws_count == 1 && (2 < ($received_parents_count + $received_parent_in_laws_count)))
if($allowed_adults == 2 && (2 < ($received_parents_count + $received_parent_in_laws_count)))
{
// dd($allowed_adults);
$result['status'] = false;
@ -787,6 +787,22 @@ if (!function_exists('calculate_premimum'))
}
}
//set primary_rack_rate_acting_self in emp_details_with_empband_max_age_max_count array for policies where self not available and premium type is 1 (i.e.) GMC parents as dep addon policy
$transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = false;
if(!isset($emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self']) && $current_grid_info['type'] == 'primary')
{
if(strtolower($transformed_familiy_member_data['relationship']) == 'self')
{
$transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = true;
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self'] = true;
}
else
{
$transformed_familiy_member_data['temp']['primary_rack_rate_acting_self'] = true;
$emp_details_with_empband_max_age_max_count[ $transformed_familiy_member_data['emp_code'] ]['primary_rack_rate_acting_self'] = true;
}
}
//generate relationship code
if($transformed_familiy_member_data['temp']['action'] != 'D' && $transformed_familiy_member_data['temp']['action'] != 'C' && $transformed_familiy_member_data['temp']['action'] != 'SI')
{
@ -1013,7 +1029,7 @@ if (!function_exists('premium_calculation_manager'))
$employee_received_si = $default_si == null ? $emp_data['policy_details']['basic_cover_si'] : $default_si;
foreach ($temp_slab_rates as $skey => $slab_value)
{
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
@ -1036,7 +1052,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
{
// dd($slab_value);
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
@ -1057,7 +1073,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
@ -1077,7 +1093,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
{
// echo $emp_data['name'];
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
@ -1099,7 +1115,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
@ -1121,7 +1137,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['grade'] == $employee_received_band && $slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) ) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
{
// $emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
@ -1143,7 +1159,7 @@ if (!function_exists('premium_calculation_manager'))
foreach ($temp_slab_rates as $skey => $slab_value)
{
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
if($slab_value['si'] == $employee_received_si && (($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
{
$emp_data['policy_details']['basic_cover_si'] = $slab_value['si'];
$emp_data['policy_details']['date_coverage'] = (isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date']);
@ -1170,7 +1186,7 @@ if (!function_exists('premium_calculation_manager'))
if( $slab_value['si'] == $employee_received_si &&
($slab_value['age_from'] <= $max_age && $slab_value['age_to'] >= $max_age) &&
(($slab_value['premium_type'] == 1 &&
( (strtolower($emp_data['relationship']) == 'self') || ($emp_data['temp']['additional_rack_rate_acting_self']) )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) )
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ) )
{
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
$emp_data['policy_details']['date_coverage'] = isset($emp_data['policy_details']['date_coverage']) ? $emp_data['policy_details']['date_coverage'] : $policy_terms['policy_start_date'];
@ -1195,7 +1211,7 @@ if (!function_exists('premium_calculation_manager'))
{
if($slab_value['si'] == $employee_received_si && $slab_value['grade'] == $employee_received_band && (($slab_value['premium_type'] == 1 &&
( (strtolower($emp_data['relationship']) == 'self') || ($emp_data['temp']['additional_rack_rate_acting_self']) )) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self'])) || ($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) ))
{
//calculate premium based on count
// echo $emp_data['name'];
@ -1224,7 +1240,7 @@ if (!function_exists('premium_calculation_manager'))
$emp_data['policy_details']['basic_cover_si'] = null;
foreach ($temp_slab_rates as $skey => $slab_value)
{
if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self'] ) )) )
if( $slab_value['si'] == $employee_received_si && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
{
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;
@ -1249,7 +1265,7 @@ if (!function_exists('premium_calculation_manager'))
$age = calculate_days_bw_dates(from_date: $emp_data['dob'])->y;
foreach ($temp_slab_rates as $skey => $slab_value)
{
if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && (strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
if( $slab_value['si'] == $employee_received_si && ($slab_value['age_from'] <= $age && $slab_value['age_to'] >= $age) && ((($slab_value['premium_type'] == 2 || $slab_value['premium_type'] == null) && $slab_value['relationship'] == $employee_relationship) || ($slab_value['premium_type'] == 1 && ( strtolower($emp_data['relationship']) == 'self' || $emp_data['temp']['primary_rack_rate_acting_self'] || $emp_data['temp']['additional_rack_rate_acting_self']) )) )
{
$emp_data['policy_details']['basic_cover_si'] = $employee_received_si;

658
app/Helpers/header.php Normal file
View File

@ -0,0 +1,658 @@
<!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/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">
<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>
<style>
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
min-height: 0;
}
.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>
</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">
<!-- 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/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/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_Favi_white_2.png" alt="" width="30" 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 id="side-menu">
<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') ?>">
<i class="mdi mdi-domain"></i>
<span> Clients </span>
</a>
</li>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<i class="fas fa-user-tie"></i>
<span class="badge badge-success badge-pill float-right">2</span>
<span> Members </span>
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<li>
<a href="<?= base_url('/employee/upload') ?>">Upload</a>
</li>
<li>
<a href="<?= base_url('/employee/list') ?>">List</a>
</li>
<li>
<a href="<?= base_url('/employee/endorsement-list') ?>">Endorsement List</a>
</li>
</ul>
</div>
</li>
<li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<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">
<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>
</ul>
</div>
</li>
<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 href="<?= base_url('/user/list') ?>">
<i class=" ri-user-3-line"></i>
<span> Users </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>
<li>
</li>
<li>
</li>
</ul>
</div>
</li>
<li>
<!-- <li class="menu-title mt-2">Apps</li> -->
</ul>
</div>
<!-- End Sidebar -->
</div>
<!-- Sidebar -left -->
</div>
<!-- Left Sidebar End -->
<!-- ============================================================== -->
<!-- Start Page Content here -->
<!-- ============================================================== -->
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">

View File

@ -11,6 +11,7 @@ class ChatBotModel extends Model
"id",
"request",
"options",
"is_option",
"created_by",
"updated_by",
"is_active",

View File

@ -0,0 +1,210 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
table.dataTable thead th {
padding: 4px 4px !important;
}
.col-12{
max-width: 98% !important;
}
</style>
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="margin-bottom:1rem;">
<div class="col-6" style="align-self: center;">
<h4 style="position: relative;">Advertisement Image List</h4>
</div>
<div class="col-6" style="text-align: right; position: relative;top: 5px;">
<a data-toggle="modal" data-target="#bike_make_login-modal" href="#" type="button" id="btnAdd" class="btn btn-primary waves-effect waves-light" data-toggle="" data-placement="top" title="Add" data-trigger="hover">ADD</a>
</div>
</div>
<table class="table table-sm table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">Advertisement Image Name</th>
<th class="font-weight-medium">Status</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody>
<?php foreach($addImageList as $row){ ?>
<tr >
<td class="client_info" data-id="<?php echo $row['id']; ?>"><?php echo $row['name']; ?></td>
<td>
<?php echo $row['is_active']; ?>
</td>
<td>
<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 advertise_image_edit" href="#" data-toggle="modal" data-id="<?php echo $row['id']; ?>" data-target="#bike_make_login-modal"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<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>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->
</div>
<!-- end row -->
<div id="append_client_info"></div>
<div id="bike_make_login-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="text-center mt-2 mb-4">
<h4 id="advertise_add_edit">Add Advertise Image </h4>
</div>
<form id="model_form_data" class="px-4">
<input type="text" name="add_image_id" id="add_image_id" value="0" hidden>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label for="branchname">Image</label>
<input class="form-control" name="advertise_image" id="advertise_image" type="file" accept="image/*" onchange="PreviewImage();" required="">
</div>
<div class="form-group col-md-6 float-left" style="position: relative;top: 0px;">
<img src=" " width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/>
</div>
</div>
</div>
<div class="form-group text-center">
<button class="btn btn-rounded btn-primary" type="submit" onclick="submitBranch(this)">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
function submitBranch(params) {
// if ($('#add_image_id').val()) {
// var url = '<?= base_url("edit_advertise_image/"); ?>'+$('#add_image_id').val();
// }else{
var url = '<?= base_url("add_advertise_image"); ?>';
// }
var formData = new FormData($('#model_form_data')[0]);
$.ajax({
type: 'POST',
url: url,
data: formData,
dataType: 'json',
processData: false,
contentType: false,
success: function(response) {
console.log(response);
$('#bike_model_login-modal').modal('hide');
$('#bike_make_name').val('');
window.location.reload();
},
error: function(xhr, status, error) {
// Handle error response here
console.error(xhr.responseText);
}
});
}
function PreviewImage() {
console.log('function called');
var fileInput = document.getElementById("advertise_image");
var file = fileInput.files[0];
if (file) {
var allowedExtensions = ["jpg", "jpeg", "png"];
var fileExtension = file.name.split('.').pop().toLowerCase();
if (!allowedExtensions.includes(fileExtension) || file.size > 200 * 1024) {
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
fileInput.value = ""; // Clear the file input
document.getElementById("uploadPreview").src = "<?= base_url()."public/assets/images/avatar_2x.png" ?>"; // Remove the preview image
return;
}
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function (event) {
var img = new Image();
img.src = event.target.result;
img.onload = function () {
if (img.width !== 1640 || img.height !== 664) {
toastr.warning('Image dimensions must be 1640x664 pixels.', 'Invalid image dimensions.');
fileInput.value = ""; // Clear the file input
document.getElementById("uploadPreview").src = "<?= base_url()."public/assets/images/avatar_2x.png" ?>"; // Remove the preview image
} else {
document.getElementById("uploadPreview").src = img.src;
}
};
};
}
}
$('#btnAdd').click(function () {
$('#add_image_id').val(0);
$('#advertise_add_edit').html('Add Advertise Image');
$('#uploadPreview').attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
})
$('.advertise_image_edit').click(function (params) {
// console.log($(this).data('id'));
$('#add_image_id').val($(this).data('id'));
var url = '<?= base_url("getAdvertiseImage/"); ?>'+$(this).data('id') ;
$.ajax({
type: 'GET',
url: url,
success: function (response) {
console.log(response);
$('#advertise_add_edit').html('Edit Advertise Image');
$('#uploadPreview').attr('src', '<?= base_url() . "public/uploads/advertiseImage/"?>' + response)
.on('error', function() {
$(this).attr('src', '<?= base_url()."public/assets/images/avatar_2x.png" ?>');
});
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
}
})
})
</script>

View File

@ -40,6 +40,7 @@
<!-- <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" />
@ -69,6 +70,8 @@
}
</script>
<style>
body[data-sidebar-size=condensed]:not([data-layout=compact]):not(.auth-fluid-pages) {
min-height: 0;
}
@ -288,6 +291,10 @@
bottom: 5px;
left: 60px;
}
#app_content_management:hover {
color: red;
}
</style>
<script>
@ -607,6 +614,28 @@
<span> Users </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>
<li>
</li>
<li>
</li>
</ul>
</div>
</li>
<li>
<!-- <li class="menu-title mt-2">Apps</li> -->
</ul>
</div>