diff --git a/app/Config/Acl.php b/app/Config/Acl.php index a1b44339..9e04a90a 100644 --- a/app/Config/Acl.php +++ b/app/Config/Acl.php @@ -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]], diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 02f194d1..0bbec752 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -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'); 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/LeadsController.php b/app/Controllers/LeadsController.php index 958d7eba..0f96da92 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -366,18 +366,6 @@ class LeadsController extends BaseController // print_r($this->request->getPost()); die; $id = $this->request->getPost('id'); $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' => [ @@ -396,16 +384,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}$/]', @@ -438,9 +422,11 @@ class LeadsController extends BaseController ], '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,8 +448,7 @@ 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) { $rules['client_type'] = [ 'rules' => 'required', @@ -524,8 +509,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'] = ""; 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/Controllers/VidalApiController.php b/app/Controllers/VidalApiController.php index eac51552..c5274eff 100644 --- a/app/Controllers/VidalApiController.php +++ b/app/Controllers/VidalApiController.php @@ -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); 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 @@