863 lines
29 KiB
PHP
863 lines
29 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use CodeIgniter\HTTP\IncomingRequest;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
use CodeIgniter\API\ResponseTrait;
|
|
|
|
use App\Models\UserModel;
|
|
use App\Models\ClientModel;
|
|
use App\Models\ClientBranchModel;
|
|
use App\Models\ClientKYCDocsModel;
|
|
use App\Models\ClientPolicyModel;
|
|
use App\Models\ClientRMModel;
|
|
use App\Models\InsurerBranchModel;
|
|
use App\Models\InsurerModel;
|
|
use App\Models\KYCDocsModel;
|
|
use App\Models\KYCEntityTypeModel;
|
|
use App\Models\LevelContactModel;
|
|
use App\Models\PolicesModel;
|
|
use App\Models\TPABranchModel;
|
|
use App\Models\TPAModel;
|
|
use App\Models\StateModel;
|
|
use App\Models\PolicyTypeModel;
|
|
|
|
class MasterController extends AdminController
|
|
{
|
|
use ResponseTrait;
|
|
|
|
protected $myLogger;
|
|
protected $insurerModel;
|
|
protected $userModel;
|
|
protected $insurerBranchModel;
|
|
protected $insurerKYCDocsModel;
|
|
protected $insurerPolicyModel;
|
|
protected $insurerRMModel;
|
|
protected $kycDocsModel;
|
|
protected $kycEntityTypeModel;
|
|
protected $levelContactModel;
|
|
protected $policesModel;
|
|
protected $tpaBranchModel;
|
|
protected $tpaModel;
|
|
protected $stateModel;
|
|
protected $policyTypeModel;
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
set_session_context('Master');
|
|
$this->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 '<pre>';
|
|
// 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 Master';
|
|
|
|
$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 "<pre>";
|
|
// 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 Master';
|
|
|
|
$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 "<pre>";
|
|
// 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);
|
|
|
|
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->insurerBranchModel->where('insurer_id', $this->request->getPost('insurer_id'))->findAll();
|
|
echo json_encode(array("status" => true , 'data' => $branchData, 'edit'));
|
|
}else{
|
|
echo json_encode(array("status" => false, 'edit'));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 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 '<pre>';
|
|
// 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 Master';
|
|
|
|
|
|
// 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 "<pre>";
|
|
// 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 Master';
|
|
|
|
$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 "<pre>";
|
|
// 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 '<pre>';
|
|
// 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 Master';
|
|
|
|
|
|
// 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 "<pre>";
|
|
// 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();
|
|
// print_r($data);die;
|
|
|
|
if($data['kyc_type_id'] == ''){
|
|
// PrimaryKey
|
|
$data['kyc_type_id'] =$data['PrimaryKey'];
|
|
}
|
|
// print_r($data);die;
|
|
|
|
$data['created_by'] = get_session_userid();
|
|
$insert = $this->kycDocsModel->insert($data);
|
|
|
|
if($insert){
|
|
$kycDocsData = $this->kycDocsModel->where('kyc_type_id', $data['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 Master';
|
|
|
|
$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 "<pre>";
|
|
// 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');
|
|
|
|
// print_r("id");
|
|
// print_r($id);die;
|
|
$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 '<pre>';
|
|
// 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 Master';
|
|
|
|
|
|
// 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 "<pre>";
|
|
|
|
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 Policy Type';
|
|
|
|
$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();
|
|
|
|
// print_r($id);die;
|
|
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){
|
|
$policyData = $this->policesModel->where(['id' => $id, 'is_active' => 1])->findAll();
|
|
echo json_encode(array("status" => true , 'data' => $policyData));
|
|
}else{
|
|
echo json_encode(array("status" => false));
|
|
}
|
|
}
|
|
|
|
} |