diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index f7626dad..69a64d66 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 @@
+
-
+
-
-
-
-
-
- | Relationship Manager |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- | = implode(', ', $account_managers) ?> |
-
-
- | = implode(', ', $managers) ?> |
-
-
- |
- = implode(', ', $heads) ?>
- |
-
-
-
diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php
index aff9953a..0c3e8b40 100755
--- a/app/Views/client_kyc.php
+++ b/app/Views/client_kyc.php
@@ -1,4 +1,35 @@
@@ -12,19 +43,19 @@
+ | S.no |
Document Name |
Status |
Action |
+
-
-
-
+
@@ -34,6 +65,7 @@