FEAT_IR_FILE_UPLOAD
This commit is contained in:
parent
4544568755
commit
ea30f6cfa8
@ -651,6 +651,7 @@ $routes->group("employeeRest", ["filter" => ["authJWT"]], function ($routes) {
|
|||||||
$routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
|
$routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
|
||||||
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
|
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
|
||||||
$routes->get('getClaimTypeMaster',"EmployeeRestController::getClaimTypeMaster");
|
$routes->get('getClaimTypeMaster',"EmployeeRestController::getClaimTypeMaster");
|
||||||
|
$routes->get('uploadIRDocs',"EmployeeRestController::uploadIRDocs");
|
||||||
|
|
||||||
// add retail policy
|
// add retail policy
|
||||||
$routes->post("addEmpRetailPolicy", "EmployeeRestController::addEmpRetailPolicy");
|
$routes->post("addEmpRetailPolicy", "EmployeeRestController::addEmpRetailPolicy");
|
||||||
|
|||||||
@ -3747,7 +3747,7 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handleCliamFiles($data, $ticket_id, $ticket_message_id = null)
|
public function handleCliamFiles($data, $ticket_id, $ticket_message_id = null, $tpa_claim_push = true, $ir_docs = false)
|
||||||
{
|
{
|
||||||
if (!empty($data) && !empty($ticket_id)) {
|
if (!empty($data) && !empty($ticket_id)) {
|
||||||
$insert_ids = [];
|
$insert_ids = [];
|
||||||
@ -3765,6 +3765,10 @@ class EmployeeRestController extends AdminController
|
|||||||
'mime_type' => getMimeTypeByFileName($value['file_name']),
|
'mime_type' => getMimeTypeByFileName($value['file_name']),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if($ir_docs == true){
|
||||||
|
$data['docs_for_ir'] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$insert_ids[] = $claim_file->insert($data);
|
$insert_ids[] = $claim_file->insert($data);
|
||||||
|
|
||||||
if (getMimeTypeByFileName($value['file_name']) == "application/pdf") {
|
if (getMimeTypeByFileName($value['file_name']) == "application/pdf") {
|
||||||
@ -3772,16 +3776,19 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($pdf_exist_in_the_file) {
|
if ($pdf_exist_in_the_file && $tpa_claim_push == true) {
|
||||||
// this call for TPA integration
|
// this call for TPA integration
|
||||||
$apiServiceController = new ApiServiceController();
|
$apiServiceController = new ApiServiceController();
|
||||||
$apiServiceController->pushClaims($ticket_id);
|
$apiServiceController->pushClaims($ticket_id);
|
||||||
log_message('error', "pushClaims function called with Ticket ID: {$ticket_id}, In Employee Rest Controller");
|
log_message('error', "pushClaims function called with Ticket ID: {$ticket_id}, In Employee Rest Controller");
|
||||||
} else {
|
} else {
|
||||||
log_message('error', "Failed to call the pushClaims function in EmployeeRestController for Ticket ID: {$ticket_id}, because the .pdf file does not exist.");
|
if($tpa_claim_push == false){
|
||||||
|
log_message('error', 'Skip the TPA claim push');
|
||||||
|
}else{
|
||||||
|
log_message('error', "Failed to call the pushClaims function in EmployeeRestController for Ticket ID: {$ticket_id}, because the .pdf file does not exist.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $insert_ids;
|
return $insert_ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4973,6 +4980,34 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
return $this->respond(['status' => 200,'message' => 'success','data' => $data]);
|
return $this->respond(['status' => 200,'message' => 'success','data' => $data]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function uploadIRDocs()
|
||||||
|
{
|
||||||
|
$ticket_id = $this->request->getPost('ticket_id') ?? null;
|
||||||
|
$get_file_data = $this->request->getFiles('claim_docs') ?? null;
|
||||||
|
$get_docs_name = $this->request->getPost('claim_doc_names') ?? [];
|
||||||
|
|
||||||
|
if (is_string($get_docs_name)) {
|
||||||
|
$decoded = json_decode($get_docs_name, true);
|
||||||
|
$get_docs_name = json_last_error() === JSON_ERROR_NONE ? $decoded : [];
|
||||||
|
} elseif (!is_array($get_docs_name)) {
|
||||||
|
$get_docs_name = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$file_data = [];
|
||||||
|
if (isset($get_file_data) && !empty($get_file_data)) {
|
||||||
|
$file_path = WRITEPATH . 'uploads/claim_files/';
|
||||||
|
$file_data = multi_file_Upload($get_file_data, $file_path, $get_docs_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->handleCliamFiles($file_data, $ticket_id, null, false, true);
|
||||||
|
|
||||||
|
if(!empty($result)){
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Files uploaded successfully'], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false, 'code' => 400, 'message' => 'Failed to upload the file'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class ClaimFilesModel extends Model
|
|||||||
'is_active',
|
'is_active',
|
||||||
'file_name',
|
'file_name',
|
||||||
'mime_type',
|
'mime_type',
|
||||||
|
'docs_for_ir',
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user