diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0ac3773a..eb828452 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -495,7 +495,7 @@ $routes->group("/bdsReport", ["filter" => "authMVC"], function ($routes) { //New Tickets $routes->group("/ticket", ["filter" => "authMVC"], function ($routes) { $routes->match( ['get', 'post'], 'list','TicketController::ticketList'); - $routes->get('new','TicketController::ticket_form'); + $routes->get('new/(:any)','TicketController::ticket_form/$1'); $routes->post('create','TicketController::createTicket'); $routes->get('update','TicketController::updateTicket'); $routes->get('view/(:any)','TicketController::view_ticket/$1'); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 9c8e8d64..38192213 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -4047,18 +4047,38 @@ class ClientController extends AdminController // -----------BDS REPORT CONTROLLER--------------------------------------------------------------------------------- - $BDSReportController = new BDSReportController(); + // $BDSReportController = new BDSReportController(); // $data['data'] = $BDSReportController->getBAPInsurerData(); // return $this->loadLayout('irda_bap_insurer_report_list', $data); - $data['data'] = $BDSReportController->getBAPClientData(); - return $this->loadLayout('irda_bap_client_report_list', $data); + // $data['data'] = $BDSReportController->getBAPClientData(); + // return $this->loadLayout('irda_bap_client_report_list', $data); // $data['data'] = $BDSReportController->getClientData(1); // return $this->loadLayout('irda_client_report_list', $data); // $BDSReportController->getBAPClientData(); + + //-------------------------------------------------------------------------------------------------------- + + // $email_id = 'venkateshraman786@gmail.com'; + // $common = ['mail_type'=>'test_mail_cli']; + // $bcc = "vitvelz@gmail.com"; + + // $data = db_connect() + // ->table('jobs') + // ->where('id', 2264) + // ->get() + // ->getResultArray(); + + // $data = json_decode($data[0]['payload'], true); + + // // dd($data); + // // Send email and get response + // $result = MailHelper::send_email($data[0]); + // echo json_encode($result); + // log_message('error',json_encode($result)); } // ------------------------------------------------------------------------------------------------------- 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..c489e247 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -4,7 +4,13 @@ namespace App\Controllers; use App\Controllers\BaseController; use CodeIgniter\HTTP\ResponseInterface; - +use App\Models\TicketMasterModel; +use App\Models\TicketClaimStatusModel; +use App\Models\ClientModel; +use App\Models\TicketHistoryModel; +use App\Models\TicketMailTemplateModel; +use App\Models\TicketMessageModel; +use App\Models\TicketNoteModel; use Psr\Log\LoggerInterface; use Kint\Kint; @@ -18,10 +24,23 @@ class TicketController extends BaseController protected $ticketType; protected $priorityType; protected $relationshipType; + protected $modeOFIntimate; + protected $claimType; + protected $claimStatus; + + protected $clientModel; + protected $ticketMasterModel; + protected $ticketHistoryModel; + protected $ticketMailTemplateModel; + protected $ticketMesageModel; + protected $ticketNoteModel; 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", @@ -41,6 +60,31 @@ class TicketController extends BaseController "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", + ] + ]; + $this->ticketMasterModel = new TicketMasterModel(); + $this->claimStatus = new TicketClaimStatusModel(); + $this->clientModel = new ClientModel(); + $this->ticketHistoryModel = new TicketHistoryModel(); + } public function ticketList() @@ -48,8 +92,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,48 +108,70 @@ 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() + public function ticket_form($ticket_type) { $data['ticket_form'] = 1; - return $this->loadLayout('ticket_form_gmc', $data); + $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) @@ -116,6 +182,33 @@ class TicketController extends BaseController 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($return_value){ + 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() @@ -129,4 +222,4 @@ class TicketController extends BaseController } -} +} \ No newline at end of file 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..51896dbc 100644 --- a/app/Models/TicketMasterModel.php +++ b/app/Models/TicketMasterModel.php @@ -12,7 +12,45 @@ 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', + 'is_active', + 'claim_number' + ]; + // Callbacks protected $allowCallbacks = true; diff --git a/app/Models/TicketNoteModel.php b/app/Models/TicketNoteModel.php index b3a62b94..c9c10746 100644 --- a/app/Models/TicketNoteModel.php +++ b/app/Models/TicketNoteModel.php @@ -12,7 +12,7 @@ class TicketNoteModel extends Model protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; - protected $allowedFields = []; + protected $allowedFields = ['id,created_by','updated_by','is_active']; // Callbacks protected $allowCallbacks = true; diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index a4accd6b..cbe4f817 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -755,7 +755,7 @@ dataType: 'json', success: function(res) { - console.log('client_policy_res', res); + console.log('client_policy_res by btnPolicyEdit', res); var gst = (res.data.gst == 0.00) ? 18 : res.data.gst; @@ -944,7 +944,7 @@ }, 1000); setTimeout(function(){ - appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number + appendCDACNO(res.cd_data, res.data.cd_ac_pk) // append and select the current CD Account Number appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy }, 2000) @@ -1660,7 +1660,7 @@ text: item.cd_ac_no }); - if (select === item.cd_ac_no) { + if (select === item.id) { //console.log('selected'); option.attr('selected', true); } @@ -1990,7 +1990,7 @@ }, 1000); setTimeout(function(){ - appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number + appendCDACNO(res.cd_data, res.data.cd_ac_pk) // append and select the current CD Account Number appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy }, 2000) diff --git a/app/Views/layout/footer.php b/app/Views/layout/footer.php index bef8a1fc..c63f59f6 100755 --- a/app/Views/layout/footer.php +++ b/app/Views/layout/footer.php @@ -2,6 +2,9 @@ + + +