diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 3c2af991..4b09e9ae 100755 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -41,6 +41,7 @@ use App\Models\PolicyTransactionStatusModel; use App\Models\VehicleModel; use App\Models\LeadsModel; use App\Models\ClientApiModel; +use App\Models\HRAccessControlModel; use App\Controllers\EmpDataServiceController; use App\Controllers\GoogleDriveController; @@ -88,6 +89,7 @@ class ClientController extends AdminController protected $leadsModel; protected $clientApi; protected $PTCOShareDetailsModel; + protected $HRAccessControlModel; public function __construct() @@ -125,6 +127,7 @@ class ClientController extends AdminController $this->leadsModel = new LeadsModel(); $this->clientApi = new ClientApiModel(); $this->PTCOShareDetailsModel = new PTCOShareDetailsModel(); + $this->HRAccessControlModel = new HRAccessControlModel(); } //-------------------------------------------------------------------------------------------------------- @@ -674,7 +677,7 @@ class ClientController extends AdminController } $data['insurerName'] = $this->insurerModel->getInsurerName($insurerId, $clientId); - $data['depositdata'] = $this->clientPolicyModel->getdepositData($clientId, $insurerId, $cd_ac_pk); + $data['depositdata'] = $this->clientPolicyModel->getdepositData($clientId, $insurerId, $cd_ac_pk, $subTypeOptions); $data['clientData'] = $this->clientPolicyModel->getClientById($clientId); $data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId, $cd_ac_pk); $data['cd_ac_pk'] = $cd_ac_pk; @@ -1031,19 +1034,9 @@ class ClientController extends AdminController $insert = $this->clientBranchModel->insert($data); if ($insert) { - for ($i = 0; $i < count($this->request->getPost('name')); $i++) { - // Prepare data to insert - $data = [ - 'contact_type' => 'client', - 'ref_id' => $insert, - 'created_by' => get_session_userid(), - 'name' => $this->request->getPost('name')[$i], - 'email' => $this->request->getPost('email')[$i], - 'mobile' => $this->request->getPost('mobile')[$i], - 'designation' => $this->request->getPost('designation')[$i] - ]; - $contacts = $this->levelContactModel->insert($data); - } + $level_contact_data = $this->request->getPost('level_contect_data'); + $level_contact_data = !empty($level_contact_data) ? json_decode($level_contact_data, true) : null; + $this->saveLevelContacts($level_contact_data, $insert); } if ($insert) { @@ -1135,19 +1128,9 @@ class ClientController extends AdminController if ($insert) { - $this->levelContactModel->where('ref_id', $id)->where('contact_type', 'client')->delete(); - for ($i = 0; $i < count($this->request->getPost('name')); $i++) { - $data = [ - 'contact_type' => 'client', - 'ref_id' => $id, - 'updated_by' => get_session_userid(), - 'name' => $this->request->getPost('name')[$i], - 'email' => $this->request->getPost('email')[$i], - 'mobile' => $this->request->getPost('mobile')[$i], - 'designation' => $this->request->getPost('designation')[$i] - ]; - $contacts = $this->levelContactModel->insert($data); - } + $level_contact_data = $this->request->getPost('level_contect_data'); + $level_contact_data = !empty($level_contact_data) ? json_decode($level_contact_data, true) : null; + $this->saveLevelContacts($level_contact_data, $id); } if ($insert) { @@ -1161,7 +1144,8 @@ class ClientController extends AdminController 'list_of_branch_units' => $list_of_branch_units, 'total_count' => $total_count, 'uncommonValues' => $uncommonValues, - 'message' => 'Client branch updated successfully' + 'message' => 'Client branch updated successfully', + 'response_data' => $this->request->getPost() ], 200); } else { @@ -1169,6 +1153,24 @@ class ClientController extends AdminController } } + public function saveLevelContacts($level_contact_data, $branch_id) + { + if (!empty($level_contact_data) && is_array($level_contact_data)) { + foreach ($level_contact_data as $value) { + if (!empty($value['id'])) { + $id = $value['id']; + unset($value['id']); + $this->levelContactModel->update($id, $value); + } else { + unset($value['id']); + $value['contact_type'] = "client"; + $value['ref_id'] = $branch_id ?? null; + $this->levelContactModel->insert($value); + } + } + } + } + public function createClientPolicy() @@ -4869,7 +4871,7 @@ class ClientController extends AdminController // ---------- EMP SERVICE CONTROLLER -------------------------------------------------------------------------------- $employeeRestController = new EmployeeServiceController(); - // $employeeRestController->excelFileDataValidation(['file_id' => 823]); + // $employeeRestController->excelFileDataValidation(['file_id' => 1629]); die; // $employeeRestController->employeesOnboardPreprocess(['file_id' => 726]); // $employeeRestController->employeesOnboardProcess(['file_id' => 835]); // $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]); @@ -4888,18 +4890,20 @@ class ClientController extends AdminController // ----------EMP DATA SERVICE CONTROLLER-------------------------------------------------------------------------------- + $batch_data = [ + 'client_id' => 97, + 'client_policy_id' => 6174, + 'client_branch_id' => 73, + 'insurer_or_tpa' => "insurer", + 'event_type' => "deletion", + 'actions' => "export", + 'file_name' => "deletion_enhancement_test_file.xlsx", + ]; + // $batch_data = [ // 'client_id' => 29, - // 'client_policy_id' => 17, - // 'client_branch_id' => 15, - // 'insurer_or_tpa' => "insurer", - // 'event_type' => "deletion", - // ]; - - // $batch_data = [ - // 'client_id' => 89, - // 'client_policy_id' => 328, - // 'client_branch_id' => 88, + // 'client_policy_id' => 77, + // 'client_branch_id' => 45, // 'insurer_or_tpa' => "insurer", // // 'insurer_or_tpa' => "tpa", // 'event_type' => "si_enhancement", @@ -4920,11 +4924,12 @@ class ClientController extends AdminController // $EmpDataServiceController->sendMailForDownloadingECard($ids); $EmpDataServiceController = new EmpDataServiceController(); + // $return = $EmpDataServiceController->generateExcelForDeletion($batch_data); dd($return); die; // $EmpDataServiceController->generateExcelForSIEnhancement($batch_data); die; // $EmpDataServiceController->importInceptionFileValidation(['file_id' => 1932]); die; // $EmpDataServiceController->importDeletionValidation(['file_id' => 304]); //for live // $EmpDataServiceController->importSIEnhancementUpdateEndorsementID(['file_id' => 1199]); //for live - // $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 1205]); //for live + // $result = $EmpDataServiceController->importSIEnhancementValidation(['file_id' => 2496]); //for live // $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 214]); //for live // $result = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($batch_data); @@ -5105,12 +5110,19 @@ class ClientController extends AdminController - // $param = "533454"; + // $param = 9715454901; // $type = 'emp_code'; // $client_policy_id = 64; - // $client_id = 51; + // $client_id = 3927; // $result = $this->getTheEmpDataForClaimSearchByMobile($param, $type, $client_policy_id, $client_id); + // $result = $this->employeePolicyModel->getEmployeePolicy(); + // $result = $this->getHrAccessData($client_id); + // $html = view('hr_access_controll', $result); + // dd($html); + + // $employeeRestController = new EmployeeRestController(); + // $result = $employeeRestController->getPreEmployeePolicyCount($param, $client_id); // dd($result); } @@ -5207,7 +5219,8 @@ class ClientController extends AdminController ->where('employees.relationship', "Self") ->where('employee_polices.is_active', 1) ->where('client_policy.id', $param) - ->findAll(); + ->get() + ->getResultArray(); $dataForClientAndInsurer = $this->clientPolicyModel ->select(" @@ -5293,9 +5306,9 @@ class ClientController extends AdminController $query->where('employees.client_id', $client_id); } - // if (!empty($client_policy_id)) { - // $query->where('employee_polices.client_policy_id', $client_policy_id); - // } + if (!empty($client_policy_id)) { + $query->where('employee_polices.client_policy_id', $client_policy_id); + } $query->groupBy('employees.id') ->orderBy('employees.id', 'DESC'); @@ -5316,7 +5329,7 @@ class ClientController extends AdminController if(!empty($data) && count($data) > 0){ - $memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], null, $client_id); + $memberData = $this->employeeModel->getEmployeeByEmployeeCode($data['emp_code'], $client_policy_id, $client_id); $acms_datas = $this->employeeModel->getAcmUsingClientID($data['client_id']); // if(!empty($acms_datas)){ // $acms = $acms_datas; @@ -6063,9 +6076,13 @@ class ClientController extends AdminController // --------------------------------------------------------------------------------------------------- - public function constructHrAccessData() + public function viewHrAccessData() { - $html = view('hr_access_controll'); + $client_id = $this->request->getGet('client_id'); + $data = $this->getHrAccessData($client_id); + // $data = []; + + $html = view('hr_access_controll', $data); return $this->respond([ 'status' => true, 'code' => 200, @@ -6073,6 +6090,301 @@ class ClientController extends AdminController ], 200); } + public function getHrAccessData($client_id) + { + $hrAccessData = []; + + $post_client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first(); + + $hrAccessData['post_hr_data'] = $this->clientBranchModel + ->select('lc.id as post_hr_id, lc.name as hr_name, lc.mobile as hr_mobile, lc.email as hr_mail') + ->join('level_contacts lc', 'client_branch.id = lc.ref_id') + ->where('client_branch.is_active', 1) + ->where('lc.is_active', 1) + ->where('lc.contact_type', 'client') + ->where('client_branch.client_id', $client_id) + ->findAll(); + + $hrAccessData['post_policy_data'] = $this->clientPolicyModel + ->select('client_policy.id as client_policy_id, client_policy.policy_no as policy_no, policy_type.policy_type, client_policy.policy_status') + ->join('policy_type', 'client_policy.policy_type_id = policy_type.id') + ->where('client_policy.is_active', 1) + ->where('client_policy.client_id', $client_id) + // ->orderBy('client_policy_id', 'desc') + ->orderBy('client_policy.policy_status', 'desc') + ->findAll(); + + $hrAccessData['post_cd_data'] = $this->CDMasterModel + ->select('cd_master.id as cd_master_pk, cd_master.cd_ac_no as cd_account_no, insurers.name as insurer_name, insurers.short_name as insurer_short_name') + ->join('insurers', 'cd_master.insurer_id = insurers.id') + ->where('cd_master.is_active', 1) + ->where('cd_master.client_id', $client_id) + ->findAll(); + + $hrAccessData['hr_access_table_data'] = $this->HRAccessControlModel + ->where('is_active', 1) + ->where('post_client_id', $client_id) + ->findAll(); + + try { + log_message('error', 'Attempting to connect to preDB...'); + $db2 = \Config\Database::connect('preDB'); + log_message('error', 'Connection to preDB successful.'); + } catch (\Throwable $e) { + log_message('error', 'DB connection to preDB failed: ' . $e->getMessage()); + + $hrAccessData['pre_hr_data'] = []; + $hrAccessData['pre_policy_data'] = []; + $combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id); + return $combinedHrAccessData; + } + + $pre_client_data = $db2->table('clients')->where('is_active', 1)->where('short_name', $post_client_data['short_name'])->get()->getRowArray(); + + $hrAccessData['pre_hr_data'] = $db2->table('client_branch') + ->select('lc.id as pre_hr_id, lc.name as hr_name, lc.mobile as hr_mobile, lc.email as hr_mail') + ->join('level_contacts lc', 'client_branch.id = lc.ref_id') + ->where('client_branch.is_active', 1) + ->where('lc.is_active', 1) + ->where('lc.contact_type', 'client') + ->where('client_branch.client_id', $pre_client_data['id']) + ->get() + ->getResultArray(); + + $hrAccessData['pre_policy_data'] = $db2->table('client_policy') + ->select('client_policy.id as client_policy_id, client_policy.policy_no as policy_no, policy_type.policy_type, client_policy.policy_status') + ->join('policy_type', 'client_policy.policy_type_id = policy_type.id') + ->where('client_policy.is_active', 1) + ->where('client_policy.client_id', $pre_client_data['id']) + // ->orderBy('client_policy_id', 'desc') + ->orderBy('client_policy.policy_status', 'desc') + ->get() + ->getResultArray(); + + // dd($hrAccessData); + + $combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id); + return $combinedHrAccessData; + } + + public function constructHrAccessData($data, $client_id) + { + // dd($data); + $preHrs = $data['pre_hr_data']; + $postHrs = $data['post_hr_data']; + $hrAccessTableData = $data['hr_access_table_data']; + $merged = []; + + // Merge based on mobile and email + foreach ($postHrs as $post) { + $found = false; + foreach ($preHrs as $index => $pre) { + if ($post['hr_mobile'] === $pre['hr_mobile'] && $post['hr_mail'] === $pre['hr_mail']) { + $merged[] = [ + 'pre_hr_id' => $pre['pre_hr_id'], + 'post_hr_id' => $post['post_hr_id'], + 'hr_name' => $post['hr_name'], + 'hr_mobile' => $post['hr_mobile'], + 'hr_mail' => $post['hr_mail'] + ]; + unset($preHrs[$index]); // remove matched pre_hr + $found = true; + break; + } + } + + if (!$found) { + $merged[] = [ + 'pre_hr_id' => null, + 'post_hr_id' => $post['post_hr_id'], + 'hr_name' => $post['hr_name'], + 'hr_mobile' => $post['hr_mobile'], + 'hr_mail' => $post['hr_mail'] + ]; + } + } + + // Remaining preHrs (not matched) + foreach ($preHrs as $pre) { + $merged[] = [ + 'pre_hr_id' => $pre['pre_hr_id'], + 'post_hr_id' => null, + 'hr_name' => $pre['hr_name'], + 'hr_mobile' => $pre['hr_mobile'], + 'hr_mail' => $pre['hr_mail'] + ]; + } + + // dd($merged); + + $result = []; + + if (empty($hrAccessTableData)) { + + // No access data — fill result with hr data and other fields as null + foreach ($merged as $hr) { + $result[] = [ + 'hr_access_table_pk' => null, + 'post_client_id' => $client_id ?? null, + 'pre_hr_id' => $hr['pre_hr_id'] ?? null, + 'post_hr_id' => $hr['post_hr_id'] ?? null, + 'allowed_pre_modules' => [], + 'allowed_post_modules' => [], + 'allowed_pre_policies' => [], + 'allowed_active_policies' => [], + 'allowed_cd' => [], + 'hr_name' => $hr['hr_name'] ?? null, + 'hr_mobile' => $hr['hr_mobile'] ?? null, + 'hr_mail' => $hr['hr_mail'] ?? null, + ]; + } + + } else { + foreach ($hrAccessTableData as $access) { + foreach ($merged as $hr) { + if ($hr['post_hr_id'] == $access['post_hr_id']) { + + $allowed_modules = json_decode($access['allowed_modules'], true) ?? null; + if ($allowed_modules == null) { + $allowed_pre_modules = null; + $allowed_post_modules = null; + } else { + $allowed_pre_modules = $allowed_modules['pre'] ?? []; + $allowed_post_modules = $allowed_modules['post'] ?? []; + } + + $result[] = [ + 'hr_access_table_pk' => $access['id'] ?? null, + 'post_client_id' => $access['post_client_id'] ?? null, + 'pre_hr_id' => $hr['pre_hr_id'] ?? null, + 'post_hr_id' => $hr['post_hr_id'] ?? null, + 'allowed_pre_modules' => $allowed_pre_modules, + 'allowed_post_modules' => $allowed_post_modules, + 'allowed_pre_policies' => json_decode($access['allowed_pre_policies'], true) ?? [], + 'allowed_active_policies' => json_decode($access['allowed_active_policies']) ?? [], + 'allowed_cd' => json_decode($access['allowed_cd'], true) ?? [], + 'hr_name' => $hr['hr_name'], + 'hr_mobile' => $hr['hr_mobile'], + 'hr_mail' => $hr['hr_mail'] + ]; + break; + } + } + } + } + + $resultData['hr_access_data'] = $result; + $resultData['pre_policy_data'] = $data['pre_policy_data']; + $resultData['post_policy_data'] = $data['post_policy_data']; + $resultData['post_cd_data'] = $data['post_cd_data']; + + // dd($resultData); + + return $resultData; + } + + public function saveHrAccessData() + { + try { + // Step 1: Fetch and decode the JSON data + $client_id = $this->request->getPost('client_id'); + $jsonData = $this->request->getPost('json'); + $data = json_decode($jsonData, true); + + if (!$data || !is_array($data)) { + log_message('error', 'Invalid or empty JSON in saveHrAccessData: ' . $jsonData); + return $this->respond([ + 'status' => false, + 'code' => 400, + 'message' => 'Invalid JSON data provided.', + ], 400); + } + + $success = []; + $errors = []; + $skippedCount = 0; + + // Step 2: Loop and insert/update + foreach ($data as $index => $value) { + try { + // Decode allowed_modules and validate + $allowed_modules = json_decode($value['allowed_modules'], true); + if (empty($allowed_modules)) { + $skippedCount++; + continue; // Skip this record + } + + // Format allowed_modules: { pre: [1], post: [2,3,4] } + $pre = in_array(1, $allowed_modules) ? [1] : []; + $post = array_values(array_filter($allowed_modules, fn($v) => $v !== 1)); + $value['allowed_modules'] = json_encode(['pre' => $pre, 'post' => $post]); + + // INSERT or UPDATE + if (empty($value['pk']) || (int)$value['pk'] === 0) { + unset($value['pk']); // Prevent insert error + $insertedId = $this->HRAccessControlModel->insert($value); + if ($insertedId === false) { + throw new \Exception('Insert failed: ' . json_encode($this->HRAccessControlModel->errors())); + } + $success[] = "Inserted row at index {$index} with ID {$insertedId}."; + } else { + $update = $this->HRAccessControlModel->update($value['pk'], $value); + if ($update === false) { + throw new \Exception('Update failed for ID ' . $value['pk'] . ': ' . json_encode($this->HRAccessControlModel->errors())); + } + $success[] = "Updated row with ID {$value['pk']}."; + } + } catch (\Exception $e) { + log_message('error', 'HRAccess Save Error at index ' . $index . ': ' . $e->getMessage()); + $errors[] = "Error at index {$index}: " . $e->getMessage(); + } + } + + // Step 3: If all rows were skipped (no allowed_modules) + if (count($data) === $skippedCount) { + return $this->respond([ + 'status' => false, + 'code' => 422, + 'message' => 'Please select at least one module for any user.', + ], 422); + } + + // Step 4: Final response + if (empty($errors)) { + + $data = $this->getHrAccessData($client_id); + $html = view('hr_access_controll', $data); + + return $this->respond([ + 'status' => true, + 'code' => 200, + 'message' => 'All records processed successfully.', + 'details' => $success, + 'data' => $html, + ], 200); + + } else { + return $this->respond([ + 'status' => false, + 'code' => 207, + 'message' => 'Some records failed to save.', + 'success' => $success, + 'errors' => $errors + ], 207); + } + } catch (\Exception $e) { + log_message('critical', 'Fatal error in saveHrAccessData: ' . $e->getMessage()); + return $this->respond([ + 'status' => false, + 'code' => 500, + 'message' => 'Unexpected server error.', + 'error' => $e->getMessage() + ], 500); + } + } + + + } diff --git a/app/Controllers/RestAuthenticationController.php b/app/Controllers/RestAuthenticationController.php index abdffbdf..4aa0d89d 100755 --- a/app/Controllers/RestAuthenticationController.php +++ b/app/Controllers/RestAuthenticationController.php @@ -541,7 +541,7 @@ class RestAuthenticationController extends AdminController try { // mobile number $otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null; - $mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null; + $mobile_number = isset($this->request->getJSON()->mobile_no) ? $this->request->getJSON()->mobile_no : null; // email id $otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null; $email = isset($this->request->getJSON()->email) ? $this->request->getJSON()->email : null; @@ -571,7 +571,7 @@ class RestAuthenticationController extends AdminController } - if(isset($this->request->getJSON()->mobile_number)){ + if(isset($this->request->getJSON()->mobile_no)){ $hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id') ->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left') diff --git a/app/Models/HRAccessControlModel.php b/app/Models/HRAccessControlModel.php index 81f16f0e..a9a4e2c7 100644 --- a/app/Models/HRAccessControlModel.php +++ b/app/Models/HRAccessControlModel.php @@ -12,6 +12,7 @@ class HRAccessControlModel extends Model 'id', 'pre_hr_id', 'post_hr_id', + 'post_client_id', 'allowed_modules', 'allowed_pre_policies', 'allowed_active_policies', diff --git a/app/Views/client_basic_info.php b/app/Views/client_basic_info.php index 220164b8..32420ed2 100755 --- a/app/Views/client_basic_info.php +++ b/app/Views/client_basic_info.php @@ -98,7 +98,7 @@ input:checked + .slider:before { + placeholder="Enter Short Name" value="" name="short_name" onkeyup="validateInput(this, 'clients', 'short_name', 'clientBtnSubmit')" required> @@ -137,7 +137,7 @@ input:checked + .slider:before {
+ id="clientBtnSubmit">Submit
diff --git a/app/Views/client_branch.php b/app/Views/client_branch.php index 40e04f54..708a66df 100755 --- a/app/Views/client_branch.php +++ b/app/Views/client_branch.php @@ -163,6 +163,9 @@
+ + +
+ name="email[]" id="email" data-parsley-trigger="change" data-parsley-type="email" onkeyup="validateInput(this, 'level_contacts', 'email', 'branchBtnSubmit')" required>
+ id="branchBtnSubmit">Submit
@@ -347,6 +350,9 @@ $("#branch_form").submit(function(event) { var selectedValues = $("#selected").val(); console.log(selectedValues, selectedValues); + let level_contect_data = getContactsData(); + console.log('level_contect_data', level_contect_data); + event.preventDefault(); branch_PrimaryKey = $('#client_id_branch').val(); @@ -370,11 +376,14 @@ $("#branch_form").submit(function(event) { var formData = new FormData($('#branch_form')[0]); const jsonString = JSON.stringify(selectedValues); + const level_contect_data_json_string = JSON.stringify(level_contect_data); console.log('jsonString', jsonString); + console.log('level_contect_data_json_string', level_contect_data_json_string); // Append the JSON string to the FormData object formData.append('units', jsonString); + formData.append('level_contect_data', level_contect_data_json_string); $.ajax({ data: formData, @@ -495,6 +504,8 @@ $('body').on('click', '.btnBranchEdit', function() { dataType: 'json', success: function(res) { + console.log('branch response', res); + setTimeout(function() { $('.loader').fadeOut(); $('.loader-mask').delay(350).fadeOut('slow'); @@ -525,10 +536,25 @@ $('body').on('click', '.btnBranchEdit', function() { appendOption(res.data.units) - $('#name').val(res.contact[0].name); - $('#email').val(res.contact[0].email); - $('#mobile').val(res.contact[0].mobile); - $('#designation').val(res.contact[0].designation); + // $('#branch_table_pk').val(res.contact[0].id); + // $('#name').val(res.contact[0].name); + // $('#email').val(res.contact[0].email); + // $('#mobile').val(res.contact[0].mobile); + // $('#designation').val(res.contact[0].designation); + + if (res.contact && res.contact.length > 0 && res.contact[0]) { + $('#branch_table_pk').val(res.contact[0].id || ''); + $('#name').val(res.contact[0].name || ''); + $('#email').val(res.contact[0].email || ''); + $('#mobile').val(res.contact[0].mobile || ''); + $('#designation').val(res.contact[0].designation || ''); + } else { + $('#branch_table_pk').val(''); + $('#name').val(''); + $('#email').val(''); + $('#mobile').val(''); + $('#designation').val(''); + } res.contact.shift(); // console.log(res.contact.length) @@ -579,6 +605,7 @@ function appendContactHtml(contact = false, reset = false) {
+
@@ -591,11 +618,11 @@ function appendContactHtml(contact = false, reset = false) {
- +
- +
@@ -767,6 +794,51 @@ function checkMobileNumber(input) { }); } + +function validateInput(input, table, field, submitButId){ + + let value = $(input).val(); + let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim(); + + let message = "Value is duplicate!"; + if(label){ + message = label + " already exists!"; + } + + checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) { + if (isDuplicate) { + toastr.warning(message, 'WARNING'); + // $(input).val('') + $('#' + submitButId).prop('disabled', true); + } else{ + $('#' + submitButId).prop('disabled', false); + } + }); + +} + +function getContactsData() { + const contacts = []; + + const ids = $('input[name="branch_table_pk[]"]'); + const names = $('input[name="name[]"]'); + const mobiles = $('input[name="mobile[]"]'); + const emails = $('input[name="email[]"]'); + const designations = $('input[name="designation[]"]'); + + for (let i = 0; i < ids.length; i++) { + contacts.push({ + id: $(ids[i]).val() || null, + name: $(names[i]).val(), + mobile: $(mobiles[i]).val(), + email: $(emails[i]).val(), + designation: $(designations[i]).val() + }); + } + + return contacts; +} + - - - - - + + diff --git a/app/Views/hr_access_controll.php b/app/Views/hr_access_controll.php new file mode 100644 index 00000000..3052daca --- /dev/null +++ b/app/Views/hr_access_controll.php @@ -0,0 +1,178 @@ +
+
+
+ + +
+ + $value) { + $key = $key + 1 ?> + + +
+ + + + + + +
+ +
+ +
+
+
+
+
+
+
+
+ > + Pre enrollment +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + $policies) { + $statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active'; + $statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive'; + ?> +
+ > + +
+ +
+ +
+
+ +
+
+
+ > + Active policies +
+
+ + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + $policies) { + $statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active'; + $statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive'; + ?> +
+ > + +
+ + + +
+
+
+ +
+
+
+ > + CD statement +
+ +
+ + +
+ + +
+ + $cd) { ?> +
+ > + +
+ +
+
+
+ +
+
+
+ > + Claims +
+
+
+
+
+
+
+ + + + +
+ +
+
+ + +
There is no HR data
+ +
+
+
\ No newline at end of file