Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2025-11-17 17:05:47 +05:30
commit 26a631b801
4 changed files with 73 additions and 22 deletions

View File

@ -462,6 +462,8 @@ $routes->post("employeeRest/changePassword", "RestAuthenticationController::chan
$routes->post("employeeRest/verifyPassword", "RestAuthenticationController::verifyPassword"); $routes->post("employeeRest/verifyPassword", "RestAuthenticationController::verifyPassword");
$routes->post("employeeRest/verifyOtp", "RestAuthenticationController::verifyOtp"); $routes->post("employeeRest/verifyOtp", "RestAuthenticationController::verifyOtp");
$routes->post("employeeRest/checkPassword", "RestAuthenticationController::checkPassword"); $routes->post("employeeRest/checkPassword", "RestAuthenticationController::checkPassword");
$routes->get("employeeRest/downloadSampleExcel", "EmployeeRestController::downloadSampleExcel");
// $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount"); // $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount");

View File

@ -412,27 +412,48 @@ class EmployeeController extends AdminController
* @return redirect back with an error message if the file is not found, otherwise sends the file to the user for download. * @return redirect back with an error message if the file is not found, otherwise sends the file to the user for download.
*/ */
public function downloadSampleExcelFile($actionType = null) public function downloadSampleExcelFile($actionType = null, $return_type = 0)
{ {
// $actionType = $this->request->getGet(); // $actionType = $this->request->getGet();
$filePath = ''; $filePath = '';
// Path to your file // Path to your file
if ($actionType == 'inception') { if ($actionType == 'inception') {
$filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls'; $filePath = ($return_type == 1)
? base_url('public/sample_excel/sample_inception.xls')
: ROOTPATH . 'public/sample_excel/sample_inception.xls';
} else if ($actionType == 'correction') { } else if ($actionType == 'correction') {
$filePath = ROOTPATH . 'public/sample_excel/sample_correction .xls'; $filePath = ($return_type == 1)
? base_url('public/sample_excel/sample_correction.xls')
: ROOTPATH . 'public/sample_excel/sample_correction.xls';
} else if ($actionType == 'si_enhancement') { } else if ($actionType == 'si_enhancement') {
$filePath = ROOTPATH . 'public/sample_excel/sample_si_enhancement.xls'; $filePath = ($return_type == 1)
? base_url('public/sample_excel/sample_si_enhancement.xls')
: ROOTPATH . 'public/sample_excel/sample_si_enhancement.xls';
} else if ($actionType == 'dependent_addtion') { } else if ($actionType == 'dependent_addtion') {
$filePath = ROOTPATH . 'public/sample_excel/sample_dependent_addition.xls'; $filePath = ($return_type == 1)
? base_url('public/sample_excel/sample_dependent_addition.xls')
: ROOTPATH . 'public/sample_excel/sample_dependent_addition.xls';
} else if ($actionType == 'addition') { } else if ($actionType == 'addition') {
$filePath = ROOTPATH . 'public/sample_excel/sample_addition.xls'; $filePath = ($return_type == 1)
? base_url('public/sample_excel/sample_addition.xls')
: ROOTPATH . 'public/sample_excel/sample_addition.xls';
} else if ($actionType == 'deletion') { } else if ($actionType == 'deletion') {
$filePath = ROOTPATH . 'public/sample_excel/sample_deletion.xls'; $filePath = ($return_type == 1)
? base_url('public/sample_excel/sample_deletion.xls')
: ROOTPATH . 'public/sample_excel/sample_deletion.xls';
} else if ($actionType == 'enrollment') { } else if ($actionType == 'enrollment') {
$filePath = ROOTPATH . 'public/sample_excel/enrollment.xlsx'; $filePath = ($return_type == 1)
? base_url('public/sample_excel/enrollment.xlsx')
: ROOTPATH . 'public/sample_excel/enrollment.xlsx';
} else if ($actionType == 'missed_inception') { } else if ($actionType == 'missed_inception') {
$filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls'; $filePath = ($return_type == 1)
? base_url('public/sample_excel/sample_inception.xls')
: ROOTPATH . 'public/sample_excel/sample_inception.xls';
}
if($return_type == 1){
return $filePath;
} }
// Check if the file exists // Check if the file exists

View File

@ -801,8 +801,16 @@ class EmployeeRestController extends AdminController
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]); $result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
if(isset($result['error_summary']) && count($result['error_summary'])) if(isset($result['error_summary']) && count($result['error_summary']))
{ {
if(isset($result['error_type'])){
$result = $empServiceController->getExcelErrorData($file_id); $result = $empServiceController->getExcelErrorData($file_id);
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "file upload failed with errors",'data' => $result], 200); return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "file upload failed with errors",'data' => $result], 200);
}else {
$message = "file upload failed with errors";
if(isset($result['error_data'])){
$message = $result['error_data'];
}
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => $message,'data' => $result], 200);
}
} }
@ -1094,9 +1102,19 @@ class EmployeeRestController extends AdminController
}else{ }else{
return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404); return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404);
} }
} catch (\Exception $e) { } catch (\Throwable $th) {
$this->myLogger->logme("error", ($e->getMessage().' --- '.$e->getLine() . '----' . $e->getTraceAsString())); $this->myLogger->logme("error", ($th->getMessage().' --- '.$th->getLine() . '----' . $th->getTraceAsString()));
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500); $errorData = [
'message' => $th->getMessage(),
'file' => $th->getFile(),
'line' => $th->getLine(),
'code' => $th->getCode(),
'trace' => $th->getTraceAsString(),
'trace_array' => $th->getTrace(), // full array version (optional)
'function' => $th->getTrace()[0]['function'] ?? null,
'class' => $th->getTrace()[0]['class'] ?? null,
];
return $this->respond(['status' => 'failed','code' => 500,'data' => $th->getMessage(), 'error_data' => $errorData], 500);
} }
@ -1782,7 +1800,7 @@ class EmployeeRestController extends AdminController
$post_branch_id = $this->request->getGet('post_branch_id'); $post_branch_id = $this->request->getGet('post_branch_id');
if ($pre_client_id != null) { if (!empty($pre_client_id)) {
$client = $this->clientModel->where('id', $pre_client_id)->first(); $client = $this->clientModel->where('id', $pre_client_id)->first();
@ -1810,8 +1828,7 @@ class EmployeeRestController extends AdminController
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
} }
} elseif ($post_client_id != null) { } elseif (!empty($post_client_id)) {
$restAuthController = new RestAuthenticationController; $restAuthController = new RestAuthenticationController;
@ -1819,7 +1836,6 @@ class EmployeeRestController extends AdminController
'client_id' => $post_client_id, 'client_id' => $post_client_id,
'client_branch_id' => $post_branch_id 'client_branch_id' => $post_branch_id
]; ];
return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails'); return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails');
} else { } else {
@ -3506,6 +3522,8 @@ class EmployeeRestController extends AdminController
} }
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
public function hrFileUpload() public function hrFileUpload()
{ {
@ -3642,6 +3660,17 @@ class EmployeeRestController extends AdminController
} }
} }
public function downloadSampleExcel()
{
$employeeController = new EmployeeController();
$file_path = $employeeController->downloadSampleExcelFile('enrollment', 1);
if(empty($file_path)){
return $this->respond(['status' => "success", 'code' => 404, 'data' => "", "message" => "Sample file not avilable"], 200);
}else{
return $this->respond(['status' => "success", 'code' => 200, 'data' => $file_path], 200);
}
}
} }

View File

@ -1570,8 +1570,7 @@ class RestAuthenticationController extends AdminController
if (isset($employeeData['employee_id']) && password_verify($old_password, $employeeData['password'])) { if (isset($employeeData['employee_id']) && password_verify($old_password, $employeeData['password'])) {
// Hash new password // Hash new password
// $newHashedPassword = password_hash($new_password, PASSWORD_DEFAULT); $newHashedPassword = password_hash($new_password, PASSWORD_DEFAULT);
$newHashedPassword = $new_password;
// Update password and clear OTP // Update password and clear OTP
$updated = $this->employeeModel->update($employeeData['employee_id'], [ $updated = $this->employeeModel->update($employeeData['employee_id'], [