diff --git a/app/Config/Routes.php b/app/Config/Routes.php index ba34cea6..f9333b5d 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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 @@ -271,7 +279,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"); diff --git a/app/Controllers/AppContentManagementController.php b/app/Controllers/AppContentManagementController.php new file mode 100644 index 00000000..300036be --- /dev/null +++ b/app/Controllers/AppContentManagementController.php @@ -0,0 +1,96 @@ +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'); + } + +} \ No newline at end of file diff --git a/app/Controllers/ChatBotController.php b/app/Controllers/ChatBotController.php index d048ada7..6fd006c8 100644 --- a/app/Controllers/ChatBotController.php +++ b/app/Controllers/ChatBotController.php @@ -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" + ]; + } + + +} + + + } + + + diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 01f35d7c..185ff9ce 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -217,11 +217,13 @@ class ClientController extends AdminController // 3 => 'Refund', // 4 => 'Debit', // ]; + $subTypeOptions = [ 1 => 'Replenishment', 2 => 'Adjustment', 3 => 'Refund From Deletion', 4 => 'Debit', + 5 => 'Asset Policy', ]; $data['subTypeOptions'] = $subTypeOptions; @@ -660,6 +662,7 @@ class ClientController extends AdminController $data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1; $data['client_branch_id'] = $this->request->getPost('client_branch_id'); $data['cd_ac_no'] = $this->request->getPost('cd_ac_no'); + $data['gst'] = $this->request->getPost('gst'); @@ -756,9 +759,9 @@ class ClientController extends AdminController $data['inception_type'] = $this->request->getPost('inception_type') ? 2 : 1; $data['client_branch_id'] = $this->request->getPost('client_branch_id'); $data['cd_ac_no'] = $this->request->getPost('cd_ac_no'); + $data['gst'] = $this->request->getPost('gst'); - - + $policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first(); if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) { diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index ae32b9a4..ec8467e6 100644 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -268,22 +268,33 @@ class EmployeeController extends AdminController '(SELECT SUM(ep.rata_premimum) + SUM(ep.gst) FROM employees e JOIN employee_polices ep ON e.id = ep.employee_id - WHERE e.file_id = files.id AND ep.client_policy_id = files.policy_id) as total' + WHERE e.file_id = files.id AND ep.client_policy_id = files.policy_id) as total', + 'policy_type.policy_type' , + 'cp.policy_no' , ]) ->join('user_profiles up', 'files.created_by = up.id') ->join('client_policy cp', 'files.policy_id = cp.id', 'left') ->join('client_branch cb', 'files.client_branch_id = cb.id', 'left') ->join('policies pm', 'cp.policy_id = pm.id', 'left') + ->join('policy_type', 'policy_type.id = pm.policy_type_id') ->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left') ->where('files.created_by', get_session_userid()) ->orderBy('files.created_at', 'desc') ->findAll(); // dd($data['fileList']); - $data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name, client_branch.branch_name') + $data['batch_list'] = $this->batchFileModel->select( + 'batch_files.*, + policies.name as policy_name, + clients.short_name as client_short_name, + client_branch.branch_name, + client_policy.policy_no, + policy_type.policy_type + ') ->join('client_policy', 'client_policy.id = batch_files.client_policy_id') ->join('client_branch', 'client_branch.id = batch_files.client_branch_id') ->join('policies', 'policies.id = client_policy.policy_id') + ->join('policy_type', 'policy_type.id = policies.policy_type_id') ->join('clients', 'clients.id = client_policy.client_id') ->orderBy('batch_files.id', 'desc') ->findAll(); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 7e5e0937..2539b119 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -29,7 +29,6 @@ use App\Models\FEContentModel; use App\Models\AddImgModel; - use App\Controllers\Jobs ; use App\Controllers\JobWorker ; @@ -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' =>$employee_id, 'status' => 'inprogress', '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' => $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 $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); @@ -712,23 +700,23 @@ class EmployeeRestController extends AdminController $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 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); + } + } + + } diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index 184cbefa..f654dc40 100644 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -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'], diff --git a/app/Filters/AuthJWT.php b/app/Filters/AuthJWT.php index 193ad6ec..b64a2a76 100644 --- a/app/Filters/AuthJWT.php +++ b/app/Filters/AuthJWT.php @@ -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'); diff --git a/app/Helpers/JWTToken.php b/app/Helpers/JWTToken.php index 592c38f8..5e351c5e 100644 --- a/app/Helpers/JWTToken.php +++ b/app/Helpers/JWTToken.php @@ -13,6 +13,7 @@ use CodeIgniter\HTTP\RequestInterface; use ReflectionClass; use App\Models\EmployeeModel; +use App\Models\LevelContactModel; class JWTToken @@ -25,13 +26,20 @@ 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); + if(isset($data['emp_code'])){ + $model = new EmployeeModel(); + $model->update($id, $data); + + }else{ + $models = new LevelContactModel(); + $models->update($id, $data); + + } + return $token; } diff --git a/app/Models/ChatBotModel.php b/app/Models/ChatBotModel.php index caae27a5..65270779 100644 --- a/app/Models/ChatBotModel.php +++ b/app/Models/ChatBotModel.php @@ -11,6 +11,7 @@ class ChatBotModel extends Model "id", "request", "options", + "is_option", "created_by", "updated_by", "is_active", diff --git a/app/Models/ClientModel.php b/app/Models/ClientModel.php index fd1e8510..d1d35a2f 100644 --- a/app/Models/ClientModel.php +++ b/app/Models/ClientModel.php @@ -36,9 +36,25 @@ class ClientModel extends Model //get client and its associated policies in same array public function clientsWithPolicies() { + + $role_id = get_role_id(); + $user_id = get_session_userid(); + + $columns = ['clients.id ', 'client_name','short_name']; + $clients = $this->select($columns) + ->where('is_active',1) + ->findAll(); + + // if($role_id == 2 || $role_id == 3){ + + // $clients = $this->select($columns) + // ->join('client_rm', 'client_rm.client_id = clients.id') + // ->where('client_rm.user_id', $user_id) + // ->where('clients.is_active',1) + // ->findAll(); + // } - $columns = ['id', 'client_name','short_name']; - $clients = $this->select($columns)->where('is_active',1)->findAll(); + foreach ($clients as &$client) { $clientPolicyModel = new ClientPolicyModel(); @@ -51,6 +67,7 @@ class ClientModel extends Model 'client_branch.client_id', 'client_policy.id as client_policy_id', 'client_policy.policy_terms', + 'client_policy.policy_no', 'p.name', 'pt.policy_type', ]) diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index a69cf852..8d2af103 100644 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -43,7 +43,8 @@ class ClientPolicyModel extends Model "reason_for_exit", "policy_no", "client_branch_id", - "cd_ac_no" + "cd_ac_no", + "gst", ]; public function getClientPolicyById($id){ diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 15bf295d..160eb71e 100644 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -100,11 +100,14 @@ class EmployeePolicyModel extends Model 'emp.gender', 'emp.emp_status', 'emp.is_active as emp_is_active', - 'emp.mobile as mobile' + 'emp.mobile as mobile', + 'policy_type.policy_type', + 'cp.policy_no', ]) ->join('employees emp', 'employee_polices.employee_id = emp.id') ->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy ->join('policies pm', 'cp.policy_id = pm.id') //pm - policy master + ->join('policy_type', 'policy_type.id = pm.policy_type_id') ->join('insurers im', 'cp.insurer_id = im.id') //im - insurer master ->join('insurer_branch ib', 'cp.insurer_branch_id = ib.id') //ib - insurer branch ->join('tpa tpam', 'cp.tpa_id = tpam.id', 'left') //tpam - tpa master @@ -702,7 +705,9 @@ class EmployeePolicyModel extends Model e.endorsement_id, ep.client_policy_id, policies.name as policy_name, - insurers.short_name as insurer_short_name + insurers.short_name as insurer_short_name, + client_policy.policy_no, + policy_type.policy_type '); $query1->distinct(); $query1->join('employee_polices ep', 'ep.id = e.pk'); @@ -710,6 +715,7 @@ class EmployeePolicyModel extends Model $query1->join('client_policy', 'client_policy.id = ep.client_policy_id'); $query1->join('client_branch', 'client_branch.id = employees.client_branch_id'); $query1->join('policies', 'policies.id = client_policy.policy_id'); + $query1->join('policy_type', 'policy_type.id = policies.policy_type_id'); $query1->join('insurers', 'insurers.id = policies.insurer_id'); $query1->whereIn('e.actions', ['c']); $query1->where('ep.client_policy_id', $policy_id); @@ -736,18 +742,21 @@ class EmployeePolicyModel extends Model e.remarks, ep.client_policy_id, policies.name as policy_name, - insurers.short_name as insurer_short_name + insurers.short_name as insurer_short_name, + client_policy.policy_no, + policy_type.policy_type '); $query2->join('employee_polices ep', 'ep.id = e.pk'); $query2->join('employees', 'employees.id = ep.employee_id'); $query2->join('client_policy', 'client_policy.id = ep.client_policy_id'); $query2->join('client_branch', 'client_branch.id = employees.client_branch_id'); $query2->join('policies', 'policies.id = client_policy.policy_id'); + $query2->join('policy_type', 'policy_type.id = policies.policy_type_id'); $query2->join('insurers', 'insurers.id = policies.insurer_id'); $query2->whereIn('e.actions', ['si', 'd']); $query2->where('ep.client_policy_id', $policy_id); $query2->where('employees.client_id', $client_id); - $query1->where('employees.client_branch_id', $branch_id); + $query2->where('employees.client_branch_id', $branch_id); if($status != 0 && !empty($status)){ $query2->where('e.status', $status); diff --git a/app/Views/UserList.php b/app/Views/UserList.php index c1794990..e53e341d 100644 --- a/app/Views/UserList.php +++ b/app/Views/UserList.php @@ -269,20 +269,19 @@ $(document).ready(function () { $('body').on('click', '.btnDelete', function () { Swal.fire({ - title: "Are you sure?", - text: "You won't be able to revert this!", - icon: "warning", - showCancelButton: true, - confirmButtonColor: "#3085d6", - cancelButtonColor: "#d33", - confirmButtonText: "Yes, delete it!" + title: "Are you sure?", + text: "You need to remove this user", + icon: "info", + showCancelButton: true, + confirmButtonColor: "#3085d6", + confirmButtonText: "Yes", }).then((result) => { if (result.isConfirmed) { var student_id = $(this).attr('data-id'); $.get(''+student_id, function (data) { console.log(data); - // $('#tickets-table tbody #'+ student_id).remove(); + toastr.success('User removed successfully', 'success'); window.location.reload() }) } diff --git a/app/Views/add_image_list.php b/app/Views/add_image_list.php new file mode 100644 index 00000000..9658053d --- /dev/null +++ b/app/Views/add_image_list.php @@ -0,0 +1,210 @@ + + +
+
+
+
+
+
+

