FEAT_HR_SAMPL_FILE_DOWNLOAD
This commit is contained in:
parent
d38e253fbc
commit
96c825197b
@ -462,7 +462,7 @@ $routes->post("employeeRest/changePassword", "RestAuthenticationController::chan
|
||||
$routes->post("employeeRest/verifyPassword", "RestAuthenticationController::verifyPassword");
|
||||
$routes->post("employeeRest/verifyOtp", "RestAuthenticationController::verifyOtp");
|
||||
$routes->post("employeeRest/checkPassword", "RestAuthenticationController::checkPassword");
|
||||
$routes->get("employeeRest/downloadSampleExcel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
|
||||
$routes->get("employeeRest/downloadSampleExcel", "EmployeeRestController::downloadSampleExcel");
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
|
||||
public function downloadSampleExcelFile($actionType = null)
|
||||
public function downloadSampleExcelFile($actionType = null, $return_type = 0)
|
||||
{
|
||||
// $actionType = $this->request->getGet();
|
||||
$filePath = '';
|
||||
|
||||
// Path to your file
|
||||
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') {
|
||||
$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') {
|
||||
$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') {
|
||||
$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') {
|
||||
$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') {
|
||||
$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') {
|
||||
$filePath = ROOTPATH . 'public/sample_excel/enrollment.xlsx';
|
||||
}else if ($actionType == 'missed_inception') {
|
||||
$filePath = ROOTPATH . 'public/sample_excel/sample_inception.xls';
|
||||
$filePath = ($return_type == 1)
|
||||
? base_url('public/sample_excel/enrollment.xlsx')
|
||||
: ROOTPATH . 'public/sample_excel/enrollment.xlsx';
|
||||
} else if ($actionType == 'missed_inception') {
|
||||
$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
|
||||
|
||||
@ -3522,6 +3522,8 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------
|
||||
public function hrFileUpload()
|
||||
{
|
||||
@ -3658,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user