diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php index 18acb569..50e1dd16 100644 --- a/app/Controllers/PolicyTransactionController.php +++ b/app/Controllers/PolicyTransactionController.php @@ -701,11 +701,11 @@ class PolicyTransactionController extends BaseController nhance_branch.branch_name as nhance_branch_name, rm.first_name AS rm_name ') - ->join('user_teams', 'user_profiles.id = user_teams.user_id') + // ->join('user_teams', 'user_profiles.id = user_teams.user_id') ->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id','left') ->join('user_profiles AS rm', 'user_profiles.rm_id = rm.id', 'left') - ->where('user_teams.team_id', 5) - ->where('user_teams.is_active', 1) + // ->where('user_teams.team_id', 5) + // ->where('user_teams.is_active', 1) ->where('user_profiles.is_active', 1) ->groupBy('user_profiles.id', 'asc') ->findAll(); @@ -727,7 +727,7 @@ class PolicyTransactionController extends BaseController ->join('user_teams', 'user_profiles.id = user_teams.user_id') ->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id', 'left') ->join('user_profiles AS rm', 'user_profiles.rm_id = rm.id', 'left') - ->where('user_profiles.role', 3) + // ->where('user_profiles.role', 3) ->where('user_profiles.is_active', 1) ->groupBy('user_profiles.id', 'asc') ->findAll(); @@ -970,8 +970,8 @@ class PolicyTransactionController extends BaseController 'valid_date' => 'Please provide a valid D.O.E date.', 'regex_match' => 'The D.O.E date format is incorrect. ' ]], - 'emp_count' => ['label' => 'No of Insured', 'rules' => 'permit_empty|numeric', 'errors' => [ - 'numeric' => 'No of Insured must contain only numbers.' + 'emp_count' => ['label' => 'No of Employees', 'rules' => 'permit_empty|numeric', 'errors' => [ + 'numeric' => 'No of Employees must contain only numbers.' ]], 'dependent_count' => ['label' => 'No of Dependents', 'rules' => 'permit_empty|numeric', 'errors' => [ 'numeric' => 'No of Dependents must contain only numbers.' @@ -2491,9 +2491,9 @@ class PolicyTransactionController extends BaseController 'errors' => ['valid_date' => 'Please provide a valid Endorsement Effective Date.'] ], 'emp_count' => [ - 'label' => 'No of Insured', + 'label' => 'No of Employees', 'rules' => 'permit_empty|numeric', - 'errors' => ['numeric' => 'No of Insured must be a number.'] + 'errors' => ['numeric' => 'No of Employees must be a number.'] ], 'dependent_count' => [ 'label' => 'No of Dependents', @@ -5792,7 +5792,7 @@ class PolicyTransactionController extends BaseController 'pt_policy_issue_date' => change_date_format($policy_issue_date, 'd/M/Y', 'Y-m-d'), 'file_id' => $params['file_id'], - 'created_by' => $file['created_by'] ?? null, + 'created_by' => $file['created_by'] ?? null, ]; if(!empty($vehicle_id) && !empty($client_id)){ diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 940aeb41..2e520918 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -1063,15 +1063,21 @@ ->where('policy_transaction.is_active', 1) ->where('policy_transaction.action_type', 'inception'); - if ( - (!in_array(get_role_id(), [1, 5])) && - !( - in_array(MANAGEMENT_TEAM_ID, user_team()) || - in_array(FINANCE_TEAM_ID, user_team()) || - in_array(BUSINESS_TEAM_ID, user_team()) - ) - ) { - if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) { + // if ( + // (!in_array(get_role_id(), [1, 5])) && + // !( + // in_array(MANAGEMENT_TEAM_ID, user_team()) || + // in_array(FINANCE_TEAM_ID, user_team()) || + // in_array(BUSINESS_TEAM_ID, user_team()) + // ) + // ) { + // if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) { + // $builder->where('policy_transaction.created_by', get_session_userid()); + // } + // } + + if ((!in_array(get_role_id(), [1, 5]))) { + if (in_array(POS_TEAM_ID, user_team())) { $builder->where('policy_transaction.created_by', get_session_userid()); } } @@ -1165,20 +1171,27 @@ ->where('policy_transaction.is_active', 1) ->where('policy_transaction.action_type !=', 'inception'); - if ( - (!in_array(get_role_id(), [1, 5])) && - !( - in_array(MANAGEMENT_TEAM_ID, user_team()) || - in_array(FINANCE_TEAM_ID, user_team()) || - in_array(BUSINESS_TEAM_ID, user_team()) - ) - ) { - if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) { + // if ( + // (!in_array(get_role_id(), [1, 5])) && + // !( + // in_array(MANAGEMENT_TEAM_ID, user_team()) || + // in_array(FINANCE_TEAM_ID, user_team()) || + // in_array(BUSINESS_TEAM_ID, user_team()) + // ) + // ) { + // if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) { + // $builder->where('policy_transaction.created_by', get_session_userid()); + // } + // } + + if ((!in_array(get_role_id(), [1, 5]))) { + if (in_array(POS_TEAM_ID, user_team())) { $builder->where('policy_transaction.created_by', get_session_userid()); } } + if ($start_date != 0 && $end_date != 0 && $date_type != 0) { $this->validateDateType($date_type); @@ -3067,15 +3080,21 @@ $conditions = ""; // start safely // 1. Role-based restrictions - if ( - (!in_array(get_role_id(), [1, 5])) && - !( - in_array(MANAGEMENT_TEAM_ID, user_team()) || - in_array(FINANCE_TEAM_ID, user_team()) || - in_array(BUSINESS_TEAM_ID, user_team()) - ) - ) { - if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) { + // if ( + // (!in_array(get_role_id(), [1, 5])) && + // !( + // in_array(MANAGEMENT_TEAM_ID, user_team()) || + // in_array(FINANCE_TEAM_ID, user_team()) || + // in_array(BUSINESS_TEAM_ID, user_team()) + // ) + // ) { + // if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) { + // $conditions .= " AND pt.created_by = " . get_session_userid(); + // } + // } + + if ((!in_array(get_role_id(), [1, 5]))) { + if (in_array(POS_TEAM_ID, user_team())) { $conditions .= " AND pt.created_by = " . get_session_userid(); } } diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php index c8a43c29..636b07a7 100755 --- a/app/Views/client_kyc.php +++ b/app/Views/client_kyc.php @@ -39,26 +39,28 @@