Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
velz 2026-02-16 18:14:46 +05:30
commit 43bec44d07
27 changed files with 6933 additions and 6281 deletions

View File

@ -120,4 +120,13 @@ FHPL_USER_NAME =
FHPL_PASSWORD =
FHPL_GRANT_TYPE =
METABASE_SECRET_KEY=
METABASE_SECRET_KEY=
# Health care api details
HEALTH_INDIA_BASE_URL =
HEALTH_INDIA_TOKEN_URL =
HEALTH_INDIA_USERNAME =
HEALTH_INDIA_PASSWORD =
HEALTH_INDIA_PRIMARY_KEY_CONSTANT =

View File

@ -16,6 +16,8 @@ class Acl
'#^/getVerifyPosMobileNo#' => ['public' => true],
'#^/getVerifiedPosUserData#' => ['public' => true],
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID]],
'#^/getEmployeeActiveOrInactivePolicy#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
'#^/test/testingquerys#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
'#^/fedeploy#' => ['roles' => [ADMIN_ROLE_ID]],
'#^/visitOffBoardCheck#' => ['roles' => [ADMIN_ROLE_ID]],
'#^/logs#' => ['roles' => [ADMIN_ROLE_ID]],

View File

@ -783,10 +783,10 @@ $routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
//Third party - testing route
$routes->get('FhplGetBenefDetails','FhplApiController::FhplGetBenefDetails');
$routes->get('EcardRequest','FhplApiController::EcardRequest');
$routes->get('EcardRequest','HealthIndiaApiController::EcardRequest');
$routes->get('HospitalNetwork','MediAssistApiController::HospitalNetwork');
$routes->get('VidalGetBenefDetails','VidalApiController::VidalGetBenefDetails');
$routes->get('ClaimDetail','FhplApiController::ClaimDetail');
$routes->get('ClaimDetail','HealthIndiaApiController::ClaimDetail');
$routes->get('SubmitClaim','HealthIndiaApiController::SubmitClaim');
$routes->get('IntimateClaim','MediAssistApiController::IntimateClaim');
$routes->get('IRSubmission','MediAssistApiController::IRSubmission');
@ -836,6 +836,7 @@ $routes->group('test', function($routes) {
$routes->get('membervalidation', 'TestingController::membervalidation');
$routes->get('generateExcel', 'TestingController::generateExcel');
$routes->get('logo_renaming','TestingController::logo_renaming');
$routes->get('testingquerys','TestingController::testingquerys');
$routes->get('thzReminderCrone','ThzController::getOpenTicketsOlderThan24HoursAndAssignNextLevel');
// $routes->get('createDefaultMailTempalteInDB','TestingController::createDefaultMailTempalteInCrossDB');
// $routes->get('createDefaultMailTempalteInSameDB','TestingController::createDefaultMailTempalteInSameDB');

View File

@ -64,6 +64,10 @@ class ApiServiceController extends BaseController
{ // fhpl
$fhplApiController = new FhplApiController;
return $fhplApiController->SubmitClaim($claimId);
}else if ($tpaID == $this->health_india_primary_key)
{ // health india
$healthIndiaApiController = new HealthIndiaApiController;
return $healthIndiaApiController->SubmitClaim($claimId);
}else{
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
}
@ -145,6 +149,12 @@ class ApiServiceController extends BaseController
$fhplApiController = new FhplApiController;
$data['eCardDownload'] = $fhplApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] );
}else if($employee_policy[0]['tpa_primary_id'] == $this->health_india_primary_key)// health india
{
$healthIndiaApiController = new HealthIndiaApiController;
$data['eCardDownload'] = $healthIndiaApiController->EcardRequest( $emp_code, $policy_no , $employee_policy[0]['tpa_id'] );
}else{
if($type == "download"){
@ -292,6 +302,17 @@ class ApiServiceController extends BaseController
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
}else if ($tpa_id == $this->health_india_primary_key) // health india
{
$file_id = $fileModel->insert($data);
log_message('error', "Files table inserted successfully, File id : {$file_id}");
// $healthIndiaApiController = new HealthIndiaApiController;
// $healthIndiaApiController->HealthIndiaGetBenefDetails( [ 'polict_no' => $policy_no, 'file_id' =>$file_id ] );
$r = Jobs::addJob(['job_name' => 'HealthIndiaGetBenefDetails', 'payload' => ['policy_no' => $policy_no, 'file_id' => $file_id, 'client_policy_id' => $policy_id, 'return_type' => 'job']]);
log_message('error', "HealthIndiaGetBenefDetails job pushed successfully.");
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Action Triggered','data' => [] ]);
}else{
return $this->respond(['status' => false, 'code' => 200,'message' => 'TPA not found ','data' => [] ]);
}
@ -328,6 +349,12 @@ class ApiServiceController extends BaseController
$res = $fhplApiController->ClaimDetail($claimId);
return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]);
}else if ($tpaID == $this->health_india_primary_key) { // health india
$healthIndiaApiController = new HealthIndiaApiController;
$res = $healthIndiaApiController->ClaimDetail($claimId);
return $this->response->setJSON(['status' => $res['status'],'message' => $res['message'] ]);
}else{
log_message('error', "This ticket id ( {$claimId} ) TPA has no API service enabled. TPA ID : {$tpaID}");
$message = "This TPA has no API service enabled";

View File

@ -783,11 +783,19 @@ class ClientController extends AdminController
]
],
// 'cd_ac_no' => [
// 'rules' => 'required|regex_match[/^[a-zA-Z0-9\/_\\-]+$/]',
// 'errors' => [
// 'required' => 'Account number is required',
// 'regex_match' => 'Account number can only contain letters, numbers, slashes (/), underscores (_), and hyphens (-)',
// ]
// ],
'cd_ac_no' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/_\\-]+$/]',
'rules' => 'required|numeric',
'errors' => [
'required' => 'Account number is required',
'regex_match' => 'Account number can only contain letters, numbers, slashes (/), underscores (_), and hyphens (-)',
'required' => 'CD Account number is required.',
'numeric' => 'CD Account number must contain only numbers.',
]
],
@ -981,19 +989,19 @@ class ClientController extends AdminController
]
],
'client_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]|min_length[2]||max_length[45]',
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]|min_length[2]|max_length[45]',
'errors' => [
'required' => 'Client Name is required',
'regex_match' => 'Client Name can only contain letters, numbers, spaces, hyphens(-), and underscores(_).',
'regex_match' => 'Client Name can only contain letters, numbers, spaces, hyphens and underscores.',
'min_length' => 'Client Name must be at least 2 characters.',
'max_length' => 'Client Name must not exceed 45 characters.',
]
],
'short_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]|min_length[2]||max_length[15]',
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]|min_length[2]|max_length[15]',
'errors' => [
'required' => 'Client Short Name is required',
'regex_match' => 'Client Short Name can only contain letters, numbers, hyphens(-), and underscores(_) with no spaces.',
'regex_match' => 'Client Short Name can only contain letters, numbers, hyphens and underscores.',
'min_length' => 'Client Short Name must be at least 2 characters.',
'max_length' => 'Client Short Name must not exceed 15 characters.',
]
@ -1011,21 +1019,32 @@ class ClientController extends AdminController
'required' => 'HR File Processed By is required.',
]
],
// 'client_logo' => [
// 'rules' => [
// 'uploaded[client_logo]', // Add this to check if a file was actually sent
// 'is_image[client_logo]',
// 'max_size[client_logo,200]',
// 'ext_in[client_logo,jpg,jpeg,png]',
// 'max_dims[client_logo,100,100]',
// ],
// 'errors' => [
// 'uploaded' => 'Please upload a client logo',
// 'is_image' => 'The uploaded file must be an image',
// 'max_size' => 'File size should not exceed 200 KB',
// 'ext_in' => 'Allowed file types: jpg, jpeg, png',
// 'max_dims' => 'Image dimensions must be 100 x 100 pixels',
// ]
// ],
'client_logo' => [
'rules' => [
'is_image[client_logo]',
'max_size[client_logo,200]', // 200 KB
'ext_in[client_logo,jpg,jpeg,png]',
'max_dims[client_logo,100,100]',
],
'errors' => [
'is_image' => 'The uploaded file must be an image',
'max_size' => 'File size should not exceed 200 KB',
'ext_in' => 'Allowed file types: jpg, jpeg, png',
'max_dims' => 'Image dimensions must be 100 x 100 pixels',
]
'label' => 'Client Logo',
'rules' => 'permit_empty|is_image[client_logo]|max_size[client_logo,200]|ext_in[client_logo,jpg,jpeg,png]|max_dims[client_logo,100,100]',
'errors' => [
'is_image' => 'Please upload a valid image file.',
'max_size' => 'The logo is too heavy (Max 200KB).',
'ext_in' => 'Only JPG, JPEG, and PNG files are allowed.',
'max_dims' => 'The logo must be no larger than 100x100 pixels.',
]
],
];
if (!$this->validate($rules)) {
@ -1077,6 +1096,65 @@ class ClientController extends AdminController
public function editClientGeneralInfo()
{
$rules = [
'entity_type_id' => [
'rules' => 'required|numeric',
'errors' => [
'required' => 'Entity Type is required',
'numeric' => 'Invalid Entity Type selected'
]
],
'client_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]',
'errors' => [
'required' => 'Client Name is required',
'regex_match' => 'Client Name can only contain letters, numbers, spaces, hyphens and underscores.',
'min_length' => 'Client Name must be at least 2 characters.',
'max_length' => 'Client Name must not exceed 45 characters.',
]
],
'short_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => [
'required' => 'Client Short Name is required',
'regex_match' => 'Client Short Name can only contain letters, numbers, hyphens and underscores.',
'min_length' => 'Client Short Name must be at least 2 characters.',
'max_length' => 'Client Short Name must not exceed 15 characters.',
]
],
'pan' => [
'rules' => 'required|regex_match[/^[A-Z]{5}[0-9]{4}[A-Z]$/]',
'errors' => [
'required' => 'PAN Number is required.',
'regex_match' => 'Invalid PAN format. Example: ABCDE1234F'
]
],
'hr_file_processed_by' => [
'rules' => 'required',
'errors' => [
'required' => 'HR File Processed By is required.',
]
],
'client_logo' => [
'rules' => 'permit_empty|is_image[client_logo]|max_size[client_logo,200]|ext_in[client_logo,jpg,jpeg,png]|max_dims[client_logo,100,100]',
'errors' => [
'is_image' => 'The uploaded file must be an image',
'max_size' => 'File size should not exceed 200 KB',
'ext_in' => 'Allowed file types: jpg, jpeg, png',
'max_dims' => 'Image dimensions must be 100 x 100 pixels',
]
],
];
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',
'code' => 400,
'errors' => $this->validator->getErrors()
]);
}
$this->myLogger->logme('error', 'edit client general info function called');
$uploadFilePath = ROOTPATH . 'public/uploads/logo/';
$file_name = file_Upload($this->request->getFile('client_logo'), $uploadFilePath);
@ -1559,14 +1637,14 @@ class ClientController extends AdminController
]
],
];
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',
'code' => 400,
'errors' => $this->validator->getErrors()
]);
}
// if (!$this->validate($rules)) {
// return $this->response->setStatusCode(400)->setJSON([
// 'status' => false,
// 'message' => 'Input validation failed',
// 'code' => 400,
// 'errors' => $this->validator->getErrors()
// ]);
// }
$data['client_id'] = $this->request->getPost('client_id');
$data['created_by'] = get_session_userid();
@ -1640,14 +1718,14 @@ class ClientController extends AdminController
]
],
];
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',
'code' => 400,
'errors' => $this->validator->getErrors()
]);
}
// if (!$this->validate($rules)) {
// return $this->response->setStatusCode(400)->setJSON([
// 'status' => false,
// 'message' => 'Input validation failed',
// 'code' => 400,
// 'errors' => $this->validator->getErrors()
// ]);
// }
$id = $this->request->getPost('PrimaryKey');
$data['client_id'] = $this->request->getPost('client_id');
@ -1729,14 +1807,14 @@ class ClientController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]|min_length[3]',
'errors' => [
'required' => 'Branch Name is required',
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens(-), and underscores(_).',
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens and underscores.',
]
],
'branch_code' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => [
'required' => 'Branch Code is required',
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens(-), and underscores(_).',
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens and underscores.',
]
],
'address1' => [
@ -1747,23 +1825,34 @@ class ClientController extends AdminController
'rules' => 'permit_empty|string',
],
'state' => [
'rules' => 'required|numeric',
'errors' => ['required' => 'State is required']
'label' => 'State',
'rules' => 'required',
'errors' => ['required' => 'State is required.']
// 'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
// 'errors' => [
// 'required' => 'State is required.',
// 'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
// ]
],
'district' => [
'rules' => 'required',
'errors' => ['required' => 'District is required.']
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'required' => 'District is required.',
'regex_match' => 'District can contain letters, numbers, spaces, and hyphens.'
]
],
'city' => [
'rules' => 'required',
'errors' => ['required' => 'City is required.']
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required.',
'numeric' => 'Pincode must be numeric',
'exact_length' => 'Pincode must be exactly 6 digits'
'numeric' => 'Pincode must be digits only.',
'exact_length' => 'Pincode must be exactly 6 digits.'
]
],
'gst' => [
@ -2120,15 +2209,20 @@ class ClientController extends AdminController
$rules = [
'branch_name' => [
'rules' => 'required',
'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\-_]+$/]',
'errors' => [
'required' => 'Branch Name is required',
'required' => 'Branch Name is required',
'min_length' => 'Branch Name must be at least 3 characters long',
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens and underscores.'
]
],
'branch_code' => [
'rules' => 'required',
// Note: Codes usually don't have spaces, but I've included the others
'rules' => 'required|min_length[2]|regex_match[/^[a-zA-Z0-9\-_]+$/]',
'errors' => [
'required' => 'Branch Code is required',
'required' => 'Branch Code is required',
'min_length' => 'Branch Code must be at least 2 characters long',
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens and underscores.'
]
],
'address1' => [
@ -2138,29 +2232,35 @@ class ClientController extends AdminController
]
],
'state' => [
'rules' => 'required',
'errors' => [
'required' => 'State is required',
]
],
'district' => [
'rules' => 'required',
'errors' => [
'required' => 'District is required.',
]
],
'city' => [
'rules' => 'required',
'errors' => [
'required' => 'City is required.',
]
],
'pincode' => [
'rules' => 'required',
'errors' => [
'required' => 'Pincode is required.',
]
],
'label' => 'State',
// 'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
'rules' => 'required',
'errors' => [
'required' => 'State is required.',
// 'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
]
],
'district' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'required' => 'District is required.',
'regex_match' => 'District can contain letters, numbers, spaces, and hyphens.'
]
],
'city' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required.',
'numeric' => 'Pincode must be digits only.',
'exact_length' => 'Pincode must be exactly 6 digits.'
]
],
'gst' => [
'rules' => 'required|regex_match[/^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}Z[A-Z\d]{1}$/]',
'errors' => [
@ -2169,10 +2269,11 @@ class ClientController extends AdminController
]
],
'name.*' => [
'rules' => 'required|alpha_space',
'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\-_]+$/]',
'errors' => [
'required' => 'Contact name is required',
'alpha_space' => 'Contact name may contain only letters and spaces'
'min_length' => 'Contact name must be at least 3 characters long',
'regex_match' => 'Contact name can only contain letters, numbers, spaces, hyphens and underscores.'
]
],
'designation.*' => [
@ -2294,6 +2395,104 @@ class ClientController extends AdminController
$client_id = $this->request->getPost('client_id');
$pre_branch_id = $this->request->getPost('pre_branch_id') ?? '';
$rules = [
'branch_name' => [
'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\-_]+$/]',
'errors' => [
'required' => 'Branch Name is required',
'min_length' => 'Branch Name must be at least 3 characters long',
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens and underscores.'
]
],
'branch_code' => [
// Note: Codes usually don't have spaces, but I've included the others
'rules' => 'required|min_length[2]|regex_match[/^[a-zA-Z0-9\-_]+$/]',
'errors' => [
'required' => 'Branch Code is required',
'min_length' => 'Branch Code must be at least 2 characters long',
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens and underscores.'
]
],
'address1' => [
'rules' => 'required',
'errors' => [
'required' => 'Address Line 1 is required',
]
],
'state' => [
'label' => 'State',
'rules' => 'required',
'errors' => ['required' => 'State is required.']
],
'district' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'required' => 'District is required.',
'regex_match' => 'District can contain letters, numbers, spaces, and hyphens.'
]
],
'city' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required.',
'numeric' => 'Pincode must be digits only.',
'exact_length' => 'Pincode must be exactly 6 digits.'
]
],
'gst' => [
'rules' => 'required|regex_match[/^\d{2}[A-Z]{5}\d{4}[A-Z]{1}[A-Z\d]{1}Z[A-Z\d]{1}$/]',
'errors' => [
'required' => 'GST number is required',
'regex_match' => 'Invalid GST Number. Example: 12ABCDE1234F5Z6'
]
],
'name.*' => [
'rules' => 'required|min_length[3]|regex_match[/^[a-zA-Z0-9\s\-_]+$/]',
'errors' => [
'required' => 'Contact name is required',
'min_length' => 'Contact name must be at least 3 characters long',
'regex_match' => 'Contact name can only contain letters, numbers, spaces, hyphens and underscores.'
]
],
'designation.*' => [
'rules' => 'required|alpha_space',
'errors' => [
'required' => 'Designation is required',
'alpha_space' => 'Designation may contain only letters and spaces'
]
],
'email.*' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
'mobile.*' => [
'rules' => 'required|numeric|exact_length[10]',
'errors' => [
'required' => 'Mobile number is required',
'numeric' => 'Mobile number must contain digits only',
'exact_length' => 'Mobile number must be exactly 10 digits'
]
],
];
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',
'code' => 400,
'errors' => $this->validator->getErrors()
]);
}
$data = $this->request->getPost();
$data = sanitizeInputArrayAdvanced($data);
$data['pre_branch_id'] = $pre_branch_id;
@ -2486,13 +2685,12 @@ class ClientController extends AdminController
$sanitized_post_data = sanitizeInputArrayAdvanced($request_post_data);
$rules = [
// --- BASIC SELECTS (Required) ---
'client_branch_id' => [
'rules' => 'required',
'errors' => ['required' => 'Please select a Client Branch.']
],
'policy_type_id' => [
'rules' => 'required|is_natural_no_zero',
'rules' => ['required', 'is_natural_no_zero'],
'errors' => [
'required' => 'Policy Type is required.',
'is_natural_no_zero' => 'Please select a valid Policy Type.'
@ -2506,17 +2704,20 @@ class ClientController extends AdminController
'rules' => 'required',
'errors' => ['required' => 'Please select a TPA.']
],
// --- TEXT FIELDS (Required & Specific Format) ---
'policy_no' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_\-\/\\\]+$/]',
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\s_\-\/\\\]+$/]'],
'errors' => [
'required' => 'This field is required.',
'regex_match' => 'Only letters, numbers, spaces, _, -, /, and \ are allowed.'
'required' => 'Policy No is required.',
'regex_match' => 'Invalid characters in Policy No.'
]
],
'gst' => [
'rules' => 'required|numeric|greater_than_equal_to[0]|less_than_equal_to[100]',
'rules' => [
'required',
'numeric',
'greater_than_equal_to[0]',
'less_than_equal_to[100]'
],
'errors' => [
'required' => 'GST percentage is required.',
'numeric' => 'GST must be a valid number.',
@ -2524,45 +2725,47 @@ class ClientController extends AdminController
'less_than_equal_to' => 'GST percentage cannot exceed 100%.'
]
],
// --- DATE FIELDS (Required) ---
'policy_start_date' => [
'rules' => 'required',
'errors' => [
'required' => 'Start date is required.',
]
'errors' => ['required' => 'Start date is required.']
],
'policy_end_date' => [
'rules' => 'required',
'errors' => [
'required' => 'End date is required.',
]
],
// --- PERMIT EMPTY FIELDS (Optional) ---
'base_policy' => [
'rules' => 'permit_empty'
'errors' => ['required' => 'End date is required.']
],
'wellness_plan_id' => [
'rules' => 'permit_empty|alpha_numeric',
'errors' => [
'alpha_numeric' => 'Wellness Plan ID can only contain letters and numbers (no spaces or special characters).'
]
'errors' => ['alpha_numeric' => 'Wellness Plan ID can only contain letters and numbers.']
],
'wellness_vendor_id' => [
'rules' => 'permit_empty'
],
'disclaimer' => [
'rules' => 'permit_empty|string|min_length[5]',
'rules' => ['permit_empty', 'string', 'min_length[5]'],
'errors' => ['min_length' => 'Disclaimer should be at least 5 characters long if provided.']
],
// --- CHECKBOXES (Permit Empty) ---
'enrolment_visibility' => ['rules' => 'permit_empty'],
'is_lgbtq' => ['rules' => 'permit_empty']
];
if (!$this->validate($rules)) {
// 2. Run the initial validation
$isValid = $this->validate($rules);
// 3. Perform manual date comparison
$start = $this->request->getPost('policy_start_date');
$end = $this->request->getPost('policy_end_date');
$startDate = change_date_format($start ?? null, 'd-m-Y', 'Y-m-d') ?? null;
$endDate = change_date_format($end ?? null, 'd-m-Y', 'Y-m-d') ?? null;
if ($startDate && $endDate && ($endDate < $startDate)) {
// Manually push the error into the validator
$this->validator->setError('policy_end_date', 'Policy start and end date are mismatched (End date cannot be before Start date).');
$isValid = false;
}
// 4. Check final status
if (!$isValid) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',
@ -2669,13 +2872,12 @@ class ClientController extends AdminController
public function editClientPolicy()
{
$rules = [
// --- BASIC SELECTS (Required) ---
'client_branch_id' => [
'rules' => 'required',
'errors' => ['required' => 'Please select a Client Branch.']
],
'policy_type_id' => [
'rules' => 'required|is_natural_no_zero',
'rules' => ['required', 'is_natural_no_zero'],
'errors' => [
'required' => 'Policy Type is required.',
'is_natural_no_zero' => 'Please select a valid Policy Type.'
@ -2689,17 +2891,20 @@ class ClientController extends AdminController
'rules' => 'required',
'errors' => ['required' => 'Please select a TPA.']
],
// --- TEXT FIELDS (Required & Specific Format) ---
'policy_no' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_\-\/\\\]+$/]',
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\s_\-\/\\\]+$/]'],
'errors' => [
'required' => 'This field is required.',
'regex_match' => 'Only letters, numbers, spaces, _, -, /, and \ are allowed.'
'required' => 'Policy No is required.',
'regex_match' => 'Invalid characters in Policy No.'
]
],
'gst' => [
'rules' => 'required|numeric|greater_than_equal_to[0]|less_than_equal_to[100]',
'rules' => [
'required',
'numeric',
'greater_than_equal_to[0]',
'less_than_equal_to[100]'
],
'errors' => [
'required' => 'GST percentage is required.',
'numeric' => 'GST must be a valid number.',
@ -2707,47 +2912,47 @@ class ClientController extends AdminController
'less_than_equal_to' => 'GST percentage cannot exceed 100%.'
]
],
// --- DATE FIELDS (Required) ---
'policy_start_date' => [
'rules' => 'required|valid_date',
'errors' => [
'required' => 'Start date is required.',
'valid_date' => 'Enter a valid date format (YYYY-MM-DD).'
]
'rules' => 'required',
'errors' => ['required' => 'Start date is required.']
],
'policy_end_date' => [
'rules' => 'required|valid_date',
'errors' => [
'required' => 'End date is required.',
'valid_date' => 'Enter a valid date format (YYYY-MM-DD).'
]
],
// --- PERMIT EMPTY FIELDS (Optional) ---
'base_policy' => [
'rules' => 'permit_empty'
'rules' => 'required',
'errors' => ['required' => 'End date is required.']
],
'wellness_plan_id' => [
'rules' => 'permit_empty|alpha_numeric',
'errors' => [
'alpha_numeric' => 'Wellness Plan ID can only contain letters and numbers (no spaces or special characters).'
]
'errors' => ['alpha_numeric' => 'Wellness Plan ID can only contain letters and numbers.']
],
'wellness_vendor_id' => [
'rules' => 'permit_empty'
],
'disclaimer' => [
'rules' => 'permit_empty|string|min_length[5]',
'rules' => ['permit_empty', 'string', 'min_length[5]'],
'errors' => ['min_length' => 'Disclaimer should be at least 5 characters long if provided.']
],
// --- CHECKBOXES (Permit Empty) ---
'enrolment_visibility' => ['rules' => 'permit_empty'],
'is_lgbtq' => ['rules' => 'permit_empty']
];
if (!$this->validate($rules)) {
// 2. Run the initial validation
$isValid = $this->validate($rules);
// 3. Perform manual date comparison
$start = $this->request->getPost('policy_start_date');
$end = $this->request->getPost('policy_end_date');
$startDate = change_date_format($start ?? null, 'd-m-Y', 'Y-m-d') ?? null;
$endDate = change_date_format($end ?? null, 'd-m-Y', 'Y-m-d') ?? null;
if ($startDate && $endDate && ($endDate < $startDate)) {
// Manually push the error into the validator
$this->validator->setError('policy_end_date', 'Policy start and end date are mismatched (End date cannot be before Start date).');
$isValid = false;
}
// 4. Check final status
if (!$isValid) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',

View File

@ -2770,7 +2770,7 @@ class EmployeeController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
'mobile' => [

View File

@ -79,7 +79,7 @@ class HealthIndiaApiController extends BaseController
]);
}
public function SubmitClaim($claimId = 515)
public function SubmitClaim($claimId = 729)
{
helper('api');
@ -205,7 +205,7 @@ class HealthIndiaApiController extends BaseController
$response = call_third_party_api($url, 'POST', $headers, $body);
dd($response);
// dd($response);
log_message('error', 'TPA CLAIM PUSH HEALTH_INDIA RESPONSE | claimId: ' . $claimId . ' | response: ' . json_encode($response));
@ -239,7 +239,7 @@ class HealthIndiaApiController extends BaseController
return;
}
public function ClaimDetail($claimId = null)
public function ClaimDetail($claimId = 729)
{
helper('api');
@ -284,6 +284,8 @@ class HealthIndiaApiController extends BaseController
$response = call_third_party_api($url, 'POST', $headers, $body);
// dd($response);
log_message('error', 'CLAIM STATUS HEALTH_INDIA | claimId: ' . $claimId . ' | Response: ' . json_encode($response));
if (empty($response['data']['result'][0])) {
@ -368,9 +370,9 @@ class HealthIndiaApiController extends BaseController
$url = getenv('HEALTH_INDIA_BASE_URL') . "/Member/GetMemberEcard";
$body = [
"policY_NUMBER" => $policyNo,
"employeE_CODE" => $employeeId,
"membeR_ID" => $memberId
"policY_NUMBER" => $policyNo ,//'141600_POLICY_AWAITED',
"employeE_CODE" => $employeeId,//'DECP000',
"membeR_ID" => $memberId//'19662410E',
];
$headers = [
@ -416,8 +418,8 @@ class HealthIndiaApiController extends BaseController
try {
helper('api');
$policyNo = $requestData['policy_no'] ?? '141600_POLICY_AWAITED';
$client_policy_id = $requestData['client_policy_id'] ?? 6473;
$policyNo = $requestData['policy_no'] ?? null; //'141600_POLICY_AWAITED';
$client_policy_id = $requestData['client_policy_id'] ?? null; // 6473;
@ -442,24 +444,24 @@ class HealthIndiaApiController extends BaseController
log_message('error', "TPA ID PULL HEALTH_INDIA | called for policy_no: {$policyNo}, client_policy_id: {$client_policy_id}");
// Fetch file download dates
// $batchFiles = $this->db->table('batch_files f')
// ->select("f.created_at")
// ->where('f.client_policy_id', $client_policy_id)
// ->where('f.insurer_or_tpa', 'tpa')
// ->where('f.actions', 'export')
// ->get()
// ->getResultArray();
$batchFiles = $this->db->table('batch_files f')
->select("f.created_at")
->where('f.client_policy_id', $client_policy_id)
->where('f.insurer_or_tpa', 'tpa')
->where('f.actions', 'export')
->get()
->getResultArray();
// if (empty($batchFiles)) {
// log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request');
// if ($function_calling_type == "job") {
// return ['status' => false, 'message' => 'batchFiles not found'];
// } else {
// return $this->respond(['status' => false, 'message' => 'batchFiles not found']);
// }
// }
if (empty($batchFiles)) {
log_message('error', 'TPA ID PULL FAILED HEALTH_INDIA | batchFiles is empty for this tpa id pull request');
if ($function_calling_type == "job") {
return ['status' => false, 'message' => 'batchFiles not found'];
} else {
return $this->respond(['status' => false, 'message' => 'batchFiles not found']);
}
}
// Generate Health India Token
$tokenResponse = json_decode($this->generateAuthToken()->getBody(), true);
@ -489,9 +491,9 @@ class HealthIndiaApiController extends BaseController
$response = call_third_party_api($url, 'POST', $headers, $body);
dd($response);
// dd($response);
log_message('error', "TPA ID PULL HEALTH_INDIA | API Response: " . json_encode($response));
log_message('error', "TPA ID PULL HEALTH_INDIA | API Response Received ");
if (($response['status'] ?? false) !== true) {
log_message('error', 'HEALTH_INDIA API FAILED | response: ' . json_encode($response));
@ -560,11 +562,22 @@ class HealthIndiaApiController extends BaseController
$employeePolicyModel = new EmployeePolicyModel();
$employeePolicyData = $employeePolicyModel
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.tpa_id IS NULL')
->findAll();
$employeePolicyData = $employeePolicyModel
->select('
employees.*,
employee_polices.id as emp_policy_id,
employee_polices.client_policy_id,
')
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.is_active', 1)
->where('employee_polices.status', 'active')
->where('employees.is_active', 1)
->where('employees.emp_status', 'active')
->where('employee_polices.tpa_id IS NULL')
->where('employee_polices.client_policy_id', $client_policy_id)
->findAll();
// echo (string) $employeePolicyModel->db->getLastQuery();
// dd($employeePolicyData);
$updated = 0;
$batch_file_success = 'success';
@ -575,10 +588,15 @@ class HealthIndiaApiController extends BaseController
foreach ($allMembers as $m) {
// Match based on: employee name, employee code, and relation
if($m['relation'] == 'Employee') { $relation = 'self'; }
else if($m['relation'] == 'WIFE') { $relation = 'spouse'; }
else { $relation = $m['relation']; }
if (
strtolower(trim($policy['name'])) === strtolower(trim($m['insured_Name'] ?? '')) &&
($policy['emp_code'] ?? '') == ($m['employeeCode'] ?? '') &&
strtolower($policy['relationship']) === strtolower($m['relation'] ?? '')
strtolower($policy['relationship']) === strtolower($relation ?? '')
) {
$hasMatchForThisPolicy = true;

View File

@ -121,29 +121,29 @@ class ICICILombardController extends AdminController
$body = [
"PolicyNumber" => "4016/PPN/A/O/53185987/00/000",
"CDBGAccountNumber" => "CD-MUM-0026",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440018",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440022",
"MemberDetails" => [
[
"MemberEmpId" => "EMPID3625562",
"MemberEmpId" => "EMPID3625565",
"DOJ" => "21-MAR-2019",
"InsuredName" => "Jeeva",
"InsuredName" => "sanjeev",
"DOB" => "7-JUL-1993",
"Relationship" => "SELF",
"Gender" => "MALE",
"DOC" => '19-Nov-2025',
"DOC" => '25-Jan-2026',
"SumInsured" => "500000",
"EmailId" => "Jeeva@GMAIL.COM",
"EmailId" => "sanjeev@GMAIL.COM",
"FlagStatus" => "A"
],
[
"MemberEmpId" => "EMPID3625562",
"MemberEmpId" => "EMPID3625565",
"DOJ" => "21-MAR-2019",
"InsuredName" => "Muthu",
"InsuredName" => "bhavya",
"DOB" => "8-AUG-1970",
"Relationship" => "MOTHER",
"Gender" => "FEMALE",
"DOC" => '19-Nov-2025',
"EmailId" => "Muthu@GMAIL.COM",
"DOC" => '25-Jan-2026',
"EmailId" => "bhavya@GMAIL.COM",
"FlagStatus" => "A"
],
]
@ -180,8 +180,8 @@ class ICICILombardController extends AdminController
$body = [
"PolicyNumber" => "4016/PPN/A/O/53185987/00/000",
"BatchId" => "3725147",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440018"
"BatchId" => "3728144",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440022"
];
$response = call_third_party_api($url, 'POST', $headers, $body, true);
@ -213,9 +213,9 @@ class ICICILombardController extends AdminController
];
$body = [
"PolicyNumber" => "4016/PPN/A/O/53167743/00/000",
"PolicyNumber" => "4016/PPN/A/O/53185987/00/000",
"IMID" => "201580517901",
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440018"
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440022"
];
$response = call_third_party_api($url, 'POST', $headers, $body, true);

View File

@ -195,6 +195,10 @@ class JobWorker extends AdminController
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\FhplApiController',
],
'HealthIndiaGetBenefDetails' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\HealthIndiaApiController',
],
'bdsDumpExcelFileFormatValidation' => [
'type' => 'CC', // Handler Category
'handler' => 'App\Controllers\PolicyTransactionController',

View File

@ -365,21 +365,10 @@ class LeadsController extends BaseController
{
// print_r($this->request->getPost()); die;
$id = $this->request->getPost('id');
$postData = $this->request->getPost();
$data = $this->prepareLeadData();
// print_r($data); die;
if (!$id) {
return $this->insertNewLead($data);
} else {
return $this->updateOldLead($id, $data);
}
}
private function prepareLeadData()
{
$rules = [
'lead_type' => [
'rules' => 'integer',
'errors' => ['required' => 'Lead Type is required']
@ -396,16 +385,12 @@ class LeadsController extends BaseController
'rules' => 'required|regex_match[/^[a-zA-Z0-9_ -]+$/]',
'errors' => [
'required' => 'Client Name is required',
'regex_match' => 'Client Name only letters, numbers and characters _ - and space are allowed'
'regex_match' => 'Client Name only letters, numbers, space, hyphens and underscores are allowed'
]
],
'client_short_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => ['required' => 'Client Short Name is required','regex_match' => 'Client Short Name only letters, numbers and characters _ and - are allowed']
],
'gst' => [
'rules' => 'required',
'errors' => ['required' => 'GST Number is required']
'errors' => ['required' => 'Client Short Name is required','regex_match' => 'Client Short Name only letters, numbers, hyphens and underscores are allowed']
],
'gst' => [
'rules' => 'required|regex_match[/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/]',
@ -418,7 +403,7 @@ class LeadsController extends BaseController
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]|min_length[3]',
'errors' => [
'required' => 'Branch Name is required.',
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, - and _.',
'regex_match' => 'Branch Name can only contain letters, numbers, spaces, hyphens and underscores..',
'min_length' => 'Branch Name must be at least 3 characters long.'
]
],
@ -426,21 +411,23 @@ class LeadsController extends BaseController
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => [
'required' => 'Branch Code is required.',
'regex_match' => 'Branch Code can only contain letters, numbers, - and _.'
'regex_match' => 'Branch Code can only contain letters, numbers, hyphens and underscores..'
]
],
'contact_person_name' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_ -]+$/]',
'errors' => [
'required' => 'Contact Person Name is required',
'regex_match' => 'Contact person name only letters, numbers and spaces, - and _.'
'regex_match' => 'Contact person name only letters, numbers and spaces, hyphens and underscores..'
]
],
'contact_person_mobile' => [
'rules' => 'required',
'rules' => 'required|regex_match[/^[0-9]+$/]',
'errors' => ['required' => 'Contact Person Mobile is required' ,
'regex_match' => 'Contact Person Mobile Only numbers'
'rules' => 'required|exact_length[10]|regex_match[/^[0-9]+$/]',
'errors' => [
'required' => 'Contact Person Mobile is required' ,
'regex_match' => 'Contact Person Mobile Only numbers',
'exact_length'=> 'Contact Person Mobile must be exactly 10 digits long.'
]
],
'contact_person_email' => [
@ -462,9 +449,23 @@ class LeadsController extends BaseController
'errors' => ['required' => 'Status is required']
]
];
$request_data = $this->request->getPost();
$data = sanitizeInputArrayAdvanced($request_data);
if (isset($data['lead_form_type']) && (int)$data['lead_form_type'] === 2) {
foreach ($postData as $key => $value) {
// Check if the key starts with 'docs_name_'
if (strpos($key, 'docs_name_') === 0) {
$rules[$key . '.*'] = [
'label' => 'Document Name',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9_\- ]+$/]',
'errors' => [
'regex_match' => 'Document Name in {field} can only contain letters, numbers, hyphens, and underscores.'
]
];
}
}
// print_r($rules); die;
if ((int)$this->request->getPost('lead_form_type') === 2) {
$rules['client_type'] = [
'rules' => 'required',
'errors' => ['required' => 'Client Type is required']
@ -481,6 +482,51 @@ class LeadsController extends BaseController
'rules' => 'required',
'errors' => ['required' => 'Date of Expiry is required']
];
if ((int)$this->request->getPost('claim_history') === 1) {
$rules['first_year.*'] = [
'rules' => 'required|regex_match[/^\d{4}-\d{4}$/]',
'errors' => ['required' => 'Claim Year is required for all entries.','regex_match' => 'Year must be in format YYYY-YYYY.']
];
$rules['first_policy_type_.*'] = [
'rules' => 'required|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => ['required' => 'Policy Type is required in Claim History.',
'regex_match' => 'Policy Type only letters, numbers, space, hyphens and underscores are allowed'
]
];
$rules['first_date_of_loss_.*'] = [
'rules' => 'required|regex_match[/^[0-9]{2}-[0-9]{2}-[0-9]{4}$/]',
'errors' => ['required' => 'Date of Loss is required.',
'regex_match' => 'Date of Loss must be inValid format.']
];
$rules['first_cause_of_loss.*'] = [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s_-]+$/]',
'errors' => [
'required' => 'Cause of Loss is required.',
'regex_match' => 'Cause of Loss only letters, numbers, space, hyphens and underscores are allowed'
]
];
$rules['first_claim_amount.*'] = [
'rules' => 'required|numeric',
'errors' => [
'required' => 'Claim Amount is required.',
'numeric' => 'Claim Amount must be a number.'
]
];
$rules['first_settled_amount.*'] = [
'rules' => 'required|numeric',
'errors' => ['required' => 'Settled Amount is required.',
'numeric' => 'Settled Amount must be a number.']
];
$rules['first_claim_status.*'] = [
'rules' => 'required|alpha_space',
'errors' => [
'required' => 'Claim Status is required.',
'alpha_space' => 'Claim Status should only contain letters and spaces.'
]
];
}
}
// 1. MANUALLY VALIDATE FILES BEFORE PROCESSING
@ -515,7 +561,41 @@ class LeadsController extends BaseController
// }
// }
if (!$this->validate($rules)) {
$isValid = $this->validate($rules);
$start_dates = $this->request->getPost('policy_start_date');
$end_dates = $this->request->getPost('policy_end_date');
if ($start_dates && $end_dates) {
$starts = is_array($start_dates) ? $start_dates : [$start_dates];
$ends = is_array($end_dates) ? $end_dates : [$end_dates];
foreach ($starts as $index => $s_date) {
$e_date = $ends[$index] ?? null;
if ($s_date && $e_date) {
$f_start = change_date_format($s_date, 'd/m/Y', 'Y-m-d');
$f_end = change_date_format($e_date, 'd/m/Y', 'Y-m-d');
if ($f_start && $f_end && ($f_end < $f_start)) {
$isValid = false;
// Determine the error key name
// If it's an array, we use index (e.g., policy_end_date.0)
$errorKey = is_array($start_dates) ? "policy_end_date.$index" : "policy_end_date";
$this->validator->setError($errorKey, 'Date of Expiry cannot be before Date of Commencement.');
}
}
}
}
if (!$isValid) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',
@ -524,8 +604,23 @@ class LeadsController extends BaseController
]);
}
// print_r($data); die;
if (!$id) {
return $this->insertNewLead($data);
} else {
return $this->updateOldLead($id, $data);
}
}
private function prepareLeadData()
{
$request_data = $this->request->getPost();
$data = sanitizeInputArrayAdvanced($request_data);
$data['client_type'] = 1;
$data['pan'] = "";
@ -793,7 +888,7 @@ class LeadsController extends BaseController
'source_policy_end_date' => $data['source_policy_end_date'] ?? null,
'claim_history' => $data['claim_history'] ?? 0,
'next_reminder_date' => $data['next_reminder_date'] ?? 0,
'next_reminder_date' => $data['next_reminder_date'] ?? null,
'is_insurer_auto_mail' => $data['is_insurer_auto_mail'] ?? 0
];
}

