diff --git a/app/Config/Filters.php b/app/Config/Filters.php
index a602f87..96d34a1 100755
--- a/app/Config/Filters.php
+++ b/app/Config/Filters.php
@@ -66,7 +66,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/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
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index ad822a1..c5d99b3 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)
{
@@ -687,12 +687,12 @@ class EmployeeRestController extends AdminController
public function getEmployeeAndDependenceByClientId()
{
try {
- $empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'));
+ $empData = $this->employeePolicyModel->getEmployeePolicy( client_id:$this->request->getGet('client_id'),policy_id: $this->request->getGet('client_policy_id'),status:0,branch_id:$this->request->getGet('client_branch_id'), status_type: 'hr');
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);
@@ -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('md5(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', $client['id'] ?? null)
->where('client_branch_id', $pre_branch_id)
->findAll();
@@ -2213,7 +2217,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 +2231,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 +3099,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 +3125,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 +3173,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 +3576,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 +3600,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 +3661,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());
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/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php
index 89ec1de..b15d191 100755
--- a/app/Controllers/RestAuthenticationController.php
+++ b/app/Controllers/RestAuthenticationController.php
@@ -171,7 +171,7 @@ class RestAuthenticationController extends AdminController
//check the resend otp (with in 60 seconds don't allow another otp to send)
$check = canSendOtp($employeeData);
if (!$check['allowed']) {
- return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after'] ])->setStatusCode(429); // Too Many Requests
+ return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after']], 429); // Too Many Requests
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithMobileNumber: Employee verified with ID = " . $employeeData['employee_id']);
@@ -338,7 +338,7 @@ class RestAuthenticationController extends AdminController
//check the resend otp (with in 60 seconds don't allow another otp to send)
$check = canSendOtp($employeeData);
if (!$check['allowed']) {
- return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after'] ])->setStatusCode(429); // Too Many Requests
+ return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after']], 429); // Too Many Requests
}
$this->myLogger->logme("error", "REST-AUTH-CONTROLLER - verifyEmployeeWithEmailId: Valid employee found, generating OTP");
@@ -597,7 +597,7 @@ class RestAuthenticationController extends AdminController
//check the resend otp (with in 60 seconds don't allow another otp to send)
$check = canSendOtp($HrData);
if (!$check['allowed']) {
- return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after'] ])->setStatusCode(429); // Too Many Requests
+ return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after']], 429); // Too Many Requests
}
$sql = "UPDATE level_contacts SET otp = ? WHERE mobile = ? AND contact_type = 'client' AND is_active = 1";
@@ -662,7 +662,7 @@ class RestAuthenticationController extends AdminController
//check the resend otp (with in 60 seconds don't allow another otp to send)
$check = canSendOtp($HrData);
if (!$check['allowed']) {
- return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after'] ])->setStatusCode(429); // Too Many Requests
+ return $this->respond(['status' => false,'message' => 'OTP already sent. Please wait before retrying.','retry_after_seconds' => $check['retry_after']], 429); // Too Many Requests
}
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];
diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php
index 72b8ba9..92c2905 100755
--- a/app/Models/EmployeePolicyModel.php
+++ b/app/Models/EmployeePolicyModel.php
@@ -82,10 +82,19 @@ class EmployeePolicyModel extends Model
}
// ----------------------------------------------------------------------------------------------------------
- public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "")
+ public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "", $status_type = "")
{
// dd($status);
+ $status_query = "employee_polices.status"; // Default fallback
+
+ if ($status_type == "hr") {
+ $status_query = "CASE
+ WHEN employee_polices.status = 'enrolled' THEN 'under process'
+ ELSE employee_polices.status
+ END as status";
+ }
+
$result = $this->select([
'employee_polices.*',
'policy_type.policy_type as policy_name',
@@ -147,8 +156,8 @@ class EmployeePolicyModel extends Model
THEN "Newly Added"
ELSE NULL
END) AS newly_added',
-
- ])
+ $status_query
+ ], false)
->join('employees emp', 'employee_polices.employee_id = emp.id')
->join('client_policy cp', 'employee_polices.client_policy_id = cp.id') //cp - client policy
->join('policies pm', 'cp.policy_id = pm.id', 'left') //pm - policy master
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('= session()->getFlashdata('success') ?>', 'success');
+ toastr.success('= session()->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 = '= base_url('client/list/') ?>' + 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 = '= base_url('client/list/') ?>' + 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..6761bd8 100755
--- a/app/Views/employee_list.php
+++ b/app/Views/employee_list.php
@@ -302,14 +302,51 @@ function init() {
function handleItemClick(e, item) {
e.preventDefault();
- // Execute the stored onclick handler
const onclickAttr = item.getAttribute('data-onclick');
if (onclickAttr) {
- eval(onclickAttr);
+ // Regex to separate function name from the inside of the parentheses
+ // Example: myFunc(this, '123') -> match[1]="myFunc", match[2]="this, '123'"
+ const match = onclickAttr.match(/^(\w+)\((.*)\)$/);
+
+ if (match) {
+ const funcName = match[1];
+ const argsRaw = match[2];
+
+ if (typeof window[funcName] === 'function') {
+ // Parse the arguments string into a real array
+ const args = argsRaw.split(',').map(arg => {
+ let cleaned = arg.trim();
+
+ // 1. Handle the 'this' keyword
+ if (cleaned === 'this') return item;
+
+ // 2. Handle 'event' keyword
+ if (cleaned === 'event') return e;
+
+ // 3. Handle strings (remove single or double quotes)
+ if ((cleaned.startsWith("'") && cleaned.endsWith("'")) ||
+ (cleaned.startsWith('"') && cleaned.endsWith('"'))) {
+ return cleaned.substring(1, cleaned.length - 1);
+ }
+
+ // 4. Handle numbers
+ if (!isNaN(cleaned) && cleaned !== "") {
+ return Number(cleaned);
+ }
+
+ return cleaned;
+ });
+
+ // Execute function:
+ // .apply(item, args) sets the 'this' inside the function to the clicked element
+ window[funcName].apply(item, args);
+ }
+ }
}
+ // Handle standard navigation if it's a link
const href = item.getAttribute('href');
- if (href && href !== '#') {
+ if (href && href !== '#' && !href.includes('javascript:void(0)')) {
window.location.href = href;
}
@@ -691,9 +728,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..2409597 100755
--- a/app/Views/employee_upload.php
+++ b/app/Views/employee_upload.php
@@ -38,7 +38,7 @@ option:disabled {
-