diff --git a/app/Config/Routes.php b/app/Config/Routes.php index bcca1465..5782aa0f 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -66,3 +66,79 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){ $routes->get("clients-with-policies", "EmployeeController::getClientWithPolicies"); $routes->get("police-by-insurer/(:any)", "ClientController::getPolicesByInsurerId/$1"); }); + + + + + +$routes->group("/master", ["filter" => "authMVC"], function($routes){ + + + $routes->group("insurer", ["filter" => "authMVC"], function($routes){ + $routes->get("list", "MasterController::insurerList"); + $routes->get("create", "MasterController::insurerOnboarding"); + $routes->post("createpost", "MasterController::createInsurerGeneralInfo"); + $routes->post("edit", "MasterController::editInsurerGeneralInfo"); + $routes->get("list/(:any)", "MasterController::editInsurerOnboarding/$1"); + + $routes->group("branch", ["filter" => "authMVC"], function($routes){ + $routes->post("create", "MasterController::createInsurerBranch"); + $routes->post("edit", "MasterController::editInsurerBranch"); + $routes->get("editget/(:any)", "MasterController::editInsurerGet/$1"); + $routes->get("list/(:any)", "MasterController::insurerBranchList/$1"); + }); + + }); + + $routes->group("tpa", ["filter" => "authMVC"], function($routes){ + $routes->get("list", "MasterController::tpaList"); + $routes->get("create", "MasterController::tpaOnboarding"); + $routes->post("createpost", "MasterController::createTPAGeneralInfo"); + $routes->post("edit", "MasterController::editTPAGeneralInfo"); + $routes->get("list/(:any)", "MasterController::editTPAOnboarding/$1"); + + $routes->group("branch", ["filter" => "authMVC"], function($routes){ + $routes->post("create", "MasterController::createTPABranch"); + $routes->get("editget/(:any)", "MasterController::editTPAGet/$1"); + $routes->post("edit", "MasterController::editTPABranch"); + $routes->get("list/(:any)", "MasterController::tpaBranchList/$1"); + }); + }); + + $routes->group("kyc", ["filter" => "authMVC"], function($routes){ + $routes->get("list", "MasterController::kycList"); + $routes->get("create", "MasterController::kycOnboarding"); + $routes->post("createpost", "MasterController::createKYCInfo"); + $routes->post("edit", "MasterController::editKYCInfo"); + $routes->get("list/(:any)", "MasterController::editKYCOnboarding/$1"); + $routes->get("delete/(:any)", "MasterController::deleteClientKycDocs/$1"); + + + $routes->group("kycdocs", ["filter" => "authMVC"], function($routes){ + $routes->post("createpost", "MasterController::createKycDocs"); + $routes->get("editget/(:any)", "MasterController::editKYCGet/$1"); + $routes->post("edit", "MasterController::editKYCDocs"); + $routes->get("list", "MasterController::tpaBranchList"); + $routes->get("list/(:any)", "MasterController::kycDocsList/$1"); + + }); + }); + + $routes->group("policy", ["filter" => "authMVC"], function($routes){ + $routes->get("list", "MasterController::policyTypeList"); + $routes->get("create", "MasterController::policyTypeOnboarding"); + $routes->post("createpost", "MasterController::createPolicyType"); + $routes->post("edit", "MasterController::editPolicyType"); + $routes->get("list/(:any)", "MasterController::editPolicyTypeOnboarding/$1"); + + + $routes->group("policies", ["filter" => "authMVC"], function($routes){ + $routes->post("createpost", "MasterController::createPolicies"); + $routes->get("editget/(:any)", "MasterController::editPoliciesGet/$1"); + $routes->post("edit", "MasterController::editPolicies"); + $routes->get("list", "MasterController::tpaBranchList"); + $routes->get("list/(:any)", "MasterController::policesList/$1"); + }); + + }); +}); \ No newline at end of file diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php new file mode 100644 index 00000000..f0d5cc4b --- /dev/null +++ b/app/Controllers/MasterController.php @@ -0,0 +1,877 @@ +myLogger = \Config\Services::mylogger(); + + $this->insurerModel = new ClientModel(); + $this->userModel = new UserModel(); + // $this->insurerBranchModel = new ClientBranchModel(); + $this->insurerKYCDocsModel = new ClientKYCDocsModel(); + $this->insurerPolicyModel = new ClientPolicyModel(); + $this->insurerRMModel = new ClientRMModel(); + $this->insurerBranchModel = new InsurerBranchModel(); + $this->insurerModel = new InsurerModel(); + $this->kycDocsModel = new KYCDocsModel(); + $this->kycEntityTypeModel = new KYCEntityTypeModel(); + $this->levelContactModel = new LevelContactModel(); + $this->policesModel = new PolicesModel(); + $this->tpaBranchModel = new TPABranchModel(); + $this->tpaModel = new TPAModel(); + $this->stateModel = new StateModel(); + $this->policyTypeModel = new PolicyTypeModel(); + } + + public function insurerList() + { + $this->myLogger->logme('error','Insurer list function called'); + $headerData['page_name'] = 'Insurer List'; + $data['insurerList'] = $this->insurerModel->findAll(); + $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM(); + // echo '
';
+        // print_r($data['insurerList']); die;
+
+        echo view('layout/header', $headerData);
+        echo view('insurer_list', $data);
+        echo view('layout/footer');
+
+        // $this->loadLayout('insurer_onboarding', $data);
+    }
+
+ 
+    public function editInsurerOnboarding($id = null)
+    {
+
+        $this->myLogger->logme('error','Edit Insurer Onboarding function called');
+        $headerData['page_name'] = 'Edit Insurer Onboarding';
+
+        $types = array(
+            (object) array('id' => 'pvt', 'name' => 'PVT'),
+            (object) array('id' => 'psu', 'name' => 'PSU')
+        );
+    
+        $editData['types'] = $types;
+        $editData['RM']            = $this->userModel->findAll();
+        $editData['tpa']           = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
+        $editData['state']         = $this->stateModel->getAllStates();
+        $editData['insurer']       = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
+
+
+        $editData['insurer']           = $this->insurerModel->where(['id' => $id, 'is_active' => 1])->first();
+        $editData['insuer_branch']    = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
+
+
+        // echo "
";
+        // print_r($editData); die;
+
+        echo view('layout/header', $headerData);
+        echo view('insurer_onboarding', $editData);
+        echo view('layout/footer');
+
+    }
+
+
+    public function insurerOnboarding()
+    {
+        
+        $this->myLogger->logme('error','Insurer Onboarding function called');
+        $headerData['page_name'] = 'Insurer Onboarding';
+
+        $types = array(
+            (object) array('id' => 'pvt', 'name' => 'PVT'),
+            (object) array('id' => 'psu', 'name' => 'PSU')
+        );
+    
+        $data['types'] = $types;
+        // print_r($data['types']);die();
+        $data['entity']        = $this->kycEntityTypeModel->findAll();
+        $data['kyc_docs']      = $this->kycDocsModel->findAll();
+        $data['police']        = $this->policesModel->findAll();
+        $data['insurer']       = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
+        $data['tpa']           = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
+        $data['state']         = $this->stateModel->getAllStates();
+        $data['RM']            = $this->userModel->findAll();
+                
+        // echo "
";
+        // print_r($data); die;
+
+        echo view('layout/header', $headerData);
+        echo view('insurer_onboarding', $data);
+        echo view('layout/footer');
+
+    } 
+
+
+    public function createInsurerGeneralInfo()
+    {
+
+        $this->myLogger->logme('error','Insurer general info function called');
+        $data   = $this->request->getPost();
+        $data['created_by'] = get_session_userid();
+        
+        $insert = $this->insurerModel->insert($data);
+        if($insert){
+            $insurer_data = $this->insurerModel->where(['id' => $insert, 'is_active' => 1])->first();
+            echo json_encode(array("status" => true , 'data' => $insurer_data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+    public function createInsurerBranch()
+    {
+
+        $this->myLogger->logme('error','Client branch CREATE function called');
+        $data   = $this->request->getPost();
+        $data['created_by'] = get_session_userid();
+        $insert = $this->insurerBranchModel->insert($data);
+        
+        if($insert){
+            for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
+                // Prepare data to insert
+                $data = [
+                    'contact_type' => 'insurer',
+                    'ref_id'       => $insert,
+                    'created_by'   => get_session_userid(),
+                    'name'         => $this->request->getPost('name')[$i],
+                    'email'        => $this->request->getPost('email')[$i],
+                    'mobile'       => $this->request->getPost('mobile')[$i],
+                    'designation'  => $this->request->getPost('designation')[$i]
+                ];
+                $contacts = $this->levelContactModel->insert($data);
+            }
+        }
+
+        if($insert){
+            $branchData = $this->insurerBranchModel->where('insurer_id', $this->request->getPost('insurer_id'))->findAll();
+            echo json_encode(array("status" => true , 'data' => $branchData));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+    
+
+    public function insurerBranchList($id = null)
+    {
+        $this->myLogger->logme('error','Edit Insurer Onboarding function called');
+
+        $editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
+
+        // Return JSON response
+        header('Content-Type: application/json');
+        echo json_encode($editData);
+        exit();
+    }
+
+
+    
+
+    public function editInsurerGeneralInfo()
+    {
+        $this->myLogger->logme('error','edit Insurer general info function called');
+        $id                 = $this->request->getPost('PrimaryKey');
+        $data               = $this->request->getPost();
+        $data['updated_by'] = get_session_userid();
+        $update             = $this->insurerModel->update($id,$data);
+        if($update){
+            echo json_encode(array("status" => true , 'data' => $data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+
+
+
+    
+
+
+    public function editInsurerGet($id = null)
+    {
+        $this->myLogger->logme('error','Edit TPA Onboarding function called');
+
+        
+        $editData['insurerbranch'] = $this->insurerBranchModel->where(['id' => $id, 'is_active' => 1])->first();
+        $editData['levelcontact'] = $this->levelContactModel->where(['ref_id' => $id, 'contact_type' => 'insurer' , 'is_active' => 1])->findAll();
+        // print_r($editData['tpa']);
+        // Return JSON response
+        header('Content-Type: application/json');
+        echo json_encode($editData);
+        exit();
+    }
+
+
+
+    
+
+    public function editInsurerBranch()
+    {
+        $this->myLogger->logme('error','Insurer branch CREATE function called');
+        $id     = $this->request->getPost('PrimaryKey');
+        $data   = $this->request->getPost();
+        $update = $this->insurerBranchModel->update($id, $data);
+
+        // print_r($this->request->getPost('name[]'));
+        // print_r($this->request->getPost('email[]'));
+        // print_r($this->request->getPost('mobile[]'));
+        // print_r($this->request->getPost('designation[]'));
+
+        if($update){
+            $contactsToDelete = $this->levelContactModel->where(['ref_id' => $id,'contact_type' => 'insurer', 'is_active' => 1])->get()->getResult();
+            foreach ($contactsToDelete as $contact) {
+                $this->levelContactModel->delete($contact->id);
+            }
+            for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
+                // Prepare data to update
+                $data = [
+                    'contact_type' => 'insurer',
+                    'ref_id'       => $id,
+                    'created_by'   => get_session_userid(),
+                    'name'         => $this->request->getPost('name')[$i],
+                    'email'        => $this->request->getPost('email')[$i],
+                    'mobile'       => $this->request->getPost('mobile')[$i],
+                    'designation'  => $this->request->getPost('designation')[$i]
+                ];
+                $contacts = $this->levelContactModel->insert($data);
+            }
+        }
+
+        if($update){
+            $branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll();
+            echo json_encode(array("status" => true , 'data' => $branchData));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+
+// Insurer Ends
+
+
+
+
+// TPA Start
+
+
+    public function tpaList()
+    {   
+        $this->myLogger->logme('error','TPA list function called');
+        $headerData['page_name'] = 'TPA List';
+        $data['tpaList'] = $this->tpaModel->findAll();
+        // $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
+        // echo '
';
+        // print_r($data['insurerList']); die;
+
+        echo view('layout/header', $headerData);
+        echo view('tpa_list', $data);
+        echo view('layout/footer');
+
+        // $this->loadLayout('insurer_onboarding', $data);
+    }
+    
+
+
+
+    public function tpaOnboarding()
+    {
+        
+        $this->myLogger->logme('error','TPA Onboarding function called');
+        $headerData['page_name'] = 'TPA Onboarding';
+
+
+        // print_r($data['types']);die();
+        $data['entity']        = $this->kycEntityTypeModel->findAll();
+        $data['kyc_docs']      = $this->kycDocsModel->findAll();
+        $data['police']        = $this->policesModel->findAll();
+        $data['insurer']       = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
+        $data['tpa']           = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
+        $data['state']         = $this->stateModel->getAllStates();
+        $data['RM']            = $this->userModel->findAll();
+                
+        // echo "
";
+        // print_r($data); die;
+
+        echo view('layout/header', $headerData);
+        echo view('tpa_onboarding', $data);
+        echo view('layout/footer');
+
+    } 
+
+    
+
+    public function createTPAGeneralInfo()
+    {
+
+        $this->myLogger->logme('error','TPA general info function called');
+        $data   = $this->request->getPost();
+        $data['created_by'] = get_session_userid();
+        
+        $insert = $this->tpaModel->insert($data);
+        if($insert){
+            $tpa_data = $this->tpaModel->where(['id' => $insert, 'is_active' => 1])->first();
+            echo json_encode(array("status" => true , 'data' => $tpa_data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+
+
+
+
+
+    public function createTPABranch()
+    {
+
+        $this->myLogger->logme('error','TPA branch CREATE function called');
+        $data   = $this->request->getPost();
+        $data['created_by'] = get_session_userid();
+        $insert = $this->tpaBranchModel->insert($data);
+        
+        if($insert){
+            for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
+                // Prepare data to insert
+                $data = [
+                    'contact_type' => 'tpa',
+                    'ref_id'       => $insert,
+                    'created_by'   => get_session_userid(),
+                    'name'         => $this->request->getPost('name')[$i],
+                    'email'        => $this->request->getPost('email')[$i],
+                    'mobile'       => $this->request->getPost('mobile')[$i],
+                    'designation'  => $this->request->getPost('designation')[$i]
+                ];
+                $contacts = $this->levelContactModel->insert($data);
+            }
+        }
+
+        if($insert){
+            $branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll();
+            echo json_encode(array("status" => true , 'data' => $branchData));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+
+    public function editTPAOnboarding($id = null)
+    {
+
+        $this->myLogger->logme('error','Edit TPA Onboarding function called');
+        $headerData['page_name'] = 'Edit TPA Onboarding';
+
+        $editData['tpa']           = $this->tpaModel->where(['id' => $id, 'is_active' => 1])->first();
+        $editData['tpa_branch']    = $this->tpaBranchModel->where(['tpa_id' => $id, 'is_active' => 1])->findAll();
+        $editData['state']         = $this->stateModel->getAllStates();
+
+
+        // echo "
";
+        // print_r($editData); die;
+
+        echo view('layout/header', $headerData);
+        echo view('tpa_onboarding', $editData);
+        echo view('layout/footer');
+
+    }
+
+
+    
+
+    public function editTPAGeneralInfo()
+    {
+        $this->myLogger->logme('error','edit TPA general info function called');
+        $id                 = $this->request->getPost('PrimaryKey');
+        $data               = $this->request->getPost();
+        $data['updated_by'] = get_session_userid();
+        $update             = $this->tpaModel->update($id,$data);
+        if($update){
+            echo json_encode(array("status" => true , 'data' => $data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+    
+    public function editTPAGet($id = null)
+    {
+        $this->myLogger->logme('error','Edit TPA Onboarding function called');
+
+        
+        $editData['tpabranch'] = $this->tpaBranchModel->where(['id' => $id, 'is_active' => 1])->first();
+        $editData['levelcontact'] = $this->levelContactModel->where(['ref_id' => $id, 'contact_type' => 'tpa' , 'is_active' => 1])->findAll();
+        // print_r($editData['tpa']);
+        // Return JSON response
+        header('Content-Type: application/json');
+        echo json_encode($editData);
+        exit();
+    }
+
+
+
+    
+
+    public function editTPABranch()
+    {
+        $this->myLogger->logme('error','TPA branch CREATE function called');
+        $id     = $this->request->getPost('PrimaryKey');
+        $data   = $this->request->getPost();
+        $update = $this->tpaBranchModel->update($id, $data);
+
+        // print_r($this->request->getPost('name[]'));
+        // print_r($this->request->getPost('email[]'));
+        // print_r($this->request->getPost('mobile[]'));
+        // print_r($this->request->getPost('designation[]'));
+
+        if($update){
+            $contactsToDelete = $this->levelContactModel->where(['ref_id' => $id,'contact_type' => 'tpa', 'is_active' => 1])->get()->getResult();
+            foreach ($contactsToDelete as $contact) {
+                $this->levelContactModel->delete($contact->id);
+            }
+            for ($i = 0; $i < count($this->request->getPost('name')); $i++) {
+                // Prepare data to update
+                $data = [
+                    'contact_type' => 'tpa',
+                    'ref_id'       => $id,
+                    'created_by'   => get_session_userid(),
+                    'name'         => $this->request->getPost('name')[$i],
+                    'email'        => $this->request->getPost('email')[$i],
+                    'mobile'       => $this->request->getPost('mobile')[$i],
+                    'designation'  => $this->request->getPost('designation')[$i]
+                ];
+                $contacts = $this->levelContactModel->insert($data);
+            }
+        }
+
+        if($update){
+            $branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll();
+            echo json_encode(array("status" => true , 'data' => $branchData));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+
+    
+    public function tpaBranchList($id = null)
+    {
+        $this->myLogger->logme('error','TPA List function called');
+
+        $editData['tpa_branch'] = $this->tpaBranchModel->where(['tpa_id' => $id, 'is_active' => 1])->findAll();
+
+        // Return JSON response
+        header('Content-Type: application/json');
+        echo json_encode($editData);
+        exit();
+    }
+
+
+
+
+    //Ends TPA Models
+    
+    //Start KYC 
+
+
+    public function kycList()
+    {   
+        $this->myLogger->logme('error','KYC list function called');
+        $headerData['page_name'] = 'KYC List';
+        $data['kycList'] = $this->kycEntityTypeModel->findAll();
+        // $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
+        // echo '
';
+        // print_r($data['insurerList']); die;
+
+        echo view('layout/header', $headerData);
+        echo view('kyc_list', $data);
+        echo view('layout/footer');
+
+        // $this->loadLayout('insurer_onboarding', $data);
+    }
+
+    
+
+
+    public function kycOnboarding()
+    {
+        
+        $this->myLogger->logme('error','KYC Onboarding function called');
+        $headerData['page_name'] = 'KYC Onboarding';
+
+
+        // print_r($data['types']);die();
+        $data['entity']        = $this->kycEntityTypeModel->findAll();
+        $data['kyc_docs']      = $this->kycDocsModel->findAll();
+        $data['police']        = $this->policesModel->findAll();
+        $data['insurer']       = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
+        $data['tpa']           = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
+        $data['state']         = $this->stateModel->getAllStates();
+        $data['RM']            = $this->userModel->findAll();
+                
+        // echo "
";
+        // print_r($data); die;
+
+        echo view('layout/header', $headerData);
+        echo view('kyc_onboarding', $data);
+        echo view('layout/footer');
+
+    }
+
+
+    
+
+    public function createKYCInfo()
+    {
+
+        $this->myLogger->logme('error','KYC Entity Type general info function called');
+        $data   = $this->request->getPost();
+        $data['created_by'] = get_session_userid();
+        
+        $insert = $this->kycEntityTypeModel->insert($data);
+        if($insert){
+            $kyc_data = $this->kycEntityTypeModel->where(['id' => $insert, 'is_active' => 1])->first();
+            echo json_encode(array("status" => true , 'data' => $kyc_data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+    
+
+    public function createKycDocs()
+    {
+
+        $this->myLogger->logme('error','Kyc Docs CREATE function called');
+        $data   = $this->request->getPost();
+        $data['created_by'] = get_session_userid();
+        $insert = $this->kycDocsModel->insert($data);
+
+        if($insert){
+            $kycDocsData = $this->kycDocsModel->where('kyc_type_id', $this->request->getPost('kyc_type_id'))->findAll();
+            echo json_encode(array("status" => true , 'data' => $kycDocsData));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+    
+    public function editKYCOnboarding($id = null)
+    {
+
+        $this->myLogger->logme('error','Edit KYC Onboarding function called');
+        $headerData['page_name'] = 'Edit KYC Onboarding';
+
+        $editData['kyc']           = $this->kycEntityTypeModel->where(['id' => $id, 'is_active' => 1])->first();
+        $editData['kyc_docs']    = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll();
+
+
+        // echo "
";
+        // print_r($editData); die;
+
+        echo view('layout/header', $headerData);
+        echo view('kyc_onboarding', $editData);
+        echo view('layout/footer');
+
+    }
+
+
+    
+
+    public function kycDocsList($id = null)
+    {
+        $this->myLogger->logme('error','Edit KYC Docs Onboarding function called');
+
+        $editData['kyc_docs'] = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll();
+
+        // Return JSON response
+        header('Content-Type: application/json');
+        echo json_encode($editData);
+        exit();
+    }
+
+
+    
+    public function editKYCInfo()
+    {
+        $this->myLogger->logme('error','edit KYC general info function called');
+        $id                 = $this->request->getPost('PrimaryKey');
+        $data               = $this->request->getPost();
+        $data['updated_by'] = get_session_userid();
+        $update             = $this->kycEntityTypeModel->update($id,$data);
+        if($update){
+            echo json_encode(array("status" => true , 'data' => $data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+    
+    public function editKYCGet($id = null)
+    {
+        $this->myLogger->logme('error','Edit KYC Onboarding function called');
+
+        $editData['policies'] = $this->kycDocsModel->where(['id' => $id, 'is_active' => 1])->first();
+
+        // Return JSON response
+        header('Content-Type: application/json');
+        echo json_encode($editData);
+        exit();
+    }
+
+
+    
+    public function editKYCDocs()
+    {
+        $this->myLogger->logme('error','edit KYC Docs function called');
+        $id                 = $this->request->getPost('PrimaryKey');
+        $data['file_name']  = $this->request->getPost('file_name');
+        $data['updated_by'] = get_session_userid();
+        $update             = $this->kycDocsModel->update($id,$data);
+        if($update){
+            echo json_encode(array("status" => true , 'data' => $data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+
+
+
+    //Ends KYC 
+
+    //Start Policy  
+
+
+    public function policyTypeList()
+    {   
+        $this->myLogger->logme('error','Policy Type list function called');
+        $headerData['page_name'] = 'Policy Type List';
+        $data['policyList'] = $this->policyTypeModel->findAll();
+        // $data['insurer_rm'] = $this->insurerRMModel->getAllClientRM();
+        // echo '
';
+        // print_r($data['insurerList']); die;
+
+        echo view('layout/header', $headerData);
+        echo view('policy_type_list', $data);
+        echo view('layout/footer');
+
+        // $this->loadLayout('insurer_onboarding', $data);
+    }
+
+    
+
+    public function policyTypeOnboarding()
+    {
+        
+        $this->myLogger->logme('error','Policy Type Onboarding function called');
+        $headerData['page_name'] = 'Policy Type Onboarding';
+
+
+        // print_r($data['types']);die();
+        $data['entity']        = $this->kycEntityTypeModel->findAll();
+        $data['kyc_docs']      = $this->kycDocsModel->findAll();
+        $data['police']        = $this->policesModel->findAll();
+        // $data['insurer']       = $this->insurerBranchModel ->getInsurerBranchesWithInsurerNames();
+        $data['tpa']           = $this->tpaBranchModel ->getTpaBranchesWithTpaNames();
+        $data['state']         = $this->stateModel->getAllStates();
+        $data['RM']            = $this->userModel->findAll();
+        $data['policy_type']   = $this->policyTypeModel->findAll();
+        $data['insurer']       = $this->insurerModel ->findAll();
+        // echo "
";
+
+        echo view('layout/header', $headerData);
+        echo view('policy_type_onboarding', $data);
+        echo view('layout/footer');
+
+    }
+
+
+
+    
+    public function createPolicies()
+    {
+        $this->myLogger->logme('error','Policies CREATE function called');
+        $data   = $this->request->getPost();
+        // print_r($data);
+        // die();
+        $data['created_by'] = get_session_userid();
+        $insert = $this->policesModel->insert($data);
+        if($insert){
+            $policiesData = $this->policesModel->where('policy_type_id', $this->request->getPost('policy_type_id'))->findAll();
+            echo json_encode(array("status" => true , 'data' => $policiesData));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+
+    
+    public function createPolicyType()
+    {
+        $this->myLogger->logme('error','Policy Type CREATE function called');
+        $data   = $this->request->getPost();
+
+        $data['created_by'] = get_session_userid();
+        $insert = $this->policyTypeModel->insert($data);
+
+        if($insert){
+            $policyTypeData = $this->policyTypeModel->where('id', $insert)->first();
+            echo json_encode(array("status" => true , 'data' => $policyTypeData));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+    
+    
+
+    public function editPolicyTypeOnboarding($id = null)
+    {
+
+        $this->myLogger->logme('error','Edit KYC Onboarding function called');
+        $headerData['page_name'] = 'Edit KYC Onboarding';
+
+        $editData['policytype']   = $this->policyTypeModel->where(['id' => $id, 'is_active' => 1])->first();
+        $editData['policies']     = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
+        $editData['insurer']      = $this->insurerModel-> findAll();
+        echo view('layout/header', $headerData);
+        echo view('policy_type_onboarding', $editData);
+        echo view('layout/footer');
+
+    }
+
+
+
+
+
+    public function editPolicyType()
+    {
+        $this->myLogger->logme('error','edit Policy general info function called');
+        $id                 = $this->request->getPost('PrimaryKey');
+        $data               = $this->request->getPost();
+        $data['updated_by'] = get_session_userid();
+        $update             = $this->policyTypeModel->update($id,$data);
+        if($update){
+            echo json_encode(array("status" => true , 'data' => $data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+
+
+    
+
+    public function policesList($id = null)
+    {
+        $this->myLogger->logme('error','Edit Policies Onboarding function called');
+
+        // $editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
+
+        $policies = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
+
+            foreach ($policies as $policy) {
+                // Retrieve the insurer information
+                $insurer = $this->insurerModel->find($policy['insurer_id']);
+
+                // Add the insurer information to the editData array
+                if ($insurer) {
+                    $editData['policies'][$policy['id']] = [
+                        'policy' => $policy,
+                        'insurer' => $insurer
+                    ];
+                }
+            }
+
+        
+        // Return JSON response
+        header('Content-Type: application/json');
+        echo json_encode($editData);
+        exit();
+    }
+
+
+    
+    public function editPoliciesGet($id = null)
+    {
+        $this->myLogger->logme('error','Edit Policies Onboarding function called');
+
+        $editData['policies'] = $this->policesModel->where(['id' => $id, 'is_active' => 1])->first();
+
+        // Return JSON response
+        header('Content-Type: application/json');
+        echo json_encode($editData);
+        exit();
+    }
+
+
+
+    
+    public function editPolicies()
+    {
+        $this->myLogger->logme('error','edit Policy general info function called');
+        $id                 = $this->request->getPost('PrimaryKey');
+        $data               = $this->request->getPost();
+        $data['updated_by'] = get_session_userid();
+        $update             = $this->policesModel->update($id,$data);
+        if($update){
+            echo json_encode(array("status" => true , 'data' => $data));
+        }else{
+            echo json_encode(array("status" => false));
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/app/Models/InsurerModel.php b/app/Models/InsurerModel.php
index b2ffe3f5..6e6b7a1f 100644
--- a/app/Models/InsurerModel.php
+++ b/app/Models/InsurerModel.php
@@ -10,10 +10,24 @@ class InsurerModel extends Model
     protected $primaryKey       = 'id';
     protected $allowedFields    = [
         "id",
+        "type",
         "name",
-        "tpa_id",
+        "short_name",
         "created_by",
         "updated_by",
         "is_active",
     ];
+
+
+
+    public function getCreatedByUserName(){
+
+        return $this->db->table('insurers')
+        ->select('insurers.*')
+        // ->select('user_profiles.first_name as user_name')
+        // ->join('user_profiles', 'user_profiles.id = clients.created_by')
+        ->get()
+        ->getResult();
+    
+    }
 }
diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php
index b642590c..d689d7dc 100644
--- a/app/Models/PolicesModel.php
+++ b/app/Models/PolicesModel.php
@@ -11,6 +11,7 @@ class PolicesModel extends Model
     protected $allowedFields    = [
         "id",
         "insurer_id",
+        "policy_type_id",
         "name",
         "created_by",
         "updated_by",
diff --git a/app/Models/PolicyTypeModel.php b/app/Models/PolicyTypeModel.php
new file mode 100644
index 00000000..2b147308
--- /dev/null
+++ b/app/Models/PolicyTypeModel.php
@@ -0,0 +1,21 @@
+
     
-    
-
- -
+
+
@@ -24,10 +22,8 @@
-
-
- -
+
+

@@ -40,10 +36,8 @@
- - + +
- - + +
- - + +
+
+ + +
-
-
Contact 2
-
- -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
- -
-
Contact 3
-
- -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
+
@@ -185,16 +118,16 @@ \ No newline at end of file diff --git a/app/Views/insurer_basic_info.php b/app/Views/insurer_basic_info.php new file mode 100644 index 00000000..9acef300 --- /dev/null +++ b/app/Views/insurer_basic_info.php @@ -0,0 +1,147 @@ +
+
+
+
+
+ + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+ + +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/insurer_branch.php b/app/Views/insurer_branch.php new file mode 100644 index 00000000..44c276f0 --- /dev/null +++ b/app/Views/insurer_branch.php @@ -0,0 +1,476 @@ +
+ +
+ +
+ +
+ + + + + + + + + + + +
Branch NameBranch CodeAction
+
+ +
+
+
+
+ +
+ +
+ +
+ + + +
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
Contact 1
+
+ +
+ +
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+ + +
+ +
+ +
+
+ + +
+
+
+
+
+
+ + + + \ No newline at end of file diff --git a/app/Views/insurer_list.php b/app/Views/insurer_list.php new file mode 100644 index 00000000..d50eafb8 --- /dev/null +++ b/app/Views/insurer_list.php @@ -0,0 +1,134 @@ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
NameTypeAction
( ) + +
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/insurer_onboarding.php b/app/Views/insurer_onboarding.php new file mode 100644 index 00000000..ba10daa4 --- /dev/null +++ b/app/Views/insurer_onboarding.php @@ -0,0 +1,69 @@ + + +
+
+
+
+
+
+

Insurer Onboarding

+
+ +
+ +
+ + +
+
+
+
+
+ + diff --git a/app/Views/kyc_docs.php b/app/Views/kyc_docs.php new file mode 100644 index 00000000..4e4be6f3 --- /dev/null +++ b/app/Views/kyc_docs.php @@ -0,0 +1,258 @@ +
+ +
+ +
+ +
+ + + + + + + + + + +
File NameAction
+
+ +
+
+
+
+ +
+ +
+ +
+ + + +
+
+
+ + +
+
+ + +
+ + +
+ +
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/kyc_entity_type_basic_info.php b/app/Views/kyc_entity_type_basic_info.php new file mode 100644 index 00000000..18cff9f4 --- /dev/null +++ b/app/Views/kyc_entity_type_basic_info.php @@ -0,0 +1,112 @@ +
+
+
+
+
+ + + +
+
+
+ + +
+
+ +
+
+ +
+ + +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/kyc_list.php b/app/Views/kyc_list.php new file mode 100644 index 00000000..af6668a2 --- /dev/null +++ b/app/Views/kyc_list.php @@ -0,0 +1,132 @@ + + + + \ No newline at end of file diff --git a/app/Views/kyc_onboarding.php b/app/Views/kyc_onboarding.php new file mode 100644 index 00000000..778d7d4e --- /dev/null +++ b/app/Views/kyc_onboarding.php @@ -0,0 +1,69 @@ + + +
+
+
+
+
+
+

KYC Entity Type Onboarding

+
+ +
+ +
+ + +
+
+
+
+
+ + diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index dcd45fe2..388a6f1a 100644 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -512,10 +512,16 @@
diff --git a/app/Views/policies.php b/app/Views/policies.php new file mode 100644 index 00000000..85f4304b --- /dev/null +++ b/app/Views/policies.php @@ -0,0 +1,333 @@ +
+ +
+ +
+ +
+ + + + + + + + + + + +
InsurerNameAction
+
+ +
+
+
+
+ +
+ +
+ +
+ + + +
+
+
+ + +
+ + +
+ + +
+
+ +
+
+ + +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/policy_type_basic_info.php b/app/Views/policy_type_basic_info.php new file mode 100644 index 00000000..2ce5ae8c --- /dev/null +++ b/app/Views/policy_type_basic_info.php @@ -0,0 +1,129 @@ +
+
+
+
+
+ + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+ + +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/policy_type_list.php b/app/Views/policy_type_list.php new file mode 100644 index 00000000..a791143b --- /dev/null +++ b/app/Views/policy_type_list.php @@ -0,0 +1,138 @@ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Policy TypeBapAllocgallociAction
+ +
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/policy_type_onboarding.php b/app/Views/policy_type_onboarding.php new file mode 100644 index 00000000..da32edc4 --- /dev/null +++ b/app/Views/policy_type_onboarding.php @@ -0,0 +1,69 @@ + + +
+
+
+
+
+
+

Policy Type Onboarding

+
+ +
+ +
+ + +
+
+
+
+
+ + diff --git a/app/Views/tpa_basic_info.php b/app/Views/tpa_basic_info.php new file mode 100644 index 00000000..7ebe2c1c --- /dev/null +++ b/app/Views/tpa_basic_info.php @@ -0,0 +1,125 @@ +
+
+
+
+
+ + + +
+
+
+ + +
+
+ + +
+
+ +
+
+ +
+ + +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/tpa_branch.php b/app/Views/tpa_branch.php new file mode 100644 index 00000000..d1eb9977 --- /dev/null +++ b/app/Views/tpa_branch.php @@ -0,0 +1,467 @@ +
+ +
+ +
+ +
+ + + + + + + + + + + +
Branch NameBranch CodeAction
+
+ +
+
+
+
+ +
+ +
+ +
+ + + +
+
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
Contact 1
+
+ +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+ + +
+ +
+ +
+
+ + +
+
+
+
+
+
+ + + \ No newline at end of file diff --git a/app/Views/tpa_list.php b/app/Views/tpa_list.php new file mode 100644 index 00000000..1ad72245 --- /dev/null +++ b/app/Views/tpa_list.php @@ -0,0 +1,132 @@ +
+ +
+ + + \ No newline at end of file diff --git a/app/Views/tpa_onboarding.php b/app/Views/tpa_onboarding.php new file mode 100644 index 00000000..01d55afa --- /dev/null +++ b/app/Views/tpa_onboarding.php @@ -0,0 +1,69 @@ + + +
+
+
+
+
+
+

TPA Onboarding

+
+ +
+ +
+ + +
+
+
+
+
+ + diff --git a/composer.json b/composer.json index ead70015..53779a29 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,9 @@ "config": { "optimize-autoloader": true, "preferred-install": "dist", - "sort-packages": true + "sort-packages": true, + "process-timeout": 900 + }, "scripts": { "test": "phpunit"