From 5e26ae4057f61be88f312d555d6b1d2f8a52c5e3 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 6 Aug 2025 15:28:39 +0530 Subject: [PATCH 01/11] FIX_LIVE_ISSUE : RV --- app/Views/policy_gmc_terms.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 0d9b2bd..fdb3ae5 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -1223,13 +1223,9 @@ $('body').on('click', '.btnPolicyMaster', function() { if (jsonObject[key]['either-parents-pil'] == 1) { $('#family_floaters').val('EPORPIL'); - } else if (jsonObject[key].parents == 1 && jsonObject[key][ - 'parents-in-law' - ] == 1) { + } else if (jsonObject[key].parents == 1 && jsonObject[key]['parents-in-law'] == 1) { $('#family_floaters').val('2EPORPIL'); - } else if (jsonObject[key].parents == 2 && jsonObject[key][ - 'parents-in-law' - ] == 2) { + } else if (jsonObject[key].parents == 2 && jsonObject[key]['parents-in-law'] == 2) { $('#family_floaters').val('4EPORPIL'); } else if (jsonObject[key].parents == 1) { $('#family_floaters').val('1P'); @@ -1240,7 +1236,7 @@ $('body').on('click', '.btnPolicyMaster', function() { } else if (jsonObject[key]['parents-in-law'] == 2) { $('#family_floaters').val('2PIL'); } else if (jsonObject[key]['either-parents-pil'] == 2) { - $('#family_floaters').val('4EPORPIL'); + $('#family_floaters').val('2EPORPIL'); } } From 7d934d781d596265ce7e745866da0158ca553d69 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 7 Aug 2025 11:44:04 +0530 Subject: [PATCH 02/11] FIX_INCEPTION_EXPORT : RV --- app/Controllers/EmployeeController.php | 157 +++++++++++++------------ app/Models/EmployeePolicyModel.php | 37 +++--- 2 files changed, 101 insertions(+), 93 deletions(-) diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index f841d35..28a76c4 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -2477,7 +2477,8 @@ class EmployeeController extends AdminController //------------------------------------------------------------------------------------------------------ - public function test_members_list(){ + public function test_members_list() + { // $model = new EmployeeModel(); // $list = [ // ['relationship' => 'spouse','emp_code' => 'TEST002', 'name' => 'Lakshmi','email_personal' => 'lakshmi@gmail.com','mobile'=>'6382156701','gender'=>'female','dob'=>'1996-05-19','doj'=>'2022-02-01','basic_pay'=>'100000','emp_status'=>'enrolled'], @@ -2500,7 +2501,8 @@ class EmployeeController extends AdminController return $this->loadLayout('test_members_list',$data); } - public function mapEmployees(){ + public function mapEmployees() + { $client_id = $this->request->getPost('client_id'); $branch_id = $this->request->getPost('branch_id'); $policy_id = $this->request->getPost('client_policy_id'); @@ -2534,7 +2536,8 @@ class EmployeeController extends AdminController } } - public function getDataForMapping(){ + public function getDataForMapping() + { $policy_id = $this->request->getPost('policy_id');log_message('error',$policy_id); $data['policy_start_date'] = $this->clientPolicyModel->select('policy_start_date')->where('id',$policy_id)->first()['policy_start_date']; $data['si_amt'] = $this->PolicyPremium2Model->select('si')->where('client_policy_id', $policy_id)->groupBy('si')->findAll(); @@ -2542,7 +2545,8 @@ class EmployeeController extends AdminController return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200); } - public function unmapEmployees($actionType){ + public function unmapEmployees($actionType) + { $selected_employees = (array)$this->request->getPost('selected'); if($actionType == 0){ for($i = 0;$irequest->getPost('emp_id'); @@ -2712,7 +2714,8 @@ class EmployeeController extends AdminController } - public function formatFieldName($unformattedString){ + public function formatFieldName($unformattedString) + { if (str_contains($unformattedString, '_')) { $data = str_replace('_', ' ', $unformattedString); @@ -2726,88 +2729,88 @@ class EmployeeController extends AdminController } + //------------------------------------------------------------------------------------------------------ + public function download_inception() + { + $client = $this->request->getPost('client'); + $branch = $this->request->getPost('branch'); + $policies = $this->request->getPost('policies'); + $status = $this->request->getPost('status'); + $empCode = $this->request->getPost('empCode'); + $empName = $this->request->getPost('empName'); -public function download_inception() -{ - $client = $this->request->getPost('client'); - $branch = $this->request->getPost('branch'); - $policies = $this->request->getPost('policies'); - $status = $this->request->getPost('status'); - $empCode = $this->request->getPost('empCode'); - $empName = $this->request->getPost('empName'); + $result = $this->employeePolicyModel->download_inception( + $client, $branch, $policies, $status, $empCode, $empName + ); - $result = $this->employeePolicyModel->download_inception( - $client, $branch, $policies, $status, $empCode, $empName - ); + if (empty($result)) { + return $this->response->setStatusCode(204)->setBody('No data found'); + } - if (empty($result)) { - return $this->response->setStatusCode(204)->setBody('No data found'); - } + $formatted = []; + foreach ($result as $index => $row) { + $rowWithSerial = ['S.NO' => $index + 1] + $row; + $formatted[] = $rowWithSerial; + } + $result = $formatted; - $formatted = []; - foreach ($result as $index => $row) { - $rowWithSerial = ['S.NO' => $index + 1] + $row; - $formatted[] = $rowWithSerial; - } - $result = $formatted; + $spreadsheet = new Spreadsheet(); + $sheet = $spreadsheet->getActiveSheet(); - $spreadsheet = new Spreadsheet(); - $sheet = $spreadsheet->getActiveSheet(); + $headers = array_keys($result[0]); + $columnWidth = 20; // standard column width - $headers = array_keys($result[0]); - $columnWidth = 20; // standard column width - - $colIndex = 1; - foreach ($headers as $header) { - $columnLetter = Coordinate::stringFromColumnIndex($colIndex); - $cellCoordinate = $columnLetter . '1'; - - $sheet->setCellValue($cellCoordinate, ucfirst(str_replace('_', ' ', $header))); - - $sheet->getColumnDimension($columnLetter)->setWidth($columnWidth); - - $style = $sheet->getStyle($cellCoordinate); - $style->getFont()->setBold(true); - $style->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); - $style->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN); - - $colIndex++; - } - - $rowNum = 2; - foreach ($result as $row) { $colIndex = 1; - foreach ($row as $cell) { + foreach ($headers as $header) { $columnLetter = Coordinate::stringFromColumnIndex($colIndex); - $cellCoordinate = $columnLetter . $rowNum; - $sheet->setCellValue($cellCoordinate, $cell); + $cellCoordinate = $columnLetter . '1'; + + $sheet->setCellValue($cellCoordinate, ucfirst(str_replace('_', ' ', $header))); + + $sheet->getColumnDimension($columnLetter)->setWidth($columnWidth); + + $style = $sheet->getStyle($cellCoordinate); + $style->getFont()->setBold(true); + $style->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); + $style->getBorders()->getAllBorders()->setBorderStyle(Border::BORDER_THIN); + $colIndex++; } - $rowNum++; + + $rowNum = 2; + foreach ($result as $row) { + $colIndex = 1; + foreach ($row as $cell) { + $columnLetter = Coordinate::stringFromColumnIndex($colIndex); + $cellCoordinate = $columnLetter . $rowNum; + $sheet->setCellValue($cellCoordinate, $cell); + $colIndex++; + } + $rowNum++; + } + + + $exportDir = WRITEPATH . 'exports'; + if (!is_dir($exportDir)) { + mkdir($exportDir, 0777, true); + } else { + chmod($exportDir, 0777); + } + + $filename = 'inception_export_' . date('Ymd_His') . '.xlsx'; + $filepath = $exportDir . '/' . $filename; + + $writer = new Xlsx($spreadsheet); + $writer->save($filepath); + + return $this->response->setJSON([ + 'status' => 'success', + 'downloadUrl' => base_url('employee/download_file?file=' . urlencode($filename)) + ]); } - $exportDir = WRITEPATH . 'exports'; - if (!is_dir($exportDir)) { - mkdir($exportDir, 0777, true); - } else { - chmod($exportDir, 0777); - } - - $filename = 'inception_export_' . date('Ymd_His') . '.xlsx'; - $filepath = $exportDir . '/' . $filename; - - $writer = new Xlsx($spreadsheet); - $writer->save($filepath); - - return $this->response->setJSON([ - 'status' => 'success', - 'downloadUrl' => base_url('employee/download_file?file=' . urlencode($filename)) - ]); -} - - public function download_file() { $filename = $this->request->getGet('file'); diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 0ee72b6..d29c75f 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -1862,15 +1862,18 @@ class EmployeePolicyModel extends Model 'employee_polices.basic_cover_si As `Basic cover SI`', + "DATE_FORMAT(employee_polices.date_coverage, '%d-%b-%Y') AS `Date of Coverage`", "DATE_FORMAT(emp.doj, '%d-%b-%Y') AS `DOJ`", 'emp.basic_pay As `Basic Pay`', 'emp.band As `Band/Grade`', + 'emp.designation As `Designation`', 'emp.mobile as Phone', 'emp.email_corporate As Email', - 'emp.change_event', - 'employee_polices.pre_existing_alignments as `PRE EXISTING AILMENTS`', + 'COALESCE(employee_polices.pre_existing_alignments, 0) as `PRE EXISTING AILMENTS`', + + 'emp.change_event', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit', @@ -1902,25 +1905,27 @@ class EmployeePolicyModel extends Model $result->where('employee_polices.client_policy_id', $policy_id); } - if (is_array($status) && count($status) > 0) { + // if (is_array($status) && count($status) > 0) { - $result->where('employee_polices.status !=', 'expired'); + // $result->where('employee_polices.status !=', 'expired'); - if (in_array("active", $status)) { + // if (in_array("active", $status)) { - $result->where('employee_polices.tpa_id IS NOT NULL'); - $result->where('employee_polices.uhid IS NOT NULL'); - $result->whereIn('employee_polices.status', $status); - } elseif (in_array("pending", $status)) { + // $result->where('employee_polices.tpa_id IS NOT NULL'); + // $result->where('employee_polices.uhid IS NOT NULL'); + // $result->whereIn('employee_polices.status', $status); + // } elseif (in_array("pending", $status)) { - $result->where('employee_polices.tpa_id IS NULL'); - $result->where('employee_polices.uhid IS NULL'); - $result->whereIn('employee_polices.status', array_merge($status, ['active'])); - } else { + // $result->where('employee_polices.tpa_id IS NULL'); + // $result->where('employee_polices.uhid IS NULL'); + // $result->whereIn('employee_polices.status', array_merge($status, ['active'])); + // } else { - $result->whereIn('employee_polices.status', $status); - } - } + // $result->whereIn('employee_polices.status', $status); + // } + // } + + $result->where('employee_polices.status =', 'enrolled'); if (!empty(trim($emp_code))) { $result->where('emp.emp_code', $emp_code); From ba3a61476d5eaf4521cddad0b77bf15dc0fd5682 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Wed, 13 Aug 2025 14:10:09 +0530 Subject: [PATCH 03/11] CHANGE_ duplicate dependent restic : Vadivel --- app/Helpers/EmployeeHelper.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/app/Helpers/EmployeeHelper.php b/app/Helpers/EmployeeHelper.php index 6feadc8..6fd2e21 100644 --- a/app/Helpers/EmployeeHelper.php +++ b/app/Helpers/EmployeeHelper.php @@ -30,20 +30,25 @@ class EmployeeHelper public function validation_addEmployeeAndDependence($data){ - $employeeData = $this->employeeModel->where('emp_code',$data[0]->emp_code) - ->where('client_id',$data[0]->client_id) - ->where('client_branch_id',$data[0]->client_branch_id) - ->where('is_active', 1 ) - ->where('is_addon_value',0) - ->findAll(); - - $arr [] = $data; - + $arr [] = $data; + $client_policy_id = $data[0]->client_policy_id ; - + $array = $this->clientPolicyModel ->where('id',$client_policy_id) ->find(); + + $is_addon_value = $array[0]->is_addon; + + if($is_addon_value == 1){ $is_addon_value = 0 ; }else{ $is_addon_value = 1 ; } + + + $employeeData = $this->employeeModel->where('emp_code',$data[0]->emp_code) + ->where('client_id',$data[0]->client_id) + ->where('client_branch_id',$data[0]->client_branch_id) + ->where('is_active', 1 ) + ->where('is_addon_value',$is_addon_value) + ->findAll(); $array = $array[0]; From 20b0243dfb2851987e8e2c86af1b7b1ff0ff73c8 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Sat, 16 Aug 2025 12:41:43 +0530 Subject: [PATCH 04/11] CHANGE : double tab issue : GWM --- app/Helpers/EmployeeHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Helpers/EmployeeHelper.php b/app/Helpers/EmployeeHelper.php index 6fd2e21..e33e6dd 100644 --- a/app/Helpers/EmployeeHelper.php +++ b/app/Helpers/EmployeeHelper.php @@ -38,7 +38,7 @@ class EmployeeHelper ->where('id',$client_policy_id) ->find(); - $is_addon_value = $array[0]->is_addon; + $is_addon_value = $array[0]['is_addon']; if($is_addon_value == 1){ $is_addon_value = 0 ; }else{ $is_addon_value = 1 ; } From 45afb0ec90e35e2307d8511812718be1872f8c20 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Mon, 18 Aug 2025 17:21:03 +0530 Subject: [PATCH 05/11] CHANGE_ HR file upload rest api : GWM --- app/Config/Routes.php | 5 + app/Controllers/EmployeeController.php | 142 +++++++++++++++++++++++++ app/Models/HrFileUploadModel.php | 34 ++++++ 3 files changed, 181 insertions(+) create mode 100644 app/Models/HrFileUploadModel.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 4a21b1c..ed44377 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -495,6 +495,11 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage"); $routes->post("logHrActivity", "RestAuthenticationController::logHrActivity"); + $routes->get("hrFileList", "EmployeeRestController::hrFileList"); + $routes->get("hrFileUploadMasters", "EmployeeRestController::hrFileUploadMasters"); + $routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload"); + $routes->post("hrFileUpload", "RestAuthenticationController::hrFileUpload"); + }); $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); $routes->get("sendPushNotification", "EmployeeRestController::sendPushNotification"); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 28a76c4..b754828 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -27,6 +27,7 @@ use App\Models\ClientDepositModel; use App\Models\PolicyPremium2Model; use App\Models\AuditHistoryModel; use App\Models\UserModel; +use App\Models\HrFileUploadModel; @@ -73,6 +74,7 @@ class EmployeeController extends AdminController protected $PolicyPremium2Model; protected $auditHistory; protected $userModel; + protected $hrFileUploadModel; public function __construct() @@ -96,6 +98,7 @@ class EmployeeController extends AdminController $this->PolicyPremium2Model = new PolicyPremium2Model(); $this->auditHistory = new AuditHistoryModel(); $this->userModel = new userModel(); + $this->hrFileUploadModel = new HrFileUploadModel(); } public function list() @@ -2825,4 +2828,143 @@ class EmployeeController extends AdminController + //-------------------------------------------------------------------------------------------- + public function hrFileUpload() + { + try { + // Check file + $file = $this->request->getFile('file_name'); + if (!$file->isValid()) { + return $this->failValidationErrors(['file_name' => 'Invalid or missing file']); + } + + // Upload folder path + $uploadPath = WRITEPATH . 'uploads/hr_files/'; + + // If directory not exists, create it + if (!is_dir($uploadPath)) { + mkdir($uploadPath, 0777, true); + } + + // New file name with timestamp + $newFileName = time() . '_' . $file->getRandomName(); + + // Move file + $file->move($uploadPath, $newFileName); + + // Prepare data + $data = [ + 'client_id' => $this->request->getPost('client_id'), + 'client_branch_id' => $this->request->getPost('client_branch_id'), + 'policy_no' => $this->request->getPost('policy_no'), + 'file_name' => $newFileName, + 'file_action' => $this->request->getPost('file_action'), + 'status' => $this->request->getPost('status'), + 'created_by' => $this->request->getPost('created_by'), + 'updated_by' => $this->request->getPost('created_by'), + ]; + + // Save into DB + $this->hrFileUploadModel->insert($data); + + return $this->respondCreated([ + 'status' => true, + 'message' => 'File uploaded successfully', + 'data' => $data + ]); + + } catch (\Exception $e) { + return $this->failServerError($e->getMessage()); + } + + } + + public function hrFileDownload($id = null) + { + try { + + $file_id = $this->request->getFile('id') ?? $id; + + // Find record + $record = $this->hrFileUploadModel->find($file_id); + + if (!$record) { + return $this->failNotFound("File record not found"); + } + + $uploadPath = WRITEPATH . 'uploads/hr_files/'; + $filePath = $uploadPath . $record['file_name']; + + if (!file_exists($filePath)) { + return $this->failNotFound("File not found on server"); + } + + // Force file download + return $this->response->download($filePath, null) + ->setFileName($record['file_name']); + } catch (\Exception $e) { + return $this->failServerError($e->getMessage()); + } + } + + public function hrFileList() + { + try { + $request = service('request'); + $builder = $this->hrFileUploadModel; + + // Allowed filter keys + $filters = [ + 'client_id', + 'client_branch_id', + 'policy_no', + 'file_action', + 'status', + 'created_by' + ]; + + // Apply filters dynamically + foreach ($filters as $key) { + $value = $request->getGetPost($key); // supports both GET and POST + if (!empty($value)) { + $builder->where($key, $value); + } + } + + // Fetch results + $data = $builder->findAll(); + + return $this->respond([ + 'status' => true, + 'message' => 'File list fetched successfully', + 'data' => $data + ]); + } catch (\Exception $e) { + return $this->failServerError($e->getMessage()); + } + } + + public function hrFileUploadMasters() + { + try { + //for inception upload + $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement']; + + return $this->respond([ + 'status' => true, + 'message' => 'File inception upload masters', + 'data' => $data + ]); + } catch (\Exception $e) { + return $this->failServerError($e->getMessage()); + } + } + + + + + + + + } diff --git a/app/Models/HrFileUploadModel.php b/app/Models/HrFileUploadModel.php new file mode 100644 index 0000000..e5e2a22 --- /dev/null +++ b/app/Models/HrFileUploadModel.php @@ -0,0 +1,34 @@ + Date: Tue, 19 Aug 2025 12:15:58 +0530 Subject: [PATCH 06/11] CHANGE : is_premium_summary key missing live issue : gwm --- app/Controllers/EmployeeRestController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 8069280..e6371f0 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1335,7 +1335,7 @@ class EmployeeRestController extends AdminController $array->family_floaters_of_dependent_and_gst_value = 0; } - $checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms') + $checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms , client_policy.is_premium_summery as is_premium_summery') ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') ->where('client_policy.policy_type_id', 3 ) ->where('client_policy.is_addon', 1 ) From cfbf7fada28601fbc27bbf339d18359a0a4ac960 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Tue, 19 Aug 2025 15:44:22 +0530 Subject: [PATCH 07/11] CHANGE_the Pre-Enrolment app - the Mobile and Email already exits alerts are showing even before entering any text :GWM --- app/Controllers/ClientController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 678100a..ea65bca 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -133,6 +133,9 @@ class ClientController extends AdminController $field = $this->request->getPost('field'); $value = $this->request->getPost('value'); + if($value == '') + return $this->response->setJSON(['isDuplicate' => false]); + // Load the database if not already loaded $db = db_connect(); From 06b3d4f0e8cc6a7aecf89c29d5a55decf29c3a79 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Wed, 20 Aug 2025 09:42:28 +0530 Subject: [PATCH 08/11] CHANGES_HR file upload changes : GWM --- app/Config/Routes.php | 2 +- app/Controllers/EmployeeController.php | 131 ------------------- app/Controllers/EmployeeRestController.php | 138 ++++++++++++++++++++- 3 files changed, 138 insertions(+), 133 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index ed44377..601c3d8 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -498,7 +498,7 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) { $routes->get("hrFileList", "EmployeeRestController::hrFileList"); $routes->get("hrFileUploadMasters", "EmployeeRestController::hrFileUploadMasters"); $routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload"); - $routes->post("hrFileUpload", "RestAuthenticationController::hrFileUpload"); + $routes->post("hrFileUpload", "EmployeeRestController::hrFileUpload"); }); $routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy"); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index b754828..c9a0298 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -2828,137 +2828,6 @@ class EmployeeController extends AdminController - //-------------------------------------------------------------------------------------------- - public function hrFileUpload() - { - try { - // Check file - $file = $this->request->getFile('file_name'); - if (!$file->isValid()) { - return $this->failValidationErrors(['file_name' => 'Invalid or missing file']); - } - - // Upload folder path - $uploadPath = WRITEPATH . 'uploads/hr_files/'; - - // If directory not exists, create it - if (!is_dir($uploadPath)) { - mkdir($uploadPath, 0777, true); - } - - // New file name with timestamp - $newFileName = time() . '_' . $file->getRandomName(); - - // Move file - $file->move($uploadPath, $newFileName); - - // Prepare data - $data = [ - 'client_id' => $this->request->getPost('client_id'), - 'client_branch_id' => $this->request->getPost('client_branch_id'), - 'policy_no' => $this->request->getPost('policy_no'), - 'file_name' => $newFileName, - 'file_action' => $this->request->getPost('file_action'), - 'status' => $this->request->getPost('status'), - 'created_by' => $this->request->getPost('created_by'), - 'updated_by' => $this->request->getPost('created_by'), - ]; - - // Save into DB - $this->hrFileUploadModel->insert($data); - - return $this->respondCreated([ - 'status' => true, - 'message' => 'File uploaded successfully', - 'data' => $data - ]); - - } catch (\Exception $e) { - return $this->failServerError($e->getMessage()); - } - - } - - public function hrFileDownload($id = null) - { - try { - - $file_id = $this->request->getFile('id') ?? $id; - - // Find record - $record = $this->hrFileUploadModel->find($file_id); - - if (!$record) { - return $this->failNotFound("File record not found"); - } - - $uploadPath = WRITEPATH . 'uploads/hr_files/'; - $filePath = $uploadPath . $record['file_name']; - - if (!file_exists($filePath)) { - return $this->failNotFound("File not found on server"); - } - - // Force file download - return $this->response->download($filePath, null) - ->setFileName($record['file_name']); - } catch (\Exception $e) { - return $this->failServerError($e->getMessage()); - } - } - - public function hrFileList() - { - try { - $request = service('request'); - $builder = $this->hrFileUploadModel; - - // Allowed filter keys - $filters = [ - 'client_id', - 'client_branch_id', - 'policy_no', - 'file_action', - 'status', - 'created_by' - ]; - - // Apply filters dynamically - foreach ($filters as $key) { - $value = $request->getGetPost($key); // supports both GET and POST - if (!empty($value)) { - $builder->where($key, $value); - } - } - - // Fetch results - $data = $builder->findAll(); - - return $this->respond([ - 'status' => true, - 'message' => 'File list fetched successfully', - 'data' => $data - ]); - } catch (\Exception $e) { - return $this->failServerError($e->getMessage()); - } - } - - public function hrFileUploadMasters() - { - try { - //for inception upload - $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement']; - - return $this->respond([ - 'status' => true, - 'message' => 'File inception upload masters', - 'data' => $data - ]); - } catch (\Exception $e) { - return $this->failServerError($e->getMessage()); - } - } diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index e6371f0..ba01672 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -32,7 +32,7 @@ use App\Models\ClientBranchModel; use App\Models\AuditHistoryModel; use App\Models\SIMappingModel; use App\Models\InsurerModel; - +use App\Models\HrFileUploadModel; use App\Controllers\Jobs ; use App\Controllers\JobWorker ; @@ -79,6 +79,7 @@ class EmployeeRestController extends AdminController protected $siMappingModel; protected $employeeHelper; protected $insurerModel; + protected $hrFileUploadModel; public function __construct() @@ -106,6 +107,7 @@ class EmployeeRestController extends AdminController $this->siMappingModel = new SIMappingModel(); $this->employeeHelper = new EmployeeHelper(); $this->insurerModel = new InsurerModel(); + $this->hrFileUploadModel = new HrFileUploadModel(); } @@ -3494,4 +3496,138 @@ class EmployeeRestController extends AdminController } + //-------------------------------------------------------------------------------------------- + public function hrFileUpload() + { + try { + // Check file + $file = $this->request->getFile('file_name'); + if (!$file->isValid()) { + return $this->failValidationErrors(['file_name' => 'Invalid or missing file']); + } + + // Upload folder path + $uploadPath = WRITEPATH . 'uploads/hr_files/'; + + // If directory not exists, create it + if (!is_dir($uploadPath)) { + mkdir($uploadPath, 0777, true); + } + + // New file name with timestamp + $newFileName = time() . '_' . $file->getRandomName(); + + // Move file + $file->move($uploadPath, $newFileName); + + // Prepare data + $data = [ + 'client_id' => $this->request->getPost('client_id'), + 'client_branch_id' => $this->request->getPost('client_branch_id'), + 'policy_no' => $this->request->getPost('policy_no'), + 'file_name' => $newFileName, + 'file_action' => $this->request->getPost('file_action'), + 'status' => $this->request->getPost('status'), + 'created_by' => $this->request->getPost('created_by'), + 'updated_by' => $this->request->getPost('created_by'), + ]; + + // Save into DB + $this->hrFileUploadModel->insert($data); + + return $this->respondCreated([ + 'status' => true, + 'message' => 'File uploaded successfully', + 'data' => $data + ]); + + } catch (\Exception $e) { + return $this->failServerError($e->getMessage()); + } + + } + + public function hrFileDownload($id = null) + { + try { + + $file_id = $this->request->getFile('id') ?? $id; + + // Find record + $record = $this->hrFileUploadModel->find($file_id); + + if (!$record) { + return $this->failNotFound("File record not found"); + } + + $uploadPath = WRITEPATH . 'uploads/hr_files/'; + $filePath = $uploadPath . $record['file_name']; + + if (!file_exists($filePath)) { + return $this->failNotFound("File not found on server"); + } + + // Force file download + return $this->response->download($filePath, null) + ->setFileName($record['file_name']); + } catch (\Exception $e) { + return $this->failServerError($e->getMessage()); + } + } + + public function hrFileList() + { + try { + $request = service('request'); + $builder = $this->hrFileUploadModel; + + // Allowed filter keys + $filters = [ + 'client_id', + 'client_branch_id', + 'policy_no', + 'file_action', + 'status', + 'created_by' + ]; + + // Apply filters dynamically + foreach ($filters as $key) { + $value = $request->getGetPost($key); // supports both GET and POST + if (!empty($value)) { + $builder->where($key, $value); + } + } + + // Fetch results + $data = $builder->findAll(); + + return $this->respond([ + 'status' => true, + 'message' => 'File list fetched successfully', + 'data' => $data + ]); + } catch (\Exception $e) { + return $this->failServerError($e->getMessage()); + } + } + + public function hrFileUploadMasters() + { + try { + //for inception upload + $data['actions'] = ['inception' => 'Inception (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'addition' => 'Addition (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement']; + + return $this->respond([ + 'status' => true, + 'message' => 'File inception upload masters', + 'data' => $data + ]); + } catch (\Exception $e) { + return $this->failServerError($e->getMessage()); + } + } + + + } \ No newline at end of file From a46d14881b736bd517e5798344d6942c84736d94 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Wed, 20 Aug 2025 11:29:53 +0530 Subject: [PATCH 09/11] CHANGES_HR file upload changes : GWM --- app/Controllers/EmployeeRestController.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index ba01672..926fde7 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -3502,8 +3502,12 @@ class EmployeeRestController extends AdminController try { // Check file $file = $this->request->getFile('file_name'); - if (!$file->isValid()) { - return $this->failValidationErrors(['file_name' => 'Invalid or missing file']); + if (!$file) { + return $this->response->setJSON([ + 'status' => false, + 'message' => "Invalid file or file not uploaded.", + 'data' => "No Data" + ]); } // Upload folder path @@ -3551,7 +3555,7 @@ class EmployeeRestController extends AdminController { try { - $file_id = $this->request->getFile('id') ?? $id; + $file_id = $this->request->getGet('id') ?? $id; // Find record $record = $this->hrFileUploadModel->find($file_id); From d3f1335a2206cd9e64dcb1ae14c7e2328e5a93e3 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 21 Aug 2025 14:57:28 +0530 Subject: [PATCH 10/11] FIX_CONFIRMATION_MAIL_TEMPLATE_AND_ENROLLMENT_VISIBILITY : RV --- app/Controllers/EmployeeController.php | 6 +++--- app/Controllers/EmployeeRestController.php | 4 +++- app/Helpers/sendMailNotification.php | 11 ++++++----- app/Views/policy_gmc_terms.php | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 28a76c4..6ee780e 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -1970,7 +1970,7 @@ class EmployeeController extends AdminController $policy_terms = isset($policy_details['policy_terms']) ? true : false; $si_enhancement_true_or_false = 1; - if($policy_terms){ + if($policy_terms == true){ $policyTermsData = json_decode($policy_details['policy_terms']); if (isset($policyTermsData->suminsuredenhancement) && $policyTermsData->suminsuredenhancement !== null) { @@ -1983,7 +1983,7 @@ class EmployeeController extends AdminController $message = null; - if (!isset($policy_terms)) { + if ($policy_terms == false) { $message .= 'Policy terms'; } @@ -1993,7 +1993,7 @@ class EmployeeController extends AdminController } $message = isset($message) ? ($message . ' not defined for choosed policy') : null; - return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false, 'insurer_multi_event' => $insurer_details['is_multi_event']], 200); + return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false, 'insurer_multi_event' => $insurer_details['is_multi_event'] ?? null], 200); } diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 8069280..f97181c 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1335,13 +1335,14 @@ class EmployeeRestController extends AdminController $array->family_floaters_of_dependent_and_gst_value = 0; } - $checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms') + $checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms, client_policy.enrolment_visibility') ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') ->where('client_policy.policy_type_id', 3 ) ->where('client_policy.is_addon', 1 ) ->where('client_policy.client_id', $this->request->getGet('client_id') ) ->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') ) ->where('client_policy.is_active', 1 ) + ->where('client_policy.enrolment_visibility', 1 ) ->get() ->getResult(); if($checkGmcParentsPolicyExist) @@ -1903,6 +1904,7 @@ class EmployeeRestController extends AdminController ->where('client_branch_id',$this->request->getGet('client_branch_id')) ->where('policy_status', 1) ->where('is_active', 1) + ->where('enrolment_visibility', 1) ->findAll(); if(count($clientPolicy)) diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index 743ca23..10b38a3 100755 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -11,6 +11,7 @@ use App\Models\EmployeeModel; use App\Models\PolicyPremium1Model; use App\Models\PolicyPremium2Model; use App\Models\MailAttachmentModel; +use Kint\Kint; class sendMailNotification { @@ -342,10 +343,10 @@ class sendMailNotification $gst = 0; } - // dd($payable_employee_array); + // Kint::dump($payable_employee_array); // dd(count($payable_employee_array['emp_data'])); - if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0 && $client_policy_data['is_premium_summery'] == 1){ + if(isset($payable_employee_array['emp_data']) && count($payable_employee_array['emp_data']) > 0){ $table_content .= '

Policy Type :'; $temp_data = ''; @@ -402,7 +403,7 @@ class sendMailNotification // dd($si); // Premium summery for show and hide the Additional premium data - if($client_policy_data['is_premium_summery'] == 1){ + if($inner_item['payable_employee'] == 1 || $client_policy_data['is_premium_summery'] == 1){ if($policy_premium_data['premium_type'] == 2){ $temp_data .= '' . $si . ''; @@ -458,7 +459,7 @@ class sendMailNotification $table_content .= 'Sum Insured'; // Premium summery for show and hide the Additional premium data - if($client_policy_data['is_premium_summery'] == 1){ + if($inner_item['payable_employee'] == 1 || $client_policy_data['is_premium_summery'] == 1){ $table_content .= 'Premium'; $table_content .= 'GST'; } @@ -471,7 +472,7 @@ class sendMailNotification $table_content .= '

'; // Premium summery for show and hide the Additional premium data - if($client_policy_data['is_premium_summery'] == 1){ + if($inner_item['payable_employee'] == 1 || $client_policy_data['is_premium_summery'] == 1){ $addon_list_array = [ 'policy_name' => $policy_name_for_policy_type . '( Payable By Employee )', 'addtional_premium' => round($addtional_premium), diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index fdb3ae5..f1a120d 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -354,7 +354,7 @@ label {
+ value="">
From e5afea81f19ebe2b4e80e850fb1364da9d3a1b49 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 22 Aug 2025 08:44:22 +0530 Subject: [PATCH 11/11] FIX_EMPLOYEE_EDIT_VALIDATE : RV --- app/Controllers/ClientController.php | 10 +++++++--- app/Views/employee_data_list.php | 22 +++++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index ea65bca..fdf55ca 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -133,15 +133,19 @@ class ClientController extends AdminController $field = $this->request->getPost('field'); $value = $this->request->getPost('value'); - if($value == '') - return $this->response->setJSON(['isDuplicate' => false]); + // print_rr($value); die; + if($value == '') return $this->response->setJSON(['isDuplicate' => false]); // Load the database if not already loaded $db = db_connect(); // Perform the query $builder = $db->table($table); - $isDuplicate = $builder->where($field, $value)->where('is_active', 1)->countAllResults() > 0; + if(is_array($value)){ + $isDuplicate = $builder->where($value)->where('is_active', 1)->countAllResults() > 0; + }else{ + $isDuplicate = $builder->where($field, $value)->where('is_active', 1)->countAllResults() > 0; + } // Return the result return $this->response->setJSON(['isDuplicate' => $isDuplicate]); diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index 292827e..c3f2c24 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -348,14 +348,14 @@ + onkeyup="validateInput(this, 'employees', 'email_corporate')" required>
+ onkeyup="validateInput(this, 'employees', 'mobile')" required>
@@ -677,6 +677,11 @@ function send_mail_for_individual_employee_ecard(id) { function validateInput(input, table, field) { + let emp_code = $('#emp_code_for_edit').val(); + let client_id = $('#clients').val(); + console.log("emp_code", emp_code); + console.log("client_id", client_id); + let value = $(input).val(); let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim(); @@ -685,10 +690,18 @@ function validateInput(input, table, field) { message = label + " already exists!"; } - checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) { + let data = {}; + data["emp_code !="] = emp_code; + data[field] = value; + + console.log(data); + + checkDuplicateTableFieldValue(table, field, data, function(isDuplicate) { if (isDuplicate) { toastr.warning(message, 'WARNING'); - $(input).val('') + $("#btnSubmit").prop('disabled', true); + }else{ + $("#btnSubmit").prop('disabled', false); } }); @@ -722,7 +735,6 @@ function closeModal() { } - function get_emp_history(input, emp_id) { $('.loader').fadeIn(); $('.loader-mask').fadeIn();