From 5c87de3d730230296fdc3f3738bfb86fc37ed76f Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 28 Jan 2025 15:25:32 +0530 Subject: [PATCH] CHANGE_CLAIM_MODULE : RV --- app/Config/Routes.php | 3 +- app/Controllers/ClientController.php | 42 ++++++- app/Controllers/TicketController.php | 95 ++++++++++++--- app/Models/TicketMasterModel.php | 14 +-- app/Views/ticket_edit_onbording.php | 70 ++++++++++- app/Views/ticket_form_gmc.php | 73 +++++++----- app/Views/ticket_form_gpa.php | 125 +++++++++++-------- app/Views/ticket_form_handler.php | 172 ++++++++++++++++++++++----- 8 files changed, 445 insertions(+), 149 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index eb828452..08ad836a 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -337,6 +337,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->post('unmap_employees/(:num)', 'EmployeeController::unmapEmployees/$1'); $routes->get('transformMailContent', 'LeadsController::transformMailContent'); $routes->get('getCDAmount', 'ClientController::getCDAmount'); + $routes->get('getTheEmpDataForClaim/(:any)', 'ClientController::getTheEmpDataForClaim/$1'); }); $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) { @@ -497,7 +498,7 @@ $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { $routes->match( ['get', 'post'], 'list','TicketController::ticketList'); $routes->get('new/(:any)','TicketController::ticket_form/$1'); $routes->post('create','TicketController::createTicket'); - $routes->get('update','TicketController::updateTicket'); + $routes->post('update','TicketController::updateTicket'); $routes->get('view/(:any)','TicketController::view_ticket/$1'); $routes->get('mail_template','TicketController::createMailTemplate'); }); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 38192213..ad47e155 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4138,6 +4138,46 @@ class ClientController extends AdminController } else { return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found'], 200); } - } + } + + public function getTheEmpDataForClaim($client_policy_id) + { + $data = $this->clientPolicyModel->select(" + + clients.id as client_id, + clients.client_name, + insurers.id as insurer_id, + insurers.name as insurer_name, + tpa.id as tpa_id, + tpa.name as tpa_name, + + employees.id as emp_id, + employees.name as emp_name, + employees.emp_code, + employees.mobile as emp_mobile, + employees.email_corporate as emp_email, + + employee_polices.uhid as policy_no, + ") + ->join('clients', 'client_policy.client_id = clients.id', 'left') + ->join('insurers', 'client_policy.insurer_id = insurers.id', 'left') + ->join('tpa', 'client_policy.tpa_id = tpa.id', 'left') + ->join('employees', 'clients.id = employees.client_id', 'left') + ->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left') + ->where('client_policy.id',) + ->where('client_policy.is_active', 1) + ->where('insurers.is_active', 1) + ->where('tpa.is_active', 1) + ->where('employees.is_active', 1) + ->where('employee_polices.is_active', 1) + ->where('client_policy.id', $client_policy_id) + ->findAll(); + + if($data){ + return $this->respond(['status' => true, 'code' => 200, 'data' => $data], 200); + } else { + return $this->respond(['status' => false, 'code' => 404, 'message' => 'no data found', "client_policy_id" =>$client_policy_id], 200); + } + } } diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index c489e247..4da42c00 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -135,6 +135,12 @@ class TicketController extends BaseController public function ticket_form($ticket_type) { + $data = $this->ticket_form_data($ticket_type); + return $this->loadLayout('ticket_form_handler', $data); + } + + public function ticket_form_data($ticket_type) + { $data['ticket_form'] = 1; $data['ticket_type'] = $this->ticketType; $data['priorityType'] = $this->priorityType; @@ -156,12 +162,9 @@ class TicketController extends BaseController ->getResultArray(); if($ticket_type == 1){ - $data['modeOFIntimate'] = $this->claimType[1]; - return $this->loadLayout('ticket_form_handler', $data); + $data['claim_type'] = $this->claimType[1]; }else{ - - $data['modeOFIntimate'] = $this->claimType[2]; - + $data['claim_type'] = $this->claimType[2]; if($ticket_type == 2){ $data['ticket_form'] = 'GPA'; }else if($ticket_type = 3){ @@ -169,34 +172,79 @@ class TicketController extends BaseController }else if($ticket_type = 4){ $data['ticket_form'] = 'GTLI'; } - - return $this->loadLayout('ticket_form_handler', $data); } + + return $data; } public function view_ticket($ticket_id) - { - $data = []; + { + $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first(); + $ticket_data = $this->formatDateForClaim($ticket_data, 'd/m/Y'); + // dd($ticket_data); + $data = $this->ticket_form_data($ticket_data['ticket_type_id']); + $data['ticket_data'] = $ticket_data; return $this->loadLayout('ticket_edit_onbording', $data); } - public function createTicket() - { - $ticket_data = $this->request->getPost(); - // print_rr($ticket_data); die; + public function formatDateForClaim($ticket_data, $out_put_format = 'Y-m-d') + { if(empty($ticket_data['doa'])){ $ticket_data['doa'] = null; }else{ - $ticket_data['doa'] = change_date_format($ticket_data['doa']); + $ticket_data['doa'] = change_date_format($ticket_data['doa'], null, $out_put_format); } if(empty($ticket_data['dod'])){ $ticket_data['dod'] = null; }else{ - $ticket_data['dod'] = change_date_format($ticket_data['dod']); + $ticket_data['dod'] = change_date_format($ticket_data['dod'], null, $out_put_format); } + if(empty($ticket_data['dob'])){ + $ticket_data['dob'] = null; + }else{ + $ticket_data['dob'] = change_date_format($ticket_data['dob'], null, $out_put_format); + } + + if(empty($ticket_data['date_of_join'])){ + $ticket_data['date_of_join'] = null; + }else{ + $ticket_data['date_of_join'] = change_date_format($ticket_data['date_of_join'], null, $out_put_format); + } + + if(empty($ticket_data['date_of_incep'])){ + $ticket_data['date_of_incep'] = null; + }else{ + $ticket_data['date_of_incep'] = change_date_format($ticket_data['date_of_incep'], null, $out_put_format); + } + + if(empty($ticket_data['date_of_accident'])){ + $ticket_data['date_of_accident'] = null; + }else{ + $ticket_data['date_of_accident'] = change_date_format($ticket_data['date_of_accident'], null, $out_put_format); + } + + if(empty($ticket_data['date_of_death'])){ + $ticket_data['date_of_death'] = null; + }else{ + $ticket_data['date_of_death'] = change_date_format($ticket_data['date_of_death'], null, $out_put_format); + } + + if(empty($ticket_data['date_of_intimat'])){ + $ticket_data['date_of_intimat'] = null; + }else{ + $ticket_data['date_of_intimat'] = change_date_format($ticket_data['date_of_intimat'], null, $out_put_format); + } + + return $ticket_data; + } + + public function createTicket() + { + $ticket_data = $this->request->getPost(); + $ticket_data = $this->formatDateForClaim($ticket_data); // print_rr($ticket_data); die; if($ticket_data){ @@ -212,7 +260,22 @@ class TicketController extends BaseController } public function updateTicket() - { + { + $ticket_id = $this->request->getPost('ticket_master_id'); + $ticket_data = $this->request->getPost(); + $ticket_data = $this->formatDateForClaim($ticket_data); + // print_rr($ticket_data); die; + + if($ticket_data){ + $return_value = $this->ticketMasterModel->where('id', $ticket_id)->set($ticket_data)->update(); + if($return_value){ + return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully"], 200); + } else { + return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update claim'], 200); + } + }else{ + return $this->respond(['status' => false, 'code' => 404, 'message' => 'claim data not found'], 200); + } } public function createMailTemplate() diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index ab41a1fe..1d980ed5 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -12,15 +12,6 @@ class TicketMasterModel extends Model protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; -<<<<<<< HEAD - protected $allowedFields = ['id', 'ticket_type_id', 'claim_status_id', 'acm_id', 'insurer_id', - 'tpa_id', 'client_id', 'priority', 'policy_no', 'emp_code', 'tpa_no', 'emp_name', 'insured_name', - 'relationship', 'emp_mobile', 'emp_mail', 'mode_of_intimation', 'claim_type', 'hospital_name', - 'doa', 'dod', 'claim_amount', 'pod_no', 'created_by', 'updated_by', 'created_at', 'updated_at', - 'date_of_join', 'date_of_incep', 'dob', 'date_of_accident', 'date_of_death', 'date_of_intimat', - 'si_amt','claim_number,is_active' - ]; -======= protected $allowedFields = [ 'id', 'ticket_type_id', @@ -57,10 +48,11 @@ class TicketMasterModel extends Model 'date_of_intimat', 'si_amt', 'is_active', - 'claim_number' + 'claim_number', + 'emp_id', + 'insured_emp_id', ]; ->>>>>>> 3a4f7b1e836fc71f477cb6ad32a635dcae0192d0 // Callbacks protected $allowCallbacks = true; diff --git a/app/Views/ticket_edit_onbording.php b/app/Views/ticket_edit_onbording.php index 22b50aba..20873990 100644 --- a/app/Views/ticket_edit_onbording.php +++ b/app/Views/ticket_edit_onbording.php @@ -22,25 +22,29 @@