View File

@ -254,7 +254,7 @@ class MasterController extends AdminController
$this->myLogger->logme('error','Insurer Onboarding function called');
$headerData['tab_name'] = 'Insurer Masters';
$headerData['page_name'] = 'Insurers';
$types = array(
(object) array('id' => 'pvt', 'name' => 'PVT'),
(object) array('id' => 'psu', 'name' => 'PSU')
@ -284,29 +284,78 @@ class MasterController extends AdminController
$this->myLogger->logme('error','Insurer general info function called');
$rules = [
'name' => [
'rules' => 'required',
'errors' => [
'required' => 'Name is required'
]
],
'short_name' => [
'rules' => 'required|min_length[3]|max_length[8]',
'errors' => [
'required' => 'Short name is required',
'min_length' => 'Short name must be at least 3 characters',
'max_length' => 'Short name cannot exceed 8 characters'
]
],
'insurer_logo' => [
'name' => [
'label' => 'Insurer Name',
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\s\-_]+$/]'],
'errors' => [
'required' => 'Insurer Name is required.',
'regex_match' => 'Insurer Name can only contain letters, numbers, spaces, hyphens, and underscores.',
]
],
'short_name' => [
'label' => 'Insurer Short Name',
'rules' => ['required', 'regex_match[/^[a-zA-Z0-9\-_]+$/]'],
'errors' => [
'required' => 'Short Name is required.',
'regex_match' => 'Short Name can only contain letters, numbers, hyphens, and underscores.',
]
],
'type' => [
'label' => 'Insurer Type',
'rules' => 'permit_empty|in_list[pvt,psu]',
'errors' => [
'in_list' => 'Please select a valid Insurer Type (PVT or PSU).'
]
],
'category' => [
'label' => 'Insurer Category',
'rules' => 'permit_empty|in_list[life,general]',
'errors' => [
'in_list' => 'Please select a valid Category (Life or General).'
]
],
'addition_add_day' => [
'rules' => 'permit_empty' // Checkboxes return null if unchecked
],
'deletion_add_day' => [
'rules' => 'permit_empty'
],
'is_multi_event' => [
'rules' => 'permit_empty'
],
'insurer_logo' => [
'rules' => 'if_exist|is_image[insurer_logo]|max_size[insurer_logo,200]|ext_in[insurer_logo,jpg,jpeg,png]',
'errors' => [
'is_image' => 'The uploaded file must be an image',
'max_size' => 'File size should not exceed 200 KB',
'ext_in' => 'Allowed file types: jpg, jpeg, png',
]
],
];
],
];
// $rules = [
// 'name' => [
// 'rules' => 'required',
// 'errors' => [
// 'required' => 'Name is required'
// ]
// ],
// 'short_name' => [
// 'rules' => 'required|min_length[3]|max_length[8]',
// 'errors' => [
// 'required' => 'Short name is required',
// 'min_length' => 'Short name must be at least 3 characters',
// 'max_length' => 'Short name cannot exceed 8 characters'
// ]
// ],
// 'insurer_logo' => [
// 'rules' => 'if_exist|is_image[insurer_logo]|max_size[insurer_logo,200]|ext_in[insurer_logo,jpg,jpeg,png]',
// 'errors' => [
// 'is_image' => 'The uploaded file must be an image',
// 'max_size' => 'File size should not exceed 200 KB',
// 'ext_in' => 'Allowed file types: jpg, jpeg, png',
// ]
// ],
// ];
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
@ -370,34 +419,34 @@ class MasterController extends AdminController
],
'state' => [
'rules' => 'required|is_natural_no_zero',
'errors' => [
'required' => 'State is required'
]
],
'district' => [
'rules' => 'required|trim',
'errors' => [
'required' => 'District is required'
]
],
'city' => [
'rules' => 'required|trim',
'errors' => [
'required' => 'City is required'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required',
'numeric' => 'Pincode must contain only numbers',
'exact_length' => 'Pincode must be exactly 6 digits'
]
],
'label' => 'State',
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'required' => 'State is required.',
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
]
],
'district' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'required' => 'District is required.',
'regex_match' => 'District can contain letters, numbers, spaces, and hyphens.'
]
],
'city' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required.',
'numeric' => 'Pincode must be digits only.',
'exact_length' => 'Pincode must be exactly 6 digits.'
]
],
// ======================
// Contact Details (Array)
@ -422,7 +471,7 @@ class MasterController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -611,34 +660,34 @@ class MasterController extends AdminController
],
'state' => [
'rules' => 'required|is_natural_no_zero',
'errors' => [
'required' => 'State is required'
]
],
'district' => [
'rules' => 'required|trim',
'errors' => [
'required' => 'District is required'
]
],
'city' => [
'rules' => 'required|trim',
'errors' => [
'required' => 'City is required'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required',
'numeric' => 'Pincode must contain only numbers',
'exact_length' => 'Pincode must be exactly 6 digits'
]
],
'label' => 'State',
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'required' => 'State is required.',
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
]
],
'district' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'required' => 'District is required.',
'regex_match' => 'District can contain letters, numbers, spaces, and hyphens.'
]
],
'city' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required.',
'numeric' => 'Pincode must be digits only.',
'exact_length' => 'Pincode must be exactly 6 digits.'
]
],
// ======================
// Contact Details (Array)
@ -662,7 +711,7 @@ class MasterController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -1007,34 +1056,34 @@ class MasterController extends AdminController
],
'state' => [
'rules' => 'required|is_natural_no_zero',
'errors' => [
'required' => 'State is required'
]
],
'district' => [
'rules' => 'required|trim',
'errors' => [
'required' => 'District is required'
]
],
'city' => [
'rules' => 'required|trim',
'errors' => [
'required' => 'City is required'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required',
'numeric' => 'Pincode must contain only numbers',
'exact_length' => 'Pincode must be exactly 6 digits'
]
],
'label' => 'State',
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'required' => 'State is required.',
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
]
],
'district' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'required' => 'District is required.',
'regex_match' => 'District can contain letters, numbers, spaces, and hyphens.'
]
],
'city' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required.',
'numeric' => 'Pincode must be digits only.',
'exact_length' => 'Pincode must be exactly 6 digits.'
]
],
// ======================
// Contact Details (Array)
@ -1058,7 +1107,7 @@ class MasterController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -1320,35 +1369,34 @@ class MasterController extends AdminController
],
'state' => [
'rules' => 'required|is_natural_no_zero',
'errors' => [
'required' => 'State is required'
]
],
'district' => [
'rules' => 'required|trim',
'errors' => [
'required' => 'District is required'
]
],
'city' => [
'rules' => 'required|trim',
'errors' => [
'required' => 'City is required'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required',
'numeric' => 'Pincode must contain only numbers',
'exact_length' => 'Pincode must be exactly 6 digits'
]
],
'label' => 'State',
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'required' => 'State is required.',
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
]
],
'district' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'required' => 'District is required.',
'regex_match' => 'District can contain letters, numbers, spaces, and hyphens.'
]
],
'city' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required.',
'numeric' => 'Pincode must be digits only.',
'exact_length' => 'Pincode must be exactly 6 digits.'
]
],
// ======================
// Contact Details (Array)
// ======================
@ -1371,7 +1419,7 @@ class MasterController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -3522,7 +3570,7 @@ class MasterController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
'mobile' => [
@ -3540,28 +3588,28 @@ class MasterController extends AdminController
'min_length' => 'Address must be at least 5 characters'
]
],
'city' => [
'rules' => 'required|alpha_space',
'errors' => [
'required' => 'City is required',
'alpha_space' => 'City must contain only letters and spaces'
]
],
'state' => [
'rules' => 'required|alpha_space',
'errors' => [
'required' => 'State is required',
'alpha_space' => 'State must contain only letters and spaces'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required',
'numeric' => 'Pincode must contain only digits',
'exact_length' => 'Pincode must be exactly 6 digits'
]
],
'label' => 'State',
'rules' => 'required|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'required' => 'State is required.',
'regex_match' => 'State name can only contain letters, spaces, and hyphens.'
]
],
'city' => [
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-]+$/]',
'errors' => [
'regex_match' => 'City can contain letters, numbers, spaces, and hyphens.'
]
],
'pincode' => [
'rules' => 'required|numeric|exact_length[6]',
'errors' => [
'required' => 'Pincode is required.',
'numeric' => 'Pincode must be digits only.',
'exact_length' => 'Pincode must be exactly 6 digits.'
]
],
'aadhar' => [
'rules' => 'required|numeric|exact_length[12]',
'errors' => [

File diff suppressed because it is too large Load Diff

View File

@ -92,7 +92,7 @@ class ThzController extends BaseController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],

View File

@ -1136,11 +1136,11 @@ class TicketController extends BaseController
$rules = [
// --- EMPLOYEE DETAILS ---
'emp_code' => [
'label' => 'Employee Code',
'label' => 'Employee ID',
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => [
'required' => 'Employee Code is required.',
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, - and _ allowed).'
'required' => 'Employee ID is required.',
'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).'
]
],
'emp_name' => [
@ -1170,10 +1170,12 @@ class TicketController extends BaseController
'rules' => 'permit_empty|min_length[3]|max_length[50]|regex_match[/^[a-zA-Z0-9\s\-\/_]+$/]',
'errors' => [
'min_length' => 'Policy Number appears too short (min 5 characters).',
'regex_match' => 'Policy Number can only contain letters, numbers, spaces, hyphens(-), underscores(_), and slashes(/).'
'regex_match' => 'Policy Number can only contain letters, numbers, spaces, hyphens(-) underscores(_), and slashes(/).'
]
],
'tpa_no' => ['label' => 'TPA ID','rules' => 'permit_empty','errors' => []],
'tpa_no' => ['label' => 'TPA ID','rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9]+$/]','errors' => [
'regex_match' => 'TPA ID can only contain letters and numbers.'
]],
'emp_mobile' => ['label' => 'Employee Mobile No','rules' => 'required|numeric|exact_length[10]',
'errors' => [
'required' => 'Mobile number is required',
@ -1189,9 +1191,8 @@ class TicketController extends BaseController
]
],
'emp_personal_mail' => ['label' => 'Personal Mail ID',
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Personal Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -1215,23 +1216,51 @@ class TicketController extends BaseController
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
'errors' => ['required' => 'Claim Type is required']
],
'hospital_name' => ['label' => 'Hospital Name','rules' => 'required',
'errors' => ['required' => 'Hospital Name is required']
'hospital_name' => [
'label' => 'Hospital Name',
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-_.\']+$/]',
'errors' => [
'required' => 'Hospital Name is required',
'regex_match' => 'The {field} can only contain letters, numbers, spaces, dashes, underscores, dots, and apostrophes.'
]
],
'hospital_address' => ['label' => 'Hospital Address','rules' => 'required',
'errors' => ['required' => 'Hospital Address is required']
'hospital_address' => [
'label' => 'Hospital Address',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9\s\-_.,#\/]+$/]',
'errors' => [
'regex_match' => 'The {field} contains invalid characters (Allowed: letters, numbers, spaces, dashes, commas, dots, # and /).'
],
],
'hospital_city' => ['label' => 'Hospital City','rules' => 'required',
'errors' => ['required' => 'City is required']
'hospital_state' => [
'label' => 'Hospital State',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'regex_match' => 'Hospital State name can only contain letters, spaces, and hyphens.'
]
],
'hospital_state' => ['label' => 'Hospital State','rules' => 'required',
'errors' => ['required' => 'State is required']
'hospital_city' => [
'label' => 'Hospital City', // Added label for consistency
'rules' => 'permit_empty|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'regex_match' => 'Hospital City can only contain letters, spaces, and hyphens.'
]
],
'hospital_pin_code' => ['label' => 'Hospital Pincode','rules' => 'required|numeric|exact_length[6]',
'errors' => ['exact_length' => 'Pincode must be 6 digits']
'hospital_pin_code' => [
'label' => 'Hospital Pincode',
'rules' => 'permit_empty|numeric|exact_length[6]',
'errors' => [
'numeric' => 'Hospital Pincode must be digits only.',
'exact_length' => 'Hospital Pincode must be exactly 6 digits.'
]
],
'hospital_phone_no' => ['label' => 'Hospital Phone','rules' => 'required|numeric|min_length[10]',
'errors' => ['min_length' => 'Phone number too short']
'hospital_phone_no' => [
'label' => 'Hospital Phone',
'rules' => 'permit_empty|numeric|min_length[10]|max_length[15]',
'errors' => [
'numeric' => 'Phone number must contain only digits.',
'min_length' => 'Phone number is too short.',
'max_length' => 'Phone number is too long.'
]
],
'doa' => ['label' => 'DOA', 'rules' => 'required',
'errors' => ['required' => 'Date of Admission is required']
@ -1317,11 +1346,11 @@ class TicketController extends BaseController
$rules = [
// --- EMPLOYEE DETAILS ---
'emp_code' => [
'label' => 'Employee Code',
'label' => 'Employee ID',
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => [
'required' => 'Employee Code is required.',
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, - and _ allowed).',
'required' => 'Employee ID is required.',
'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
]
],
'emp_name' => [
@ -1348,9 +1377,8 @@ class TicketController extends BaseController
]
],
'emp_personal_mail' => ['label' => 'Personal Mail ID',
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Personal Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -1457,11 +1485,11 @@ class TicketController extends BaseController
$rules = [
// --- EMPLOYEE DETAILS ---
'emp_code' => [
'label' => 'Employee Code',
'label' => 'Employee ID',
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => [
'required' => 'Employee Code is required.',
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, - and _ allowed).',
'required' => 'Employee ID is required.',
'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
]
],
'emp_name' => [
@ -1490,11 +1518,13 @@ class TicketController extends BaseController
// Allows: A-Z, a-z, 0-9, spaces (\s), hyphens (\-), underscores (_), and slashes (\/)
'rules' => 'permit_empty|min_length[3]|max_length[50]|regex_match[/^[a-zA-Z0-9\s\-\/_]+$/]',
'errors' => [
'min_length' => 'Policy Number appears too short (min 5 characters).',
'regex_match' => 'Policy Number can only contain letters, numbers, spaces, hyphens(-), underscores(_), and slashes(/).'
'min_length' => 'Policy Number appears too short (min 3 characters).',
'regex_match' => 'Policy Number can only contain letters, numbers, spaces, hyphens(-) underscores(_), and slashes(/).'
]
],
'tpa_no' => ['label' => 'TPA ID','rules' => 'permit_empty','errors' => []],
'tpa_no' => ['label' => 'TPA ID','rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9]+$/]','errors' => [
'regex_match' => 'TPA ID can only contain letters and numbers.'
]],
'emp_mobile' => ['label' => 'Employee Mobile No','rules' => 'required|numeric|exact_length[10]',
'errors' => [
'required' => 'Mobile number is required',
@ -1510,9 +1540,8 @@ class TicketController extends BaseController
]
],
'emp_personal_mail' => ['label' => 'Personal Mail ID',
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Personal Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -1536,23 +1565,51 @@ class TicketController extends BaseController
'claim_type' => ['label' => 'Claim Type','rules' => 'required',
'errors' => ['required' => 'Claim Type is required']
],
'hospital_name' => ['label' => 'Hospital Name','rules' => 'required',
'errors' => ['required' => 'Hospital Name is required']
'hospital_name' => [
'label' => 'Hospital Name',
'rules' => 'required|regex_match[/^[a-zA-Z0-9\s\-_.\']+$/]',
'errors' => [
'required' => 'Hospital Name is required',
'regex_match' => 'The {field} can only contain letters, numbers, spaces, dashes, underscores, dots, and apostrophes.'
]
],
'hospital_address' => ['label' => 'Hospital Address','rules' => 'required',
'errors' => ['required' => 'Hospital Address is required']
'hospital_address' => [
'label' => 'Hospital Address',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9\s\-_.,#\/]+$/]',
'errors' => [
'regex_match' => 'The {field} contains invalid characters (Allowed: letters, numbers, spaces, dashes, commas, dots, # and /).'
],
],
'hospital_city' => ['label' => 'Hospital City','rules' => 'required',
'errors' => ['required' => 'City is required']
'hospital_state' => [
'label' => 'Hospital State',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'regex_match' => 'Hospital State name can only contain letters, spaces, and hyphens.'
]
],
'hospital_state' => ['label' => 'Hospital State','rules' => 'required',
'errors' => ['required' => 'State is required']
'hospital_city' => [
'label' => 'Hospital City', // Added label for consistency
'rules' => 'permit_empty|regex_match[/^[a-zA-Z\s\-]+$/]',
'errors' => [
'regex_match' => 'Hospital City can only contain letters, spaces, and hyphens.'
]
],
'hospital_pin_code' => ['label' => 'Hospital Pincode','rules' => 'required|numeric|exact_length[6]',
'errors' => ['exact_length' => 'Pincode must be 6 digits']
'hospital_pin_code' => [
'label' => 'Hospital Pincode',
'rules' => 'permit_empty|numeric|exact_length[6]',
'errors' => [
'numeric' => 'Hospital Pincode must be digits only.',
'exact_length' => 'Hospital Pincode must be exactly 6 digits.'
]
],
'hospital_phone_no' => ['label' => 'Hospital Phone','rules' => 'required|numeric|min_length[10]',
'errors' => ['min_length' => 'Phone number too short']
'hospital_phone_no' => [
'label' => 'Hospital Phone',
'rules' => 'permit_empty|numeric|min_length[10]|max_length[15]',
'errors' => [
'numeric' => 'Phone number must contain only digits.',
'min_length' => 'Phone number is too short.',
'max_length' => 'Phone number is too long.'
]
],
'doa' => ['label' => 'DOA', 'rules' => 'required',
'errors' => ['required' => 'Date of Admission is required']
@ -1638,11 +1695,11 @@ class TicketController extends BaseController
$rules = [
// --- EMPLOYEE DETAILS ---
'emp_code' => [
'label' => 'Employee Code',
'label' => 'Employee ID',
'rules' => 'required|min_length[2]|max_length[20]|regex_match[/^[a-zA-Z0-9_-]+$/]',
'errors' => [
'required' => 'Employee Code is required.',
'regex_match' => 'Employee Code cannot contain spaces or special characters (only letters, numbers, - and _ allowed).',
'required' => 'Employee ID is required.',
'regex_match' => 'Employee ID cannot contain spaces or special characters (only letters, numbers, hyphens and underscores. allowed).',
]
],
'emp_name' => [
@ -1669,9 +1726,8 @@ class TicketController extends BaseController
]
],
'emp_personal_mail' => ['label' => 'Personal Mail ID',
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Personal Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -1930,7 +1986,7 @@ class TicketController extends BaseController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
'mail_subject' => [
@ -3124,11 +3180,12 @@ class TicketController extends BaseController
],
'url.*' => [
'label' => 'URL',
'rules' => 'required',
'rules' => 'if_exist|required|regex_match[/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/]',
'errors' => [
'required' => 'URL is required',
'required' => 'URL is required.',
'regex_match' => 'The URL format is invalid. Example: www.google.com or https://google.com'
]
]
],
];
if (!$this->validate($rules)) {

View File

@ -114,11 +114,13 @@ class UserController extends AdminController
// Employee Code
// ======================
'emp_code' => [
'rules' => 'required|min_length[3]|max_length[15]',
'label' => 'Employee Code',
'rules' => 'required|min_length[3]|max_length[15]|regex_match[/^[a-zA-Z0-9_\-\/]+$/]',
'errors' => [
'required' => 'Employee Code is required',
'min_length' => 'Employee Code must be at least 3 characters',
'max_length' => 'Employee Code cannot exceed 15 characters',
'required' => 'Employee Code is required',
'min_length' => 'Employee Code must be at least 3 characters',
'max_length' => 'Employee Code cannot exceed 15 characters',
'regex_match' => 'Employee Code can only contain letters, numbers, underscores, hyphens, and forward slashes (/).'
]
],
@ -142,7 +144,7 @@ class UserController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -178,13 +180,10 @@ class UserController extends AdminController
]
],
];
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',
'code' => 400,
'errors' => $this->validator->getErrors()
]);
if (!$this->validate($rules)) {
return redirect()->to(base_url('/user/list'))
->withInput()
->with('errors', $this->validator->getErrors());
}
$userData['created_by'] = get_session_userid();
@ -298,11 +297,13 @@ class UserController extends AdminController
// Employee Code
// ======================
'emp_code' => [
'rules' => 'required|min_length[3]|max_length[15]',
'label' => 'Employee Code',
'rules' => 'required|min_length[3]|max_length[15]|regex_match[/^[a-zA-Z0-9_\-\/]+$/]',
'errors' => [
'required' => 'Employee Code is required',
'min_length' => 'Employee Code must be at least 3 characters',
'max_length' => 'Employee Code cannot exceed 15 characters',
'required' => 'Employee Code is required',
'min_length' => 'Employee Code must be at least 3 characters',
'max_length' => 'Employee Code cannot exceed 15 characters',
'regex_match' => 'Employee Code can only contain letters, numbers, underscores, hyphens, and forward slashes (/).'
]
],
@ -326,7 +327,7 @@ class UserController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
@ -363,12 +364,9 @@ class UserController extends AdminController
],
];
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
'message' => 'Input validation failed',
'code' => 400,
'errors' => $this->validator->getErrors()
]);
return redirect()->to(base_url('/user/list'))
->withInput()
->with('errors', $this->validator->getErrors());
}
$data = $this->request->getPost();
@ -832,7 +830,7 @@ class UserController extends AdminController
'rules' => 'required|regex_match[/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/]',
'errors' => [
'required' => 'Email address is required.',
'regex_match' => 'Please enter a valid email format (e.g., name@company.com).'
'regex_match' => 'Please enter a valid email format (e.g., name@domain.com).'
]
],
// ======================
@ -845,7 +843,7 @@ class UserController extends AdminController
],
'errors' => [
'required' => 'Retention Rate is required',
'regex_match' => 'Retention Rate must be between 0 and 100 with up to 2 decimal places'
'regex_match' => 'Retention Rate must be between 0 to 100 with up to 2 decimal places'
]
],
// ======================

