CHANGE_Motor Cliams
This commit is contained in:
parent
3661ac99ed
commit
88edf67aa1
@ -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){
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
42
app/Models/PartnerPolicyModel.php
Executable file
42
app/Models/PartnerPolicyModel.php
Executable file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class PartnerPolicyModel extends Model
|
||||
{
|
||||
protected $table = 'partner_policy';
|
||||
protected $primaryKey = 'id';
|
||||
protected $useAutoIncrement = true;
|
||||
|
||||
// Allowed fields (make sure to include only updatable/insertable ones)
|
||||
protected $allowedFields = [
|
||||
'quotation_id',
|
||||
'insured_name',
|
||||
'rc_no',
|
||||
'premium_amount',
|
||||
'policy_number',
|
||||
'payment_mode',
|
||||
'policy_pdf_file_name',
|
||||
'policy_payment_receipt_file_name',
|
||||
'is_active',
|
||||
'issued_date',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'manager_id',
|
||||
'client_id',
|
||||
'client_policy_id',
|
||||
'vehicle_id',
|
||||
'policy_transaction_id',
|
||||
'pt_oc_share_details_id',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
];
|
||||
|
||||
// Optional settings
|
||||
protected $useTimestamps = true; // enables auto timestamp
|
||||
protected $createdField = 'created_on';
|
||||
protected $updatedField = 'updated_on';
|
||||
protected $dateFormat = 'datetime';
|
||||
|
||||
}
|
||||
@ -46,6 +46,8 @@
|
||||
if (!isset($view_ticket_page)) {
|
||||
if ($selected_ticket_type == 1) {
|
||||
include('ticket_form_gmc.php');
|
||||
} else if ($selected_ticket_type == 8) {
|
||||
include('ticket_form_motor.php');
|
||||
} else {
|
||||
include('ticket_form_gpa.php');
|
||||
}
|
||||
|
||||
1146
app/Views/ticket_form_motor.php
Normal file
1146
app/Views/ticket_form_motor.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@
|
||||
<option value="2">Claim-GPA</option>
|
||||
<option value="3">EDLI</option>
|
||||
<option value="4">GTLI</option>
|
||||
<option value="8">Motor</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user