Advertisement Image List

+
+
+ ADD +
+
+ + + + + + + + + + + + + + + + + + + + +
Advertisement Image NameStatusAction
+ + + +
+
+
+
+
+ + + +
+ + + + + \ No newline at end of file diff --git a/app/Views/batch_list.php b/app/Views/batch_list.php index 0b28f477..a909008c 100644 --- a/app/Views/batch_list.php +++ b/app/Views/batch_list.php @@ -6,6 +6,13 @@ .reload:hover { cursor: pointer; } + +.truncate { + max-width: 80px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +}
@@ -22,13 +29,13 @@ SNO - Batch
Code + Batch Code File Name Client - Client
Branch + Client Branch Client Policy - Event
Type - Insurer/
TPA + Event Type + Insurer/ TPA Action Count (₹)Amount @@ -46,13 +53,12 @@ - - + + - + - - diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 611fadd3..8690c71b 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -130,6 +130,12 @@
+ +
+ + +
+
- +
@@ -110,7 +110,7 @@ - + @@ -326,7 +326,7 @@ $.each(data, function(index, item) { var option = $(' - + - + diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php index c068ec39..15b70b51 100644 --- a/app/Views/insurer_or_tpa_data.php +++ b/app/Views/insurer_or_tpa_data.php @@ -415,7 +415,7 @@ $.each(data, function(index, item) { var option = $('
SNO
( ) - -
+ + - - ' . $file['first_name'] . '' ?>