CHANGE_MOTER_CLAIM
This commit is contained in:
parent
cb465dd178
commit
99de450a1a
@ -650,6 +650,7 @@ $routes->group("employeeRest", ["filter" => ["authJWT"]], function ($routes) {
|
||||
$routes->post('initiateClaim',"EmployeeRestController::initiateClaim");
|
||||
$routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
|
||||
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
|
||||
$routes->get('getClaimTypeMaster',"EmployeeRestController::getClaimTypeMaster");
|
||||
|
||||
// add retail policy
|
||||
$routes->post("addEmpRetailPolicy", "EmployeeRestController::addEmpRetailPolicy");
|
||||
|
||||
@ -57,6 +57,7 @@ use Illuminate\Http\Request;
|
||||
|
||||
use App\Controllers\EmployeeServiceController;
|
||||
use App\Models\ClaimFilesModel;
|
||||
use App\Models\PolicyTransactionModel;
|
||||
use App\Models\TicketMailTemplateModel;
|
||||
use App\Models\TpaApiSeviceModel;
|
||||
use Composer\Pcre\Preg;
|
||||
@ -3526,11 +3527,14 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
$received_data = $this->request->getPost();
|
||||
$this->myLogger->logme('error', 'API claim initiate Recevied Params :' . json_encode($received_data ?? []));
|
||||
$get_file_data = $this->request->getFiles('claim_docs');
|
||||
$get_file_data = $this->request->getFiles('claim_docs') ?? null;
|
||||
$get_docs_name = $this->request->getPost('claim_doc_names') ?? [];
|
||||
$policy_type_id = $this->request->getPost('policy_type_id') ?? null;
|
||||
|
||||
$policy_transaction_id = $this->request->getPost('policy_transaction_id') ?? null;
|
||||
|
||||
if(!empty($policy_transaction_id)){
|
||||
$response = $this->retailClaimInitiate($received_data);
|
||||
return $this->respond($response, 200);
|
||||
}
|
||||
|
||||
if (is_string($get_docs_name)) {
|
||||
$decoded = json_decode($get_docs_name, true);
|
||||
@ -3685,6 +3689,62 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function retailClaimInitiate($data)
|
||||
{
|
||||
if(isset($data['policy_transaction_id'])){
|
||||
|
||||
$policy_transaction_model = new PolicyTransactionModel();
|
||||
|
||||
$policy = $policy_transaction_model
|
||||
->select('policy_transaction.*, clients.client_name, clients.phone as client_mobile, clients.email as client_email')
|
||||
->join('clients', 'policy_transaction.client_id = clients.id')
|
||||
->where('policy_transaction.is_active',1)
|
||||
->where('clients.is_active',1)
|
||||
->where('policy_transaction.id', $data['policy_transaction_id'])
|
||||
->first();
|
||||
|
||||
if(!empty($policy)){
|
||||
|
||||
$claimData = [
|
||||
'ticket_type_id' => $data['policy_type_id'],
|
||||
'claim_status_id' => 62,
|
||||
'policy_no' => $policy['policy_no'],
|
||||
'client_policy_id' => $policy['client_policy_id'],
|
||||
'insurer_id' => $policy['insurer_id'],
|
||||
'client_id' => $policy['client_id'] ?? null,
|
||||
'agent_id' => $policy['agent_id'] ?? null,
|
||||
'manager_id' => $policy['manager_id'] ?? null,
|
||||
'vehicle_id' => $policy['vehicle_id'] ?? null,
|
||||
'insured_name' => $policy['client_name'] ?? null,
|
||||
'emp_name' => $policy['client_name'] ?? null,
|
||||
'emp_mobile' => $policy['client_mobile'] ?? null,
|
||||
'emp_mail' => $policy['client_email'] ?? null,
|
||||
'emp_personal_mail'=> $policy['client_email'] ?? null,
|
||||
'claim_type' => $data['claim_type'],
|
||||
'claim_description'=> $data['claim_description'],
|
||||
'created_by' => $policy['client_id'] ?? null,
|
||||
];
|
||||
|
||||
$ticket_id = $this->ticketMaster->insert($claimData);
|
||||
|
||||
if($ticket_id){
|
||||
$message = 'Claim Initiated Successfully';
|
||||
return ['status' => true, 'code' => 200, 'data' => $ticket_id, 'message' => $message];
|
||||
}else{
|
||||
$message = 'Claim Initiation failed';
|
||||
return ['status' => false, 'code' => 404, 'message' => $message];
|
||||
}
|
||||
}else{
|
||||
$message = 'Claim Initiation failed. Policy data not found';
|
||||
return ['status' => false, 'code' => 404, 'message' => $message];
|
||||
}
|
||||
}else{
|
||||
$message = 'Claim Initiation failed';
|
||||
return ['status' => false, 'code' => 404, 'message' => $message];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function handleCliamFiles($data, $ticket_id, $ticket_message_id = null)
|
||||
{
|
||||
if (!empty($data) && !empty($ticket_id)) {
|
||||
@ -4901,4 +4961,16 @@ class EmployeeRestController extends AdminController
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function getClaimTypeMaster()
|
||||
{
|
||||
$data = db_connect()->table('partner_claim_type_master')->select('id,claim_type')->where('is_active',1)->get()->getResultArray();
|
||||
|
||||
if (!$data) {
|
||||
return $this->failNotFound('No data found');
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 200,'message' => 'success','data' => $data]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user