diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 8bbe79e1..76975994 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -58,6 +58,8 @@ $routes->post('save_deposit', 'ClientController::saveDeposit'); $routes->get("list/(:any)", "ClientController::editClientOnboarding/$1"); + $routes->get("remove/(:any)", "ClientController::removeClientOnboarding/$1"); + $routes->group("general", ["filter" => "authMVC"], function($routes){ $routes->post("create", "ClientController::createClientGeneralInfo"); @@ -159,7 +161,7 @@ $routes->group("/master", ["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", "MasterController::tpaBranchList"); $routes->get("list/(:any)", "MasterController::kycDocsList/$1"); }); diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index dc1688f5..240a7dde 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -102,6 +102,29 @@ class ClientController extends AdminController // $this->loadLayout('client_onboarding', $data); } + + public function removeClientOnboarding($id = null) +{ + $this->myLogger->logme('error', 'Edit Client Onboarding function called'); + $headerData['page_name'] = 'Edit Client Onboarding'; + + $this->clientModel->update($id, ['is_active' => 0]); + + // $this->clientBranchModel->where('client_id', $id)->update(['is_active' => 0]); + // $this->clientRMModel->where('client_id', $id)->update(['is_active' => 0]); + + + $data['clientList'] = $this->clientModel->getCreatedByUserName(); + $data['client_rm'] = $this->clientRMModel->getAllClientRM(); + + echo view('layout/header', $headerData); + echo view('client_list', $data); + echo view('layout/footer'); +} + + + + public function clientOnboarding() { @@ -211,7 +234,7 @@ class ClientController extends AdminController $editData['policyGridData'] = $this->policyGridModel->findAll(); - $editData['client'] = $this->clientModel->where(['id' => $id, 'is_active' => 1])->first(); + $editData['client'] = $this->clientModel->where(['id' => $id])->first(); $editData['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $id)->findAll(); $editData['client_branch'] = $this->clientBranchModel->where(['client_id' => $id, 'is_active' => 1])->findAll(); $editData['client_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll(); @@ -235,6 +258,14 @@ class ClientController extends AdminController $data = $this->request->getPost(); $data['created_by'] = get_session_userid(); $data['client_logo'] = $file_name; + + + if (!isset($data['is_download_btn'])) { + $data['is_download_btn'] = 0; + } elseif ($data['is_download_btn']) { + $data['is_download_btn'] = 1; + } + $insert = $this->clientModel->insert($data); if($insert){ $client_data = $this->clientModel->where(['id' => $insert, 'is_active' => 1])->first(); @@ -254,10 +285,16 @@ class ClientController extends AdminController $id = $this->request->getPost('PrimaryKey'); $data = $this->request->getPost(); $data['updated_by'] = get_session_userid(); - if(!empty($file_name)){ - $data['client_logo'] = $file_name; + if (!isset($data['is_download_btn'])) { + $data['is_download_btn'] = 0; + } elseif ($data['is_download_btn']) { + $data['is_download_btn'] = 1; } + + $update = $this->clientModel->update($id,$data); + + if($update){ return $this->respond(['status' => true,'code' => 200,'data' => $data], 200); }else{ @@ -523,7 +560,11 @@ class ClientController extends AdminController $data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount'); $data['is_addon'] = $this->request->getPost('is_addon'); - + if (!isset($data['is_addon'])) { + $data['is_addon'] = 0; + } elseif ($data['is_addon']) { + $data['is_addon'] = 1; + } $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); @@ -579,6 +620,13 @@ class ClientController extends AdminController $data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount'); $data['is_addon'] = $this->request->getPost('is_addon'); + + if (!isset($data['is_addon'])) { + $data['is_addon'] = 0; + } elseif ($data['is_addon']) { + $data['is_addon'] = 1; + } + $data['updated_by'] = get_session_userid(); $insert = $this->clientPolicyModel->update($id,$data); $lastQuery = $this->clientPolicyModel->getLastQuery(); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index b702c77f..816228d3 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -579,11 +579,19 @@ class MasterController extends AdminController $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', $this->request->getPost('kyc_type_id'))->findAll(); + $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)); @@ -615,8 +623,11 @@ class MasterController extends AdminController 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 @@ -765,7 +776,7 @@ class MasterController extends AdminController { $this->myLogger->logme('error','Edit KYC Onboarding function called'); - $headerData['page_name'] = 'Edit KYC Master'; + $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(); @@ -798,9 +809,9 @@ class MasterController extends AdminController // $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']); @@ -816,8 +827,8 @@ class MasterController extends AdminController // Return JSON response - header('Content-Type: application/json'); - echo json_encode($editData); + // header('Content-Type: application/json'); + // echo json_encode($editData); exit(); } diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 053e6f25..2ebafcc9 100644 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -124,6 +124,19 @@ class ClientPolicyModel extends Model ->groupBy('client_policy.client_id', $id) // Group by insurer_id ->get() ->getResult(); + + // return $this->db->table('client_policy') + // ->select('insurers.name as insurer_name, insurers.short_name as insurer_short') + // ->select('clients.client_name as client_name') + // ->select('MAX(client_policy.id) as max_id') // or any other appropriate aggregate function + // ->join('clients', 'clients.id = client_policy.client_id') + // ->join('insurers', 'insurers.id = client_policy.insurer_id') + // ->where('client_policy.client_id', $id) + // ->groupBy('client_policy.insurer_id') + // ->groupBy('client_policy.client_id') + // ->get() + // ->getResult(); + } public function getinsurerswithinsurenceid($insurerId){ diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php index 9f0a2718..a6194255 100644 --- a/app/Models/PolicesModel.php +++ b/app/Models/PolicesModel.php @@ -5,9 +5,8 @@ use App\Models\PolicyPremium1Model; use App\Models\PolicyPremium2Model; use App\Models\PolicyGridModel; use CodeIgniter\Model; -use App\Models\PolicyGridModel; -use App\Models\PolicyPremium1Model; -use App\Models\PolicyPremium2Model; +// use App\Models\PolicyPremium1Model; +// use App\Models\PolicyPremium2Model; class PolicesModel extends Model { diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php index 62420438..944faaec 100644 --- a/app/Views/client_basic_info.php +++ b/app/Views/client_basic_info.php @@ -1,3 +1,65 @@ + +
| - - + + insurer_name;?> | @@ -76,7 +76,7 @@ { extend: 'csv', text: 'CSV', - title: 'ClientList', + title: 'Client_Deposit', className: 'my_class', exportOptions: { columns: ':not(:last-child)' diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php index 958c3119..af301c6c 100644 --- a/app/Views/client_kyc.php +++ b/app/Views/client_kyc.php @@ -53,7 +53,8 @@ class="text-danger">* -