diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 2f5af3e2..744e04a0 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -7,12 +7,12 @@ use CodeIgniter\Router\RouteCollection;
* @var RouteCollection $routes
*/
- $routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
+$routes->get('/swagger', 'SwaggerController::index', ['filter' => 'authMVC']);
// $routes->get('/', 'LoginController::index');
$routes->get('/test', 'Home::index');
-$routes->get('/login', 'LoginController::index');///auth/google
+$routes->get('/login', 'LoginController::index'); ///auth/google
$routes->get('/logout', 'LoginController::logout');
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
@@ -21,7 +21,7 @@ $routes->get('download-e-card/(:segment)', 'EmployeeController::generateIDCardFo
-$routes->group("/user", ["filter" => "authMVC"], function($routes){
+$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "UserController::create");
$routes->get("create", "UserController::create");
$routes->post("edit", "UserController::edit");
@@ -32,12 +32,12 @@ $routes->group("/user", ["filter" => "authMVC"], function($routes){
});
-$routes->group("/dashboard", ["filter" => "authMVC"], function($routes){
+$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
$routes->get("view", "DashboardController::dashboard");
});
-$routes->group("/client", ["filter" => "authMVC"], function($routes){
+$routes->group("/client", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "ClientController::index");
$routes->get("create", "ClientController::clientOnboarding");
@@ -45,11 +45,11 @@ $routes->group("/client", ["filter" => "authMVC"], function($routes){
$routes->get('remove/(:num)', 'ClientController::removeClient/$1');
// application/config/routes.php
-// Add a route for the view_Deposit method
-$routes->get('view_deposit/(:num)', 'ClientController::view_Deposit/$1');
-$routes->get('createtransaction', 'ClientController::createtransaction');
+ // Add a route for the view_Deposit method
+ $routes->get('view_deposit/(:num)', 'ClientController::view_Deposit/$1');
+ $routes->get('createtransaction', 'ClientController::createtransaction');
-$routes->post('save_deposit', 'ClientController::saveDeposit');
+ $routes->post('save_deposit', 'ClientController::saveDeposit');
@@ -63,25 +63,25 @@ $routes->post('save_deposit', 'ClientController::saveDeposit');
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
-
- $routes->group("general", ["filter" => "authMVC"], function($routes){
+
+ $routes->group("general", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "ClientController::createClientGeneralInfo");
$routes->post("edit", "ClientController::editClientGeneralInfo");
- });
+ });
- $routes->group("branch", ["filter" => "authMVC"], function($routes){
+ $routes->group("branch", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "ClientController::createClientBranch");
$routes->post("edit", "ClientController::editClientBranch");
$routes->get("list/(:any)", "ClientController::getSingleBranchDataById/$1");
$routes->get("remove/(:any)", "ClientController::removeClientBranch/$1");
- });
+ });
- $routes->group("relation", ["filter" => "authMVC"], function($routes){
+ $routes->group("relation", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "ClientController::createClientRelation");
$routes->post("edit", "ClientController::editClientRelation");
- });
+ });
- $routes->group("policy", ["filter" => "authMVC"], function($routes){
+ $routes->group("policy", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "ClientController::createClientPolicy");
$routes->post("edit", "ClientController::editClientPolicy");
$routes->get("list/(:any)", "ClientController::getClientPolicyById/$1");
@@ -89,27 +89,26 @@ $routes->post('save_deposit', 'ClientController::saveDeposit');
$routes->get("getterms", "ClientController::getterms");
});
- $routes->group("kyc", ["filter" => "authMVC"], function($routes){
+ $routes->group("kyc", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "ClientController::createClientKYCInfo");
$routes->post("edit", "ClientController::editClientKYCInfo");
$routes->get("list/(:any)", "ClientController::getKycDocsById/$1");
$routes->get("delete/(:any)", "ClientController::deleteClientKycDocs/$1");
});
- $routes->group("premimum", ["filter" => "authMVC"], function($routes){
+ $routes->group("premimum", ["filter" => "authMVC"], function ($routes) {
$routes->post("create", "ClientController::createClientPolicyPremium");
$routes->post("edit", "ClientController::editClientPolicyPremium");
});
- $routes->group("terms", ["filter" => "authMVC"], function($routes){
+ $routes->group("terms", ["filter" => "authMVC"], function ($routes) {
$routes->post("gpa_create", "ClientController::policyGPATerms");
$routes->post("edit", "ClientController::editClientPolicyPremium");
});
-
});
-$routes->group("/employee", ["filter" => "authMVC"], function($routes){
+$routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "EmployeeController::list");
$routes->get("search", "EmployeeController::search");
$routes->get("upload", "EmployeeController::employeesUplodWithEvents");
@@ -120,10 +119,10 @@ $routes->group("/employee", ["filter" => "authMVC"], function($routes){
});
-$routes->group("/master", ["filter" => "authMVC"], function($routes){
+$routes->group("/master", ["filter" => "authMVC"], function ($routes) {
- $routes->group("insurer", ["filter" => "authMVC"], function($routes){
+ $routes->group("insurer", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "MasterController::insurerList");
@@ -133,17 +132,16 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
$routes->post("edit", "MasterController::editInsurerGeneralInfo");
$routes->get("list/(:any)", "MasterController::editInsurerOnboarding/$1");
- $routes->group("branch", ["filter" => "authMVC"], function($routes){
+ $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->get("remove/(:any)", "MasterController::removeInsurerBranch/$1");
});
+ });
- });
-
- $routes->group("tpa", ["filter" => "authMVC"], function($routes){
+ $routes->group("tpa", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "MasterController::tpaList");
$routes->get("create", "MasterController::tpaOnboarding");
$routes->post("createpost", "MasterController::createTPAGeneralInfo");
@@ -151,16 +149,16 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
$routes->get("list/(:any)", "MasterController::editTPAOnboarding/$1");
$routes->get("remove/(:any)", "MasterController::tpaRemove/$1");
- $routes->group("branch", ["filter" => "authMVC"], function($routes){
+ $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->get("remove/(:any)", "MasterController::removeTPABranch/$1");
});
- });
-
- $routes->group("kyc", ["filter" => "authMVC"], function($routes){
+ });
+
+ $routes->group("kyc", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "MasterController::kycList");
$routes->get("create", "MasterController::kycOnboarding");
$routes->post("createpost", "MasterController::createKYCInfo");
@@ -170,18 +168,17 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
$routes->get("delete/(:any)", "MasterController::deleteClientKycDocs/$1");
- $routes->group("kycdocs", ["filter" => "authMVC"], function($routes){
+ $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->get("remove/(:any)", "MasterController::removeKYCDocs/$1");
-
});
});
- $routes->group("policy", ["filter" => "authMVC"], function($routes){
+ $routes->group("policy", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "MasterController::policyTypeList");
$routes->get("create", "MasterController::policyTypeOnboarding");
$routes->post("createpost", "MasterController::createPolicyType");
@@ -190,7 +187,7 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
$routes->get("remove/(:any)", "MasterController::policyTypeRemove/$1");
- $routes->group("policies", ["filter" => "authMVC"], function($routes){
+ $routes->group("policies", ["filter" => "authMVC"], function ($routes) {
$routes->post("createpost", "MasterController::createPolicies");
$routes->get("editget/(:any)", "MasterController::editPoliciesGet/$1");
$routes->post("edit", "MasterController::editPolicies");
@@ -198,30 +195,29 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
$routes->get("list/(:any)", "MasterController::policesList/$1");
$routes->get("remove/(:any)", "MasterController::removePolicyPolicies/$1");
});
-
});
});
-$routes->group("/util", ["filter" => "authMVC"], function($routes){
- $routes->get("clients-with-policies", "EmployeeController::getClientWithPolicies");
- $routes->get("police-by-insurer/(:any)", "ClientController::getPolicesByInsurerId/$1");
- $routes->get("get-file-error/(:any)", "EmployeeController::getUploadedFileError/$1");
- $routes->get("kyc-other-docs-delete/(:any)", "ClientController::deleteClientKycOtherDocs/$1");
- $routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
- $routes->get("update-policy-status", "ClientController::updateClientPolicyStatus/$1");
- $routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
- $routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1");
- $routes->post("import-export", "EmployeeController::importExport");
- $routes->get("featch-client-policy-list/(:any)", "ClientController::getClientPolicyList/$1");
- $routes->get("download-file-list/(:any)", "EmployeeController::downloadFileList/$1");
- $routes->get("featch-emp-list", "EmployeeController::featchEmpList/$1");
- $routes->get("view-success-emp-list", "EmployeeController::viewUploadedEmployeeList/$1");
- $routes->get("fetch-policy-for-policy-type", "ClientController::fetchPolicyDataForPolicyType/$1");
- $routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1");
- $routes->get("init-Emp-onboard/(:any)", "EmployeeController::initiateManualEmployeesOnboardProcess/$1");
- $routes->get("full-excel-error-file/(:any)", "EmployeeController::downloadFullExcelErrorFile/$1");
- $routes->get("id-card", "EmployeeController::viewECard/$1");
+$routes->group("/util", ["filter" => "authMVC"], function ($routes) {
+ $routes->get("clients-with-policies", "EmployeeController::getClientWithPolicies");
+ $routes->get("police-by-insurer/(:any)", "ClientController::getPolicesByInsurerId/$1");
+ $routes->get("get-file-error/(:any)", "EmployeeController::getUploadedFileError/$1");
+ $routes->get("kyc-other-docs-delete/(:any)", "ClientController::deleteClientKycOtherDocs/$1");
+ $routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
+ $routes->get("update-policy-status", "ClientController::updateClientPolicyStatus/$1");
+ $routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
+ $routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1");
+ $routes->post("import-export", "EmployeeController::importExport");
+ $routes->get("featch-client-policy-list/(:any)", "ClientController::getClientPolicyList/$1");
+ $routes->get("download-file-list/(:any)", "EmployeeController::downloadFileList/$1");
+ $routes->get("featch-emp-list", "EmployeeController::featchEmpList/$1");
+ $routes->get("view-success-emp-list", "EmployeeController::viewUploadedEmployeeList/$1");
+ $routes->get("fetch-policy-for-policy-type", "ClientController::fetchPolicyDataForPolicyType/$1");
+ $routes->get("fetch-emp-count/(:any)", "EmployeeController::getEmpCount/$1");
+ $routes->get("init-Emp-onboard/(:any)", "EmployeeController::initiateManualEmployeesOnboardProcess/$1");
+ $routes->get("full-excel-error-file/(:any)", "EmployeeController::downloadFullExcelErrorFile/$1");
+ $routes->get("id-card", "EmployeeController::viewECard/$1");
});
$routes->cli('cli/processjob', 'JobWorker::processJob');
@@ -236,7 +232,7 @@ $routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
-$routes->group("/api", ["filter" => "authJWT"], function($routes){
+$routes->group("/api", ["filter" => "authJWT"], function ($routes) {
$routes->post("logined", "RestAuthenticationController::logined");
$routes->post("getId", "RestAuthenticationController::getUserIdFromToken");
});
@@ -250,7 +246,7 @@ $routes->post("/calculatePremium", "EmployeeRestController::calculatePremium");
-$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
+$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
@@ -273,8 +269,6 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
-
-
});
$routes->post("sendEmail", "EmployeeRestController::send_email");
diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php
index 370e16d3..3a058335 100644
--- a/app/Controllers/ClientController.php
+++ b/app/Controllers/ClientController.php
@@ -573,6 +573,9 @@ class ClientController extends AdminController
public function createClientPolicy()
{
+ // print_r($this->request->getPost()); die;
+
+
$this->myLogger->logme('error','Client policy CREATE function called');
$insurerValue = (string) $this->request->getPost('insurer');
@@ -607,6 +610,8 @@ class ClientController extends AdminController
$data['base_policy'] = $this->request->getPost('base_policy');
$data['policy_status'] = 1;
+
+
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
@@ -992,7 +997,10 @@ class ClientController extends AdminController
{
$this->myLogger->logme('error','getPolicesByInsurerId function called');
if($id){
- $police_data = $this->policesModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
+ $police_data = $this->policesModel
+ ->select('policies.*, policy_type.policy_type')
+ ->join('policy_type', 'policy_type.id = policies.policy_type_id')
+ ->where(['insurer_id' => $id, 'policies.is_active' => 1])->findAll();
return $this->respond(['status' => true,'code' => 200,'data' => $police_data], 200);
}else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
diff --git a/app/Models/ClientModel.php b/app/Models/ClientModel.php
index fae413f9..af579498 100644
--- a/app/Models/ClientModel.php
+++ b/app/Models/ClientModel.php
@@ -56,10 +56,10 @@ class ClientModel extends Model
return $this->db->table('clients')
->select('clients.*')
+ ->where('is_active', 1)
->get()
->getResult();
-
-
+
}
}
diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php
index e5b4e591..d0d80b54 100644
--- a/app/Models/ClientPolicyModel.php
+++ b/app/Models/ClientPolicyModel.php
@@ -276,17 +276,18 @@ public function updateStatus(){
public function getpolicyWithPattern($client_id){
- $query = "
- SELECT client_policy.*, policies.name, policies.policy_type_id
- FROM client_policy
- JOIN policies ON policies.id = client_policy.policy_id
- JOIN policy_type ON policy_type.id = policies.policy_type_id
- WHERE policy_type.policy_type = 'GMC'
- AND client_policy.client_id = {$client_id}";
+ $query = $this->db->table('client_policy')
+ ->select('client_policy.*, policies.name, policies.policy_type_id, policy_type.policy_type')
+ ->join('policies', 'policies.id = client_policy.policy_id')
+ ->join('policy_type', 'policy_type.id = policies.policy_type_id')
+ // ->where('policy_type.policy_type', 'GMC')
+ ->whereIn('policy_type.id', [2, 3])
+ ->where('client_policy.client_id', $client_id)
+ ->get()
+ ->getResult();
- $result = $this->db->query($query)->getResult();
- return $result;
+ return $query;
}
public function getTopUpPolicy($client_id, $type){
diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php
index 298094bc..d47726fb 100644
--- a/app/Views/client_policy.php
+++ b/app/Views/client_policy.php
@@ -399,11 +399,11 @@
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (xhr.status === 404) {
- toastr.warning('Resource not found', 'Warning');
+ console.log('Resource not found', 'Warning');
} else if (xhr.status === 500) {
- toastr.warning('Internal server error', 'Warning');
+ console.log('Internal server error', 'Warning');
} else {
- toastr.warning('Unknown error occurred', 'Warning');
+ console.log('Unknown error occurred', 'Warning');
}
}, 1000);
}
@@ -418,6 +418,11 @@
var secondPart = parts[1];
var url = "= base_url("util/police-by-insurer/") ?>" + secondPart;
+ var selectedOption = $('#base_policy').find(':selected');
+ var base_policy_data_id = selectedOption.data('id');
+ console.log('base_policy_data_id', base_policy_data_id);
+
+
$.get(url, function(res) {
// res = JSON.parse(res)//
// console.log(res)
@@ -427,29 +432,46 @@
$.each(res.data, function(index, item) {
if ($policy_type_value == 3) {
- if (item.policy_type_id == 5 || item.policy_type_id == 3) {
- OptionsHTML += '';
+
+ if (base_policy_data_id == 3) {
+
+ if (item.policy_type_id == 5) {
+
+ OptionsHTML += '';
+ }
+
+ } else {
+
+ if (item.policy_type_id == 5 || item.policy_type_id == 3) {
+
+ OptionsHTML += '';
+ }
+
}
+
+
} else if ($policy_type_value == 2) {
- if (item.policy_type_id == 4) {
+ if (item.policy_type_id == 4 || item.policy_type_id == 5) {
OptionsHTML += '';
+ '">' + item.name + '( ' + item.policy_type + ' )';
}
} else if ($policy_type_value == 1) {
if (item.policy_type_id == 1 || item.policy_type_id == 2) {
OptionsHTML += '';
+ '">' + item.name + '( ' + item.policy_type + ' )';
}
} else {
OptionsHTML += '';
+ '">' + item.name + '( ' + item.policy_type + ' )';
}
});
@@ -553,11 +575,35 @@
}
if (res.data.is_addon == 2 || res.data.is_addon == 3) {
- $('#insurer').prop('disabled', true);
- $('#tpa').prop('disabled', true);
+ $("#insurer").next(".select2-container").css({
+ 'pointer-events': 'none',
+ });
+ $('#select2-insurer-container').css({
+ 'background-color': '#ebebe0',
+ });
+
+ $("#tpa").next(".select2-container").css({
+ 'pointer-events': 'none',
+ });
+ $('#select2-tpa-container').css({
+ 'background-color': '#ebebe0',
+ });
+
} else {
- $('#insurer').prop('disabled', false);
- $('#tpa').prop('disabled', false);
+
+ $("#insurer").next(".select2-container").css({
+ 'pointer-events': 'auto',
+ });
+ $('#select2-insurer-container').css({
+ 'background-color': 'transparent',
+ });
+
+ $("#tpa").next(".select2-container").css({
+ 'pointer-events': 'auto',
+ });
+ $('#select2-tpa-container').css({
+ 'background-color': 'transparent',
+ });
}
var policeOptionHTML = '';
@@ -672,11 +718,11 @@
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (xhr.status === 404) {
- toastr.warning('Resource not found', 'Warning');
+ console.log('Resource not found', 'Warning');
} else if (xhr.status === 500) {
- toastr.warning('Internal server error', 'Warning');
+ console.log('Internal server error', 'Warning');
} else {
- toastr.warning('Unknown error occurred', 'Warning');
+ console.log('Unknown error occurred', 'Warning');
}
}, 1000);
}
@@ -1044,11 +1090,35 @@
$('#base_policy').val('').change();
if ($(this).val() == 2 || $(this).val() == 3) {
- $('#insurer').prop('disabled', true);
- $('#tpa').prop('disabled', true);
+
+ $("#insurer").next(".select2-container").css({
+ 'pointer-events': 'none',
+ });
+ $('#select2-insurer-container').css({
+ 'background-color': '#ebebe0',
+ });
+
+ $("#tpa").next(".select2-container").css({
+ 'pointer-events': 'none',
+ });
+ $('#select2-tpa-container').css({
+ 'background-color': '#ebebe0',
+ });
} else {
- $('#insurer').prop('disabled', false);
- $('#tpa').prop('disabled', false);
+
+ $("#insurer").next(".select2-container").css({
+ 'pointer-events': 'auto',
+ });
+ $('#select2-insurer-container').css({
+ 'background-color': 'transparent',
+ });
+
+ $("#tpa").next(".select2-container").css({
+ 'pointer-events': 'auto',
+ });
+ $('#select2-tpa-container').css({
+ 'background-color': 'transparent',
+ });
}
@@ -1107,7 +1177,8 @@
OptionsHTML += '';
$.each(res.data, function(index, item) {
OptionsHTML += '';
+ '">' + item.name + '( ' + item.policy_type + ' )';
+
});
$('#base_policy').html(OptionsHTML);
},
@@ -1176,6 +1247,8 @@
// if (item.policy_type_id == 5) {
console.log(item);
+
+
policeOptionHTML += '';