From 88edf67aa15c6cdb0b91d49af2f2f9d432f705f5 Mon Sep 17 00:00:00 2001 From: venba-Inspriron-3558 Date: Fri, 5 Sep 2025 17:17:32 +0530 Subject: [PATCH] CHANGE_Motor Cliams --- app/Config/Routes.php | 2 + app/Controllers/TicketController.php | 78 +- app/Models/PartnerPolicyModel.php | 42 + app/Views/ticket_form_handler.php | 2 + app/Views/ticket_form_motor.php | 1146 ++++++++++++++++++++++++++ app/Views/ticket_type_modal.php | 1 + 6 files changed, 1270 insertions(+), 1 deletion(-) create mode 100755 app/Models/PartnerPolicyModel.php create mode 100644 app/Views/ticket_form_motor.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 9a762179..8240c1c1 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -628,6 +628,8 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { $routes->post('upload_url',"TicketController::upload_url"); $routes->post('getUrlDataByTicketId',"TicketController::getUrlDataByTicketId"); $routes->get('remove_url',"TicketController::remove_url"); + $routes->get('fetchVehiclePolicy/(:any)','TicketController::fetchVehiclePolicy/$1'); + }); $routes->group("clientApi",["filter" => "AuthClientApi"], function ($routes){ diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 0fe8752b..c9548469 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -22,6 +22,8 @@ use App\Models\EmployeeModel; use App\Models\TPAModel; use App\Models\ClaimFilesModel; use App\Models\ClaimDumpFileModel; +use App\Models\VehicleModel; +use App\Models\PartnerPolicyModel; use DOMDocument; use Psr\Log\LoggerInterface; @@ -62,6 +64,8 @@ class TicketController extends BaseController protected $TPAModel; protected $claimFilesModel; protected $claimDumpFileModel; + protected $vehicleModel; + protected $partnerPolicyModel; public function __construct() { @@ -71,7 +75,7 @@ class TicketController extends BaseController $this->ticketMasterModel = new TicketMasterModel(); - $this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI"]; + $this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI", 8 => "Motor"]; $this->priorityType = [ 1 => "Low", 2 => "Medium", @@ -348,6 +352,8 @@ class TicketController extends BaseController $this->TPAModel = new TPAModel(); $this->claimFilesModel = new ClaimFilesModel(); $this->claimDumpFileModel = new ClaimDumpFileModel(); + $this->vehicleModel = new VehicleModel(); + $this->partnerPolicyModel = new PartnerPolicyModel(); } public function ticketList() @@ -684,6 +690,9 @@ class TicketController extends BaseController case 4: $data['ticket_form'] = 'GTLI'; break; + case 8: + $data['ticket_form'] = 'Motor'; + break; } // Fetch ACM Users @@ -719,11 +728,78 @@ class TicketController extends BaseController $data['claim_type'] = $this->claimType[2]; } + $data['client_for_motor'] = $this->clientModel->select('id,client_name')->where('client_type', 2)->where('is_active', 1)->findAll(); + $this->myLogger->logme('error', "Ticket form data fetched successfully for Ticket Type: $ticket_type"); return $data; } + public function fetchVehiclePolicy($id) + { + $method = $this->request->getMethod(); + + try { + if (!$id) { + throw new \Exception('Invalid ID', 400); + } + + if ($method === 'get') { + $data['vehicle_list'] = $this->vehicleModel + ->where('is_active', 1) + ->where('owner', $id) + ->findAll(); + + $data['partner_policy_list'] = $this->partnerPolicyModel + ->where('is_active', 1) + ->findAll(); + + $client = $this->clientModel + ->where('is_active', 1) + ->where('id', $id) + ->first(); + + $data['email'] = !empty($client) ? $client['email'] : null; + $data['phone'] = !empty($client) ? $client['phone'] : null; + + if (empty($data['vehicle_list']) && empty($data['partner_policy_list'])) { + throw new \Exception('No Records found', 404); + } + + return $this->response + ->setJSON(['status' => 'success', 'data' => $data]) + ->setStatusCode(200); + } + + throw new \Exception('Invalid request method', 405); + + } catch (\Throwable $e) { + $code = ($e->getCode() && $e->getCode() >= 100 && $e->getCode() < 600) ? $e->getCode() : 500; + + $isDbError = $e instanceof \CodeIgniter\Database\Exceptions\DatabaseException + || $e instanceof \mysqli_sql_exception + || $e instanceof \PDOException; + + $context = [ + 'title' => get_class($e), + 'type' => get_class($e), + 'code' => $code, + 'message' => $e->getMessage(), + 'file' => $e->getFile(), + 'line' => $e->getLine() + ]; + + $this->myLogger->logme('error', "Exception: {message} in {file} on line {line}", $context, 0); + + return $this->response->setJSON([ + 'status' => 'error', + 'message' => $isDbError ? 'Data Access Error' : $e->getMessage(), + 'ref' => ($isDbError ? 'database - ' : 'application - ') . $code . ' - ' . $e->getLine() + ])->setStatusCode($code); + } + } + + //transform the claim status public function transFormClaimStatus($claimStatusId, $ticket_type) { diff --git a/app/Models/PartnerPolicyModel.php b/app/Models/PartnerPolicyModel.php new file mode 100755 index 00000000..8c14ba06 --- /dev/null +++ b/app/Models/PartnerPolicyModel.php @@ -0,0 +1,42 @@ + + .readonly-select { + pointer-events: none; + background-color: #e0e0e0; + color: #666; + } + + .info-icon { + color: #007bff; + font-size: 15px; + transition: 0.3s ease; + cursor: pointer; + } + + .info-icon:hover { + color: #0056b3; + font-size: 24px; + } + + .label-font-size{ + font-size:0.875rem; + } + + + +
+
+
" style="margin-right: 23px;"> +
+ + +
+
+

Motor

+
+
+ + + +
+
+ +
+ + + + + +
+
+ +
+ + + + + +
+ + + + + + + +
+ +
+ + +
+ +
+
+ + +
+
+ +
+ + + +
+ +
+ + +
+ +
+ + +
+ + + +
+ + +
+ + + + + + + + +
+ + +

+
Claim Details
+
+ + +
+
+ + +
+ +
+ + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+ + + Rejected Approve + +
+
+ +
+
+
+ + + + + + \ No newline at end of file diff --git a/app/Views/ticket_type_modal.php b/app/Views/ticket_type_modal.php index d16b53a9..4a4728b1 100644 --- a/app/Views/ticket_type_modal.php +++ b/app/Views/ticket_type_modal.php @@ -14,6 +14,7 @@ +