222 lines
6.5 KiB
PHP
222 lines
6.5 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Controllers\BaseController;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
use Kint\Kint;
|
|
|
|
use CodeIgniter\API\ResponseTrait;
|
|
|
|
use App\Models\TicketMasterModel;
|
|
|
|
class TicketController extends BaseController
|
|
{
|
|
use ResponseTrait;
|
|
|
|
protected $myLogger;
|
|
protected $ticketType;
|
|
protected $priorityType;
|
|
protected $relationshipType;
|
|
protected $modeOFIntimate;
|
|
protected $claimType;
|
|
protected $ticketMasterModel;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->myLogger = \Config\Services::mylogger();
|
|
|
|
$this->ticketMasterModel = new TicketMasterModel();
|
|
|
|
$this->ticketType = [1 => "Claim-GMC", 2 => "Claim-GPA", 3 => "EDLI", 4 => "GTLI"];
|
|
$this->priorityType = [
|
|
1 => "Low",
|
|
2 => "Medium",
|
|
3 => "High",
|
|
4 => "Urgent",
|
|
5 => "Emergency",
|
|
6 => "Critical"
|
|
];
|
|
$this->relationshipType = [
|
|
"self" => "Self",
|
|
"spouse" => "Spouse",
|
|
"son" => "Son",
|
|
"daughter" => "Daughter",
|
|
"father" => "Father",
|
|
"mother" => "Mother",
|
|
"father-in-law" => "Father-in-Law",
|
|
"mother-in-law" => "Mother-in-Law"
|
|
];
|
|
$this->modeOFIntimate = [
|
|
1 => "In Person",
|
|
2 => "Courier",
|
|
3 => "Online Mode - Email",
|
|
4 => "Online Mode - To TPA"
|
|
];
|
|
$this->claimType = [
|
|
1 => [
|
|
1 => "Main",
|
|
2 => "OPD",
|
|
3 => "Pre ReOpen",
|
|
4 => "Post ReOpen",
|
|
],
|
|
2 => [
|
|
1 => "TTD",
|
|
2 => "PTD",
|
|
3 => "PPD",
|
|
4 => "Death",
|
|
]
|
|
];
|
|
}
|
|
|
|
public function ticketList()
|
|
{
|
|
if ($this->request->is('get')) {
|
|
$data['page_name'] = "Claims";
|
|
$data['ticket_type'] = $this->ticketType;
|
|
$data['claim_status'] = [];
|
|
$data['client_list'] = [];
|
|
|
|
return $this->loadLayout('ticket_search', $data);
|
|
|
|
} else{
|
|
|
|
$data['ticket_data'] = $this->ticketSearch();
|
|
$html = view('ticket_list', $data);
|
|
return $this->respond(['status' => true, 'html' => $html], 200);
|
|
}
|
|
}
|
|
|
|
public function ticketSearch()
|
|
{
|
|
$search_data = $this->request->getPost();
|
|
// print_r($search_data); die;
|
|
|
|
$data = [
|
|
[
|
|
'id' => 1,
|
|
'status' => 'Approved',
|
|
'claim_no' => 'CL12345',
|
|
'tpa_id' => 'TPA001',
|
|
'emp_name' => 'John Doe',
|
|
'insurer_name' => 'ABC Insurance',
|
|
'client_name' => 'XYZ Corp',
|
|
'tat' => '5 Days',
|
|
],
|
|
[
|
|
'id' => 2,
|
|
'status' => 'Pending',
|
|
'claim_no' => 'CL12346',
|
|
'tpa_id' => 'TPA002',
|
|
'emp_name' => 'Jane Smith',
|
|
'insurer_name' => 'DEF Insurance',
|
|
'client_name' => 'LMN Ltd',
|
|
'tat' => '3 Days',
|
|
],
|
|
[
|
|
'id' => 3,
|
|
'status' => 'Rejected',
|
|
'claim_no' => 'CL12347',
|
|
'tpa_id' => 'TPA003',
|
|
'emp_name' => 'Alice Johnson',
|
|
'insurer_name' => 'GHI Insurance',
|
|
'client_name' => 'PQR Co',
|
|
'tat' => '7 Days',
|
|
],
|
|
];
|
|
|
|
return $data;
|
|
}
|
|
|
|
public function ticket_form($ticket_type)
|
|
{
|
|
$data['ticket_form'] = 1;
|
|
$data['ticket_type'] = $this->ticketType;
|
|
$data['priorityType'] = $this->priorityType;
|
|
$data['relationshipType'] = $this->relationshipType;
|
|
$data['modeOFIntimate'] = $this->modeOFIntimate;
|
|
|
|
$data['acms'] = db_connect()->table('user_profiles')
|
|
->select('user_profiles.id, user_profiles.first_name')
|
|
->where('user_profiles.is_active', 1)
|
|
->where('user_profiles.role', 3)
|
|
->get()
|
|
->getResultArray();
|
|
|
|
$data['claim_status'] = db_connect()->table('ticket_claim_status')
|
|
->select('ticket_claim_status.*')
|
|
->where('ticket_claim_status.is_active', 1)
|
|
->where('ticket_claim_status.ticket_type', $ticket_type)
|
|
->get()
|
|
->getResultArray();
|
|
|
|
if($ticket_type == 1){
|
|
$data['modeOFIntimate'] = $this->claimType[1];
|
|
return $this->loadLayout('ticket_form_handler', $data);
|
|
}else{
|
|
|
|
$data['modeOFIntimate'] = $this->claimType[2];
|
|
|
|
if($ticket_type == 2){
|
|
$data['ticket_form'] = 'GPA';
|
|
}else if($ticket_type = 3){
|
|
$data['ticket_form'] == 'EDLI';
|
|
}else if($ticket_type = 4){
|
|
$data['ticket_form'] = 'GTLI';
|
|
}
|
|
|
|
return $this->loadLayout('ticket_form_handler', $data);
|
|
}
|
|
}
|
|
|
|
public function view_ticket($ticket_id)
|
|
{
|
|
$data = [];
|
|
return $this->loadLayout('ticket_edit_onbording', $data);
|
|
}
|
|
|
|
public function createTicket()
|
|
{
|
|
$ticket_data = $this->request->getPost();
|
|
// print_rr($ticket_data); die;
|
|
|
|
if(empty($ticket_data['doa'])){
|
|
$ticket_data['doa'] = null;
|
|
}else{
|
|
$ticket_data['doa'] = change_date_format($ticket_data['doa']);
|
|
}
|
|
|
|
if(empty($ticket_data['dod'])){
|
|
$ticket_data['dod'] = null;
|
|
}else{
|
|
$ticket_data['dod'] = change_date_format($ticket_data['dod']);
|
|
}
|
|
|
|
// print_rr($ticket_data); die;
|
|
|
|
if($ticket_data){
|
|
$return_value = $this->ticketMasterModel->insert($ticket_data);
|
|
if($cd_amount){
|
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim created successfully"], 200);
|
|
} else {
|
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to create claim'], 200);
|
|
}
|
|
}else{
|
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'claim data not found'], 200);
|
|
}
|
|
}
|
|
|
|
public function updateTicket()
|
|
{
|
|
}
|
|
|
|
public function createMailTemplate()
|
|
{
|
|
$data = [];
|
|
return $this->loadLayout('ticket_mail_template', $data);
|
|
}
|
|
|
|
|
|
} |