diff --git a/app/Controllers/LoginController.php b/app/Controllers/LoginController.php index b3ca2187..f5f31844 100755 --- a/app/Controllers/LoginController.php +++ b/app/Controllers/LoginController.php @@ -20,7 +20,7 @@ class LoginController extends BaseController // $isLoggedIn = check_session(); $isLoggedIn = check_session(); $hasCookie = check_cookie(); - if ($isLoggedIn || $hasCookie) { + if ($isLoggedIn && $hasCookie) { return redirect()->to(base_url('/dashboard/view')); } return view('login'); @@ -91,7 +91,11 @@ class LoginController extends BaseController { $path = getenv('cookie.Path'); session()->destroy(); - setcookie('session_data', '', time() - 3600, $path); + // setcookie('session_data', '', time() - 3600, $path); + $path = getenv('cookie.Path'); + $domain = getenv('cookie.Domain'); + $https = getenv('ccokie.secure'); + setcookie('session_data',null, time() -3600, $path, $domain, $https, true); return redirect()->to(base_url('login')); } diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index f41e53b1..e13e1c75 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -4,7 +4,9 @@ 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; @@ -18,6 +20,9 @@ class TicketController extends BaseController protected $ticketType; protected $priorityType; protected $relationshipType; + protected $ticketMasterModel; + protected $claimStatus; + protected $clientModel; public function __construct() { @@ -41,6 +46,9 @@ class TicketController extends BaseController "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() @@ -48,8 +56,8 @@ class TicketController extends BaseController if ($this->request->is('get')) { $data['page_name'] = "Claims"; $data['ticket_type'] = $this->ticketType; - $data['claim_status'] = []; - $data['client_list'] = []; + $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); @@ -64,47 +72,35 @@ class TicketController extends BaseController 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', - ], - ]; - + // 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); } diff --git a/app/Models/TicketClaimStatusModel.php b/app/Models/TicketClaimStatusModel.php index d0e959e7..bc40b394 100644 --- a/app/Models/TicketClaimStatusModel.php +++ b/app/Models/TicketClaimStatusModel.php @@ -12,7 +12,7 @@ class TicketClaimStatusModel extends Model protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; - protected $allowedFields = []; + protected $allowedFields = ["id", "ticket_type", "claim_status", "created_by", "updated_by", "is_active"]; // Callbacks protected $allowCallbacks = true; diff --git a/app/Models/TicketMasterModel.php b/app/Models/TicketMasterModel.php index 060f1594..87e918a4 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -12,7 +12,13 @@ class TicketMasterModel extends Model protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; - protected $allowedFields = []; + 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' + ]; // Callbacks protected $allowCallbacks = true; diff --git a/app/Views/ticket_search.php b/app/Views/ticket_search.php index 24317d79..2e332cd7 100644 --- a/app/Views/ticket_search.php +++ b/app/Views/ticket_search.php @@ -10,10 +10,16 @@
- +
+

Claim Filter

+
+
+
@@ -51,7 +57,7 @@ $value) { + foreach ($client_list as $key => $value) { echo ""; } } @@ -79,13 +85,13 @@
@@ -113,6 +119,34 @@