From 47ad26a3a420e3f78e16bfe9c84a6458b4a241b6 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 31 Mar 2026 18:33:23 +0530 Subject: [PATCH 1/3] CHANGE_BDS_CHANGE --- .../PolicyTransactionController.php | 18 +-- app/Models/PolicyTransactionModel.php | 73 ++++++---- app/Views/client_kyc.php | 129 ++++++++++++++---- app/Views/client_kyc_other_table.php | 12 +- app/Views/client_kyc_primary_table.php | 12 +- .../policy_transaction_inception_form.php | 2 +- .../policy_transaction_inception_list.php | 5 + 7 files changed, 183 insertions(+), 68 deletions(-) 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 @@
- -
-
- - -
-
- - -
- -
- +
+
+
+ + +
+
+ + +
+
+ +
+
+
+ + +
+
@@ -94,6 +96,24 @@ var kycPrimaryKey = $('#client_id_kyc').val(); + function getAdditionalDocRowTemplate(index) { + return ` +
+
+ + +
+
+ + +
+
+ +
+
+ `; + } + $(document).ready(function(){ kycPrimaryKey = $('#kyc_PrimaryKey').val(); @@ -195,6 +215,20 @@ }); }); + $(document).on('click', '#add_more_other_docs', function () { + var nextIndex = $('#additional_docs_rows .additional-doc-row').length; + $('#additional_docs_rows').append(getAdditionalDocRowTemplate(nextIndex)); + $('#additional_docs_rows .remove-additional-doc-row').show(); + }); + + $(document).on('click', '.remove-additional-doc-row', function () { + $(this).closest('.additional-doc-row').remove(); + + if ($('#additional_docs_rows .additional-doc-row').length <= 1) { + $('#additional_docs_rows .remove-additional-doc-row').hide(); + } + }); + }) /*** for Others documents form submit ***/ @@ -202,8 +236,35 @@ event.preventDefault(); var isValid = $('#kyc_form').parsley().validate(); - var rowHtml = ''; var form_action = ''; + var allowedExtensions = ['pdf', 'png', 'jpeg', 'jpg']; + + $('#kyc_form .other-doc-name-field, #kyc_form .other-doc-file-field').removeClass('is-invalid'); + + $('#additional_docs_rows .additional-doc-row').each(function() { + var docNameField = $(this).find('.other-doc-name-field'); + var fileField = $(this).find('.other-doc-file-field'); + var docNameValue = (docNameField.val() || '').trim(); + var selectedFile = fileField[0].files[0]; + + if (docNameValue === '' || !selectedFile) { + isValid = false; + if (docNameValue === '') { + docNameField.addClass('is-invalid'); + } + if (!selectedFile) { + fileField.addClass('is-invalid'); + } + return; + } + + var fileExtension = selectedFile.name.split('.').pop().toLowerCase(); + if (allowedExtensions.indexOf(fileExtension) === -1) { + isValid = false; + fileField.addClass('is-invalid'); + } + }); + if (isValid) { if(kycPrimaryKey === ''){ @@ -240,6 +301,8 @@ } $('#kyc_form').trigger('reset'); + $('#additional_docs_rows .additional-doc-row').not(':first').remove(); + $('#additional_docs_rows .remove-additional-doc-row').hide(); }, error: function(xhr, status, error) { console.error(xhr.responseText); @@ -274,6 +337,8 @@ } }); + } else { + toastr.warning('Please fill all Additional Document rows and upload valid files.', 'Warning'); } }); @@ -291,12 +356,14 @@ if (result.isConfirmed) { var kyc_id = $(this).attr('data-id'); - $.get(''+kyc_id, function (data) { - // console.log('kyc-'+ kyc_id) - // console.log(data) - if(data){ - $('#form_'+kyc_id).show(); - $('#name_'+kyc_id).hide(); + var client_id = $(this).attr('data-client-id') || $('#client_id_kyc').val(); + $.get(''+kyc_id, { client_id: client_id }, function (data) { + if(data && data.status){ + if (data.data) { + $('#tbody').empty(); + $('#tbody').append(data.data); + } + toastr.success('Document deleted successfully', 'Success'); } }) } @@ -317,10 +384,16 @@ if (result.isConfirmed) { var kyc_id = $(this).attr('data-id'); - $.get(''+kyc_id, function (data) { - // console.log('kyc-'+ kyc_id) - if(data){ - $('#kyc-'+ kyc_id).remove(); + var client_id = $(this).attr('data-client-id') || $('#client_id_kyc').val(); + $.get(''+kyc_id, { client_id: client_id }, function (data) { + if(data && data.status){ + if (data.data) { + $('#other_docs').empty(); + $('#other_docs').append(data.data); + } else { + $('#kyc-'+ kyc_id).remove(); + } + toastr.success('Document deleted successfully', 'Success'); } }) } diff --git a/app/Views/client_kyc_other_table.php b/app/Views/client_kyc_other_table.php index 119c7831..c6629722 100644 --- a/app/Views/client_kyc_other_table.php +++ b/app/Views/client_kyc_other_table.php @@ -2,9 +2,17 @@ $item): ?> - - + + + + + diff --git a/app/Views/client_kyc_primary_table.php b/app/Views/client_kyc_primary_table.php index 20317d97..86c2674f 100644 --- a/app/Views/client_kyc_primary_table.php +++ b/app/Views/client_kyc_primary_table.php @@ -17,7 +17,17 @@ - + + + + + + diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index 27d8efb7..174aeaa9 100644 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -766,7 +766,7 @@
-->
- +
diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index aeecd703..39b49b27 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -661,6 +661,11 @@ function getAddPage(){ if(view == 1){ runInceptionAddFlowFromList(); + setTimeout(() => { + var backUrl = ''; + var backButton = ``; + updateNavTitle('Add Policy', backButton); + }, 500); } } From 5f3f4380894d4fb485695083a3e3b05c9d92fb53 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Tue, 31 Mar 2026 18:35:31 +0530 Subject: [PATCH 2/3] CHANGE_BDS_CHANGE_1 --- app/Config/Acl.php | 2 +- app/Views/layout/header.php | 52 +++++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/app/Config/Acl.php b/app/Config/Acl.php index 7721a764..c967de82 100644 --- a/app/Config/Acl.php +++ b/app/Config/Acl.php @@ -309,7 +309,7 @@ class Acl // ===================== DEFAULT DENY (ZERO TRUST) ===================== '#^/#' => [ - 'roles' => [ADMIN_ROLE_ID], + 'roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID], 'teams' => [] ], ]; diff --git a/app/Views/layout/header.php b/app/Views/layout/header.php index 69f7d3ab..0280e6e8 100755 --- a/app/Views/layout/header.php +++ b/app/Views/layout/header.php @@ -2102,9 +2102,10 @@ body[data-sidebar-size="condensed"] .footer { - + + + -
  • @@ -2135,27 +2136,29 @@ body[data-sidebar-size="condensed"] .footer {
  • - -
  • - - - Policy TAT Reports - -
    - -
    -
  • +
  • + + + Policy TAT Reports + +
    + +
    +
  • + +