diff --git a/app/Config/Database.php b/app/Config/Database.php index dcc1c2dd..c0f91c65 100755 --- a/app/Config/Database.php +++ b/app/Config/Database.php @@ -134,6 +134,10 @@ class Database extends Config 'ssl_ca' => ROOTPATH . 'ca.pem', 'ssl_verify' => true, ]; + $this->preDB['encrypt'] = [ + 'ssl_ca' => ROOTPATH . 'ca.pem', + 'ssl_verify' => true, + ]; } } diff --git a/app/Controllers/ApiServiceController.php b/app/Controllers/ApiServiceController.php index 5f8f17e4..e1858c95 100644 --- a/app/Controllers/ApiServiceController.php +++ b/app/Controllers/ApiServiceController.php @@ -92,13 +92,25 @@ class ApiServiceController extends BaseController } + // $employee_policy = $this->employeePolicyModel + // ->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ') + // ->join('employees', 'employee_polices.employee_id = employees.id', 'left') + // ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left') + // ->where('employee_polices.employee_id',$id) + // ->where('employee_polices.client_policy_id',$client_policy_id) + // ->where('employee_polices.is_active', 1 )->findAll(); + $employee_policy = $this->employeePolicyModel ->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ') ->join('employees', 'employee_polices.employee_id = employees.id', 'left') ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left') - ->where('employee_polices.employee_id',$id) - ->where('employee_polices.client_policy_id',$client_policy_id) - ->where('employee_polices.is_active', 1 )->findAll(); + ->where('employees.emp_code', $emp_code) + ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('employee_polices.is_active', 1) + ->where('employees.is_active', 1) + ->where('employee_polices.status', 'active') + ->where('employees.emp_status', 'active') + ->findAll(); if(count($employee_policy) > 0) diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 039f6f99..89069011 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -2726,7 +2726,9 @@ class ClientController extends AdminController $search_term = 'GMC'; } else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) { $search_term = 'GPA'; - } else { + } else if($policy_type_id == 72){ + $search_term = 'GMC'; + }else { $search_term = ""; } @@ -2736,7 +2738,7 @@ class ClientController extends AdminController if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) { $premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); - } else if ($search_term === 'GMC') { + } else if ($search_term === 'GMC' || $policy_type_id == 72) { $premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll(); @@ -2766,7 +2768,7 @@ class ClientController extends AdminController // echo '
';
// echo $family_floater;
- if ($search_term === 'GMC') {
+ if ($search_term === 'GMC' || $policy_type_id == 72 ) {
// $resultss = [];
$resultss = $results;
@@ -3400,6 +3402,7 @@ class ClientController extends AdminController
[
'Status' => true,
'code' => 200,
+ 'policy_type_id' => $record['policy_type_id'],
'data' => $record['policy_terms'],
'policy_addon' => $record['is_addon'],
'emp_count_by_policy' => $emp_count_by_policy
@@ -4225,34 +4228,41 @@ class ClientController extends AdminController
$client_policy_id = $this->request->getPost("client_policy_id");
$policy_terms = $this->request->getPost("policy_terms");
$policy_terms = json_decode($policy_terms, true);
-
- $data = [];
-
- foreach ($policy_terms as $key => $value) {
-
- if (str_ends_with($key, '_display')) {
-
- $original_key = substr($key, 0, -8);
-
- $newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
-
- $data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
- } else {
-
- $data[$key] = $value;
- }
- }
-
- if (!empty($data)) {
- $policy_terms['is_payable_employee']['self'] = 0;
- $policy_terms = json_encode($data);
- }
-
-
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
+ // print_r($policy_terms); die;
+
+ if(empty($policy_terms)){
+ return $this->respond(['status' => false, 'code' => 404, 'message' => 'Policy terms data could not be empty', 'formdata' => $this->request->getPost()], 200);
+ }
if ($record) {
+ $data = [];
+
+ foreach ($policy_terms as $key => $value) {
+
+ if (str_ends_with($key, '_display')) {
+
+ $original_key = substr($key, 0, -8);
+
+ $newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
+
+ $data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
+ } else {
+
+ $data[$key] = $value;
+ }
+ }
+
+ if($record['policy_type_id'] == 72){
+ $data['enrollment_display_key'] = $this->otherPolicyTermsDisplayKeyConstruct($policy_terms);
+ }
+
+ if (!empty($data)) {
+ $policy_terms['is_payable_employee']['self'] = 0;
+ $policy_terms = json_encode($data);
+ }
+
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
if ($update) {
@@ -4260,12 +4270,34 @@ class ClientController extends AdminController
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
}
+
} else {
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
}
}
+ public function otherPolicyTermsDisplayKeyConstruct($data)
+ {
+ $labels = $data['special_condition_label'] ?? [];
+ $values = $data['special_condition_input'] ?? [];
+
+ $special_conditions = [];
+
+ foreach ($labels as $i => $label) {
+ $value = $values[$i] ?? '';
+
+ // skip if label or value is empty
+ if (trim($label) === '' || trim($value) === '') {
+ continue;
+ }
+
+ $special_conditions[$label] = $value;
+ }
+
+ return $special_conditions;
+ }
+
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
{
@@ -5971,8 +6003,8 @@ class ClientController extends AdminController
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
$empServiceController = new EmployeeServiceController();
- // $res = $empServiceController->excelFileFormatValidation(['file_id' => '1126']);
- // $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
+ // $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']);
+ // $res = $empServiceController->excelFileDataValidation(['file_id' => '1248']);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
diff --git a/app/Controllers/DashboardController.php b/app/Controllers/DashboardController.php
index 8958c26d..50a9e4c1 100755
--- a/app/Controllers/DashboardController.php
+++ b/app/Controllers/DashboardController.php
@@ -238,7 +238,7 @@ class DashboardController extends AdminController
$data['client_branch_emp_list'] = $results;
$session = \Config\Services::session();
- $session->set('enrollment_data', json_encode($data));
+ // $session->set('enrollment_data', json_encode($data));
$data['pendingActionsData'] = $pendingActionsData;
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php
index 385a4bff..f106f274 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -732,6 +732,11 @@
// dd($data);
+ //Fetch POS
+ $data['pos_data'] = db_connect()->table('partner_pos')
+ ->where('is_active', 1)
+ ->get()
+ ->getResultArray();
// Load view
$this->loadLayout('policy_transaction_inception_list', $data);
@@ -985,11 +990,11 @@
$data['co_share'] = 1;
}
- if (!isset($data['bro_payable_by'])) {
- $data['bro_payable_by'] = 0;
- } elseif ($data['bro_payable_by']) {
- $data['bro_payable_by'] = 1;
- }
+ // if (!isset($data['bro_payable_by'])) {
+ // $data['bro_payable_by'] = 0;
+ // } elseif ($data['bro_payable_by']) {
+ // $data['bro_payable_by'] = 1;
+ // }
if (!isset($data['same_as_proposer'])) {
$data['same_as_proposer'] = 0;
@@ -2382,6 +2387,7 @@
'service_person_branch_id' => $issue_type['service_person_branch_id'] ?? null,
'agent_id' => $issue_type['agent_id'] ?? null,
'agent_code' => $issue_type['agent_code'] ?? null,
+ 'pos_id' => $issue_type['pos_id'] ?? null,
];
$data['client_branch_id'] = $client_branch_id;
diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php
index 9095986c..0a6d9e51 100755
--- a/app/Helpers/utility_helper.php
+++ b/app/Helpers/utility_helper.php
@@ -238,7 +238,7 @@ if (!function_exists('generate_download_link')) {
}
if (!function_exists('generate_random_alphanumeric')) {
- function generate_random_alphanumeric($length = 6) {
+ function generate_random_alphanumeric($length = 12) {
$random_string = '';
for ($i = 0; $i < $length; $i++) {
$random_ascii = rand(0, 61);
diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php
index 509dbd30..92ab47d8 100644
--- a/app/Models/PolicyTransactionModel.php
+++ b/app/Models/PolicyTransactionModel.php
@@ -88,6 +88,7 @@
'salse_person_manager_id',
'service_person_manager_id',
'service_person_branch_id',
+ 'pos_id',
];
diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php
index 45ad39a0..6f6d74dc 100755
--- a/app/Views/employee_list.php
+++ b/app/Views/employee_list.php
@@ -355,11 +355,54 @@
// }
});
+
+ var client_list = ''; // local variable for storing the client branch list
+ var branch_list = ''; // local variable for storing the client branch list
+ var policy_list = ''; // local variable for storing the client policy list
+ var branch_policy = '';
+ var policy_list_by_client = '';
+
+ $(document).ready(function() {
+ getClientAndBranchAndPolicy();
+ })
+
+ //featch client and branch and policy
+ function getClientAndBranchAndPolicy() {
+ $.ajax({
+ url: '= base_url("/util/getClientAndBranchAndPolicy") ?>',
+ type: "GET",
+ dataType: 'json',
+ success: function(res) {
+
+ console.log('getClientAndBranchAndPolicy', res);
+ if (res.status == true) {
+
+ client_list = res.client_data;
+ branch_list = res.branch_data;
+ policy_list = res.policy_data;
+ policy_list_by_client = res.policyListByClient;
+
+ appendClients(client_list);
+ // appendBranch(branch_list);
+ // appendPolicies(policy_list);
+
+ } else {
+ console.log('No data found');
+ }
+
+ },
+ error: function(xhr, status, error) {
+ console.error(xhr.responseText);
+ console.error(status, error);
+ }
+ });
+ }
+
// Declare a global variable to store API response data
- var clientPolicies = [];
- var clientPoliciesWithBranch = {
- policies: []
- };
+ // var clientPolicies = [];
+ // var clientPoliciesWithBranch = {
+ // policies: []
+ // };
var client_id = '= isset($getData) ? $getData['client_id'] : '0' ?>';
var client_branch_id = '= isset($getData) ? $getData['branch_id'] : '0' ?>';
@@ -376,91 +419,91 @@
});
- $(document).ready(function() {
- console.log("document loaded");
- //fetchClientPolicies();
- });
+ // $(document).ready(function() {
+ // console.log("document loaded");
+ // //fetchClientPolicies();
+ // });
- $(window).on("load", function() {
- console.log("window loaded");
- fetchClientPolicies();
- });
+ // $(window).on("load", function() {
+ // console.log("window loaded");
+ // fetchClientPolicies();
+ // });
- function fetchClientPolicies() {
- $('#loader').show();
- var apiURL = '' + 'util/clients-with-policies';
- console.log('fetchClientPolicies');
- // console.log(apiURL);
- $.ajax({
- url: apiURL,
- method: 'GET',
- headers: {
- "Content-Type": "application/json",
- "X-Requested-With": "XMLHttpRequest"
- },
- success: function(response) {
- // console.log(response.code);
- // console.log(response.dataStatus);
- // console.log(response.data);
- if (response.code === 200 && response.dataStatus === true && response.data !== "") {
- try {
- clientPolicies = (response.data);
+ // function fetchClientPolicies() {
+ // $('#loader').show();
+ // var apiURL = '' + 'util/clients-with-policies';
+ // console.log('fetchClientPolicies');
+ // // console.log(apiURL);
+ // $.ajax({
+ // url: apiURL,
+ // method: 'GET',
+ // headers: {
+ // "Content-Type": "application/json",
+ // "X-Requested-With": "XMLHttpRequest"
+ // },
+ // success: function(response) {
+ // // console.log(response.code);
+ // // console.log(response.dataStatus);
+ // // console.log(response.data);
+ // if (response.code === 200 && response.dataStatus === true && response.data !== "") {
+ // try {
+ // clientPolicies = (response.data);
- response.data.forEach(policy => {
- // console.log('policies', policy.policies);
- policy.policies.forEach(p => {
- clientPoliciesWithBranch.policies.push(p);
- });
- });
+ // response.data.forEach(policy => {
+ // // console.log('policies', policy.policies);
+ // policy.policies.forEach(p => {
+ // clientPoliciesWithBranch.policies.push(p);
+ // });
+ // });
- // console.log('1',clientPolicies);
- appendClients(clientPolicies);
+ // // console.log('1',clientPolicies);
+ // appendClients(clientPolicies);
- //this function for reselect the policy
- setTimeout(function() {
- if (client_id != 0) {
- var foundPolicies = clientPolicies.find(function(item) {
- // console.log(typeof item.id)
- return item.id == client_id;
- });
- appendBranch(foundPolicies.branchs);
- }
- }, 500);
+ // //this function for reselect the policy
+ // setTimeout(function() {
+ // if (client_id != 0) {
+ // var foundPolicies = clientPolicies.find(function(item) {
+ // // console.log(typeof item.id)
+ // return item.id == client_id;
+ // });
+ // appendBranch(foundPolicies.branchs);
+ // }
+ // }, 500);
- setTimeout(function() {
- if (client_branch_id != 0) {
+ // setTimeout(function() {
+ // if (client_branch_id != 0) {
- var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
- // console.log('item', item);
- return item.branch_id === client_branch_id;
- });
+ // var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
+ // // console.log('item', item);
+ // return item.branch_id === client_branch_id;
+ // });
- if (foundPolicies) {
- // console.log('foundPolicies', foundPolicies);
- appendPolicies(foundPolicies);
- } else {
- console.log('No policies found for the selected client');
- }
- }
- }, 500);
- //end
+ // if (foundPolicies) {
+ // // console.log('foundPolicies', foundPolicies);
+ // appendPolicies(foundPolicies);
+ // } else {
+ // console.log('No policies found for the selected client');
+ // }
+ // }
+ // }, 500);
+ // //end
- } catch (error) {
- console.error('Error parsing API response data:', error);
- }
- } else if (response.code === 404 && response.dataStatus === false) {
- console.error('no data found', response);
- } else {
- console.error('Something went wrong!');
- }
- },
- error: function(xhr, status, error) {
- console.error('Error fetching data from API:', error);
- }
- });
+ // } catch (error) {
+ // console.error('Error parsing API response data:', error);
+ // }
+ // } else if (response.code === 404 && response.dataStatus === false) {
+ // console.error('no data found', response);
+ // } else {
+ // console.error('Something went wrong!');
+ // }
+ // },
+ // error: function(xhr, status, error) {
+ // console.error('Error fetching data from API:', error);
+ // }
+ // });
- $('#loader').hide();
- }
+ // $('#loader').hide();
+ // }
function appendClients(data) {
var clientID = = isset($getData) ? $getData['client_id'] : '0' ?>;
@@ -507,8 +550,9 @@
// console.log(PolicyID)
$.each(data, function(index, item) {
var option = $('