129 lines
4.0 KiB
PHP
129 lines
4.0 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use App\Controllers\BaseController;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use App\Models\TicketMasterModel;
|
|
use App\Models\TicketClaimStatusModel;
|
|
use App\Models\ClientModel;
|
|
use Psr\Log\LoggerInterface;
|
|
use Kint\Kint;
|
|
|
|
use CodeIgniter\API\ResponseTrait;
|
|
|
|
class TicketController extends BaseController
|
|
{
|
|
use ResponseTrait;
|
|
|
|
protected $myLogger;
|
|
protected $ticketType;
|
|
protected $priorityType;
|
|
protected $relationshipType;
|
|
protected $ticketMasterModel;
|
|
protected $claimStatus;
|
|
protected $clientModel;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->myLogger = \Config\Services::mylogger();
|
|
$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->ticketMasterModel = new TicketMasterModel();
|
|
$this->claimStatus = new TicketClaimStatusModel();
|
|
$this->clientModel = new ClientModel();
|
|
}
|
|
|
|
public function ticketList()
|
|
{
|
|
if ($this->request->is('get')) {
|
|
$data['page_name'] = "Claims";
|
|
$data['ticket_type'] = $this->ticketType;
|
|
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active',1)->findAll();
|
|
$data['client_list'] = $this->clientModel->select('id,client_name')->where('is_active',1)->findAll();
|
|
|
|
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);
|
|
$where = [];
|
|
foreach ($search_data as $search_objects => $key){
|
|
if ($key != null && $key != '' && $key!= 0 ){
|
|
$where[$search_objects] = $key;
|
|
}
|
|
}
|
|
// print_rr($where);
|
|
$data = $this->ticketMasterModel
|
|
->select('ticket_master.id, ticket_claim_status.claim_status as status,
|
|
ticket_master.claim_number as claim_no,ticket_master.tpa_id,ticket_master.emp_name,
|
|
insurers.name as insurer_name, clients.client_name,
|
|
DATE_FORMAT(ticket_master.created_at, "%d-%m-%Y") as tat')
|
|
->join('insurers','insurers.id = ticket_master.insurer_id and insurers.is_active = 1','left')
|
|
->join('clients','clients.id = ticket_master.client_id and clients.is_active = 1','left')
|
|
->join('ticket_claim_status','ticket_claim_status.id = ticket_master.claim_status_id and ticket_claim_status.is_active = 1','left')
|
|
->where('ticket_master.is_active',1)
|
|
->where($where)
|
|
->findAll();
|
|
// print_rr($data);
|
|
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
|
// print_rr($data);die();
|
|
return $data;
|
|
}
|
|
|
|
public function ticket_form()
|
|
{
|
|
$data['ticket_form'] = 1;
|
|
$data['claim_status'] = '';
|
|
return $this->loadLayout('ticket_form_gmc', $data);
|
|
}
|
|
|
|
public function view_ticket($ticket_id)
|
|
{
|
|
$data = [];
|
|
return $this->loadLayout('ticket_edit_onbording', $data);
|
|
}
|
|
|
|
public function createTicket()
|
|
{
|
|
}
|
|
|
|
public function updateTicket()
|
|
{
|
|
}
|
|
|
|
public function createMailTemplate()
|
|
{
|
|
$data = [];
|
|
return $this->loadLayout('ticket_mail_template', $data);
|
|
}
|
|
|
|
|
|
}
|