From 0714f4ad66b22bd1271b98ea4e4f5807e86451df Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 11 Feb 2026 15:23:58 +0530 Subject: [PATCH 01/13] FIX_ISSUE_404_200 --- app/Controllers/EmployeeRestController.php | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 800b172..01492da 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -141,7 +141,7 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'success','code' => 200,'data' => $result, 'AccountManagerDetails'=> isset($AccountManagerDetails[0]) ? $AccountManagerDetails[0] : null ],200); } else { $result = "No Match's"; - return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404); + return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200); } } catch (\Throwable $th) { return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); @@ -162,7 +162,7 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); } else { $result = "No Match's"; - return $this->respond(['status' => 'failed','code' => 404,'data' => $result],404); + return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200); } } } catch (\Throwable $th) { @@ -190,7 +190,7 @@ class EmployeeRestController extends AdminController } else { - return $this->respond(['status' => 'failed','code' => 404,'data' => []],404); + return $this->respond(['status' => 'failed','code' => 404,'data' => []],200); } } catch (\Throwable $th) { return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); @@ -220,7 +220,7 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200); } else { $result = "No Matches"; - return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404); + return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 200); } } } catch (\Exception $e) { @@ -584,7 +584,7 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'success','code' => 200,'data' =>[] ], 200); }else{ - return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404); + return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 200); } @@ -615,7 +615,7 @@ class EmployeeRestController extends AdminController $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($requestData[0]->client_policy_id, $requestData[0]->emp_code); } - if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); } + if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 200); } foreach ($requestData as $key => $value) { @@ -692,7 +692,7 @@ class EmployeeRestController extends AdminController if ($empData) { return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200); } else { - return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); } @@ -805,7 +805,7 @@ class EmployeeRestController extends AdminController if ($ClientPolicyData) { return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200); } else { - return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); } @@ -1211,7 +1211,7 @@ class EmployeeRestController extends AdminController $this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => '','error_data' => ''])->update(); return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 200); }else{ - return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 404); + return $this->respond(['status' => 'failed', 'code' => 404, 'message' => "Client id and Client Policy id is Not Match!" ], 200); } } catch (\Throwable $th) { $this->myLogger->logme("error", ($th->getMessage().' --- '.$th->getLine() . '----' . $th->getTraceAsString())); @@ -2168,10 +2168,10 @@ class EmployeeRestController extends AdminController // return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails'); // } else { - // return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + // return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); // } // } else { - // return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + // return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); // } // } catch (\Exception $e) { // return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500); @@ -2213,7 +2213,7 @@ class EmployeeRestController extends AdminController ], 200); } else { - return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); } } elseif (!empty($post_client_id)) { @@ -2227,7 +2227,7 @@ class EmployeeRestController extends AdminController } else { - return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404); + return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200); } } catch (\Exception $e) { @@ -3095,7 +3095,7 @@ class EmployeeRestController extends AdminController return $employee_data_group_by_family; }else{ // dd ($employee_data_group_by_family); - return $this->respond(['status' => 'success','code' => (count($employee_data_group_by_family) ? 200 : 404),'data' => [$employee_data_group_by_family] ], 200); + return $this->respond(['status' => 'success','code' => (count($employee_data_group_by_family) ? 200 : 200),'data' => [$employee_data_group_by_family] ], 200); } } @@ -3121,7 +3121,7 @@ class EmployeeRestController extends AdminController } if(count($policyId) == 0){ - return $this->respond(['status' => 'failed','code' => (count($policyId) ? 200 : 404),'data' => [] ], 200); + return $this->respond(['status' => 'failed','code' => (count($policyId) ? 200 : 200),'data' => [] ], 200); } @@ -3169,9 +3169,9 @@ class EmployeeRestController extends AdminController if($result) { - return $this->respond(['status' => 'success','code' => (count($result) ? 200 : 404),'data' => $result ], 200); + return $this->respond(['status' => 'success','code' => (count($result) ? 200 : 200),'data' => $result ], 200); }else{ - return $this->respond(['status' => 'failed','code' => (count($result) ? 200 : 404),'data' => [] ], 200); + return $this->respond(['status' => 'failed','code' => (count($result) ? 200 : 200),'data' => [] ], 200); } } @@ -3572,7 +3572,7 @@ class EmployeeRestController extends AdminController } else { - return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404); + return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],200); } } catch (\Throwable $th) { return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); @@ -3596,7 +3596,7 @@ class EmployeeRestController extends AdminController } else { - return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404); + return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],200); } } catch (\Throwable $th) { return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); @@ -3657,7 +3657,7 @@ class EmployeeRestController extends AdminController return $this->respond(['status' => 'failed', 'code' => 400, 'message' => 'Firebase Token is required'], 400); } } else { - return $this->respond(['status' => 'failed', 'code' => 404, 'message' => 'Employee not found'], 404); + return $this->respond(['status' => 'failed', 'code' => 404, 'message' => 'Employee not found'], 200); } } catch (\Throwable $th) { log_message('error', 'An error occurred: ' . $th->getMessage()); From 31dd204e317faa709ebfb576ff486c06f77516cf Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Wed, 11 Feb 2026 17:16:39 +0530 Subject: [PATCH 02/13] FIX_RELATION_ISSUE --- app/Config/Filters.php | 2 +- app/Helpers/EmployeeHelper.php | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/Config/Filters.php b/app/Config/Filters.php index 0042bda..31f27ad 100755 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -62,7 +62,7 @@ class Filters extends BaseConfig public array $globals = [ 'before' => [ 'HttpRequestLog' => ['except' => 'cli/*'], - 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','/employeeRest/*','processjob']], + 'AclFilter' => ['except' => ['login', 'logout', 'auth/*', 'oauth2callback','claim-form-download', 'claims-feedback-form', 'autobookstackLogin','/employeeRest/*','processjob', 'getPreEmployeePolicyCount']], 'Cors', 'SecurityInputFilter' => ['except' => ['/client/notification/create','test_mail'] ], 'GlobalPostFileUploadGuard', diff --git a/app/Helpers/EmployeeHelper.php b/app/Helpers/EmployeeHelper.php index e33e6dd..15a3f36 100644 --- a/app/Helpers/EmployeeHelper.php +++ b/app/Helpers/EmployeeHelper.php @@ -43,12 +43,16 @@ class EmployeeHelper if($is_addon_value == 1){ $is_addon_value = 0 ; }else{ $is_addon_value = 1 ; } - $employeeData = $this->employeeModel->where('emp_code',$data[0]->emp_code) - ->where('client_id',$data[0]->client_id) - ->where('client_branch_id',$data[0]->client_branch_id) - ->where('is_active', 1 ) - ->where('is_addon_value',$is_addon_value) - ->findAll(); + $employeeData = $this->employeeModel + ->join('employee_polices', 'employees.id = employee_polices.employee_id') + ->where('employees.emp_code',$data[0]->emp_code) + ->where('employees.client_id',$data[0]->client_id) + ->where('employees.client_branch_id',$data[0]->client_branch_id) + ->where('employees.is_active', 1 ) + ->where('employee_polices.client_policy_id', $client_policy_id) + ->where('employee_polices.is_active', 1) + ->where('is_addon_value',$is_addon_value) + ->findAll(); $array = $array[0]; From 89e20f23aa7840e6548692845ba9da31bf9aeb13 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 13 Feb 2026 14:38:46 +0530 Subject: [PATCH 03/13] FIX_REQUIRED_ISSUE --- app/Views/notification.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Views/notification.php b/app/Views/notification.php index 6033700..16dec5d 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -1189,7 +1189,7 @@
- +
@@ -1228,7 +1228,7 @@
- +
@@ -1252,7 +1252,7 @@
- +
From a44a6926679ea605182f3a45a51b3e5e94ea7824 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Fri, 13 Feb 2026 14:47:20 +0530 Subject: [PATCH 04/13] FIX_ISSUE --- app/Views/notification.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Views/notification.php b/app/Views/notification.php index 16dec5d..9abf5ff 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -1188,7 +1188,7 @@
-
+
@@ -1227,7 +1227,7 @@
-
+
@@ -1251,7 +1251,7 @@
-
+
@@ -1295,7 +1295,7 @@ // Check if a file is selected if (!fileInput.files.length) { - toastr.warning("Please select a file to upload."); + toastr.warning("Please select a file to upload.", "Validation Error"); return; } From ff338609cc3b21f597a6f7c8713793583327c93e Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Wed, 18 Feb 2026 10:46:40 +0530 Subject: [PATCH 05/13] FIX_Toastr_Warning msg should be case sensitive --- app/Controllers/MasterController.php | 1 + app/Views/UserList.php | 2 +- app/Views/cd_master_list.php | 8 +-- app/Views/client_branch.php | 24 +++---- app/Views/client_kyc.php | 6 +- app/Views/client_list.php | 16 ++--- app/Views/client_onboarding.php | 10 +-- app/Views/client_others_tab.php | 4 +- app/Views/client_policy.php | 16 ++--- app/Views/employee_data_list.php | 20 +++--- app/Views/employee_list.php | 4 +- app/Views/employee_upload.php | 16 ++--- app/Views/enrollment_list.php | 8 +-- app/Views/file_list.php | 6 +- app/Views/insurer_branch.php | 10 +-- app/Views/insurer_export_templete.php | 8 +-- app/Views/insurer_list.php | 6 +- app/Views/insurer_onboarding.php | 2 +- app/Views/insurer_or_tpa_data.php | 4 +- app/Views/insurer_statement_list.php | 2 +- app/Views/kyc_docs.php | 10 +-- app/Views/kyc_entity_type_basic_info.php | 2 +- app/Views/kyc_list.php | 6 +- app/Views/kyc_onboarding.php | 2 +- app/Views/leads_list.php | 4 +- app/Views/notification.php | 58 +++++++-------- app/Views/policies.php | 12 ++-- app/Views/policy_gmc_terms.php | 2 +- app/Views/policy_gpa_terms.php | 2 +- app/Views/policy_grid.php | 70 +++++++++---------- app/Views/policy_grid_excel.php | 6 +- .../policy_transaction_endorsement_form.php | 6 +- .../policy_transaction_endorsement_list.php | 4 +- .../policy_transaction_inception_form.php | 30 ++++---- .../policy_transaction_inception_list.php | 12 ++-- app/Views/policy_type_basic_info.php | 2 +- app/Views/policy_type_list.php | 6 +- app/Views/policy_type_onboarding.php | 2 +- app/Views/rack_rate_auto_si.php | 12 ++-- app/Views/report_bds.php | 2 +- app/Views/report_bds_filter.php | 2 +- app/Views/test_members_list.php | 26 +++---- app/Views/tpa_branch.php | 10 +-- app/Views/tpa_list.php | 6 +- app/Views/tpa_onboarding.php | 2 +- app/Views/variance_report_list.php | 2 +- app/Views/vehicle_details.php | 2 +- app/Views/vehicle_master_list.php | 6 +- app/Views/view_rfq.php | 18 ++--- 49 files changed, 249 insertions(+), 248 deletions(-) diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 24527ad..812b23e 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -156,6 +156,7 @@ class MasterController extends AdminController $this->myLogger->logme('error','Edit Insurer Onboarding function called'); $headerData['page_name'] = 'Edit Insurer Master'; + print_r($headerData);die; $types = array( (object) array('id' => 'pvt', 'name' => 'PVT'), diff --git a/app/Views/UserList.php b/app/Views/UserList.php index be654b8..b526ca6 100755 --- a/app/Views/UserList.php +++ b/app/Views/UserList.php @@ -290,7 +290,7 @@ $(document).ready(function () { var student_id = $(this).attr('data-id'); $.get(''+student_id, function (data) { console.log(data); - toastr.success('User removed successfully', 'success'); + toastr.success('User removed successfully', 'Success'); window.location.reload() }) } diff --git a/app/Views/cd_master_list.php b/app/Views/cd_master_list.php index 92bde59..f8a3278 100755 --- a/app/Views/cd_master_list.php +++ b/app/Views/cd_master_list.php @@ -312,7 +312,7 @@ document.addEventListener("DOMContentLoaded", function () { has('success')) : ?> - toastr.success('getFlashdata('success') ?>', 'success'); + toastr.success('getFlashdata('success') ?>', 'Success'); var endDatePicker = flatpickr("#opening_date", { @@ -410,7 +410,7 @@ document.addEventListener("DOMContentLoaded", function () { console.log(res) if(res.status == true){ - toastr.warning(res.message, 'warning'); + toastr.warning(res.message, 'Warning'); $('#cd_ac_no').val(''); } }, @@ -446,10 +446,10 @@ document.addEventListener("DOMContentLoaded", function () { // console.log(res.status == true); if(res){ if (res.status == true) { - toastr.success('CD removed successfully.', 'success'); + toastr.success('CD removed successfully.', 'Success'); location.reload(); } else { - toastr.warning('Failed to remove CD.', 'warning'); + toastr.warning('Failed to remove CD.', 'Warning'); } } }, diff --git a/app/Views/client_branch.php b/app/Views/client_branch.php index 449d1e8..b8e9f29 100755 --- a/app/Views/client_branch.php +++ b/app/Views/client_branch.php @@ -609,7 +609,7 @@ $('body').on('click', '.btnBranchEdit', function() { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -811,10 +811,10 @@ function removeClientBranch(element) { // console.log(res.status == true); if (res) { if (res.status == true) { - toastr.success(res.message, 'success'); + toastr.success(res.message, 'Success'); location.reload(); } else { - toastr.warning(res.message, 'warning'); + toastr.warning(res.message, 'Warning'); } } }, @@ -824,7 +824,7 @@ function removeClientBranch(element) { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + console.log('Something Wrong!', 'Warning'); }, 1000); } }); @@ -938,7 +938,7 @@ function validateInput(input, table, field, submitBtnId){ checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) { if (isDuplicate) { - toastr.warning(message, 'WARNING'); + toastr.warning(message, 'Warning'); // $(input).val('') $('#'+submitBtnId).prop('disabled', true); } else{ @@ -972,7 +972,7 @@ function validateDuplicateByClientBranch(input, field, submitButId) { if (isLocalDuplicate) { console.log(`r u n Local`); console.log(`duplicate found for ${field}`); - toastr.warning(message, 'WARNING'); + toastr.warning(message, 'Warning'); $('#' + submitButId).prop('disabled', true); return; } @@ -999,7 +999,7 @@ function validateDuplicateByClientBranch(input, field, submitButId) { if (response.isDuplicate) { console.log(`r u n Server`); console.log(`duplicate found for ${field}`); - toastr.warning(message, 'WARNING'); + toastr.warning(message, 'Warning'); $('#' + submitButId).prop('disabled', true); } else { console.log(`No duplicate for ${field}`); @@ -1044,13 +1044,13 @@ function checkAllFieldsValid(submitButId) { $('#' + submitButId).prop('disabled', true); // show correct message based on what’s duplicated if (emailDuplicates && mobileDuplicates) { - toastr.warning("Email and Mobile values are duplicate!", "WARNING"); + toastr.warning("Email and Mobile values are duplicate!", "Warning"); console.log('Both Email and Mobile duplicates'); } else if (emailDuplicates) { - toastr.warning("Email duplicate!", "WARNING"); + toastr.warning("Email duplicate!", "Warning"); console.log('Cross Check Email duplicates'); } else if (mobileDuplicates) { - toastr.warning("Mobile duplicate!", "WARNING"); + toastr.warning("Mobile duplicate!", "Warning"); console.log('Cross Check Mobile duplicates'); } console.log(`btn Dis - true`); @@ -1096,9 +1096,9 @@ function removeLevelContacts(id){ console.log('Data fetched successfully:', response); if (response.status == true) { - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); } else { - toastr.warning(response.message, 'WARNING'); + toastr.warning(response.message, 'Warning'); } }, function(xhr, status, error) { diff --git a/app/Views/client_kyc.php b/app/Views/client_kyc.php index 99bab2b..2c96495 100755 --- a/app/Views/client_kyc.php +++ b/app/Views/client_kyc.php @@ -212,7 +212,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } @@ -333,7 +333,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } @@ -438,7 +438,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); diff --git a/app/Views/client_list.php b/app/Views/client_list.php index 89ff403..a65ff46 100755 --- a/app/Views/client_list.php +++ b/app/Views/client_list.php @@ -402,7 +402,7 @@ // if(res){ // if (res.status == true) { - // toastr.success('Client removed successfully.', 'success'); + // toastr.success('Client removed successfully.', 'Success'); // location.reload(); // } else { // Swal.fire({ @@ -410,7 +410,7 @@ // text: res.message, // icon: "warning" // }); - // // toastr.warning(res.message, 'warning'); + // // toastr.warning(res.message, 'Warning'); // } // } // }, @@ -419,7 +419,7 @@ // console.error(status, error); // $('.loader').fadeOut(); // $('.loader-mask').delay(350).fadeOut('slow'); - // console.log('Something Wrong!', 'warning'); + // console.log('Something Wrong!', 'Warning'); // } // }); // } @@ -466,15 +466,15 @@ $('.loader-mask').delay(350).fadeOut('slow'); if (res.status == true) { - toastr.success(res.message, 'success'); + toastr.success(res.message, 'Success'); location.reload(); } else { Swal.fire({ - title: "warning!", + title: "Warning!", text: res.message, icon: "warning" }); - // toastr.warning(res.message, 'warning'); + // toastr.warning(res.message, 'Warning'); } }, error: function (xhr, status, error) { @@ -563,10 +563,10 @@ if(res.status == true){ let client_url = '' + res.client_id + '?client_policy_id=' + res.client_policy_id+'#police-tab'; - toastr.success(res.message, 'SUCCESS') + toastr.success(res.message, 'Success') window.location.href = client_url }else{ - toastr.success(res.message, 'WARNING') + toastr.warning(res.message, 'Warning') } $('.close').click() diff --git a/app/Views/client_onboarding.php b/app/Views/client_onboarding.php index dc37b06..08e9359 100755 --- a/app/Views/client_onboarding.php +++ b/app/Views/client_onboarding.php @@ -200,7 +200,7 @@ body { if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){ $('#btnBranchAdd').hide(); - toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000}); + toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000}); }else{ if ($('#btnBranchBack')[0].style.display == 'none') { $('#btnBranchAdd').show(); @@ -215,7 +215,7 @@ body { if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){ $('#relation_form').hide(); - toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000}); + toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000}); }else{ $('#relation_form').show(); } @@ -228,7 +228,7 @@ body { if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){ $('#BtnAdd').hide(); - toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000}); + toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000}); }else{ if ($('#btnPolicyBack')[0].style.display == 'none') { $('#BtnAdd').show(); @@ -243,7 +243,7 @@ body { if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){ $('#btnBranchAdd').hide(); - toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000}); + toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000}); }else{ if ($('#btnBranchBack')[0].style.display == 'none') { $('#btnBranchAdd').show(); @@ -259,7 +259,7 @@ body { if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){ $('#notification-tab').hide(); - toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000}); + toastr.warning('Please Add the Client!', 'Warning',{timeOut: 2000}); }else{ if ($('#notification-tab')[0].style.display == 'none') { $('#notification-tab').show(); diff --git a/app/Views/client_others_tab.php b/app/Views/client_others_tab.php index e7f0979..193eb8b 100755 --- a/app/Views/client_others_tab.php +++ b/app/Views/client_others_tab.php @@ -59,9 +59,9 @@ $(document).ready(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); if (res.status == true) { - toastr.success(res.message, 'SUCCESS'); + toastr.success(res.message, 'Success'); } else { - toastr.warning(res.message, 'WARNING'); + toastr.warning(res.message, 'Warning'); } }, diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 0da8700..1e410a9 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -1686,7 +1686,7 @@ $('#policy_type').change(function() { } if ($(this).val() == 5) { - toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'INFO'); + toastr.warning('Please Change the Policy Terms after Submit the Policy!', 'Info'); } if ($(this).val() == '4' || $(this).val() == '5') { @@ -1891,7 +1891,7 @@ function fetchClientBranch() { // //console.log(res.data.length); if (res.data.length == 0) { - toastr.warning('The client does not have any branches.', 'warning'); + toastr.warning('The client does not have any branches.', 'Warning'); return; } @@ -2018,15 +2018,15 @@ function removepolicy(element) { if (res) { if (res.status == true) { - toastr.success('Policy removed successfully.', 'success'); + toastr.success('Policy removed successfully.', 'Success'); location.reload(); } else { Swal.fire({ - title: "warning!", + title: "Warning!", text: res.message, icon: "warning" }); - // toastr.warning('Failed to remove policy', 'warning'); + // toastr.warning('Failed to remove policy', 'Warning'); } } }, @@ -2060,7 +2060,7 @@ $('#policy_no').change(function() { console.log(res) if (res.status == true) { - toastr.warning(res.message, 'warning'); + toastr.warning(res.message, 'Warning'); $('#policy_no').val(''); } }, @@ -2331,10 +2331,10 @@ function featchClient() { if (res.status == true) { let client_url = '' + res.client_id + '?client_policy_id=' + res.client_policy_id + '#police-tab'; - toastr.success(res.message, 'SUCCESS') + toastr.success(res.message, 'Success') window.location.href = client_url; } else { - toastr.success(res.message, 'WARNING'); + toastr.warning(res.message, 'Warning'); } $('.close').click() diff --git a/app/Views/employee_data_list.php b/app/Views/employee_data_list.php index c3f2c24..c8f094b 100755 --- a/app/Views/employee_data_list.php +++ b/app/Views/employee_data_list.php @@ -536,7 +536,7 @@ function get_emp_master_data_for_update_ajax(id) { $('#gender').prop('disabled', false); $('#dob').prop('disabled', false); - toastr.warning(res.message, 'WARNING'); + toastr.warning(res.message, 'Warning'); } }, error: function(xhr, status, error) { @@ -583,7 +583,7 @@ function update_emp_master_data_submit_function(event, form) { $('.loader-mask').delay(350).fadeOut('slow'); if (response.status == true) { - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); $('.close').click(); @@ -599,7 +599,7 @@ function update_emp_master_data_submit_function(event, form) { fetchEmpolyeeList(); } else { - toastr.error(response.message, 'ERROR'); + toastr.error(response.message, 'Error'); } }, error: function(xhr, status, error) { @@ -616,7 +616,7 @@ function update_emp_master_data_submit_function(event, form) { console.error('Response Text: ', xhr.responseText); } - toastr.warning('Error uploading file', 'WARNING'); + toastr.warning('Error uploading file', 'Warning'); console.error('Upload error:', error); }, complete: function() { @@ -657,9 +657,9 @@ function send_mail_for_individual_employee_ecard(id) { $('.loader-mask').delay(350).fadeOut('slow'); if (res.status == true) { - toastr.success(res.message, 'SUCCESS'); + toastr.success(res.message, 'Success'); } else { - toastr.error(res.message, 'ERROR'); + toastr.error(res.message, 'Error'); } }, error: function(xhr, status, error) { @@ -698,7 +698,7 @@ function validateInput(input, table, field) { checkDuplicateTableFieldValue(table, field, data, function(isDuplicate) { if (isDuplicate) { - toastr.warning(message, 'WARNING'); + toastr.warning(message, 'Warning'); $("#btnSubmit").prop('disabled', true); }else{ $("#btnSubmit").prop('disabled', false); @@ -800,12 +800,12 @@ function get_emp_history(input, emp_id) { showModal(); } else { let message = response.message; - toastr.error(message, 'ERROR'); + toastr.error(message, 'Error'); } }, function(xhr, status, error) { console.error('Error fetching data:', error); console.error(xhr.responseText); - toastr.error('An error occurred while fetching the report page.', 'ERROR'); + toastr.error('An error occurred while fetching the report page.', 'Error'); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); @@ -844,7 +844,7 @@ function downloadInception(){ empName: empName }, success: function(response) { - if (response.status === 'success') { + if (response.status === 'Success') { $('', { href: response.downloadUrl, download: '', diff --git a/app/Views/employee_list.php b/app/Views/employee_list.php index 3a779fb..c4c2baa 100755 --- a/app/Views/employee_list.php +++ b/app/Views/employee_list.php @@ -691,9 +691,9 @@ function sendManualEcard(input) $('.loader-mask').delay(350).fadeOut('slow'); if(res.status == false){ - toastr.info(res.message, 'INFO'); + toastr.info(res.message, 'Info'); }else{ - toastr.success(res.message, 'SUCCESS'); + toastr.success(res.message, 'Success'); } }, diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php index 98bb2c9..cb2147e 100755 --- a/app/Views/employee_upload.php +++ b/app/Views/employee_upload.php @@ -183,7 +183,7 @@ $('#file_upload').hide(); $(document).ready(function() { has('success1')): ?> - toastr.success('getFlashdata('success1') ?>', 'success'); + toastr.success('getFlashdata('success1') ?>', 'Success'); // Initialize select2 $("#client_id").select2(); @@ -247,22 +247,22 @@ $(document).ready(function() { if(checkValues() == 'client'){ - toastr.warning('Client is Required', 'warning') + toastr.warning('Client is Required', 'Warning') return false; }else if(checkValues() == 'policy'){ - toastr.warning('Policy is Required', 'warning') + toastr.warning('Policy is Required', 'Warning') return false; }else if(checkValues() == 'branch'){ - toastr.warning('Branch is Required', 'warning') + toastr.warning('Branch is Required', 'Warning') return false; }else if(checkValues() == 'event'){ - toastr.warning('Event is Required', 'warning') + toastr.warning('Event is Required', 'Warning') return false; }else{ @@ -291,7 +291,7 @@ $(document).ready(function() { // $('#policy_id').mouseover(); console.log('required'); // alert('please choose policy for this uploaing event '); - toastr.warning('please choose policy for this uploaing event', 'warning') + toastr.warning('please choose policy for this uploaing event', 'Warning') return false; } else { @@ -330,7 +330,7 @@ $(document).ready(function() { .data !== "") { toastr.success( 'File upload successs, Data validation is in-progress', - 'success'); + 'Success'); window.location.reload(true); } else if (response.code === 404 && response.dataStatus === false) { console.error('no data found', response); @@ -850,7 +850,7 @@ $('#fetch_enrolled_data').click(function() var action = $('#upload-action-type').val(); // console.log(client_id + '-' + policy_id); if (client_id == '0' || policy_id == '0') { - toastr.warning('please select the client and policy for this uploaing event', 'warning') + toastr.warning('please select the client and policy for this uploaing event', 'Warning') $('#full-width-modal').modal('hide'); return; } diff --git a/app/Views/enrollment_list.php b/app/Views/enrollment_list.php index 8d3810d..495d959 100755 --- a/app/Views/enrollment_list.php +++ b/app/Views/enrollment_list.php @@ -811,13 +811,13 @@ $('.loader-mask').delay(350).fadeOut('slow'); if (response.code === 200 && response.dataStatus === true && response.data !== "") { - toastr.success('File upload success, Data validation is in-progress', 'success'); + toastr.success('File upload success, Data validation is in-progress', 'Success'); setTimeout(function() { window.location.href = ''; }, 600); } else if (response.code === 404 && response.dataStatus === false) { console.error('No data found', response); - toastr.error(response.message, 'error'); + toastr.error(response.message, 'Error'); setTimeout(function() { window.location.href = ''; }, 600); @@ -908,9 +908,9 @@ $('.loader-mask').delay(350).fadeOut('slow'); if(res.status == false){ - toastr.info(res.message, 'INFO'); + toastr.info(res.message, 'Info'); }else{ - toastr.success(res.message, 'SUCCESS'); + toastr.success(res.message, 'Success'); } }, diff --git a/app/Views/file_list.php b/app/Views/file_list.php index 9886ae9..84c1a8b 100755 --- a/app/Views/file_list.php +++ b/app/Views/file_list.php @@ -89,7 +89,7 @@ echo '' . $file['status'] . ''; } - } else if ($file['status'] == 'success') { + } else if ($file['status'] == 'Success') { if ($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addtion') { $tool_tip_text = "Live(s) : {$file['employee_count']}" . " | Total premium : ₹ " . format_indian_number($file['total'], 2, ','); @@ -128,7 +128,7 @@ ">Download View - + Truncate @@ -455,7 +455,7 @@ $('#uploadForm').submit(function() { .data !== "") { toastr.success( 'File upload successs, Data validation is in-progress', - 'success'); + 'Success'); $('.close').click() window.location.reload(true); } else if (response.code === 404 && response.dataStatus === false) { diff --git a/app/Views/insurer_branch.php b/app/Views/insurer_branch.php index 9001fec..e138a72 100755 --- a/app/Views/insurer_branch.php +++ b/app/Views/insurer_branch.php @@ -292,7 +292,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -358,7 +358,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -515,10 +515,10 @@ // console.log(res.status == true); if(res){ if (res.status == true) { - toastr.success('Insurer branch removed successfully', 'success'); + toastr.success('Insurer branch removed successfully', 'Success'); location.reload(); } else { - toastr.warning('Failed to remove insurer branch', 'warning'); + toastr.warning('Failed to remove insurer branch', 'Warning'); } } }, @@ -527,7 +527,7 @@ console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Failed to remove insurer branch', 'warning'); + toastr.warning('Failed to remove insurer branch', 'Warning'); } }); diff --git a/app/Views/insurer_export_templete.php b/app/Views/insurer_export_templete.php index 19c9657..f3d2369 100755 --- a/app/Views/insurer_export_templete.php +++ b/app/Views/insurer_export_templete.php @@ -440,9 +440,9 @@ $('.loader-mask').delay(350).fadeOut('slow'); if(res.status == false){ - toastr.error(res.message, 'ERROR'); + toastr.error(res.message, 'Error'); }else{ - toastr.success(res.message, 'SUCCESS'); + toastr.success(res.message, 'Success'); } window.location.reload(true); @@ -677,9 +677,9 @@ $('.loader-mask').delay(350).fadeOut('slow'); if(res.status == false){ - toastr.error(res.message, 'ERROR'); + toastr.error(res.message, 'Error'); }else{ - toastr.success(res.message, 'SUCCESS'); + toastr.success(res.message, 'Success'); } window.location.reload(true); diff --git a/app/Views/insurer_list.php b/app/Views/insurer_list.php index 150f9be..33d2600 100755 --- a/app/Views/insurer_list.php +++ b/app/Views/insurer_list.php @@ -277,10 +277,10 @@ class csvExport { // console.log(res.status == true); if(res){ if (res.status == true) { - toastr.success('Insurer removed successfully', 'success'); + toastr.success('Insurer removed successfully', 'Success'); location.reload(); } else { - toastr.warning('Failed to remove insurer', 'warning'); + toastr.warning('Failed to remove insurer', 'Warning'); } } }, @@ -289,7 +289,7 @@ class csvExport { console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Failed to remove insurer', 'warning'); + toastr.warning('Failed to remove insurer', 'Warning'); } }); } diff --git a/app/Views/insurer_onboarding.php b/app/Views/insurer_onboarding.php index 03e9598..838691b 100755 --- a/app/Views/insurer_onboarding.php +++ b/app/Views/insurer_onboarding.php @@ -59,7 +59,7 @@ if(check_insurer_id[0].value == '' || check_insurer_id[0].value == null || check_insurer_id[0].value == 0){ $('#btnBranchAdd').hide(); - toastr.warning('First Add the Insurer!', 'warning',{timeOut: 2000}); + toastr.warning('First Add the Insurer!', 'Warning',{timeOut: 2000}); }else{ if ($('#btnBranchBack')[0].style.display == 'none') { $('#btnBranchAdd').show(); diff --git a/app/Views/insurer_or_tpa_data.php b/app/Views/insurer_or_tpa_data.php index 84b4106..be65079 100755 --- a/app/Views/insurer_or_tpa_data.php +++ b/app/Views/insurer_or_tpa_data.php @@ -156,7 +156,7 @@ has('success')) : ?> - toastr.success('getFlashdata('success') ?>', 'success'); + toastr.success('getFlashdata('success') ?>', 'Success'); $('#import_excel_btn').hide(); @@ -200,7 +200,7 @@ $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); $$("#import_export_excel_form")[0].reset() - toastr.success('File Download successs', 'success'); + toastr.success('File Download successs', 'Success'); } else if (response.code === 404 && response.status === false) { diff --git a/app/Views/insurer_statement_list.php b/app/Views/insurer_statement_list.php index 83dee91..49ef917 100755 --- a/app/Views/insurer_statement_list.php +++ b/app/Views/insurer_statement_list.php @@ -961,7 +961,7 @@ maxDate.setDate(today.getDate() + 180); .data !== "") { toastr.success( 'File upload successs', - 'success'); + 'Success'); $('.close').click(); window.location.reload(true); } else if (response.code === 404 && response.dataStatus === false) { diff --git a/app/Views/kyc_docs.php b/app/Views/kyc_docs.php index 56a0bac..5f16fac 100755 --- a/app/Views/kyc_docs.php +++ b/app/Views/kyc_docs.php @@ -201,7 +201,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -241,7 +241,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -304,7 +304,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); }, 1000); + console.log('Something Wrong!', 'Warning'); }, 1000); } }); } @@ -352,7 +352,7 @@ $(document).ready(function () { window.location.href = '' + kyc_docs_id_for_reload; } else { - toastr.warning('Failed to remove KYC docs', 'warning'); + toastr.warning('Failed to remove KYC docs', 'Warning'); } } }, @@ -361,7 +361,7 @@ $(document).ready(function () { console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Failed to remove KYC docs', 'warning'); + toastr.warning('Failed to remove KYC docs', 'Warning'); } }); } diff --git a/app/Views/kyc_entity_type_basic_info.php b/app/Views/kyc_entity_type_basic_info.php index 2a0980f..aedd84c 100755 --- a/app/Views/kyc_entity_type_basic_info.php +++ b/app/Views/kyc_entity_type_basic_info.php @@ -86,7 +86,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); diff --git a/app/Views/kyc_list.php b/app/Views/kyc_list.php index e6c0870..904456c 100755 --- a/app/Views/kyc_list.php +++ b/app/Views/kyc_list.php @@ -271,12 +271,12 @@ function removeKYC(element) { // console.log(res.status == true); if(res){ if (res.status == true) { - toastr.success('KYC entity removed successfully', 'success'); + toastr.success('KYC entity removed successfully', 'Success'); location.reload(); } else { - toastr.warning('Failed to remove KYC entity', 'warning'); + toastr.warning('Failed to remove KYC entity', 'Warning'); } } }, @@ -286,7 +286,7 @@ function removeKYC(element) { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); diff --git a/app/Views/kyc_onboarding.php b/app/Views/kyc_onboarding.php index 412331b..dea9e38 100755 --- a/app/Views/kyc_onboarding.php +++ b/app/Views/kyc_onboarding.php @@ -75,7 +75,7 @@ body { console.log(check_policy_type_id.val()); if(check_policy_type_id[0].value == '' || check_policy_type_id[0].value == null || check_policy_type_id[0].value == 0){ $('#btnBranchAdd').hide(); - toastr.warning('First Add the KYC Entity Type!', 'warning',{timeOut: 2000}); + toastr.warning('First Add the KYC Entity Type!', 'Warning',{timeOut: 2000}); }else{ if ($('#btnBranchBack')[0].style.display == 'none') { $('#btnBranchAdd').show(); diff --git a/app/Views/leads_list.php b/app/Views/leads_list.php index ddf4d23..dd3176f 100755 --- a/app/Views/leads_list.php +++ b/app/Views/leads_list.php @@ -270,11 +270,11 @@ $(document).ready(function(){ has('create_success')) : ?> - toastr.success('getFlashdata('create_success') ?>', 'success'); + toastr.success('getFlashdata('create_success') ?>', 'Success'); has('update_success')) : ?> - toastr.success('getFlashdata('update_success') ?>', 'success'); + toastr.success('getFlashdata('update_success') ?>', 'Success'); diff --git a/app/Views/notification.php b/app/Views/notification.php index 6033700..6181141 100755 --- a/app/Views/notification.php +++ b/app/Views/notification.php @@ -814,13 +814,13 @@ console.log('Parsed respond', respond) if (respond.status == 'success') { - toastr.success(respond.message, 'SUCCESS') + toastr.success(respond.message, 'Success') } else { - toastr.warning(respond.message, 'WARNING') + toastr.warning(respond.message, 'Warning') } } else { - toastr.warning('Failed to sent mail', 'WARNING') + toastr.warning('Failed to sent mail', 'Success') } }, error: function(xhr, status, error) { @@ -835,16 +835,16 @@ } else { let alert_msg = 'Template ID not exist' - toastr.warning(alert_msg, 'WARNING'); + toastr.warning(alert_msg, 'Warning'); } } else { - toastr.warning('Please enter the valid mail', 'WARNING'); + toastr.warning('Please enter the valid mail', 'Warning'); } } else { - toastr.warning('Please enter the valid mail', 'WARNING'); + toastr.warning('Please enter the valid mail', 'Warning'); } } @@ -981,10 +981,10 @@ $('.loader-mask').delay(350).fadeOut('slow'); if (response.status == true) { - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); addHTMLInput(response.data); } else { - toastr.error(response.message, 'ERROR'); + toastr.error(response.message, 'Error'); } }, error: function(xhr, status, error) { @@ -1001,7 +1001,7 @@ console.error('Response Text: ', xhr.responseText); } - toastr.warning('Error uploading file', 'WARNING'); + toastr.warning('Error uploading file', 'Warning'); console.error('Upload error:', error); }, complete: function() { @@ -1033,10 +1033,10 @@ $('.loader-mask').delay(350).fadeOut('slow'); if (res.status == true) { - toastr.success(res.message, 'SUCCESS') + toastr.success(res.message, 'Success') addHTMLInput(res.data); } else { - toastr.warning(res.message, 'WARNING') + toastr.warning(res.message, 'Warning') } }, error: function(xhr, status, error) { @@ -1109,13 +1109,13 @@ console.log('Parsed respond', respond) if (respond.status == 'success') { - toastr.success(respond.message, 'SUCCESS') + toastr.success(respond.message, 'Success') } else { - toastr.warning(respond.message, 'WARNING') + toastr.warning(respond.message, 'Warning') } } else { - toastr.warning('Failed to sent mail', 'WARNING') + toastr.warning('Failed to sent mail', 'Warning') } }, error: function(xhr, status, error) { @@ -1130,16 +1130,16 @@ } else { let alert_msg = 'Template ID not exist' - toastr.warning(alert_msg, 'WARNING'); + toastr.warning(alert_msg, 'Warning'); } } else { - toastr.warning('Please enter the valid mail', 'WARNING'); + toastr.warning('Please enter the valid mail', 'Warning'); } } else { - toastr.warning('Please enter the valid mail', 'WARNING'); + toastr.warning('Please enter the valid mail', 'Warning'); } } @@ -1321,10 +1321,10 @@ $('.loader-mask').delay(350).fadeOut('slow'); if (response.status == true) { - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); addHTMLInput(response.data); } else { - toastr.error(response.message, 'ERROR'); + toastr.error(response.message, 'Error'); } }, error: function(xhr, status, error) { @@ -1341,7 +1341,7 @@ console.error('Response Text: ', xhr.responseText); } - toastr.warning('Error uploading file', 'WARNING'); + toastr.warning('Error uploading file', 'Warning'); console.error('Upload error:', error); }, complete: function() { @@ -1373,10 +1373,10 @@ $('.loader-mask').delay(350).fadeOut('slow'); if (res.status == true) { - toastr.success(res.message, 'SUCCESS') + toastr.success(res.message, 'Success') addHTMLInput(res.data); } else { - toastr.warning(res.message, 'WARNING') + toastr.warning(res.message, 'Warning') } }, error: function(xhr, status, error) { @@ -1687,7 +1687,7 @@ // setTimeout(function() { // $('.loader').fadeOut(); // $('.loader-mask').delay(350).fadeOut('slow'); - // toastr.warning('Something Went Wrong!', 'warning'); + // toastr.warning('Something Went Wrong!', 'Warning'); // }, 1000); // } // }); @@ -1747,7 +1747,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Went Wrong!', 'warning'); + toastr.warning('Something Went Wrong!', 'Warning'); }, 1000); } }); @@ -1807,7 +1807,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Went Wrong!', 'warning'); + toastr.warning('Something Went Wrong!', 'Warning'); }, 1000); } }); @@ -1867,7 +1867,7 @@ // setTimeout(function() { // $('.loader').fadeOut(); // $('.loader-mask').delay(350).fadeOut('slow'); - // toastr.warning('Something Went Wrong!', 'warning'); + // toastr.warning('Something Went Wrong!', 'Warning'); // }, 1000); // } // }); @@ -1928,7 +1928,7 @@ setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Went Wrong!', 'warning'); + toastr.warning('Something Went Wrong!', 'Warning'); }, 1000); } }); @@ -1988,7 +1988,7 @@ // setTimeout(function() { // $('.loader').fadeOut(); // $('.loader-mask').delay(350).fadeOut('slow'); - // toastr.warning('Something Went Wrong!', 'warning'); + // toastr.warning('Something Went Wrong!', 'Warning'); // }, 1000); // } // }); @@ -2082,7 +2082,7 @@ { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); diff --git a/app/Views/policies.php b/app/Views/policies.php index 02f81ef..3e8586e 100755 --- a/app/Views/policies.php +++ b/app/Views/policies.php @@ -266,7 +266,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -315,7 +315,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -385,7 +385,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -420,13 +420,13 @@ function removePolicies(element) { // console.log(res.status == true); if(res){ if (res.status == true) { - toastr.success('Policy removed successfully', 'success'); + toastr.success('Policy removed successfully', 'Success'); // $('#branch_table').empty(); // location.reload(); window.location.href = '' + policy_id_for_reload; } else { - toastr.warning('Failed to remove policy', 'warning'); + toastr.warning('Failed to remove policy', 'Warning'); } } }, @@ -435,7 +435,7 @@ function removePolicies(element) { console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Failed to remove policy', 'warning'); + toastr.warning('Failed to remove policy', 'Warning'); } }); } diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index f1a120d..ee15767 100755 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -1461,7 +1461,7 @@ $('body').on('click', '.btnPolicyMaster', function() { }); } else if (gmc_policy_type_id != 'GPA' && gmc_policy_type_id != 'GMC') { - // toastr.warning('The terms has no data ', 'warning'); + // toastr.warning('The terms has no data ', 'Warning'); } $(document).ready(function() { diff --git a/app/Views/policy_gpa_terms.php b/app/Views/policy_gpa_terms.php index 21e786a..881b473 100755 --- a/app/Views/policy_gpa_terms.php +++ b/app/Views/policy_gpa_terms.php @@ -844,7 +844,7 @@ $('body').on('click', '.btnPolicyMaster', function() { }); } else if (gpa_policy_type_id != 'GPA' && gpa_policy_type_id != 'GMC') { - // toastr.warning("This policy has no policy terms.", 'warning'); + // toastr.warning("This policy has no policy terms.", 'Warning'); } }); diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index 6f2b558..9c755c8 100755 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -255,7 +255,7 @@ $(document).on('submit', 'form[id^="GridForm_"]', function(event) { console.log('checkFamiliFloatersKeysDuplicate', isEqual) if(isEqual){ - toastr.warning('Family floaters alerdey exist', 'warning'); + toastr.warning('Family floaters alerdey exist', 'Warning'); return false; } @@ -671,7 +671,7 @@ $(document).on('change', 'select[id^="grid_"]', function(event) setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -2000,7 +2000,7 @@ function checkDuplicate(unique_id = null) if (siDuplicates) { // highlightDuplicates(duplicateIndices); - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2042,7 +2042,7 @@ function checkDuplicate(unique_id = null) if (siDuplicates) { // highlightDuplicates(duplicateIndices); - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2083,7 +2083,7 @@ function checkDuplicate(unique_id = null) } if (ageDuplicates) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2130,7 +2130,7 @@ function checkDuplicate(unique_id = null) } if (siDuplicates || ageDuplicates) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2170,7 +2170,7 @@ function checkDuplicate(unique_id = null) } if (ageDuplicates) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2216,7 +2216,7 @@ function checkDuplicate(unique_id = null) } if (siDuplicates || ageDuplicates) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2263,7 +2263,7 @@ function checkDuplicate(unique_id = null) } if (siDuplicates || ageDuplicates) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2303,7 +2303,7 @@ function checkDuplicate(unique_id = null) } if (duplicatesFound) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2353,7 +2353,7 @@ function checkDuplicate(unique_id = null) } if (duplicatesFound) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2398,7 +2398,7 @@ function checkDuplicate(unique_id = null) } if (duplicatesFound) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2452,7 +2452,7 @@ function checkDuplicate(unique_id = null) } if (duplicatesFound) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2488,7 +2488,7 @@ function checkDuplicate(unique_id = null) if (siDuplicates) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -2529,7 +2529,7 @@ function checkDuplicate(unique_id = null) if (siDuplicates) { - toastr.warning('Duplicates found!', 'warning'); + toastr.warning('Duplicates found!', 'Warning'); return true; } else { return false; @@ -3147,7 +3147,7 @@ function checkCheckboxes() toastr.warning('You must select at least one checkbox.', 'Warning'); return false; } else if (checkedCount == uncheckedCount) { - toastr.warning('You can not select all of the checkboxes', 'Waraning'); + toastr.warning('You can not select all of the checkboxes', 'Warning'); return false; } return true; @@ -3589,7 +3589,7 @@ function removeTab(input, tabID, tabName) text: res.message, icon: "success" }); - // toastr.success('Policy removed successfully.', 'success'); + // toastr.success('Policy removed successfully.', 'Success'); } else { if(res.rr_count > 0){ Swal.fire({ @@ -3605,7 +3605,7 @@ function removeTab(input, tabID, tabName) }); } - // toastr.warning('Failed to remove policy', 'warning'); + // toastr.warning('Failed to remove policy', 'Warning'); } } }, @@ -3614,7 +3614,7 @@ function removeTab(input, tabID, tabName) console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + console.log('Something Wrong!', 'Warning'); } }); } @@ -3704,7 +3704,7 @@ function renameRackRateTab(input, unique_id = null, tabName = null) $('#rack_rate_name').val(newTabName); - // toastr.success('Policy removed successfully.', 'success'); + // toastr.success('Policy removed successfully.', 'Success'); } else { if(res.rr_count > 0){ Swal.fire({ @@ -3723,7 +3723,7 @@ function renameRackRateTab(input, unique_id = null, tabName = null) } - // toastr.warning('Failed to remove policy', 'warning'); + // toastr.warning('Failed to remove policy', 'Warning'); } } }, @@ -3732,7 +3732,7 @@ function renameRackRateTab(input, unique_id = null, tabName = null) console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + console.log('Something Wrong!', 'Warning'); } }); } @@ -4021,7 +4021,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4049,7 +4049,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4078,7 +4078,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4107,7 +4107,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4137,7 +4137,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4166,7 +4166,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4195,7 +4195,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4224,7 +4224,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4253,7 +4253,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4282,7 +4282,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4311,7 +4311,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4343,7 +4343,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; @@ -4371,7 +4371,7 @@ function checkValideUnits(unique_id = null) console.log('checkValideUnits function uncommonValues', uncommonValues); if (uncommonValues.length > 0) { - toastr.warning('Given unit does not exist in the branch!', 'warning'); + toastr.warning('Given unit does not exist in the branch!', 'Warning'); return true; } else { return false; diff --git a/app/Views/policy_grid_excel.php b/app/Views/policy_grid_excel.php index 6634f35..437bd37 100755 --- a/app/Views/policy_grid_excel.php +++ b/app/Views/policy_grid_excel.php @@ -178,7 +178,7 @@ function copyHeaders(unique_id) { // //console.log('excel_headers[formatType]', typeof excel_headers[formatType]) if (excel_headers[formatType] == undefined) { - toastr.error('Headers not found', 'Warning'); + toastr.warning('Headers not found', 'Warning'); return; } @@ -203,7 +203,7 @@ function copyHeaders(unique_id) { //console.log('headerString', headerString); navigator.clipboard.writeText(headerString).then(function() { - toastr.success('Headers copied to clipboard', 'success'); + toastr.success('Headers copied to clipboard', 'Success'); }, function(err) { toastr.error(err, 'Could not copy headers:'); }); @@ -493,7 +493,7 @@ function generateTable(unique_id) { // console.log(secondKey) if ($('.duplicate').length > 0) { //console.log('test'); - toastr.warning("Duplicates found!", "warning"); + toastr.warning("Duplicates found!", "Warning"); $('.excel_table_class').empty(); $('.excel_textarea').val(''); } diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php index ea3bb0c..ad7eab9 100755 --- a/app/Views/policy_transaction_endorsement_form.php +++ b/app/Views/policy_transaction_endorsement_form.php @@ -599,7 +599,7 @@ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', funct let isAnyChecked = $('input[type="checkbox"][name="co_share_type[]"]:checked').length > 1; if (isAnyChecked) { - toastr.warning('Only one leader can be selected.', 'WARNING!'); + toastr.warning('Only one leader can be selected.', 'Warning!'); $(this).prop('checked', false); } }); @@ -667,7 +667,7 @@ $(document).on('click', '[name="co_share_type[]"]', function() { if(insurer == ""){ - toastr.warning('Please select the insurer.', 'WARNING!'); + toastr.warning('Please select the insurer.', 'Warning!'); $(this).prop('checked', false); }else{ if(client_id && insurer_id){ @@ -1443,7 +1443,7 @@ $('#setInsurerCount').on('input', function() { addInsurerColumn(); } } else { - toastr.warning('Please enter the insurer count', 'WARNING'); + toastr.warning('Please enter the insurer count', 'Warning'); } }); diff --git a/app/Views/policy_transaction_endorsement_list.php b/app/Views/policy_transaction_endorsement_list.php index e790634..25aacb4 100755 --- a/app/Views/policy_transaction_endorsement_list.php +++ b/app/Views/policy_transaction_endorsement_list.php @@ -412,11 +412,11 @@ document.addEventListener("DOMContentLoaded", function () { has('create_success')) : ?> - toastr.success('getFlashdata('create_success') ?>', 'success'); + toastr.success('getFlashdata('create_success') ?>', 'Success'); has('update_success')) : ?> - toastr.success('getFlashdata('update_success') ?>', 'success'); + toastr.success('getFlashdata('update_success') ?>', 'Success'); diff --git a/app/Views/policy_transaction_inception_form.php b/app/Views/policy_transaction_inception_form.php index cfbf43e..da6a34f 100755 --- a/app/Views/policy_transaction_inception_form.php +++ b/app/Views/policy_transaction_inception_form.php @@ -1182,7 +1182,7 @@ $(document).ready(function(){ }else{ - toastr.warning('Please select the Owner type', 'WARNING'); + toastr.warning('Please select the Owner type', 'Warning'); } @@ -1285,7 +1285,7 @@ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', funct let isAnyChecked = $('input[type="checkbox"][name="co_share_type[]"]:checked').length > 1; if (isAnyChecked) { - toastr.warning('Only one leader can be selected.', 'WARNING!'); + toastr.warning('Only one leader can be selected.', 'Warning!'); $(this).prop('checked', false); } }); @@ -1356,7 +1356,7 @@ $(document).on('click', '[name="co_share_type[]"]', function() { // console.log('insurer_id', insurer_id); if(insurer == ""){ - toastr.warning('Please select the insurer.', 'WARNING!'); + toastr.warning('Please select the insurer.', 'Warning!'); $(this).prop('checked', false); }else{ @@ -1426,7 +1426,7 @@ $(document).ready(function() { if(!client_id){ $(this).val('').select2(); - toastr.warning('Please select the Client', 'WARNING'); + toastr.warning('Please select the Client', 'Warning'); } }); @@ -2248,7 +2248,7 @@ function co_share_percentage_calculation(input, extra = null){ }); if (val_sum > 100) { - toastr.warning('Sum of the co-share is greater than 100', 'WARNING'); + toastr.warning('Sum of the co-share is greater than 100', 'Warning'); } // // Find the empty input(s) @@ -2761,7 +2761,7 @@ function addCDAccountNumber(input) if(client_id == '' || insurer_id == ''){ - toastr.warning('Client, Insurer, or both do not exist.', 'WARNING!'); + toastr.warning('Client, Insurer, or both do not exist.', 'Warning!'); $(input).val('') return false; } @@ -2769,7 +2769,7 @@ function addCDAccountNumber(input) if (isAnyLeaderChecked) { if(cop_yes){ $('#cd_ac_no_'+uniqueid).val(''); - toastr.warning('Please select the Leader.', 'WARNING!'); + toastr.warning('Please select the Leader.', 'Warning!'); return false; } } @@ -2777,7 +2777,7 @@ function addCDAccountNumber(input) if(!leader){ if(cop_yes){ $('#cd_ac_no_'+uniqueid).val(''); - toastr.warning('The CD account number not for the Leader.', 'WARNING!'); + toastr.warning('The CD account number not for the Leader.', 'Warning!'); return false; } } @@ -3635,7 +3635,7 @@ $('#policy_no').change(function(){ // if (!leader) { // $(this).val(''); -// toastr.warning('Please select the Leader.', 'WARNING!'); +// toastr.warning('Please select the Leader.', 'Warning!'); // } // }); @@ -3660,7 +3660,7 @@ $('#setInsurerCount').on('click', function() { addInsurerColumn(); // Ensure this function is defined properly // } // } else { - // toastr.warning('Please enter a valid insurer count', 'WARNING'); + // toastr.warning('Please enter a valid insurer count', 'Warning'); // } }); @@ -4477,7 +4477,7 @@ function validateInput(input, table, field){ checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) { if (isDuplicate) { - toastr.warning(message, 'WARNING'); + toastr.warning(message, 'Warning'); $(input).val('') } }); @@ -4549,7 +4549,7 @@ function checkCDAmountForBasePremium(input) { // Validate inputs if (!base_premium || !cd_ac_no) { - toastr.warning('Base premium or CD account number is missing', 'WARNING'); + toastr.warning('Base premium or CD account number is missing', 'Warning'); return; } @@ -4569,16 +4569,16 @@ function checkCDAmountForBasePremium(input) { if (!response.base_premium_greater_than_balance) { console.log('Base premium is less than or equal to CD balance:', 'SUCCESS'); } else { - toastr.warning('Base premium greater than CD Amount', 'WARNING'); + toastr.warning('Base premium greater than CD Amount', 'Warning'); $(input).val("0") } } else { - toastr.error(response.message || 'Unable to fetch data', 'ERROR'); + toastr.error(response.message || 'Unable to fetch data', 'Error'); } }, function(xhr, status, error) { console.error('Error fetching data:', error); console.error(xhr.responseText); - toastr.error('An error occurred while checking the CD amount.', 'ERROR'); + toastr.error('An error occurred while checking the CD amount.', 'Error'); }); } diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index 0db1241..3f59159 100755 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -511,11 +511,11 @@ $(document).ready(function(){ has('create_success')) : ?> - toastr.success('getFlashdata('create_success') ?>', 'success'); + toastr.success('getFlashdata('create_success') ?>', 'Success'); has('update_success')) : ?> - toastr.success('getFlashdata('update_success') ?>', 'success'); + toastr.success('getFlashdata('update_success') ?>', 'Success'); @@ -1210,7 +1210,7 @@ $(document).ready(function(){ myModal.show(); }else{ $('#client_id').val('').change(); - toastr.warning('Please select the client type', 'WARNING') + toastr.warning('Please select the client type', 'Warning') } } @@ -1362,7 +1362,7 @@ $('#cd_ac_no_data').change(function(){ console.log('CD Account Number Responcce', res) if(res.status == true){ - toastr.warning(res.message, 'warning'); + toastr.warning(res.message, 'Warning'); $('#cd_ac_no_data').val(''); } }, @@ -1647,10 +1647,10 @@ function removePolicyTransaction(input, pt_id) { console.log('Data fetched successfully:', response); if (response.status === true) { - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); window.location.reload(); } else { - toastr.warning(response.message, 'WARNING'); + toastr.warning(response.message, 'Warning'); } }, function(xhr, status, error) { console.error('Error fetching data:', error); diff --git a/app/Views/policy_type_basic_info.php b/app/Views/policy_type_basic_info.php index b42ec43..43e22ff 100755 --- a/app/Views/policy_type_basic_info.php +++ b/app/Views/policy_type_basic_info.php @@ -108,7 +108,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); diff --git a/app/Views/policy_type_list.php b/app/Views/policy_type_list.php index 592b234..1d7750c 100755 --- a/app/Views/policy_type_list.php +++ b/app/Views/policy_type_list.php @@ -315,10 +315,10 @@ function removePolciyType(element) { // console.log(res.status == true); if(res){ if (res.status == true) { - toastr.success('Policy type removed successfully', 'success'); + toastr.success('Policy type removed successfully', 'Success'); location.reload(); } else { - toastr.warning('Failed to remove policy type', 'warning'); + toastr.warning('Failed to remove policy type', 'Warning'); } } }, @@ -327,7 +327,7 @@ function removePolciyType(element) { console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Failed to remove policy type', 'warning'); + toastr.warning('Failed to remove policy type', 'Warning'); } }); } diff --git a/app/Views/policy_type_onboarding.php b/app/Views/policy_type_onboarding.php index 04e867e..9b9dc7c 100755 --- a/app/Views/policy_type_onboarding.php +++ b/app/Views/policy_type_onboarding.php @@ -74,7 +74,7 @@ body { if(check_policy_type_id[0].value == '' || check_policy_type_id[0].value == null || check_policy_type_id[0].value == 0){ $('#btnBranchAdd').hide(); - toastr.warning('First Add the Policy Type!', 'warning',{timeOut: 2000}); + toastr.warning('First Add the Policy Type!', 'Warning',{timeOut: 2000}); }else{ if ($('#btnBranchBack')[0].style.display == 'none') { $('#btnBranchAdd').show(); diff --git a/app/Views/rack_rate_auto_si.php b/app/Views/rack_rate_auto_si.php index 37b9f43..5c256a1 100755 --- a/app/Views/rack_rate_auto_si.php +++ b/app/Views/rack_rate_auto_si.php @@ -195,18 +195,18 @@ $(document).ready(function() { if (response.status) { if (response.status == true) { - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); } else { - toastr.warning(response.message, 'WARNING'); + toastr.warning(response.message, 'Warning'); } } else { - toastr.error(response.message || 'Unable to get responce', 'ERROR'); + toastr.error(response.message || 'Unable to get responce', 'Error'); } }, error: function(xhr, status, error) { console.error('Error fetching data:', error); console.error(xhr.responseText); - toastr.error('An error occurred while Auto SI Form Submit.', 'ERROR'); + toastr.error('An error occurred while Auto SI Form Submit.', 'Error'); }, }); }); @@ -296,7 +296,7 @@ function getRackRateSIAmountAndAutoSiDataForAutoSI(client_policy_id) { icon: 'warning', }) } else { - toastr.error(response.message || 'Unable to fetch data', 'ERROR'); + toastr.error(response.message || 'Unable to fetch data', 'Error'); addRow(); } } @@ -307,7 +307,7 @@ function getRackRateSIAmountAndAutoSiDataForAutoSI(client_policy_id) { }, function(xhr, status, error) { console.error('Error fetching data:', error); console.error(xhr.responseText); - toastr.error('An error occurred while checking the SI amount.', 'ERROR'); + toastr.error('An error occurred while checking the SI amount.', 'Error'); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); diff --git a/app/Views/report_bds.php b/app/Views/report_bds.php index 3fa60b7..be86cba 100755 --- a/app/Views/report_bds.php +++ b/app/Views/report_bds.php @@ -234,7 +234,7 @@ function getCoShareStatementDetails(pt_id){ appendTableData(response.data) } else { - toastr.warning(response.message, 'WARNING'); + toastr.warning(response.message, 'Warning'); } }, function(xhr, status, error) { console.error('Error fetching data:', error); diff --git a/app/Views/report_bds_filter.php b/app/Views/report_bds_filter.php index 373ef98..e71666b 100755 --- a/app/Views/report_bds_filter.php +++ b/app/Views/report_bds_filter.php @@ -522,7 +522,7 @@ function getClientPolicyDataBasedOnClientAndInsuer(){ appendPolicies(response.data) } else { - toastr.warning(response.message, 'WARNING'); + toastr.warning(response.message, 'Warning'); } }, function(xhr, status, error) { console.error('Error fetching data:', error); diff --git a/app/Views/test_members_list.php b/app/Views/test_members_list.php index 80e0625..57858e5 100755 --- a/app/Views/test_members_list.php +++ b/app/Views/test_members_list.php @@ -609,7 +609,7 @@ document.addEventListener("DOMContentLoaded", function () { $('#email_corporate').val(''); $('#mobile').val(''); - toastr.warning(res.message, 'WARNING'); + toastr.warning(res.message, 'Warning'); } }, error: function (xhr, status, error) { @@ -656,7 +656,7 @@ document.addEventListener("DOMContentLoaded", function () { $('.loader-mask').delay(350).fadeOut('slow'); if(response.status == true){ - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); $('.close').click(); @@ -671,7 +671,7 @@ document.addEventListener("DOMContentLoaded", function () { window.location.reload(); }else{ - toastr.error(response.message, 'ERROR'); + toastr.error(response.message, 'Error'); } }, error: function(xhr, status, error) { @@ -688,7 +688,7 @@ document.addEventListener("DOMContentLoaded", function () { console.error('Response Text: ', xhr.responseText); } - toastr.warning('Error uploading file', 'WARNING'); + toastr.warning('Error uploading file', 'Warning'); console.error('Upload error:', error); }, complete: function() { @@ -729,9 +729,9 @@ document.addEventListener("DOMContentLoaded", function () { // $('.loader-mask').delay(350).fadeOut('slow'); // if(res.status == true){ - // toastr.success(res.message, 'SUCCESS'); + // toastr.success(res.message, 'Success'); // }else{ - // toastr.error(res.message, 'ERROR'); + // toastr.error(res.message, 'Error'); // } // }, // error: function (xhr, status, error) { @@ -754,7 +754,7 @@ document.addEventListener("DOMContentLoaded", function () { }) if(selected.length == 0){ - toastr.warning('Please select atleast one employee', 'WARNING'); + toastr.warning('Please select atleast one employee', 'Warning'); return; } $('#employee_ids').val(selected); @@ -1033,12 +1033,12 @@ for (let i = 0; i < selected_count.length; i++) { if (response.code === 200) { console.log(`Iteration ${i}: Success - ${response.message}`); } else { - toastr.error(response.message, 'ERROR'); + toastr.error(response.message, 'Error'); } }, error: function(xhr, status, error) { console.error('AJAX Error:', error); - toastr.error('An error occurred. Please try again.', 'ERROR'); + toastr.error('An error occurred. Please try again.', 'Error'); }, complete: function() { // Increment the completed requests counter @@ -1046,7 +1046,7 @@ for (let i = 0; i < selected_count.length; i++) { // Check if all AJAX requests have completed if (completedRequests === selected_count.length) { - toastr.success('All employees have been successfully mapped.', 'SUCCESS'); + toastr.success('All employees have been successfully mapped.', 'Success'); $('#map_emp_modal').modal('hide'); window.location.reload(); } @@ -1063,7 +1063,7 @@ function unmapEmployees(){ }) if(selected.length == 0){ - toastr.warning('Please select atleast one employee', 'WARNING'); + toastr.warning('Please select atleast one employee', 'Warning'); return; } @@ -1108,10 +1108,10 @@ function unmapEmployees(){ $('.loader-mask').delay(350).fadeOut('slow'); if (res.status === true) { - toastr.success(res.message, 'SUCCESS'); + toastr.success(res.message, 'Success'); window.location.reload(); } else { - toastr.error(res.message, 'ERROR'); + toastr.error(res.message, 'Error'); } }, error: function (xhr, status, error) { diff --git a/app/Views/tpa_branch.php b/app/Views/tpa_branch.php index 1f850f6..4cbf226 100755 --- a/app/Views/tpa_branch.php +++ b/app/Views/tpa_branch.php @@ -282,7 +282,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -341,7 +341,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -387,7 +387,7 @@ $(document).ready(function () { setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Something Wrong!', 'warning'); + toastr.warning('Something Wrong!', 'Warning'); }, 1000); } }); @@ -547,7 +547,7 @@ function removeTPABranch(element) { toastr.success('TPA branch removed successfully', 'success'); location.reload(); } else { - toastr.warning('Failed to remove TPA branch', 'warning'); + toastr.warning('Failed to remove TPA branch', 'Warning'); } } }, @@ -556,7 +556,7 @@ function removeTPABranch(element) { console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Failed to remove TPA branch', 'warning'); + toastr.warning('Failed to remove TPA branch', 'Warning'); } }); } diff --git a/app/Views/tpa_list.php b/app/Views/tpa_list.php index 8c86278..74a1135 100755 --- a/app/Views/tpa_list.php +++ b/app/Views/tpa_list.php @@ -271,10 +271,10 @@ function removeTPA(element) { // console.log(res.status == true); if(res){ if (res.status == true) { - toastr.success('TPA removed successfully', 'success'); + toastr.success('TPA removed successfully', 'Success'); location.reload(); } else { - toastr.warning('Failed to remove TPA', 'warning'); + toastr.warning('Failed to remove TPA', 'Warning'); } } }, @@ -283,7 +283,7 @@ function removeTPA(element) { console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - toastr.warning('Failed to remove TPA', 'warning'); + toastr.warning('Failed to remove TPA', 'Warning'); } }); } diff --git a/app/Views/tpa_onboarding.php b/app/Views/tpa_onboarding.php index 2d6196a..33f71b0 100755 --- a/app/Views/tpa_onboarding.php +++ b/app/Views/tpa_onboarding.php @@ -74,7 +74,7 @@ body { if(check_tpa_id[0].value == '' || check_tpa_id[0].value == null || check_tpa_id[0].value == 0){ $('#btnBranchAdd').hide(); - toastr.warning('First Add the TPA!', 'warning',{timeOut: 2000}); + toastr.warning('First Add the TPA!', 'Warning',{timeOut: 2000}); }else{ if ($('#btnBranchBack')[0].style.display == 'none') { $('#btnBranchAdd').show(); diff --git a/app/Views/variance_report_list.php b/app/Views/variance_report_list.php index 0738733..f8004b1 100755 --- a/app/Views/variance_report_list.php +++ b/app/Views/variance_report_list.php @@ -663,7 +663,7 @@ function getClientPolicyDataBasedOnClientAndInsuer(){ appendPolicies(response.data) } else { - toastr.warning(response.message, 'WARNING'); + toastr.warning(response.message, 'Warning'); } }, function(xhr, status, error) { console.error('Error fetching data:', error); diff --git a/app/Views/vehicle_details.php b/app/Views/vehicle_details.php index df98d9d..05ad87c 100755 --- a/app/Views/vehicle_details.php +++ b/app/Views/vehicle_details.php @@ -386,7 +386,7 @@ $('#cost_center').change(function() { console.log(res) if (res.status == true) { - toastr.warning(res.message, 'warning'); + toastr.warning(res.message, 'Warning'); $('#cost_center').val(''); } }, diff --git a/app/Views/vehicle_master_list.php b/app/Views/vehicle_master_list.php index f28ef11..e979e34 100755 --- a/app/Views/vehicle_master_list.php +++ b/app/Views/vehicle_master_list.php @@ -577,10 +577,10 @@ function removeVehicleMasterData(element) { // console.log(res.status == true); if (res) { if (res.status == true) { - toastr.success('Vehicle Data removed successfully.', 'success'); + toastr.success('Vehicle Data removed successfully.', 'Success'); location.reload(); } else { - toastr.warning('Failed to remove Vehicle Data.', 'warning'); + toastr.warning('Failed to remove Vehicle Data.', 'Warning'); } } }, @@ -589,7 +589,7 @@ function removeVehicleMasterData(element) { console.error(status, error); $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); - console.log('Something Wrong!', 'warning'); + console.log('Something Wrong!', 'Warning'); } }); } diff --git a/app/Views/view_rfq.php b/app/Views/view_rfq.php index ddcbc1b..9f04a0c 100755 --- a/app/Views/view_rfq.php +++ b/app/Views/view_rfq.php @@ -3549,12 +3549,12 @@ function ajaxRequest(formData) { console.log(res); if (res.status == 'success' && res.code == 200) { - toastr.success('Mail send Successfully', 'SUCCESS') + toastr.success('Mail send Successfully', 'Success') } else { if (res.messgae) { - toastr.error(res.messgae, 'ERROR') + toastr.error(res.messgae, 'Error') } else { - toastr.error('Mail send failed', 'ERROR') + toastr.error('Mail send failed', 'Error') } } @@ -3611,7 +3611,7 @@ function getInsurerBranchContacts(input){ $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); if(res.status == false){ - toastr.warning(res.message, 'WARNING') + toastr.warning(res.message, 'Warning') }else{ appendInsurerContact(res.data) } @@ -3770,7 +3770,7 @@ function getMailContent(id){ console.log(response); $('#'+id).val(response.data) } else { - toastr.error(response.message || 'Unable to fetch data', 'ERROR'); + toastr.error(response.message || 'Unable to fetch data', 'Error'); } }, function(xhr, status, error) { console.error('Error fetching data:', error); @@ -5157,9 +5157,9 @@ function autoCaluculationForPremiumChildTable(input) { console.log('Data sent successfully:', response); if (response.status == true) { - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); } else { - toastr.warning(response.message, 'WARNING'); + toastr.warning(response.message, 'Warning'); } window.location.reload(); @@ -5228,9 +5228,9 @@ function autoCaluculationForPremiumChildTable(input) { console.log('Data sent successfully:', response); if (response.status == true) { - toastr.success(response.message, 'SUCCESS'); + toastr.success(response.message, 'Success'); } else { - toastr.warning(response.message, 'WARNING'); + toastr.warning(response.message, 'Warning'); } window.location.href = '' + lead_id + '/' + 2; From 28bb7728dc64014f4c91122386c094d6a9d29fe3 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 19 Feb 2026 10:42:04 +0530 Subject: [PATCH 06/13] FIX_CLIENT_DATA_FETCHING --- app/Controllers/EmployeeRestController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 01492da..16dfc91 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2190,14 +2190,14 @@ class EmployeeRestController extends AdminController if (!empty($pre_client_id)) { - $client = $this->clientModel->where('md5(id)', $pre_client_id)->first(); + $client = $this->clientModel->where('id', $pre_client_id)->first(); if ($client) { $client['client_logo'] = base_url() . 'public/uploads/logo/' . $client['client_logo']; $clientPolicy = $this->clientPolicyModel - ->where('md5(client_id)', $pre_client_id) + ->where('client_id', $pre_client_id) ->where('client_branch_id', $pre_branch_id) ->findAll(); From 1a7b92befb2b23a3089e839b9488718d7858e77b Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Thu, 19 Feb 2026 11:14:25 +0530 Subject: [PATCH 07/13] FIX_CLIENT_DETAILS --- app/Controllers/EmployeeRestController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 16dfc91..c5d99b3 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -2189,15 +2189,19 @@ class EmployeeRestController extends AdminController if (!empty($pre_client_id)) { + if (is_string($pre_client_id) && preg_match('/^[a-f0-9]{32}$/i', $pre_client_id)) { + $client = $this->clientModel->where('MD5(id)', $pre_client_id)->first(); + }else{ + $client = $this->clientModel->where('id', $pre_client_id)->first(); + } - $client = $this->clientModel->where('id', $pre_client_id)->first(); if ($client) { $client['client_logo'] = base_url() . 'public/uploads/logo/' . $client['client_logo']; $clientPolicy = $this->clientPolicyModel - ->where('client_id', $pre_client_id) + ->where('client_id', $client['id'] ?? null) ->where('client_branch_id', $pre_branch_id) ->findAll(); From 1986cf45da89dc02eff2f4746b93c817142fbc19 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Sat, 21 Feb 2026 09:49:39 +0530 Subject: [PATCH 08/13] CHANGE_ERROR_MESSAGE --- app/Controllers/EmployeeController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 0f40f94..b3718c0 100755 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -410,9 +410,9 @@ class EmployeeController extends AdminController //endof validation process if (isset($result['error_summary']) && count($result['error_summary'])) { if(!$is_post_request){ - return ['status' => false, 'message' => 'file rejected with errors', 'file_id' => $file_id]; + return ['status' => false, 'message' => 'File rejected with errors', 'file_id' => $file_id]; }else{ - return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'file rejected with errors'], 200); + return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'File rejected with errors'], 200); } } } else //if file size greater than 1 add the file as job From 9b34d98aedeb74428da08c6cf1c464bd7016566f Mon Sep 17 00:00:00 2001 From: velz Date: Sat, 21 Feb 2026 11:48:43 +0530 Subject: [PATCH 09/13] FEAT_API_RATE_LIMITER --- app/Config/Filters.php | 4 + app/Config/RateLimiter.php | 89 +++++++++++++++ app/Filters/AuthApiRateLimitFilter.php | 141 +++++++++++++++++++++++ app/Filters/JwtApiRateLimitFilter.php | 151 +++++++++++++++++++++++++ 4 files changed, 385 insertions(+) create mode 100644 app/Config/RateLimiter.php create mode 100644 app/Filters/AuthApiRateLimitFilter.php create mode 100644 app/Filters/JwtApiRateLimitFilter.php diff --git a/app/Config/Filters.php b/app/Config/Filters.php index 0042bda..a602f87 100755 --- a/app/Config/Filters.php +++ b/app/Config/Filters.php @@ -20,6 +20,8 @@ use App\Filters\GlobalPostFileUploadGuard; use App\Filters\SecurityInputFilter; use App\Filters\AclFilter; use App\Filters\RateLimitFilter; +use App\Filters\JwtApiRateLimitFilter; +use App\Filters\AuthApiRateLimitFilter; @@ -49,6 +51,8 @@ class Filters extends BaseConfig 'SecurityInputFilter' => SecurityInputFilter::class, 'AclFilter' => AclFilter::class, 'ratelimit' => RateLimitFilter::class, + 'AuthApiRateLimitFilter' => AuthApiRateLimitFilter::class, + 'JwtApiRateLimitFilter' => JwtApiRateLimitFilter::class, ]; diff --git a/app/Config/RateLimiter.php b/app/Config/RateLimiter.php new file mode 100644 index 0000000..99d8b60 --- /dev/null +++ b/app/Config/RateLimiter.php @@ -0,0 +1,89 @@ + 60, // max requests + 'window' => 60, // window in seconds + 'violation_soft' => 3, // violations before soft block + ]; + + /* + |-------------------------------------------------------------------------- + | Auth API Routes (verifyMobile, verifyOTP, etc.) + |-------------------------------------------------------------------------- + */ + public array $authApi = [ + 'limit' => 10, // max requests per window + 'window' => 180, // window in seconds (3 min) + 'violation_soft' => 3, // failed attempts before soft block + ]; + + /* + |-------------------------------------------------------------------------- + | User-Level Progressive Block Durations (seconds) + | 0 = permanent until manual unblock + |-------------------------------------------------------------------------- + */ + public array $userBlock = [ + 'soft_duration' => 0, // permanent, manual unblock only + 'medium_duration' => 7200, // 2 hours + 'hard_duration' => 86400, // 24 hours + // attempts while at a block level before escalating to next + 'medium_trigger' => 1, // attempts during soft → medium + 'hard_trigger' => 1, // attempts during medium → hard + ]; + + /* + |-------------------------------------------------------------------------- + | IP-Level Throttle & Progressive Block (independent of user) + |-------------------------------------------------------------------------- + */ + public array $ipBlock = [ + 'limit' => 120, // max requests per window + 'window' => 60, // window in seconds + 'violation_soft' => 5, // violations before soft block + 'soft_duration' => 0, // permanent, manual unblock only + 'medium_duration' => 7200, // 2 hours + 'hard_duration' => 86400, // 24 hours + 'medium_trigger' => 1, // attempts during soft → medium + 'hard_trigger' => 1, // attempts during medium → hard + ]; + + /* + |-------------------------------------------------------------------------- + | Cache Key Prefixes + |-------------------------------------------------------------------------- + */ + public array $cacheKeys = [ + 'ip_count' => 'rl_ip_count_', + 'ip_violations' => 'rl_ip_viol_', + 'ip_block' => 'rl_ip_block_', + 'ip_block_hits' => 'rl_ip_blkhit_', + 'user_count' => 'rl_usr_count_', + 'user_violations' => 'rl_usr_viol_', + 'user_block' => 'rl_usr_block_', + 'user_block_hits' => 'rl_usr_blkhit_', + ]; + + /* + |-------------------------------------------------------------------------- + | HTTP Status Codes per block level + |-------------------------------------------------------------------------- + */ + public array $statusCodes = [ + 'throttle' => 429, + 'soft' => 429, + 'medium' => 403, + 'hard' => 451, + ]; +} diff --git a/app/Filters/AuthApiRateLimitFilter.php b/app/Filters/AuthApiRateLimitFilter.php new file mode 100644 index 0000000..3dc0db2 --- /dev/null +++ b/app/Filters/AuthApiRateLimitFilter.php @@ -0,0 +1,141 @@ +post('api/auth/verify-otp', 'AuthController::verifyOtp', ['filter' => 'authApiRateLimit']); + * + * Register in app/Config/Filters.php: + * 'AuthApiRateLimitFilter' => \App\Filters\AuthApiRateLimitFilter::class + */ +class AuthApiRateLimitFilter implements FilterInterface +{ + protected RateLimiterService $limiter; + + public function __construct() + { + $this->limiter = new RateLimiterService(); + } + + // ------------------------------------------------------------------------- + // BEFORE — runs before the controller + // ------------------------------------------------------------------------- + + public function before(RequestInterface $request, $arguments = null) + { + $fingerprint = generateFingerprint(); + + // 1. IP-level check + $ipResult = $this->limiter->checkIp($fingerprint, 'authApi'); + if ($ipResult) { + return $this->jsonResponse($ipResult); + } + + // 2. User-level block check (identity may not be present yet on first hit) + $identity = $this->resolveIdentity($request); + if ($identity) { + $userResult = $this->limiter->checkUser($identity); + if ($userResult) { + return $this->jsonResponse($userResult); + } + } + + // Store resolved identity in request for use in after() + if ($identity) { + $request->setGlobal('rateLimitIdentity', $identity); + } + $request->setGlobal('rateLimitFingerprint', $fingerprint); + + return null; // pass through + } + + // ------------------------------------------------------------------------- + // AFTER — runs after the controller; records failures on bad responses + // ------------------------------------------------------------------------- + + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) + { + // Only act on failed responses (4xx from auth failures) + $statusCode = $response->getStatusCode(); + if ($statusCode < 400 || $statusCode === 429 || $statusCode === 403 || $statusCode === 451) { + return; // 2xx/3xx = success; 429/403/451 already handled + } + + $fingerprint = $request->getGlobal('rateLimitFingerprint') ?? generateFingerprint(); + $identity = $request->getGlobal('rateLimitIdentity') + ?? $this->resolveIdentity($request); + + // Record failure at IP level + $this->limiter->recordIpFailure($fingerprint); + + // Record failure at user level + if ($identity) { + $this->limiter->recordUserFailure($identity, 'authApi'); + } + } + + // ------------------------------------------------------------------------- + // HELPERS + // ------------------------------------------------------------------------- + + /** + * Extract identity from POST body or GET params. + * Looks for 'email' or 'mobile_number'. + */ + protected function resolveIdentity(RequestInterface $request): ?string + { + // Try POST body first + $email = $request->getPost('email'); + $mobile = $request->getPost('mobile_number'); + + // Fallback to GET params + if (! $email && ! $mobile) { + $email = $request->getGet('email'); + $mobile = $request->getGet('mobile_number'); + } + + if ($email) { + return strtolower(trim($email)); + } + + if ($mobile) { + return trim($mobile); + } + + return null; + } + + /** + * Build and return a JSON response for blocked/throttled requests. + */ + protected function jsonResponse(array $result): ResponseInterface + { + $response = service('response'); + $response->setStatusCode($result['status']); + $response->setContentType('application/json'); + $response->setBody(json_encode([ + 'success' => false, + 'error' => [ + 'code' => strtoupper('RATE_LIMIT_' . $result['level']), + 'message' => $result['message'], + 'type' => $result['type'] ?? 'request', + ], + ])); + return $response; + } +} diff --git a/app/Filters/JwtApiRateLimitFilter.php b/app/Filters/JwtApiRateLimitFilter.php new file mode 100644 index 0000000..2c887b6 --- /dev/null +++ b/app/Filters/JwtApiRateLimitFilter.php @@ -0,0 +1,151 @@ +get('api/profile', 'ProfileController::index', ['filter' => 'jwtApiRateLimit']); + * + * Register in app/Config/Filters.php: + * 'JwtApiRateLimitFilter' => \App\Filters\JwtApiRateLimitFilter::class + */ +class JwtApiRateLimitFilter implements FilterInterface +{ + protected RateLimiterService $limiter; + + public function __construct() + { + $this->limiter = new RateLimiterService(); + } + + // ------------------------------------------------------------------------- + // BEFORE — runs before the controller + // ------------------------------------------------------------------------- + + public function before(RequestInterface $request, $arguments = null) + { + $fingerprint = generateFingerprint(); + + // 1. IP-level throttle + block check + $ipResult = $this->limiter->checkIp($fingerprint, 'jwtApi'); + if ($ipResult) { + return $this->jsonResponse($ipResult); + } + + // 2. Resolve user identity from JWT + // Uses your existing JWT helper functions. + // If neither returns a value, fall back to IP-only limiting. + $identity = $this->resolveIdentityFromJwt(); + + if ($identity) { + // User-level throttle (request count based for JWT routes) + $userResult = $this->limiter->checkUserThrottle($identity, 'jwtApi'); + if ($userResult) { + return $this->jsonResponse($userResult); + } + } + + // Stash for after() use + $request->setGlobal('rateLimitFingerprint', $fingerprint); + if ($identity) { + $request->setGlobal('rateLimitIdentity', $identity); + } + + return null; // pass through + } + + // ------------------------------------------------------------------------- + // AFTER — records IP failure on controller-level bad responses + // ------------------------------------------------------------------------- + + public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) + { + $statusCode = $response->getStatusCode(); + + // Only act on auth-related failures from the controller (401, 422, etc.) + // 429/403/451 are already handled by before(); skip 2xx/3xx. + if ($statusCode < 400 || in_array($statusCode, [429, 403, 451])) { + return; + } + + $fingerprint = $request->getGlobal('rateLimitFingerprint') ?? generateFingerprint(); + $identity = $request->getGlobal('rateLimitIdentity') ?? $this->resolveIdentityFromJwt(); + + $this->limiter->recordIpFailure($fingerprint); + + if ($identity) { + $this->limiter->recordUserFailure($identity, 'jwtApi'); + } + } + + // ------------------------------------------------------------------------- + // HELPERS + // ------------------------------------------------------------------------- + + /** + * Resolve user identity from JWT using your existing helper functions. + * Tries email first, then mobile. Returns null if JWT is absent/invalid. + * + * IMPORTANT: Replace getEmailFromJWT() / getMobileFromJWT() with your + * actual function names if they differ. + */ + protected function resolveIdentityFromJwt(): ?string + { + try { + // Try email from JWT + if (function_exists('getEmailFromJWT')) { + $email = getEmailFromJWT(); + if ($email) { + return strtolower(trim($email)); + } + } + + // Try mobile from JWT + if (function_exists('getMobileFromJWT')) { + $mobile = getMobileFromJWT(); + if ($mobile) { + return trim($mobile); + } + } + } catch (\Throwable $e) { + // JWT invalid or expired — fall through to IP-only limiting + log_message('debug', '[RateLimiter] JWT identity resolution failed: ' . $e->getMessage()); + } + + return null; + } + + /** + * Build and return a JSON response for blocked/throttled requests. + */ + protected function jsonResponse(array $result): ResponseInterface + { + $response = service('response'); + $response->setStatusCode($result['status']); + $response->setContentType('application/json'); + $response->setBody(json_encode([ + 'success' => false, + 'error' => [ + 'code' => strtoupper('RATE_LIMIT_' . $result['level']), + 'message' => $result['message'], + 'type' => $result['type'] ?? 'request', + ], + ])); + return $response; + } +} From c520b87af5b5cb9ba4bb96ec6417a0d947db5666 Mon Sep 17 00:00:00 2001 From: velz Date: Mon, 23 Feb 2026 15:46:05 +0530 Subject: [PATCH 10/13] FEAT_API_RATE_LIMIT_COND --- app/Config/Routes.php | 4 +- app/Config/Services.php | 10 + .../RestAuthenticationController.php | 6 + app/Filters/AuthApiRateLimitFilter.php | 61 ++- app/Filters/JwtApiRateLimitFilter.php | 8 +- app/Helpers/HttpRequestHelper.php | 1 + app/Helpers/utility_helper.php | 103 ++++- app/Libraries/RateLimiterService.php | 385 ++++++++++++++++++ 8 files changed, 528 insertions(+), 50 deletions(-) create mode 100644 app/Libraries/RateLimiterService.php diff --git a/app/Config/Routes.php b/app/Config/Routes.php index a0eb3e0..cb4c782 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -454,7 +454,7 @@ $routes->group("/api", ["filter" => [ 'ratelimit' , 'authJWT' ] ], function ($r // $routes->post("employeeRest/createOrUpdateEmployeePolicySiAmount", "EmployeeRestController::createOrUpdateEmployeePolicySiAmount"); // $routes->post("employeeRest/calculatePremium", "EmployeeRestController::calculatePremium"); // $routes->post("updateMpin", "RestAuthenticationController::updateMpin"); -$routes->group("employeeRest", ['filter' => [ 'GlobalPostFileUploadGuard', 'ratelimit' , 'appSignature' , 'authJWT' ] ], function ($routes) { +$routes->group("employeeRest", ['filter' => [ 'GlobalPostFileUploadGuard', 'appSignature' , 'authJWT','JwtApiRateLimitFilter' ] ], function ($routes) { $routes->post('logout', 'RestAuthenticationController::logout'); @@ -507,7 +507,7 @@ $routes->group("employeeRest", ['filter' => [ 'GlobalPostFileUploadGuard', 'rate }); -$routes->group("employeeRest", ['filter' => ['ratelimit' , 'appSignature'] ], function ($routes) { +$routes->group("employeeRest", ['filter' => ['appSignature','AuthApiRateLimitFilter'] ], function ($routes) { //Employee login api's $routes->post("verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber"); diff --git a/app/Config/Services.php b/app/Config/Services.php index fab85a5..d37961a 100755 --- a/app/Config/Services.php +++ b/app/Config/Services.php @@ -8,6 +8,7 @@ use App\Libraries\MyLogger; use App\Libraries\GmailAPI; use App\Libraries\MyGoogleDrive; use App\Libraries\DataServiceSqlite; +use App\Libraries\RateLimiterService; use App\Controllers\Home; /** @@ -80,5 +81,14 @@ class Services extends BaseService return new MyGoogleDrive(); } + + public static function limiter($getShared = true) + { + if ($getShared) { + return static::getSharedInstance('limiter'); + } + + return new RateLimiterService(); + } } diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index b15d191..e29c0a7 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -142,6 +142,7 @@ class RestAuthenticationController extends AdminController log_message('error', ' '); log_message('error', '************************ PRE END ********************************'); $result = ['user_verification' => false , 'message' => "User not found"]; + recordRateLimitFailure(); return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200); } @@ -320,6 +321,7 @@ class RestAuthenticationController extends AdminController } $result = ['user_verification' => false , 'message' => "User not found"]; + recordRateLimitFailure(); return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200); } @@ -445,10 +447,12 @@ class RestAuthenticationController extends AdminController $otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null; if(empty($otp)){ + recordRateLimitFailure(); return $this->respond(['status' => 'OTP is required','code' => 400,'message' => 'OTP is required'], 200); } if (empty($mobile_number) && empty($email_id)) { + recordRateLimitFailure(); return $this->respond(['status' => 'failed','code' => 400,'message' => 'Mobile number or Email ID is required'], 200); } @@ -472,9 +476,11 @@ class RestAuthenticationController extends AdminController // Call the third-party API function $apiResponse = $this->callThirdPartyAPI($retailApiParams, 'getVerifiedRetailUserData'); // print_r($apiResponse); die; + recordRateLimitFailure(); return $this->respond(['status' => 'failed', 'code' => 200, 'data' => [], 'post_enrollment' => json_decode($apiResponse, true)], 200); } + recordRateLimitFailure(); return $this->respond(['status' => 'Invalid OTP','code' => 404,'data' => "", 'message' => "Invalid OTP"],200); } diff --git a/app/Filters/AuthApiRateLimitFilter.php b/app/Filters/AuthApiRateLimitFilter.php index 3dc0db2..29ce42f 100644 --- a/app/Filters/AuthApiRateLimitFilter.php +++ b/app/Filters/AuthApiRateLimitFilter.php @@ -38,8 +38,9 @@ class AuthApiRateLimitFilter implements FilterInterface public function before(RequestInterface $request, $arguments = null) { + // $this->limiter->unblockUser('9698262411');die; $fingerprint = generateFingerprint(); - + // echo $fingerprint;die; // 1. IP-level check $ipResult = $this->limiter->checkIp($fingerprint, 'authApi'); if ($ipResult) { @@ -47,7 +48,8 @@ class AuthApiRateLimitFilter implements FilterInterface } // 2. User-level block check (identity may not be present yet on first hit) - $identity = $this->resolveIdentity($request); + $identity = resolveIdentity($request); + // echo $identity;die; if ($identity) { $userResult = $this->limiter->checkUser($identity); if ($userResult) { @@ -70,15 +72,33 @@ class AuthApiRateLimitFilter implements FilterInterface public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { + + // Routes where rate-limit failure should be recorded + // $allowedRoutes = [ + // 'employeeRest/verifyEmployeeNumber', + // 'employeeRest/getVerifiedUserData', + // 'employeeRest/verifyEmployeeEmailId', + // 'employeeRest/verifyHrWithMobileNumber', + // 'employeeRest/verifyHrWithEmail', + // 'employeeRest/verifyHrWithEmail', + // 'employeeRest/getVerifiedHrData', + // ]; + + // $currentPath = service('request')->getPath(); + // if (!in_array($currentPath, $allowedRoutes)) { + // return; // Don't record failures for unrelated routes + // } + // Only act on failed responses (4xx from auth failures) $statusCode = $response->getStatusCode(); + // print_r($response);die(); if ($statusCode < 400 || $statusCode === 429 || $statusCode === 403 || $statusCode === 451) { return; // 2xx/3xx = success; 429/403/451 already handled } - $fingerprint = $request->getGlobal('rateLimitFingerprint') ?? generateFingerprint(); - $identity = $request->getGlobal('rateLimitIdentity') - ?? $this->resolveIdentity($request); + $fingerprint = $request->getVar('rateLimitFingerprint') ?? generateFingerprint(); + $identity = $request->getVar('rateLimitIdentity') + ?? resolveIdentity($request); // Record failure at IP level $this->limiter->recordIpFailure($fingerprint); @@ -89,37 +109,6 @@ class AuthApiRateLimitFilter implements FilterInterface } } - // ------------------------------------------------------------------------- - // HELPERS - // ------------------------------------------------------------------------- - - /** - * Extract identity from POST body or GET params. - * Looks for 'email' or 'mobile_number'. - */ - protected function resolveIdentity(RequestInterface $request): ?string - { - // Try POST body first - $email = $request->getPost('email'); - $mobile = $request->getPost('mobile_number'); - - // Fallback to GET params - if (! $email && ! $mobile) { - $email = $request->getGet('email'); - $mobile = $request->getGet('mobile_number'); - } - - if ($email) { - return strtolower(trim($email)); - } - - if ($mobile) { - return trim($mobile); - } - - return null; - } - /** * Build and return a JSON response for blocked/throttled requests. */ diff --git a/app/Filters/JwtApiRateLimitFilter.php b/app/Filters/JwtApiRateLimitFilter.php index 2c887b6..1644aea 100644 --- a/app/Filters/JwtApiRateLimitFilter.php +++ b/app/Filters/JwtApiRateLimitFilter.php @@ -40,7 +40,7 @@ class JwtApiRateLimitFilter implements FilterInterface public function before(RequestInterface $request, $arguments = null) { $fingerprint = generateFingerprint(); - + // echo $fingerprint;die; // 1. IP-level throttle + block check $ipResult = $this->limiter->checkIp($fingerprint, 'jwtApi'); if ($ipResult) { @@ -50,7 +50,8 @@ class JwtApiRateLimitFilter implements FilterInterface // 2. Resolve user identity from JWT // Uses your existing JWT helper functions. // If neither returns a value, fall back to IP-only limiting. - $identity = $this->resolveIdentityFromJwt(); + // $identity = $this->resolveIdentityFromJwt(); + $identity = ''; if ($identity) { // User-level throttle (request count based for JWT routes) @@ -84,7 +85,8 @@ class JwtApiRateLimitFilter implements FilterInterface } $fingerprint = $request->getGlobal('rateLimitFingerprint') ?? generateFingerprint(); - $identity = $request->getGlobal('rateLimitIdentity') ?? $this->resolveIdentityFromJwt(); + // $identity = $request->getGlobal('rateLimitIdentity') ?? $this->resolveIdentityFromJwt(); + $identity = $request->getGlobal('rateLimitIdentity') ?? ''; $this->limiter->recordIpFailure($fingerprint); diff --git a/app/Helpers/HttpRequestHelper.php b/app/Helpers/HttpRequestHelper.php index 3e072e8..53268b3 100755 --- a/app/Helpers/HttpRequestHelper.php +++ b/app/Helpers/HttpRequestHelper.php @@ -15,6 +15,7 @@ class HttpRequestHelper $data = [ 'ip' => $request->getIPAddress(), + 'real_ip' => getRealClientIP(), 'platform' => $platform, 'browser' => $browser, 'method' => strtoupper($request->getMethod()), diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index 71eeb49..893a32d 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -773,19 +773,104 @@ function getRealClientIP() return $request->getIPAddress(); } -function generateFingerprint() +function generateFingerprint(): string { $request = service('request'); $ua = $request->getUserAgent()->getAgentString(); + // echo $ua; + // die; $ip = getRealClientIP(); - // echo $ip;die(); - // Use only subnet (first 3 blocks) to tolerate IP change - $ipParts = explode('.', $ip); - $ipSubnet = $ipParts[0] . '.' . $ipParts[1] . '.' . $ipParts[2]; - // $secret = env('app.sessionFingerprintSalt'); + // Normalize localhost + if ($ip === '127.0.0.1' || $ip === '::1') { + $ipGroup = 'localhost'; + } + // IPv4 handling + elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + $parts = explode('.', $ip); + // Use /24 subnet (first 3 octets) + $ipGroup = $parts[0] . '.' . $parts[1] . '.' . $parts[2]; + } + // IPv6 handling + elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + // Use first 4 blocks of IPv6 (rough /64 grouping) + $blocks = explode(':', $ip); + $ipGroup = implode(':', array_slice($blocks, 0, 4)); + } + // Fallback + else { + $ipGroup = 'unknown'; + } - // return hash('sha256', $ua . '|' . $ipSubnet . '|' . $secret); - return hash('sha256', $ua . '|' . $ipSubnet ); -} \ No newline at end of file + // return $ua . '_' . $ipGroup; + return hash('sha256', $ua . '|' . $ipGroup); +} + + +/** + * Extract identity from POST body or GET params. + * Looks for 'email' or 'mobile_number'. + */ + function resolveIdentity($request): ?string + { + // Try POST body first + $email = $request->getPost('email'); + // print_r($email);die; + $mobile = $request->getPost('mobile_number'); + + // Fallback to GET params + if (! $email && ! $mobile) { + $email = $request->getGet('email'); + $mobile = $request->getGet('mobile_number'); + } + // Fallback to JSON params + if (! $email && ! $mobile) { + $req_data = $request->getJSON(); + // print_r( $req_data); + + $mobile = $req_data->mobile_number ?? null; + // return trim($mobile_number); + + $email = $req_data->email ?? null; + + if (!$email) + { + $email = $req_data->email_id ?? null; + } + // return trim($email); + } + + if ($email) { + return strtolower(trim($email)); + } + + if ($mobile) { + return trim($mobile); + } + + return null; + } + + + function recordRateLimitFailure(string $context = 'authApi'): void + { + /** @var IncomingRequest $request */ + $request = \Config\Services::request(); + + $limiter = \Config\Services::limiter(); // or your custom limiter service + + $fingerprint = $request->getVar('rateLimitFingerprint') + ?? generateFingerprint(); + + $identity = $request->getVar('rateLimitIdentity') + ?? resolveIdentity($request); + + // Record IP-level failure + $limiter->recordIpFailure($fingerprint); + + // Record user-level failure + if (!empty($identity)) { + $limiter->recordUserFailure($identity, $context); + } + } \ No newline at end of file diff --git a/app/Libraries/RateLimiterService.php b/app/Libraries/RateLimiterService.php new file mode 100644 index 0000000..a5120f5 --- /dev/null +++ b/app/Libraries/RateLimiterService.php @@ -0,0 +1,385 @@ +config = config('RateLimiter'); + $this->cache = \Config\Services::cache(); + } + + // ========================================================================= + // PUBLIC — IP LEVEL + // ========================================================================= + + /** + * Check & throttle by fingerprint (IP+UA based). + * Returns null on pass, or an array ['level'=>..., 'message'=>...] on block. + */ + public function checkIp(string $fingerprint, string $routeType = 'jwtApi'): ?array + { + // echo $fingerprint;die; + // 1. Is the IP already blocked? + $blockInfo = $this->getIpBlock($fingerprint); + // print_rr($blockInfo);die(); + if ($blockInfo) { + // Count hit while blocked → maybe escalate + $this->recordIpBlockHit($fingerprint, $blockInfo['level']); + return $this->blockedResponse('ip', $blockInfo['level']); + } + + // 2. Throttle check + $cfg = $this->config->ipBlock; + $countKey = $this->config->cacheKeys['ip_count'] . $fingerprint; + $count = (int) ($this->cache->get($countKey) ?? 0); + + if ($count === 0) { + $this->cache->save($countKey, 1, $cfg['window']); + } else { + $this->cache->save($countKey, $count + 1, $cfg['window']); + } + + if (($count + 1) > $cfg['limit']) { + // Over limit → record violation + $violated = $this->incrementIpViolation($fingerprint); + if ($violated >= $cfg['violation_soft']) { + $this->blockIp($fingerprint, 'soft'); + return $this->blockedResponse('ip', 'soft'); + } + return [ + 'level' => 'throttle', + 'message' => 'Too many requests. Please slow down.', + 'status' => $this->config->statusCodes['throttle'], + ]; + } + + return null; + } + + /** + * Record a "bad outcome" for IP (e.g. controller calls this after failed auth). + * Same escalation path as throttle violations. + */ + public function recordIpFailure(string $fingerprint): ?array + { + $blockInfo = $this->getIpBlock($fingerprint); + if ($blockInfo) { + $this->recordIpBlockHit($fingerprint, $blockInfo['level']); + return $this->blockedResponse('ip', $blockInfo['level']); + } + + $violated = $this->incrementIpViolation($fingerprint); + $cfg = $this->config->ipBlock; + + if ($violated >= $cfg['violation_soft']) { + $this->blockIp($fingerprint, 'soft'); + return $this->blockedResponse('ip', 'soft'); + } + + return null; + } + + /** + * Manually block an IP at a given level. + */ + public function blockIp(string $fingerprint, string $level = 'soft'): void + { + $cfg = $this->config->ipBlock; + $blockKey = $this->config->cacheKeys['ip_block'] . $fingerprint; + + $duration = $this->blockDuration($cfg, $level); + + $data = [ + 'level' => $level, + 'blocked_at' => time(), + 'fingerprint'=> $fingerprint, + ]; + + // Duration 0 = store for 10 years (permanent until manual unblock) + $ttl = $duration > 0 ? $duration : (10 * 365 * 24 * 3600); + $this->cache->save($blockKey, $data, $ttl); + } + + /** + * Manually unblock an IP. Clears block, violations, and counters. + */ + public function unblockIp(string $fingerprint): void + { + $keys = $this->config->cacheKeys; + $this->cache->delete($keys['ip_block'] . $fingerprint); + $this->cache->delete($keys['ip_violations'] . $fingerprint); + $this->cache->delete($keys['ip_count'] . $fingerprint); + $this->cache->delete($keys['ip_block_hits'] . $fingerprint); + } + + /** + * Get current IP block info or null if not blocked. + */ + public function getIpBlock(string $fingerprint): ?array + { + $blockKey = $this->config->cacheKeys['ip_block'] . $fingerprint; + $data = $this->cache->get($blockKey); + return $data ?: null; + } + + // ========================================================================= + // PUBLIC — USER LEVEL + // ========================================================================= + + /** + * Check if a user (by email or mobile) is blocked. + * Returns null on pass, or block response array on block. + */ + public function checkUser(string $identity): ?array + { + $blockInfo = $this->getUserBlock($identity); + if ($blockInfo) { + $this->recordUserBlockHit($identity, $blockInfo['level']); + return $this->blockedResponse('user', $blockInfo['level']); + } + return null; + } + + /** + * Record a failed attempt for a user identity. + * Called from controller after() or manually after a failed verification. + * Handles escalation: free → soft → medium → hard + */ + public function recordUserFailure(string $identity, string $routeType = 'authApi'): ?array + { + $blockInfo = $this->getUserBlock($identity); + + if ($blockInfo) { + // Already blocked — count hit and maybe escalate + $this->recordUserBlockHit($identity, $blockInfo['level']); + return $this->blockedResponse('user', $blockInfo['level']); + } + + // Not blocked yet — increment violation count + $violated = $this->incrementUserViolation($identity, $routeType); + $cfg = $this->config->userBlock; + $routeCfg = $this->config->{$routeType}; + + if ($violated >= $routeCfg['violation_soft']) { + $this->blockUser($identity, 'soft'); + return $this->blockedResponse('user', 'soft'); + } + + return null; + } + + /** + * Manually block a user identity at a given level. + */ + public function blockUser(string $identity, string $level = 'soft'): void + { + $cfg = $this->config->userBlock; + $blockKey = $this->config->cacheKeys['user_block'] . $this->hashIdentity($identity); + + $duration = $this->blockDuration($cfg, $level); + $ttl = $duration > 0 ? $duration : (10 * 365 * 24 * 3600); + + $data = [ + 'level' => $level, + 'blocked_at' => time(), + 'identity' => $identity, + ]; + + $this->cache->save($blockKey, $data, $ttl); + } + + /** + * Manually unblock a user identity. Independent — does NOT touch IP block. + */ + public function unblockUser(string $identity): void + { + $keys = $this->config->cacheKeys; + $hashed = $this->hashIdentity($identity); + + $this->cache->delete($keys['user_block'] . $hashed); + $this->cache->delete($keys['user_violations'] . $hashed); + $this->cache->delete($keys['user_count'] . $hashed); + $this->cache->delete($keys['user_block_hits'] . $hashed); + } + + /** + * Get current user block info or null if not blocked. + */ + public function getUserBlock(string $identity): ?array + { + $blockKey = $this->config->cacheKeys['user_block'] . $this->hashIdentity($identity); + $data = $this->cache->get($blockKey); + return $data ?: null; + } + + // ========================================================================= + // USER THROTTLE (for JWT API routes — request count based) + // ========================================================================= + + /** + * Throttle check for a known user on JWT routes. + * Increments request counter; if over limit records violation. + */ + public function checkUserThrottle(string $identity, string $routeType = 'jwtApi'): ?array + { + $blockCheck = $this->checkUser($identity); + if ($blockCheck) { + return $blockCheck; + } + + $cfg = $this->config->{$routeType}; + $hashed = $this->hashIdentity($identity); + $countKey = $this->config->cacheKeys['user_count'] . $hashed; + $count = (int) ($this->cache->get($countKey) ?? 0); + + if ($count === 0) { + $this->cache->save($countKey, 1, $cfg['window']); + } else { + $this->cache->save($countKey, $count + 1, $cfg['window']); + } + + if (($count + 1) > $cfg['limit']) { + $violated = $this->incrementUserViolation($identity, $routeType); + if ($violated >= $cfg['violation_soft']) { + $this->blockUser($identity, 'soft'); + return $this->blockedResponse('user', 'soft'); + } + return [ + 'level' => 'throttle', + 'message' => 'Too many requests. Please slow down.', + 'status' => $this->config->statusCodes['throttle'], + ]; + } + + return null; + } + + // ========================================================================= + // PRIVATE HELPERS + // ========================================================================= + + /** + * Increment IP violation counter and return new count. + */ + protected function incrementIpViolation(string $fingerprint): int + { + $key = $this->config->cacheKeys['ip_violations'] . $fingerprint; + $count = (int) ($this->cache->get($key) ?? 0) + 1; + // Keep violation record for the block window duration + $this->cache->save($key, $count, $this->config->ipBlock['window'] * 10); + return $count; + } + + /** + * Record a hit while IP is already blocked; escalate if thresholds met. + */ + protected function recordIpBlockHit(string $fingerprint, string $currentLevel): void + { + $cfg = $this->config->ipBlock; + $hitKey = $this->config->cacheKeys['ip_block_hits'] . $fingerprint; + $hits = (int) ($this->cache->get($hitKey) ?? 0) + 1; + $this->cache->save($hitKey, $hits, 10 * 365 * 24 * 3600); + + if ($currentLevel === 'soft' && $hits >= $cfg['medium_trigger']) { + $this->cache->delete($hitKey); + $this->blockIp($fingerprint, 'medium'); + } elseif ($currentLevel === 'medium' && $hits >= $cfg['hard_trigger']) { + $this->cache->delete($hitKey); + $this->blockIp($fingerprint, 'hard'); + } + } + + /** + * Increment user violation counter and return new count. + */ + protected function incrementUserViolation(string $identity, string $routeType): int + { + $hashed = $this->hashIdentity($identity); + $key = $this->config->cacheKeys['user_violations'] . $hashed; + $count = (int) ($this->cache->get($key) ?? 0) + 1; + $window = $this->config->{$routeType}['window'] ?? 180; + $this->cache->save($key, $count, $window * 10); + return $count; + } + + /** + * Record a hit while user is already blocked; escalate if thresholds met. + */ + protected function recordUserBlockHit(string $identity, string $currentLevel): void + { + $cfg = $this->config->userBlock; + $hashed = $this->hashIdentity($identity); + $hitKey = $this->config->cacheKeys['user_block_hits'] . $hashed; + $hits = (int) ($this->cache->get($hitKey) ?? 0) + 1; + $this->cache->save($hitKey, $hits, 10 * 365 * 24 * 3600); + + if ($currentLevel === 'soft' && $hits >= $cfg['medium_trigger']) { + $this->cache->delete($hitKey); + $this->blockUser($identity, 'medium'); + } elseif ($currentLevel === 'medium' && $hits >= $cfg['hard_trigger']) { + $this->cache->delete($hitKey); + $this->blockUser($identity, 'hard'); + } + } + + /** + * Resolve block duration from config based on level. + */ + protected function blockDuration(array $cfg, string $level): int + { + return match ($level) { + 'soft' => $cfg['soft_duration'], + 'medium' => $cfg['medium_duration'], + 'hard' => $cfg['hard_duration'], + default => 0, + }; + } + + /** + * Build a standardised blocked response array. + */ + protected function blockedResponse(string $type, string $level): array + { + $messages = [ + 'soft' => 'Your access has been temporarily suspended. Please contact support.', + 'medium' => 'Your access has been restricted due to repeated violations.', + 'hard' => 'Your access has been permanently blocked. Please contact support.', + ]; + + return [ + 'level' => $level, + 'type' => $type, + 'message' => $messages[$level] ?? 'Access denied.', + 'status' => $this->config->statusCodes[$level], + ]; + } + + /** + * Hash user identity (email or mobile) for cache key safety. + */ + protected function hashIdentity(string $identity): string + { + // return strtolower(trim($identity)); + return hash('sha256', strtolower(trim($identity))); + } +} From e7896b5fe1d66a24a0bf94005cf5704cffebbe94 Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 23 Feb 2026 16:56:01 +0530 Subject: [PATCH 11/13] FIX_ISSUE --- app/Views/client_policy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 1e410a9..ad919af 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -332,7 +332,7 @@ input:checked + .slider:before {
-->
- +
From 4f4bbfb7b4e519e58134973fcfed0b0e824f869b Mon Sep 17 00:00:00 2001 From: "venkatesh.r" Date: Mon, 23 Feb 2026 17:47:28 +0530 Subject: [PATCH 12/13] CHANGE_SUMBIT_TO_SAVE --- app/Views/policy_grid.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Views/policy_grid.php b/app/Views/policy_grid.php index 9c755c8..6a55075 100755 --- a/app/Views/policy_grid.php +++ b/app/Views/policy_grid.php @@ -143,7 +143,7 @@
- + Rename
@@ -363,9 +363,11 @@ $('body').on('click', '.btnPolicyModel', function() $('.loader-mask').fadeIn(); if (policy_type_string == 'GPA' || policy_type_id == 6 || policy_type_id == 7) { + $('.saveButtonChange').text('Submit'); $('#add_new_rack_rate_tab_div').hide(); $('#rack_rate_one').hide(); } else { + $('.saveButtonChange').text('Save'); $('#add_new_rack_rate_tab_div').show(); $('#rack_rate_one').show(); } @@ -3411,7 +3413,7 @@ function appendNewTab(tabNameData = null, data = null)
- + Delete Rename
From d20f1a95281e1896366ec954a8a5f6cc2b0eed7c Mon Sep 17 00:00:00 2001 From: velz Date: Mon, 23 Feb 2026 18:54:20 +0530 Subject: [PATCH 13/13] FEAT_API_RATE_LIMIT_COND --- app/Filters/AuthApiRateLimitFilter.php | 5 +++-- app/Filters/JwtApiRateLimitFilter.php | 5 +++-- app/Helpers/utility_helper.php | 10 ++++++++-- app/Libraries/RateLimiterService.php | 1 + 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/Filters/AuthApiRateLimitFilter.php b/app/Filters/AuthApiRateLimitFilter.php index 29ce42f..fd2efca 100644 --- a/app/Filters/AuthApiRateLimitFilter.php +++ b/app/Filters/AuthApiRateLimitFilter.php @@ -39,7 +39,7 @@ class AuthApiRateLimitFilter implements FilterInterface public function before(RequestInterface $request, $arguments = null) { // $this->limiter->unblockUser('9698262411');die; - $fingerprint = generateFingerprint(); + $fingerprint = generateFingerprint(exclude_ua: true); // echo $fingerprint;die; // 1. IP-level check $ipResult = $this->limiter->checkIp($fingerprint, 'authApi'); @@ -96,7 +96,8 @@ class AuthApiRateLimitFilter implements FilterInterface return; // 2xx/3xx = success; 429/403/451 already handled } - $fingerprint = $request->getVar('rateLimitFingerprint') ?? generateFingerprint(); + $fingerprint = $request->getVar('rateLimitFingerprint') ?? generateFingerprint(exclude_ua: true); + $identity = $request->getVar('rateLimitIdentity') ?? resolveIdentity($request); diff --git a/app/Filters/JwtApiRateLimitFilter.php b/app/Filters/JwtApiRateLimitFilter.php index 1644aea..6e0b84f 100644 --- a/app/Filters/JwtApiRateLimitFilter.php +++ b/app/Filters/JwtApiRateLimitFilter.php @@ -39,7 +39,7 @@ class JwtApiRateLimitFilter implements FilterInterface public function before(RequestInterface $request, $arguments = null) { - $fingerprint = generateFingerprint(); + $fingerprint = generateFingerprint(exclude_ua: true); // echo $fingerprint;die; // 1. IP-level throttle + block check $ipResult = $this->limiter->checkIp($fingerprint, 'jwtApi'); @@ -84,7 +84,8 @@ class JwtApiRateLimitFilter implements FilterInterface return; } - $fingerprint = $request->getGlobal('rateLimitFingerprint') ?? generateFingerprint(); + $fingerprint = $request->getGlobal('rateLimitFingerprint') ?? generateFingerprint(exclude_ua: true); + // $identity = $request->getGlobal('rateLimitIdentity') ?? $this->resolveIdentityFromJwt(); $identity = $request->getGlobal('rateLimitIdentity') ?? ''; diff --git a/app/Helpers/utility_helper.php b/app/Helpers/utility_helper.php index 893a32d..bac046f 100755 --- a/app/Helpers/utility_helper.php +++ b/app/Helpers/utility_helper.php @@ -773,7 +773,7 @@ function getRealClientIP() return $request->getIPAddress(); } -function generateFingerprint(): string +function generateFingerprint(bool $exclude_ua = false): string { $request = service('request'); @@ -804,7 +804,11 @@ function generateFingerprint(): string } // return $ua . '_' . $ipGroup; + if($exclude_ua){ + return hash('sha256', $ipGroup); + } return hash('sha256', $ua . '|' . $ipGroup); + } @@ -861,7 +865,9 @@ function generateFingerprint(): string $limiter = \Config\Services::limiter(); // or your custom limiter service $fingerprint = $request->getVar('rateLimitFingerprint') - ?? generateFingerprint(); + ?? generateFingerprint(exclude_ua: true); + + $identity = $request->getVar('rateLimitIdentity') ?? resolveIdentity($request); diff --git a/app/Libraries/RateLimiterService.php b/app/Libraries/RateLimiterService.php index a5120f5..3bcb564 100644 --- a/app/Libraries/RateLimiterService.php +++ b/app/Libraries/RateLimiterService.php @@ -113,6 +113,7 @@ class RateLimiterService 'level' => $level, 'blocked_at' => time(), 'fingerprint'=> $fingerprint, + 'ip' => getRealClientIP(), ]; // Duration 0 = store for 10 years (permanent until manual unblock)