Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2026-02-10 15:29:30 +05:30
commit 4307757a91
6 changed files with 86 additions and 25 deletions

View File

@ -784,10 +784,10 @@ class ClientController extends AdminController
],
'cd_ac_no' => [
'rules' => 'required|is_natural_no_zero',
'rules' => 'required|regex_match[/^[a-zA-Z0-9\/_\\-]+$/]',
'errors' => [
'required' => 'Account number is required',
'is_natural_no_zero' => 'must be a positive integer',
'regex_match' => 'Account number can only contain letters, numbers, slashes (/), underscores (_), and hyphens (-)',
]
],
@ -6470,9 +6470,9 @@ class ClientController extends AdminController
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
$empServiceController = new EmployeeServiceController();
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']);
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1252']);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1263]);
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1264']);
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1264']);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1264]);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1262]);
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);

View File

@ -607,7 +607,7 @@ class EmployeeRestController extends AdminController
{
try {
$empData = $this->employeePolicyModel->getEmployeePolicy(client_id: $this->request->getGet('client_id'), policy_id: $this->request->getGet('client_policy_id'), status: 0, branch_id: $this->request->getGet('client_branch_id'));
$empData = $this->employeePolicyModel->getEmployeePolicy(client_id: $this->request->getGet('client_id'), policy_id: $this->request->getGet('client_policy_id'), status: 0, branch_id: $this->request->getGet('client_branch_id'), status_type: 'inactive');
if ($empData) {
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
@ -2360,15 +2360,15 @@ class EmployeeRestController extends AdminController
$value['policy_name'] = $policyTypeData->long_name;
$value['insurer_name'] = $insurerData->name;
$value['insurer_short_name'] = $insurerData->short_name;
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy(client_id: $value['client_id'], policy_id: $value['client_policy_id'], status: 0, branch_id: $this->request->getGet('client_branch_id'));
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy(client_id: $value['client_id'], policy_id: $value['client_policy_id'], status: 0, branch_id: $this->request->getGet('client_branch_id'), status_type: 'inactive');
// dd($employeeDetails);
$activeCount = 0;
$inactiveCount = 0;
if (count($employeeDetails)) {
foreach ($employeeDetails as $item) {
if ($item['emp_status'] === 'active') {
if ($item['status'] === 'active') {
$activeCount++;
} elseif ($item['emp_status'] === 'inactive') {
} elseif ($item['status'] === 'inactive') {
$inactiveCount++;
}
}
@ -5447,7 +5447,7 @@ class EmployeeRestController extends AdminController
$file_id = $this->request->getGet('id');
// Find record
$record = $this->batchFileModel->where('id', $file_id)->first();;
$record = $this->batchFileModel->where('MD5(id)', $file_id)->first();
if (!$record) {
$data['message'] = 'File record not found';
return view('errors/404', $data);

View File

@ -1402,6 +1402,8 @@ class EmployeeServiceController extends AdminController
$employee_data_group_by_family = data_group_by_family($excel_data, 'excel', '', $current_column_action);
// dd($employee_data_group_by_family);
$employee_insert_count = 0;
foreach ($employee_data_group_by_family as $emp_id => $family)
{
@ -1425,11 +1427,25 @@ class EmployeeServiceController extends AdminController
$data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units);
// dd($data);
$employee_data_group_by_family[$emp_id] = $data;
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
$res = $this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
if($res > 0){
$employee_insert_count++;
}
}
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
if($employee_insert_count > 0){
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update();
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]);
}else{
$reason = json_encode([
'error_summary' => [5 => 1],
'error_data' => "Rack rate configuration issue: Please check the slab rates configuration"
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$this->fileModel->where('id', $file_id)->set(['status' => 'failed','reason' => $reason])->update();
$this->myLogger->logme("error",'{file_id} uploaded failed with reason: Rack rate configuration issue: Please check the slab rates configuration',['file_id' => $file_id]);
}
$this->setPullNotification($this->getFileMetaDataByFileId($file_id,'success'));
@ -1842,6 +1858,7 @@ class EmployeeServiceController extends AdminController
$policy_details = $this->clientPolicyModel->where('id', $file['policy_id'])->first();
// dd($policy_details);
$employee_insert_count = 0;
foreach($familiy_data as $fkey => $value)
{
if(is_array($value))
@ -1974,6 +1991,7 @@ class EmployeeServiceController extends AdminController
// else{ $emp_policy_id = $employee_policy[0]['id']; }
$this->myLogger->logme('error',$log_message);
$employee_insert_count++;
}// if end
}// is array check end
@ -1982,6 +2000,8 @@ class EmployeeServiceController extends AdminController
$this->myLogger->logme('error','######Incoming value is not an array');
}
}// for end
return $employee_insert_count;
}//function end

View File

@ -316,7 +316,7 @@ class ClientPolicyModel extends Model
->select('user_profiles.first_name as username')
->select("CASE
WHEN cash_deposit.file_id IS NOT NULL AND cash_deposit.file_id != ''
THEN CONCAT(" . $this->db->escape($url) . ", cash_deposit.file_id)
THEN CONCAT(" . $this->db->escape($url) . ", MD5(cash_deposit.file_id))
ELSE NULL
END AS split_up_url",
false)

View File

@ -222,7 +222,7 @@ class EmployeePolicyModel extends Model
// return $res;
// } // remarks do not remove
public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "")
public function getEmployeePolicy($client_id = 0, $policy_id = 0, $status = [], $branch_id = 0, $emp_code = "", $emp_name = "", $status_type = '')
{
// dd($status);
$ecard_download_link = "
@ -356,8 +356,13 @@ class EmployeePolicyModel extends Model
// Always check these conditions
$result
->where('employee_polices.is_active', 1)
->where('emp.is_active', 1)
->where('employee_polices.status !=', 'inactive');
->where('emp.is_active', 1);
if($status_type == 'inactive'){
$result->whereIn('employee_polices.status', ['active', 'inactive']);
}else{
$result->where('employee_polices.status !=', 'inactive');
}
$res = $result->findAll();

View File

@ -306,17 +306,53 @@
}
function handleItemClick(e, item) {
e.preventDefault();
// Execute the stored onclick handler
e.preventDefault();
const onclickAttr = item.getAttribute('data-onclick');
if (onclickAttr) {
eval(onclickAttr);
}
// Regex to separate function name from the inside of the parentheses
// Example: myFunc(this, '123') -> match[1]="myFunc", match[2]="this, '123'"
const match = onclickAttr.match(/^(\w+)\((.*)\)$/);
if (match) {
const funcName = match[1];
const argsRaw = match[2];
// Handle href navigation
if (typeof window[funcName] === 'function') {
// Parse the arguments string into a real array
const args = argsRaw.split(',').map(arg => {
let cleaned = arg.trim();
// 1. Handle the 'this' keyword
if (cleaned === 'this') return item;
// 2. Handle 'event' keyword
if (cleaned === 'event') return e;
// 3. Handle strings (remove single or double quotes)
if ((cleaned.startsWith("'") && cleaned.endsWith("'")) ||
(cleaned.startsWith('"') && cleaned.endsWith('"'))) {
return cleaned.substring(1, cleaned.length - 1);
}
// 4. Handle numbers
if (!isNaN(cleaned) && cleaned !== "") {
return Number(cleaned);
}
return cleaned;
});
// Execute function:
// .apply(item, args) sets the 'this' inside the function to the clicked element
window[funcName].apply(item, args);
}
}
}
// Handle standard navigation if it's a link
const href = item.getAttribute('href');
if (href && href !== '#') {
if (href && href !== '#' && !href.includes('javascript:void(0)')) {
window.location.href = href;
}
@ -324,7 +360,7 @@
activeDropdown.style.display = 'none';
activeDropdown = null;
}
e.stopPropagation();
}