diff --git a/app/Controllers/ApiServiceController.php b/app/Controllers/ApiServiceController.php
index f908fa91..dac26cb1 100644
--- a/app/Controllers/ApiServiceController.php
+++ b/app/Controllers/ApiServiceController.php
@@ -42,7 +42,7 @@ class ApiServiceController extends BaseController
$mediAssistController = new MediAssistApiController();
return $mediAssistController->SubmitClaim($claimId);
}else{
-
+ log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
}
}
@@ -117,8 +117,13 @@ class ApiServiceController extends BaseController
$filesData = $fileModel->where('is_active', 1)->where('action', 'api')->where('status', 'inprogress')->countAllResults();
if($filesData > 0){
- log_message('error', "Already the TPA GetBenefDetails job inprocess");
- return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA initiation is in progress.','data' => [] ]);
+ log_message('error', "TPA GetBenefDetails job is already in process.");
+ return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA initiation is in progress.','data' => [] ]);
+ }
+
+ if (empty($policy_no)) {
+ log_message('error', 'GetBenefDetails: policy_no missing in request');
+ return $this->respond(['status' => false, 'message' => 'policy_no required']);
}
$data = [
@@ -128,15 +133,16 @@ class ApiServiceController extends BaseController
'client_id' => $client_id,
'policy_id' => $policy_id,
'client_branch_id'=> $branch_id,
+ 'created_by'=> get_session_userid(),
];
- if ($tpa_id == 2) // MediAssist
+ if ($tpa_id == 1) // MediAssist
{
$file_id = $fileModel->insert($data);
log_message('error', "Files table inserted successfully, File id : {$file_id}");
// $mediAssistController = new MediAssistApiController();
// $mediAssistController->GetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] );
- $r = Jobs::addJob(['job_name' => 'GetBenefDetails', 'payload' => ['polict_no' => $policy_no, 'file_id' => $file_id]]);
+ $r = Jobs::addJob(['job_name' => 'GetBenefDetails', 'payload' => ['policy_no' => $policy_no, 'file_id' => $file_id, 'return_type' => 'job']]);
log_message('error', "GetBenefDetails job pushed successfully.");
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index 908a1ede..97991061 100755
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -5651,6 +5651,10 @@ class ClientController extends AdminController
// dd($return);
// die;
+ // $ticket_id = 515;
+ // $apiServiceController = new ApiServiceController();
+ // $apiServiceController->pushClaims($ticket_id); die;
+
// $employeeController = new EmployeeController();
// $employeeController->truncateFileData('633');
diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php
index 7d14927a..57a05395 100755
--- a/app/Controllers/EmployeeController.php
+++ b/app/Controllers/EmployeeController.php
@@ -2289,8 +2289,10 @@ class EmployeeController extends AdminController
$si_enhancement_true_or_false = $policyTermsData->suminsuredenhancement;
}
}
-
+ $employeeRest = new EmployeeRestController();
+ $tpa_api_service_status = $employeeRest->checkTpaApiEnable($client_policy_id, 'getTPAID', 'internel');
+
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']);
$message = null;
@@ -2305,7 +2307,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'], 'tpa_api_service_status' => $tpa_api_service_status], 200);
}
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index 40ea8e5f..e0ea1eb5 100755
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -3636,11 +3636,6 @@ class EmployeeRestController extends AdminController
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
}
- // this call for TPA integration
- $apiServiceController = new ApiServiceController();
- $apiServiceController->pushClaims($insert_status);
- log_message('error', "pushClaims function called with Ticket ID: {$insert_status}, In Employee Rest Controller");
-
} else {
$message = 'Something Went Wrong';
return $this->respond(['status' => false, 'code' => 400, 'message' => $message], 200);
@@ -3651,11 +3646,12 @@ class EmployeeRestController extends AdminController
}
}
- public function handleCliamFiles($data, $ticket_id, $ticket_message_id)
+ public function handleCliamFiles($data, $ticket_id, $ticket_message_id = null)
{
if(!empty($data) && !empty($ticket_id))
{
$insert_ids = [];
+ $pdf_exist_in_the_file = false;
$claim_file = new ClaimFilesModel();
foreach ($data as $key => $value) {
@@ -3666,11 +3662,26 @@ class EmployeeRestController extends AdminController
'url' => $value['file_path'],
'file_type' => 2,
'ticket_message_id' => $ticket_message_id,
+ 'mime_type' => getMimeTypeByFileName($value['file_name']),
];
$insert_ids[] = $claim_file->insert($data);
+
+ if(getMimeTypeByFileName($value['file_name']) == "application/pdf"){
+ $pdf_exist_in_the_file = true;
+ }
}
+ if($pdf_exist_in_the_file){
+ // 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.");
+ }
+
+
return $insert_ids;
}
@@ -3867,6 +3878,7 @@ class EmployeeRestController extends AdminController
{
$emp_id = $this->request->getGet('emp_id');
+
$db = \Config\Database::connect();
$data = $db->table('employees e')
->select('pt.policy_type,
@@ -3883,11 +3895,12 @@ class EmployeeRestController extends AdminController
->get()
->getResultArray();
-
+ // print_r($db->getLastQuery());die();
+ // print_r($data);die();
// Loop through $data and check for policy_type = GMC
$userParams = [];
foreach ($data as $row) {
- if ($row['policy_type'] === 'GMC') {
+ // if ($row['policy_type'] === 'GMC') {
$userParams['name'] = $row['name'];
$userParams['email'] = $row['email'];
$userParams['phone'] = $row['phone'];
@@ -3906,14 +3919,14 @@ class EmployeeRestController extends AdminController
$userParams['moduleName'] = 'home';
break; // stop after first GMC match
- }
+ // }
}
if (empty($userParams)) {
return $this->respond(['status' => 'failed','message' => 'Coming soon........!'], 200);
}
-
+ // echo 'coming';die();
// Derive 32-byte key from SHA256
$derivedKey = hash('sha256', env('VISIT_SECRET_KEY'), true);
diff --git a/app/Controllers/MediAssistApiController.php b/app/Controllers/MediAssistApiController.php
index 691c8ec4..8511ed9f 100644
--- a/app/Controllers/MediAssistApiController.php
+++ b/app/Controllers/MediAssistApiController.php
@@ -5,9 +5,14 @@ namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\FileModel;
use CodeIgniter\HTTP\ResponseInterface;
+use CodeIgniter\HTTP\IncomingRequest;
+use CodeIgniter\HTTP\RequestInterface;
+use CodeIgniter\API\ResponseTrait;
class MediAssistApiController extends BaseController
-{
+{
+ use ResponseTrait;
+
public function index()
{
//
@@ -54,7 +59,7 @@ class MediAssistApiController extends BaseController
->join('employees e', 'e.id = tm.emp_id', 'left')
->join('client_policy cp', 'tm.client_policy_id = cp.id', 'left')
->join('ticket_notes tn', 'tn.ticket_id = tm.id', 'left')
- ->join('claim_files cf', 'cf.ticket_id = tm.id AND cf.file_type = 2', 'left')
+ ->join('claim_files cf', "cf.ticket_id = tm.id AND cf.file_type = 2 and cf.mime_type = 'application/pdf'", 'left')
->where('tm.id', $claimId)
->get()
->getRowArray(); // single record
@@ -195,126 +200,186 @@ class MediAssistApiController extends BaseController
public function GetBenefDetails($requestData)
{
-
helper('api');
- $url = getenv('MEDI_ASSIST_API_BASE_URL_LIVE') . '/GetBenefDetails';
- $method = 'POST';
+ $function_calling_type = $requestData['return_type'] ?? 'job';
- $headers = [
- 'Content-Type: application/json',
- 'Username:' . getenv('MEDI_ASSIST_API_USERNAME_LIVE'),
- 'Password:' . getenv('MEDI_ASSIST_API_PASSWORD_LIVE'),
- ];
+ try {
- $policyNo = $requestData['policy_no'] ?? null;
+ $url = getenv('MEDI_ASSIST_API_BASE_URL_LIVE') . '/GetBenefDetails';
+ $method = 'POST';
- if (empty($policyNo)) {
- log_message('error', 'GetBenefDetails: policy_no missing in request');
- return $this->response->setJSON(['status' => false,'message' => 'policy_no required']);
- }
-
- log_message('error', "GetBenefDetails called for policy_no: {$policyNo}");
-
- $allBenef = [];
- $startIndex = 0;
- $range = 100;
- $totalCount = 0;
-
- do {
- $body = [
- "policyNo" => $policyNo,
- "startDate" => "",
- "endDate" => "",
- "isDeActivedata" => false,
- "startIndex" => $startIndex,
- "range" => $range,
- "employeeId" => ""
+ $headers = [
+ 'Content-Type: application/json',
+ 'Username:' . getenv('MEDI_ASSIST_API_USERNAME_LIVE'),
+ 'Password:' . getenv('MEDI_ASSIST_API_PASSWORD_LIVE'),
];
- log_message('error', "GetBenefDetails API Request (startIndex={$startIndex}): " . json_encode($body));
+ $policyNo = $requestData['policy_no'] ?? null;
- $response = call_third_party_api($url, $method, $headers, $body);
-
- if ($response['status'] != true) {
- log_message('error', 'GetBenefDetails API failed: ' . json_encode($response));
- return $this->response->setJSON([ 'status' => false,'message' => 'API call failed','data' => $response]);
+ if (empty($policyNo)) {
+ log_message('error', 'GetBenefDetails: policy_no missing in request');
+ if($function_calling_type == "job"){
+ return ['status' => false, 'message' => 'policy_no required'];
+ }else{
+ return $this->respond(['status' => false, 'message' => 'policy_no required']);
+ }
}
- $data = $response['data'] ?? [];
+ log_message('error', "GetBenefDetails called for policy_no: {$policyNo}");
- if (!isset($data['benefDetails'])) {
- log_message('error', "GetBenefDetails: 'benefDetails' missing in API response: " . json_encode($data));
- break;
+ $allBenef = [];
+ $startIndex = 0;
+ $range = 100;
+ $totalCount = 0;
+
+
+ do {
+ $body = [
+ "policyNo" => $policyNo,
+ "startDate" => "",
+ "endDate" => "",
+ "isDeActivedata" => false,
+ "startIndex" => $startIndex,
+ "range" => $range,
+ "employeeId" => ""
+ ];
+
+ log_message('error', "GetBenefDetails API Request (startIndex={$startIndex}): " . json_encode($body));
+
+ $response = call_third_party_api($url, $method, $headers, $body);
+
+ if ($response['status'] != true) {
+
+ // update file table status after the tpa id failed to update
+ if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
+ $file_model = new FileModel();
+ $file_model->where('id', $requestData['file_id'])->set('status', 'failed')->update();
+ log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
+ } else {
+ log_message('error', "Failed to update file table status.");
+ }
+
+ log_message('error', 'GetBenefDetails API failed: ' . json_encode($response));
+
+ if($function_calling_type == "job"){
+ return ['status' => false, 'message' => 'API call failed', 'data' => $response];
+ }else{
+ return $this->respond(['status' => false, 'message' => 'API call failed', 'data' => $response]);
+ }
+ }
+
+ $data = $response['data'] ?? [];
+
+ if (!isset($data['benefDetails'])) {
+ log_message('error', "GetBenefDetails: 'benefDetails' missing in API response: " . json_encode($data));
+ break;
+ }
+
+ $count = $data['count'] ?? 0;
+ $totalCount = $count;
+ $fetchedCount = count($data['benefDetails']);
+
+ log_message('error', "Fetched {$fetchedCount} records (startIndex={$startIndex}) of total {$count}");
+
+ $allBenef = array_merge($allBenef, $data['benefDetails']);
+
+ $startIndex += $range;
+ } while ($startIndex < $totalCount);
+
+ // now update DB
+ $db = \Config\Database::connect();
+ $updated = 0;
+
+
+ foreach ($allBenef as $row) {
+
+ // $update = $db->table('employee_polices')
+ // ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.policy_no = ' . $db->escape($row['polNo']), 'left')
+ // ->join(
+ // 'employees',
+ // 'employee_polices.employee_id = employees.id
+ // AND employees.emp_code = ' . $db->escape($row['priBenefEmpCode']) . '
+ // AND employees.relationship = ' . $db->escape($row['relName']),
+ // 'left'
+ // )
+ // ->where('employee_polices.tpa_id IS NULL')
+ // ->update(['employee_polices.tpa_id' => $row['benefMediAssistID']]);
+
+ $update = $db->table('employee_polices')
+ ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
+ ->join('employees', 'employee_polices.employee_id = employees.id', 'left')
+ ->where('client_policy.policy_no', $row['polNo'])
+ ->where('employees.emp_code', $row['priBenefEmpCode'])
+ ->where('employees.relationship', $row['relName'])
+ ->where('employee_polices.tpa_id IS NULL', null, false)
+ ->update(['employee_polices.tpa_id' => $row['benefMediAssistID']]);
+
+
+
+ if ($db->affectedRows() > 0) {
+ $updated++;
+ log_message('error', "Updated tpa_id for emp_code={$row['priBenefEmpCode']}, policy={$row['polNo']}");
+ }
}
- $count = $data['count'] ?? 0;
- $totalCount = $count;
- $fetchedCount = count($data['benefDetails']);
+ // update file table status after the tpa id successfully updated
+ if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
+ $file_model = new FileModel();
+ $file_model->where('id', $requestData['file_id'])->set('status', 'success')->update();
+ log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
+ } else {
+ log_message('error', "Failed to update file table status.");
+ }
- log_message('error', "Fetched {$fetchedCount} records (startIndex={$startIndex}) of total {$count}");
- $allBenef = array_merge($allBenef, $data['benefDetails']);
+ log_message('error', "GetBenefDetails completed. Total fetched={$totalCount}, updated={$updated}");
- $startIndex += $range;
+ if($function_calling_type == "job"){
+ return [
+ 'status' => true,
+ 'message' => 'Updated successfully',
+ 'total_fetched' => $totalCount,
+ 'total_updated' => $updated
+ ];
+ }else{
+ return $this->respond([
+ 'status' => true,
+ 'message' => 'Updated successfully',
+ 'total_fetched' => $totalCount,
+ 'total_updated' => $updated
+ ]);
+ }
- } while ($startIndex < $totalCount);
+ } catch (\Throwable $th) {
- // now update DB
- $db = \Config\Database::connect();
- $updated = 0;
+ // update file table status after the tpa id failed to update
+ if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
+ $file_model = new FileModel();
+ $file_model->where('id', $requestData['file_id'])->set('status', 'failed')->update();
+ log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
+ } else {
+ log_message('error', "Failed to update file table status.");
+ }
-
+ $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,
+ ];
- foreach ($allBenef as $row) {
-
- // $update = $db->table('employee_polices')
- // ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.policy_no = ' . $db->escape($row['polNo']), 'left')
- // ->join(
- // 'employees',
- // 'employee_polices.employee_id = employees.id
- // AND employees.emp_code = ' . $db->escape($row['priBenefEmpCode']) . '
- // AND employees.relationship = ' . $db->escape($row['relName']),
- // 'left'
- // )
- // ->where('employee_polices.tpa_id IS NULL')
- // ->update(['employee_polices.tpa_id' => $row['benefMediAssistID']]);
-
- $update = $db->table('employee_polices')
- ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
- ->join('employees', 'employee_polices.employee_id = employees.id', 'left')
- ->where('client_policy.policy_no', $row['polNo'])
- ->where('employees.emp_code', $row['priBenefEmpCode'])
- ->where('employees.relationship', $row['relName'])
- ->where('employee_polices.tpa_id IS NULL', null, false)
- ->update(['employee_polices.tpa_id' => $row['benefMediAssistID']]);
-
-
-
- if ($db->affectedRows() > 0) {
- $updated++;
- log_message('error', "Updated tpa_id for emp_code={$row['priBenefEmpCode']}, policy={$row['polNo']}");
+ log_message('error', 'Exception thrown while calling GetBenefDetails API: ' . json_encode($errorData));
+ if($function_calling_type == "job"){
+ return ['status' => false, 'message' => 'API call failed', 'data' => $errorData];
+ }else{
+ return $this->respond(['status' => false, 'message' => 'API call failed', 'data' => $errorData]);
}
}
-
- // update file table status after the tpa id successfully updated
- if(isset($requestData['file_id']) && !empty($requestData['file_id'])){
- $file_model = new FileModel();
- $file_model->where('id', $requestData['file_id'])->set('status', 'success')->update();
- log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
- }else{
- log_message('error', "Failed to update file table status.");
- }
-
-
- log_message('error', "GetBenefDetails completed. Total fetched={$totalCount}, updated={$updated}");
-
- return $this->response->setJSON([
- 'status' => true,
- 'message' => 'Updated successfully',
- 'total_fetched' => $totalCount,
- 'total_updated' => $updated
- ]);
}
diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php
index f41b9a8f..84dfb6b3 100644
--- a/app/Controllers/TicketController.php
+++ b/app/Controllers/TicketController.php
@@ -1057,11 +1057,6 @@ class TicketController extends BaseController
$mail_responce = $this->sendAutoMailTrigger($return_value);
$this->autoMessageInsertBasedOnMailResponse($mail_responce, $return_value);
- // this call for TPA integration
- $apiServiceController = new ApiServiceController();
- $apiServiceController->pushClaims($return_value);
- log_message('error', "pushClaims function called with Ticket ID: {$return_value}, In Ticket Controller");
-
return $this->respond(['status' => true, 'ticket_id' => $return_value, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully", 'mail_responce' => $mail_responce], 200);
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
@@ -2232,7 +2227,8 @@ class TicketController extends BaseController
}
- public function feedbackList(){
+ public function feedbackList()
+ {
$data['feedback_data'] = $this->ticketMasterModel->select("ticket_master.*,clients.client_name")->join("clients","clients.id = ticket_master.client_id")->where("ticket_master.is_active",1)->where("ticket_master.feedback_json IS NOT NULL", null, false)->where("ticket_master.feedback_json !=", "")->findAll();
$data['page_name'] = "Claims";
@@ -2240,7 +2236,8 @@ class TicketController extends BaseController
$this->loadLayout("ticket_feedback_list",$data);
}
- public function getMoreInfo($requestFrom = null , $ticket_id = null) {
+ public function getMoreInfo($requestFrom = null , $ticket_id = null)
+ {
if($requestFrom == null){
$ticket_id = $this->request->getPost('ticket_id');
@@ -2265,7 +2262,7 @@ class TicketController extends BaseController
->groupBy("th.old_value, tcs.claim_status")
->get()
->getResultArray();
- // dd($ticket_previous_status);
+ // dd($ticket_previous_status);
// Loop through previous status and gather the required data
foreach ($ticket_previous_status as $status) {
// $this->myLogger->logme("error", "Status : " . json_encode($status));
@@ -2326,13 +2323,15 @@ class TicketController extends BaseController
}
}
- private function isDate($value, $format = 'Y-m-d') {
+ private function isDate($value, $format = 'Y-m-d')
+ {
// Check if the value is a valid date string (basic validation)
$date = \DateTime::createFromFormat($format, $value);
return $date && $date->format($format) === $value;
}
- public function upload_url(){
+ public function upload_url()
+ {
$data = $this->request->getPost();
@@ -2340,34 +2339,43 @@ class TicketController extends BaseController
foreach ($data['docs_name'] as $key => $eachData) {
- if (!empty($eachData) ) {
+ if (!empty($eachData)) {
- $insertData = [
- 'doc_name' => $data['docs_name'][$key]??'',
- 'url' => $data['url'][$key]??'',
- 'ticket_id'=> $data['ticket_id_url']??'',
- 'created_by' => get_session_userid(),
- 'is_active' => 1,
- 'file_type' => 1
- ];
-
- $insertArr[] = $insertData;
-
- }
+ $insertData = [
+ 'doc_name' => $data['docs_name'][$key] ?? '',
+ 'url' => $data['url'][$key] ?? '',
+ 'ticket_id' => $data['ticket_id_url'] ?? '',
+ 'created_by' => get_session_userid(),
+ 'is_active' => 1,
+ 'file_type' => 1
+ ];
+
+ $insertArr[] = $insertData;
+ }
}
- if(!empty($insertArr)){
- // Insert into database
- $insert = $this->claimFilesModel->insertBatch($insertArr);
+ if (!empty($insertArr)) {
+ // Insert into database
+ $insert = $this->claimFilesModel->insertBatch($insertArr);
}
-
+
if (isset($insert) && !empty($insert)) {
+
+ if (isset($data['ticket_id_url']) && !empty($data['ticket_id_url'])) {
+ // this call for TPA integration
+ $ticket_id = $data['ticket_id_url'];
+ $apiServiceController = new ApiServiceController();
+ $apiServiceController->pushClaims($ticket_id);
+ log_message('error', "pushClaims function called with Ticket ID: {$ticket_id}, In Ticket Controller while claim file upload");
+ } else {
+ log_message('error', "Failed to call the pushClaims function in TicketController during claim file upload because the ticket id was not found.");
+ }
+
return $this->respond(['status' => true, 'message' => 'File uploaded successfully ']);
} else {
return $this->respond(['status' => false, 'message' => 'Failed to upload file ']);
}
-
}
public function getUrlDataByTicketId()
diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php
index 8f976243..4e89f10a 100755
--- a/app/Helpers/utility_helper.php
+++ b/app/Helpers/utility_helper.php
@@ -901,3 +901,28 @@ if (!function_exists('formatKey')) {
}
}
+if (!function_exists('getMimeTypeByFileName')) {
+ function getMimeTypeByFileName($file_name)
+ {
+ $ext = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
+
+ $mime_types = [
+ 'pdf' => 'application/pdf',
+ 'jpg' => 'image/jpeg',
+ 'jpeg' => 'image/jpeg',
+ 'png' => 'image/png',
+ 'gif' => 'image/gif',
+ 'doc' => 'application/msword',
+ 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+ 'xls' => 'application/vnd.ms-excel',
+ 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'csv' => 'text/csv',
+ 'txt' => 'text/plain',
+ 'zip' => 'application/zip',
+ 'rar' => 'application/x-rar-compressed',
+ 'json' => 'application/json',
+ ];
+
+ return $mime_types[$ext] ?? 'application/octet-stream'; // default fallback
+ }
+}
diff --git a/app/Models/ClaimFilesModel.php b/app/Models/ClaimFilesModel.php
index 2d747e3d..0e0a987c 100644
--- a/app/Models/ClaimFilesModel.php
+++ b/app/Models/ClaimFilesModel.php
@@ -21,6 +21,7 @@ class ClaimFilesModel extends Model
'updated_at',
'is_active',
'file_name',
+ 'mime_type',
];
// Callbacks
diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php
index 97885014..8a4e1c13 100755
--- a/app/Views/employee_upload.php
+++ b/app/Views/employee_upload.php
@@ -175,6 +175,7 @@ option:disabled {
var client_id_param = 0;
var client_branch_id_param = 0;
var client_policy_param = 0;
+var tpa_api_sevice = 0;
$('#file_upload').hide();
@@ -984,7 +985,6 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
-
$.ajax({
url: apiURL,
@@ -1011,6 +1011,19 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
var event = response.insurer_multi_event ;
$('#event_type_data').val(response.insurer_multi_event);
+ console.log('response.tpa_api_service_status', response.tpa_api_service_status);
+ console.log('tpa_api_sevice 1', tpa_api_sevice);
+ if(response.tpa_api_service_status){
+ tpa_api_sevice = 1;
+ }else{
+ tpa_api_sevice = 0;
+ }
+ $('.fetch_tpa').hide();
+ $('#action_type').val('').change();
+ $('#event_type').val('').change();
+
+ console.log('tpa_api_sevice 2', tpa_api_sevice);
+
if(event == 1){
$("#event_type").attr("multiple", "multiple");
$("#event_type").attr("name", "event_type[]");
diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php
index b4c615b3..2c9406cb 100755
--- a/app/Views/insurer_or_tpa_data.php
+++ b/app/Views/insurer_or_tpa_data.php
@@ -111,15 +111,22 @@