Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
9ead4735ed
@ -651,6 +651,7 @@ $routes->group("employeeRest", ["filter" => ["authJWT"]], function ($routes) {
|
||||
$routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
|
||||
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
|
||||
$routes->get('getClaimTypeMaster',"EmployeeRestController::getClaimTypeMaster");
|
||||
$routes->post('uploadIRDocs',"EmployeeRestController::uploadIRDocs");
|
||||
|
||||
// add retail policy
|
||||
$routes->post("addEmpRetailPolicy", "EmployeeRestController::addEmpRetailPolicy");
|
||||
|
||||
@ -3749,7 +3749,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)) {
|
||||
$insert_ids = [];
|
||||
@ -3767,6 +3767,10 @@ class EmployeeRestController extends AdminController
|
||||
'mime_type' => getMimeTypeByFileName($value['file_name']),
|
||||
];
|
||||
|
||||
if($ir_docs == true){
|
||||
$data['docs_for_ir'] = 1;
|
||||
}
|
||||
|
||||
$insert_ids[] = $claim_file->insert($data);
|
||||
|
||||
if (getMimeTypeByFileName($value['file_name']) == "application/pdf") {
|
||||
@ -3774,16 +3778,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
|
||||
$apiServiceController = new ApiServiceController();
|
||||
$apiServiceController->pushClaims($ticket_id);
|
||||
log_message('error', "pushClaims function called with Ticket ID: {$ticket_id}, In Employee Rest Controller");
|
||||
} 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;
|
||||
}
|
||||
|
||||
@ -4975,6 +4982,40 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
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') ?? [];
|
||||
$required_docs = $this->request->getPost('required_docs') ?? [];
|
||||
|
||||
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)){
|
||||
// $this->ticketMaster->where('id', $ticket_id)->set(['required_docs', $required_docs])->update();
|
||||
db_connect()->query(
|
||||
"UPDATE ticket_master SET required_docs = ? WHERE id = ?",
|
||||
[$required_docs, $ticket_id]
|
||||
);
|
||||
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',
|
||||
'file_name',
|
||||
'mime_type',
|
||||
'docs_for_ir',
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
|
||||
Loading…
Reference in New Issue
Block a user