From dc60635076bbb0aa27da03b7a904d2144fb5067c Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 10 Dec 2025 11:44:55 +0530 Subject: [PATCH] FEAT_FETCH_CLAIM_STATS_AND _REQUIRED_IR_DOCS --- app/Config/Routes.php | 3 +- app/Controllers/ApiServiceController.php | 2 + app/Controllers/TicketController.php | 26 + app/Views/claim_files_upload.php | 814 ++++++++++++++++------- app/Views/ticket_edit_onbording.php | 48 +- 5 files changed, 630 insertions(+), 263 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 535cc452..a3a3f7ec 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -712,7 +712,8 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { $routes->post('getUrlDataByTicketId',"TicketController::getUrlDataByTicketId"); $routes->get('remove_url',"TicketController::remove_url"); $routes->get('fetchVehiclePolicy/(:any)','TicketController::fetchVehiclePolicy/$1'); - + $routes->post('saveIRDocsJson',"TicketController::saveIRDocsJson"); + $routes->get('getTpaClaimStatus',"ApiServiceController::getClaimStatus"); }); $routes->group("clientApi",["filter" => "AuthClientApi"], function ($routes){ diff --git a/app/Controllers/ApiServiceController.php b/app/Controllers/ApiServiceController.php index 0c86258c..1296fbdf 100644 --- a/app/Controllers/ApiServiceController.php +++ b/app/Controllers/ApiServiceController.php @@ -237,6 +237,8 @@ class ApiServiceController extends BaseController return $mediAssistController->ClaimDetail($claimId); }else{ log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}"); + $message = "This TPA has no API service enabled"; + return $this->response->setJSON(['status' => false,'message' => $message ]); } } diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 87620e51..e2ba20fe 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -2837,6 +2837,32 @@ class TicketController extends BaseController echo $errorMessage; } } + + // -------- END CLAIM DUMP UPLOAD ---------------------------------------------------------------------------------------------- + public function saveIRDocsJson() + { + $ticket_id = $this->request->getPost('ticket_id'); + $required_docs = $this->request->getPost('required_docs'); + + if(empty($ticket_id)){ + return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to save Docs'], 200); + } + + if(empty($required_docs)){ + return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to save Docs'], 200); + } + + db_connect()->query( + "UPDATE ticket_master SET required_docs = ? WHERE id = ?", + [$required_docs, $ticket_id] + ); + + $required_docs = $this->ticketMasterModel->select('required_docs')->where('id', $ticket_id)->first(); + $required_docs = json_decode($required_docs['required_docs'] ?? '{}', true) ?? []; + + return $this->respond(['status' => true, 'code' => 200, 'message' => 'IR docs saved successfully', 'data' => $required_docs], 200); + + } } diff --git a/app/Views/claim_files_upload.php b/app/Views/claim_files_upload.php index 80eccfa0..1c4f0079 100644 --- a/app/Views/claim_files_upload.php +++ b/app/Views/claim_files_upload.php @@ -1,9 +1,68 @@ -
+ +
+
+
+ +
+
+
IR Documents
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
Document Name
+
Status
+
Action
+
+ + +
+ + + +
+
+
+ + + +
+
+
-
+
-
+

File List

@@ -72,7 +131,6 @@
- + + diff --git a/app/Views/ticket_edit_onbording.php b/app/Views/ticket_edit_onbording.php index 125d792e..b21b1345 100644 --- a/app/Views/ticket_edit_onbording.php +++ b/app/Views/ticket_edit_onbording.php @@ -33,19 +33,29 @@ } +
-
-
+
+

Claims

-
@@ -350,4 +360,34 @@ } }); } + + function fetchTpaClaimStatus(){ + + let ticket_master_id = $('#ticket_master_id').val(); + console.log({ticket_master_id}); + + let requestData = { + claim_id: ticket_master_id, + }; + + let url = ''; + + // Send AJAX request + sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) { + + console.log('Data fetched successfully:', response); + + if (response.status) { + toastr.success(response.message || 'Status updated successfully', 'SUCCESS'); + window.location.reload(true); + } else { + toastr.warning(response.message || 'Failed to update status', 'WARNING'); + } + + }, function(xhr, status, error) { + console.error('Error fetching data:', error); + console.error(xhr.responseText); + toastr.error('An error occurred while saving docs.', 'ERROR'); + }); + } \ No newline at end of file