View File

@ -77,7 +77,8 @@ class VidalApiController extends BaseController
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_HTTPHEADER, [
"x-ms-blob-type: BlockBlob",
"Content-Length: $fileSize"
"Content-Length: $fileSize" ,
"Content-Type: multipart/form-data"
]);
$uploadResponse = curl_exec($ch2);

View File

@ -1114,9 +1114,9 @@ class EmployeePolicyModel extends Model
public function getDeletionEmployeeDataForExportExcel($ref_data, $return_type = 0)
{
$client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_id'];
$client_branch_id = $ref_data['client_branch_id'];
$client_id = (string) "'".$ref_data['client_id']."'";
$client_policy_id = (string) "'".$ref_data['client_policy_id']."'";
$client_branch_id = (string) "'".$ref_data['client_branch_id']."'";
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
$get_insurer_id_from_client_policy = $this->db->table('client_policy')
@ -1929,6 +1929,8 @@ class EmployeePolicyModel extends Model
public function getDeletionDataForTruncated($file_id)
{
$file_id = (int)$file_id;
// Fetch the necessary details in a single query using JOINs
$result = $this->db->table('files f')
->select('i.deletion_add_day')
@ -2064,6 +2066,8 @@ class EmployeePolicyModel extends Model
$action = "da";
}
$file_id = (int)$file_id;
$query = $this->db->query("
SELECT
@ -2086,6 +2090,7 @@ class EmployeePolicyModel extends Model
// dd($this->db->getLastQuery(), $result);
// dd($result);
return $result[0];
}
@ -2096,6 +2101,8 @@ class EmployeePolicyModel extends Model
log_message('error', 'updateEmployeePolicyTruncateReverse model function called');
log_message('error', 'FILE ID : {data}', ['data' => $file_id]);
$file_id = (int)$file_id;
$this->db->query("
UPDATE employee_polices
SET
@ -2137,6 +2144,9 @@ class EmployeePolicyModel extends Model
//calculate the CD Transaction sum of the amount for the inception, addition, dependent addition, missed inception
public function calculateCdTranctionAmount($file_id)
{
$file_id = (int)$file_id;
$query = $this->db->query("
SELECT

View File

@ -73,6 +73,6 @@ class MessageModel extends Model
$query = $builder->get();
return $query->getResult();
dd($this->db->getLastQuery());
// dd($this->db->getLastQuery());
}
}

View File

@ -2432,6 +2432,9 @@
return $result;
}
//not in use function due to complexity of query and union, so writing raw query with bindings to avoid sql injection
public function getBDSReportListSingleUnion($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0, $user_id = 0, $where = [])
{
@ -3015,6 +3018,15 @@
public function getBDSReportList($start_date = 0, $end_date = 0, $client_id = 0, $insurer_id = 0, $policy_type_id = 0, $date_type = 0, $issuer = 0, $client_branch_id = 0, $insurer_branch_id = 0, $client_policy_id = 0, $user_id = 0, $where = [])
{
$client_id = (int)$client_id;
$insurer_id = (int)$insurer_id;
$policy_type_id = (int)$policy_type_id;
$client_branch_id = (int)$client_branch_id;
$insurer_branch_id = (int)$insurer_branch_id;
$client_policy_id = (int)$client_policy_id;
$user_id = (int)$user_id;
$issuer = (int)$issuer;
$whereAdded = false;
$statement_month_condition = '';
if ($date_type == 'statement_month' && $start_date != 0 && $end_date != 0) {
@ -3689,6 +3701,8 @@
";
$query = $this->db->query($sql);
$result = $query->getResultArray();
// $countofalldata = count($result);
// dd($result);
// dd($this->db->getLastQuery()->getQuery());

View File

@ -884,12 +884,18 @@ table.dataTable tbody td {
</table>
</div>
</div>
<?php if (session()->getFlashdata('errors')): ?>
<script>
$(document).ready(function() {
<?php foreach (session()->getFlashdata('errors') as $error): ?>
toastr.error("<?= addslashes($error) ?>", "Validation Error");
<?php endforeach; ?>
});
</script>
<?php endif; ?>
<?php if (session()->getFlashdata('error')) : ?>
<?php foreach (session()->getFlashdata('error') as $error) : ?>
<script>
toastr.error("<?= esc($error) ?>", "Validation Error");
</script>
<?php endforeach; ?>
<script>
var errorModal = new bootstrap.Modal(

View File

@ -67,12 +67,12 @@
<div class="form-row">
<div class="form-group col-md-6">
<label for="mobile">CD Account Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="cd_ac_no_for_cd_master" name="cd_ac_no" required>
<input type="text" class="form-control" id="cd_ac_no_for_cd_master" name="cd_ac_no" onkeypress="return onlyNumbers(event)" required data-parsley-type="digits">
</div>
<div class="form-group col-md-6">
<label for="mobile">Opening Amount<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required>
<input type="text" class="form-control" id="opening_bal" name="opening_bal" onkeypress="return onlyNumbers(event)" required data-parsley-type="digits">
</div>
</div>

View File

@ -221,6 +221,7 @@ input:checked + .slider:before {
$(document).ready(function() {
$('#client_logo').change(function() {
validateFile(this);
return;
});
$('#parent_client_id').select2();
});
@ -415,44 +416,60 @@ input:checked + .slider:before {
function validateFile(input) {
if (!input.files || !input.files[0]) return;
const file = input.files[0];
const allowedExtensions = ["jpg", "jpeg", "png"];
const fileExtension = file.name.split(".").pop().toLowerCase();
const fileSize = file.size / 1024; // KB
// Log Initial Info
console.log("File Selected:", file.name);
console.log("File Size:", fileSize.toFixed(2) + " KB");
// Check if the file extension is allowed
if (!allowedExtensions.includes(fileExtension)) {
toastr.warning('Only JPG, JPEG, PNG files are allowed.', 'Invalid file type.');
$("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
input.value = "";
resetImageInput(input);
return;
}
// Check file size
const fileSize = file.size / 1024; // in KB
if (fileSize > 200) {
console.error("Validation Failed: File too large (" + fileSize.toFixed(2) + " KB)");
toastr.warning('Maximum file size allowed is 200KB.', 'File size exceeds limit.');
$("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
input.value = "";
resetImageInput(input);
return;
}
// Check image dimensions
const img = new Image();
img.src = URL.createObjectURL(file);
img.onload = function() {
console.log("Dimensions Detected:", this.width + "x" + this.height);
if (this.width !== 100 || this.height !== 100) {
console.error("Validation Failed: Wrong dimensions.");
toastr.warning('Image dimensions should be 100x100 pixels.', 'Invalid image dimensions.');
$("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
}
resetImageInput(input); // CRITICAL: This stops the file from being sent
}else {
console.log("Validation Passed: Image is 100x100 and under 200KB.");
// If both size and dimensions are valid, you can proceed with your logic here
// For example, you can display the image
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById("uploadPreview").src = e.target.result;
$("#uploadPreview").attr("src", e.target.result);
};
reader.readAsDataURL(file);
}
};
img.src = URL.createObjectURL(file);
}
// Helper function to clear the preview and the file input
function resetImageInput(input) {
input.value = ""; // This clears the file so it won't be submitted
$("#uploadPreview").attr("src", "<?= base_url()?>/public/assets/images/avatar_2x.png");
}
</script>

View File

@ -108,11 +108,36 @@ $("#drive_file_upload_form").submit(function(event) {
$('#drive_file_upload_form')[0].reset();
},
error: function (xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
error:function (xhr) {
if (xhr.status === 400) {
let response = JSON.parse(xhr.responseText);
let errorMessages = "";
let seenMessages = []; // Array to store unique messages
if (response.errors) {
$.each(response.errors, function (field, message) {
if (!seenMessages.includes(message)) {
errorMessages += `• ${message}<br>`;
seenMessages.push(message); // Mark this message as "seen"
}
});
toastr.error(errorMessages, 'Validation Error', { "allowHtml": true });
} else {
toastr.warning(response.message || 'Validation failed', 'Warning');
}
} else if (xhr.status === 403) {
let response = JSON.parse(xhr.responseText);
toastr.error(response.message, 'Security Policy');
} else if (xhr.status === 500) {
toastr.error('Something went wrong . Please try again later.', 'Server Error');
} else {
toastr.error('An unexpected error occurred. Please try again later.', 'Error');
}
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
});

View File

@ -573,7 +573,8 @@ if (isset($selected_lead_type)) {
<input type="text" class="form-control" name="docs_name_${increment}[]" placeholder="${placeholder}">
</div>
<div class="form-group col-md-5">
<label>File Upload<span class="text-danger"></span></label>
<label>File Upload<span class="text-danger"></span></label><br>
<span class="text-danger">PDF | Excel (XLSX, XLS) | Images (PNG, JPG)</span>
<input type="file" class="form-control" id="file_name_${fileIndex}" name="file_name_${increment}[]" accept="${accept}">
</div>
<div class="col-md-2" style="position: relative; bottom: 16px;">
@ -638,7 +639,8 @@ if (isset($selected_lead_type)) {
</div>
<div class="col-auto" style="align-content: center;">
<label>File Upload </label>
<label>File Upload </label> <br>
<span class="text-danger">PDF | Excel (XLSX, XLS) | Images (PNG, JPG)</span>
</div>
<div class="col-md-3">
<div class="input-icon">

View File

@ -1027,7 +1027,7 @@
<div class="form-group col-md-2">
<label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
<select class="form-control first_year_" id="first_year_${increment}" name="first_year[]">
<select class="form-control claim-input first_year_" id="first_year_${increment}" name="first_year[]">
<option value="">Select Year</option>
<?php foreach ($lastFiveYears as $year) {
echo "<option value='$year'>$year</option>";
@ -1036,27 +1036,27 @@
</div>
<div class="form-group col-md-2">
<label for="first_policy_type_${increment}">Policy Type<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_policy_type_${increment}" name="first_policy_type_[]">
<input type="text" class="form-control claim-input" id="first_policy_type_${increment}" name="first_policy_type_[]">
</div>
<div class="form-group col-md-2">
<label for="first_date_of_loss_${increment}">Date of Loss<span class="text-danger">*</span></label>
<input type="text" class="form-control loss_date" id="first_date_of_loss_${increment}" name="first_date_of_loss_[]">
<input type="text" class="form-control loss_date claim-input" id="first_date_of_loss_${increment}" name="first_date_of_loss_[]">
</div>
<div class="form-group col-md-2">
<label for="first_cause_of_death_${increment}">Cause Of Loss <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_cause_of_loss_${increment}" name="first_cause_of_loss[]">
<input type="text" class="form-control claim-input" id="first_cause_of_loss_${increment}" name="first_cause_of_loss[]">
</div>
<div class="form-group col-md-2">
<label for="first_claim_amount_${increment}">Claim Amount<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_claim_amount_${increment}" name="first_claim_amount[]">
<input type="text" class="form-control claim-input" id="first_claim_amount_${increment}" name="first_claim_amount[]">
</div>
<div class="form-group col-md-2">
<label for="first_claim_amount_${increment}">Settled Amount<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_settled_amount_${increment}" name="first_settled_amount[]">
<input type="text" class="form-control claim-input" id="first_settled_amount_${increment}" name="first_settled_amount[]">
</div>
<div class="form-group col-md-2">
<label for="first_claim_status_${increment}">Claim Status<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="first_claim_status_${increment}" name="first_claim_status[]">
<input type="text" class="form-control claim-input" id="first_claim_status_${increment}" name="first_claim_status[]">
</div>
<div class="form-group col-md-2">
<div class="" style="position: relative; top: 28px; float: right; text-align: end;">
@ -1072,6 +1072,16 @@
referenceDiv.insertAdjacentHTML('beforeend', claimsFields);
let isChecked = $("#claim_history").length > 0 ? $("#claim_history").prop("checked") : true;
let lastRow = $(".claim-row").last();
if (isChecked) {
lastRow.show();
lastRow.find(".claim-input").attr("required", true);
} else {
lastRow.hide();
lastRow.find(".claim-input").removeAttr("required");
}
// Increment claim index
increment = increment + 1;
@ -1143,9 +1153,15 @@
// No rows yet, so create them
appendThreeYearsClaims();
}
$(".claim-input").attr("required", true);
} else {
$(".claim-row").hide();
$(".claim-input").removeAttr("required"); // Required Attributes Remove
$(".claim-input").val(""); // Value Reset
$(".claim-input").each(function() {
$(this).parsley().reset(); // Validation Reset
});
}
}

View File

@ -741,12 +741,12 @@
</div>
<div class="form-group col-md-3">
<label for="bp_cgst">D.O.C</label>
<label for="bp_cgst">D.O.C <span class="text-danger">*</span></label>
<input id="policy_start_date" type="text" class="form-control" name="policy_start_date" placeholder="DD/MM/YYYY" >
</div>
<div class="form-group col-md-3">
<label for="bp_igst">D.O.E</label>
<label for="bp_igst">D.O.E <span class="text-danger">*</span></label>
<input id="policy_end_date" type="text" class="form-control" name="policy_end_date" placeholder="DD/MM/YYYY" >
</div>
<!--

View File

@ -383,12 +383,23 @@
let $label = $('#employee_data_points_label');
let $input = $('#emp_mobile_number_for_claim');
// Remove old attributes but DO NOT clear the .val()
$input.removeAttr('onkeypress maxlength oninput');
if (value == "mobile") {
$label.text('Employee Mobile Number');
$input.attr('onkeypress', 'return onlyNumbers(event)').attr('maxlength', '10');
$input.val($input.val().replace(/[^0-9]/g, '').substring(0, 10));
$input.attr('oninput', "this.value = this.value.replace(/[^0-9]/g, '').substring(0, 10)");
} else {
$label.text('Employee ID');
$input.removeAttr('onkeypress maxlength');
$input.attr('onkeypress', 'return onlyEmployee(event)');
$input.val($input.val().replace(/[^a-zA-Z0-9\s\-_/]/g, ''));
$input.attr('oninput', "this.value = this.value.replace(/[^a-zA-Z0-9\\s\\-_/]/g, '')");
}
});
@ -1069,6 +1080,24 @@
return false;
}
function onlyEmployee(event) {
var charCode = (event.which) ? event.which : event.keyCode;
// Allow Numbers (48-57)
// Allow Uppercase (65-90)
// Allow Lowercase (97-122)
// Allow Space (32), Hyphen (45), Underscore (95), Forward Slash (47)
if (
(charCode >= 48 && charCode <= 57) ||
(charCode >= 65 && charCode <= 90) ||
(charCode >= 97 && charCode <= 122) ||
[32, 45, 95, 47].includes(charCode)
) {
return true;
}
return false;
}
function setClientPolicyData(input) {
// console.log('policy_value ',input);