diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index af024fd7..2d86b540 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -1717,14 +1717,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'); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index 0f5be81d..c03b7069 100755 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -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([ diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 076d1303..7b4ef595 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -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, hyphens and underscores. 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' => [ @@ -1332,11 +1332,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, hyphens and underscores. 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' => [ @@ -1471,11 +1471,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, hyphens and underscores. 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' => [ @@ -1653,11 +1653,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, hyphens and underscores. 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' => [ diff --git a/app/Views/cd_master_add_modal.php b/app/Views/cd_master_add_modal.php index 7a8cf69f..2d9c0143 100644 --- a/app/Views/cd_master_add_modal.php +++ b/app/Views/cd_master_add_modal.php @@ -67,7 +67,7 @@
- +