MERGE_UAT_BATCH_RELEASE_WITH_POST

This commit is contained in:
Ubuntu 2025-12-24 22:56:01 +05:30
commit 2a6da8c70e
14 changed files with 515 additions and 267 deletions

View File

@ -108,6 +108,10 @@ class Database extends Config
'ssl_ca' => ROOTPATH . 'ca.pem', 'ssl_ca' => ROOTPATH . 'ca.pem',
'ssl_verify' => true, 'ssl_verify' => true,
]; ];
$this->postDB['encrypt'] = [
'ssl_ca' => ROOTPATH . 'ca.pem',
'ssl_verify' => true,
];
} }
} }
} }

View File

@ -507,7 +507,7 @@ class ClientController extends AdminController
// echo "<pre>"; // echo "<pre>";
// print_r($data); die; // print_r($data); die;
$data['placeHolders'] = ['member_name', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name']; $data['placeHolders'] = ['member_name', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name', 'enrollment_open_date', 'enrollment_close_date'];
// dd($data['placeHolders']); // dd($data['placeHolders']);
@ -653,7 +653,7 @@ class ClientController extends AdminController
$editData['client_policy'] = $clientPoliceData; $editData['client_policy'] = $clientPoliceData;
$editData['client_policy']['role'] = get_role_id(); $editData['client_policy']['role'] = get_role_id();
$editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll(); $editData['notification'] = $this->notificationModel->select('template_name,enabled')->where('client_id', $id)->findAll();
$editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name']; $editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name', 'enrollment_open_date', 'enrollment_close_date'];
$editData['auto_fetch_client_list'] = $this->getClientListFromPost(); $editData['auto_fetch_client_list'] = $this->getClientListFromPost();
@ -4623,7 +4623,7 @@ class ClientController extends AdminController
// $res = $employeeRestController->getExcelErrorData(['file_id' => 897]); // $res = $employeeRestController->getExcelErrorData(['file_id' => 897]);
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]); // $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]);
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]); // $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]); // $res = $employeeRestController->employeesEnrollmentInsert(['file_id' => 1138]);
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]); // $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
// dd($res); // dd($res);

View File

@ -279,10 +279,15 @@ class EmployeeController extends AdminController
$client_id = $this->request->getPost('client_id'); $client_id = $this->request->getPost('client_id');
$policy_id = $this->request->getPost('policy_id'); $policy_id = $this->request->getPost('policy_id');
$branch_id = $this->request->getPost('branch_id'); $branch_id = $this->request->getPost('branch_id');
$enrollment_open_date = $this->request->getPost('enrollment_open_date');
$enrollment_close_date = $this->request->getPost('enrollment_close_date');
$action = $this->request->getPost('upload-action-type'); $action = $this->request->getPost('upload-action-type');
$status = 'inprogress'; $status = 'inprogress';
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1]); //here field policy_id have client_policy_id and not policy id from policy master $enrollment_open_date = change_date_format($enrollment_open_date, 'd/m/Y', 'Y-m-d');
$enrollment_close_date = change_date_format($enrollment_close_date, 'd/m/Y', 'Y-m-d');
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id,'uploaded_by' => 1, 'enrollment_open_date' => $enrollment_open_date, 'enrollment_close_date' => $enrollment_close_date]); //here field policy_id have client_policy_id and not policy id from policy master
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]); $this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
//start validation process //start validation process
@ -328,7 +333,7 @@ class EmployeeController extends AdminController
$data['fileList'] = $this->fileModel $data['fileList'] = $this->fileModel
->select([ ->select([
'files.id','files.file_name','files.created_by','files.created_at','files.is_active','files.status','files.client_id','files.policy_id','files.client_branch_id','files.action','files.uploaded_by', 'files.id','files.file_name','files.created_by','files.created_at','files.is_active','files.status','files.client_id','files.policy_id','files.client_branch_id','files.action','files.uploaded_by', 'enrollment_open_date', 'enrollment_close_date',
'up.emp_code', 'up.emp_code',
'up.first_name', 'up.first_name',
'c.short_name', 'c.short_name',

View File

@ -236,7 +236,7 @@ class EmployeeRestController extends AdminController
$data = $this->request->getJSON(); $data = $this->request->getJSON();
//enrolment check //enrolment check
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id); $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id, $data[0]->emp_code);
if($openForEnrollment == false){ if($openForEnrollment == false){
return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => 'Enrollment closed.'], 200); return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => 'Enrollment closed.'], 200);
} }
@ -369,6 +369,19 @@ class EmployeeRestController extends AdminController
$basic_cover_si = $policy_terms->sum_insured; $basic_cover_si = $policy_terms->sum_insured;
} }
$other_employee_policy_data = $this->employeePolicyModel
->select('employee_polices.*')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employees.emp_code', $emp_code)
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.is_active', 1)
->where('employees.is_active', 1)
->whereIn('employee_polices.status', ['draft', 'enrolled'])
->whereIn('employees.emp_status', ['draft', 'enrolled'])
->where('employee_polices.enrollment_open_date is not null')
->where('employee_polices.enrollment_close_date is not null')
->first();
$checkDataExist = $this->employeePolicyModel->where('employee_id',$employee_id)->where('client_policy_id',$client_policy_id)->where('is_active', 1)->first(); $checkDataExist = $this->employeePolicyModel->where('employee_id',$employee_id)->where('client_policy_id',$client_policy_id)->where('is_active', 1)->first();
if($checkDataExist){ if($checkDataExist){
@ -389,6 +402,11 @@ class EmployeeRestController extends AdminController
$data['status']= 'draft'; $data['status']= 'draft';
$data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id); $data['date_coverage'] = $this->getEmployeeCoverageDate($emp_code, $client_policy_id);
if(!empty($other_employee_policy_data)){
$data['enrollment_open_date']= $other_employee_policy_data['enrollment_open_date'] ?? null;
$data['enrollment_close_date']= $other_employee_policy_data['enrollment_close_date'] ?? null;
}
// dd($data); // dd($data);
$this->employeePolicyModel->insert($data); $this->employeePolicyModel->insert($data);
@ -470,7 +488,6 @@ class EmployeeRestController extends AdminController
}else{ return null; } }else{ return null; }
} }
public function RelationshipMap($value){ public function RelationshipMap($value){
if ($value === 'Mother' || $value === 'Father') { if ($value === 'Mother' || $value === 'Father') {
@ -573,7 +590,7 @@ class EmployeeRestController extends AdminController
// print_r($requestData); // print_r($requestData);
// dd($requestData); // dd($requestData);
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($requestData[0]->client_policy_id); $openForEnrollment = $this->findThePolicyIsOpenForEnrollment($requestData[0]->client_policy_id, $requestData[0]->emp_code);
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); } if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
foreach ($requestData as $key => $value) foreach ($requestData as $key => $value)
@ -1455,7 +1472,37 @@ class EmployeeRestController extends AdminController
$array->family_floaters_of_dependent_and_gst_value = 0; $array->family_floaters_of_dependent_and_gst_value = 0;
} }
$checkGmcParentsPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, policy_type.long_name as Policy_Name , client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms , client_policy.is_premium_summery as is_premium_summery, client_policy.enrolment_visibility') $checkGmcParentsPolicyExist = $this->clientPolicyModel->select("
client_policy.id as ClientPolicyId,
client_policy.client_id as ClientId,
client_policy.policy_type_id as policy_type_id,
policy_type.long_name as Policy_Name ,
client_policy.is_addon as is_addon ,
(
SELECT COALESCE(
MAX(
CASE
WHEN ep.enrollment_open_date <= CURDATE()
AND ep.enrollment_close_date >= CURDATE()
THEN 1
ELSE 0
END
), 0
)
FROM employee_polices ep
INNER JOIN employees e ON e.id = ep.employee_id
WHERE e.is_active = 1
AND ep.is_active = 1
AND ep.enrollment_open_date IS NOT NULL
AND ep.enrollment_close_date IS NOT NULL
AND e.emp_code = '{$emp_code}'
AND ep.client_policy_id = client_policy.id
) AS OpenForEnrollment,
client_policy.inception_type as inception_type ,
client_policy.policy_terms as Policy_Terms ,
client_policy.is_premium_summery as is_premium_summery,
client_policy.enrolment_visibility
")
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left') ->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
->where('client_policy.policy_type_id', 3 ) ->where('client_policy.policy_type_id', 3 )
->where('client_policy.is_addon', 1 ) ->where('client_policy.is_addon', 1 )
@ -1746,7 +1793,36 @@ class EmployeeRestController extends AdminController
public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id,$login_by_hr) public function getAdditionalGPAPolicy($empData,$policy_type,$emp_code,$client_id,$client_branch_id,$login_by_hr)
{ {
$checkPolicyExist = $this->clientPolicyModel->select('client_policy.id as ClientPolicyId , client_policy.client_id as ClientId, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type , client_policy.policy_terms as Policy_Terms , client_policy.enrolment_visibility,client_policy.is_premium_summery') $checkPolicyExist = $this->clientPolicyModel->select("
client_policy.id as ClientPolicyId ,
client_policy.client_id as ClientId,
client_policy.policy_type_id as policy_type_id,
client_policy.is_addon as is_addon ,
(
SELECT COALESCE(
MAX(
CASE
WHEN ep.enrollment_open_date <= CURDATE()
AND ep.enrollment_close_date >= CURDATE()
THEN 1
ELSE 0
END
), 0
)
FROM employee_polices ep
INNER JOIN employees e ON e.id = ep.employee_id
WHERE e.is_active = 1
AND ep.is_active = 1
AND ep.enrollment_open_date IS NOT NULL
AND ep.enrollment_close_date IS NOT NULL
AND e.emp_code = '{$emp_code}'
AND ep.client_policy_id = client_policy.id
) AS OpenForEnrollment,
client_policy.inception_type as inception_type ,
client_policy.policy_terms as Policy_Terms ,
client_policy.enrolment_visibility,
client_policy.is_premium_summery
")
->where('client_policy.policy_type_id', $policy_type ) ->where('client_policy.policy_type_id', $policy_type )
->where('client_policy.is_addon', 1 ) ->where('client_policy.is_addon', 1 )
->where('client_policy.client_id', $client_id ) ->where('client_policy.client_id', $client_id )
@ -2062,6 +2138,7 @@ class EmployeeRestController extends AdminController
{ {
try { try {
$emp_code = $this->request->getGet('emp_code');
$addOnEmployeeData = $this->employeeModel->where('is_active', 1 ) $addOnEmployeeData = $this->employeeModel->where('is_active', 1 )
->where('emp_code',$this->request->getGet('emp_code')) ->where('emp_code',$this->request->getGet('emp_code'))
->where('client_id',$this->request->getGet('client_id')) ->where('client_id',$this->request->getGet('client_id'))
@ -2070,7 +2147,30 @@ class EmployeeRestController extends AdminController
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id')) $clientPolicy = $this->clientPolicyModel->select("
client_policy.*,
(
SELECT COALESCE(
MAX(
CASE
WHEN ep.enrollment_open_date <= CURDATE()
AND ep.enrollment_close_date >= CURDATE()
THEN 1
ELSE 0
END
), 0
)
FROM employee_polices ep
INNER JOIN employees e ON e.id = ep.employee_id
WHERE e.is_active = 1
AND ep.is_active = 1
AND ep.enrollment_open_date IS NOT NULL
AND ep.enrollment_close_date IS NOT NULL
AND e.emp_code = '{$emp_code}'
AND ep.client_policy_id = client_policy.id
) AS open_for_enrollment
")
->where('client_id',$this->request->getGet('client_id'))
->where('client_branch_id',$this->request->getGet('client_branch_id')) ->where('client_branch_id',$this->request->getGet('client_branch_id'))
->where('policy_status', 1) ->where('policy_status', 1)
->where('is_active', 1) ->where('is_active', 1)
@ -2079,6 +2179,7 @@ class EmployeeRestController extends AdminController
if(count($clientPolicy)) if(count($clientPolicy))
{ {
$self = $this->employeeModel->where('employees.is_active', 1) $self = $this->employeeModel->where('employees.is_active', 1)
->where('employees.emp_code', $this->request->getGet('emp_code')) ->where('employees.emp_code', $this->request->getGet('emp_code'))
->where('employees.client_id', $this->request->getGet('client_id')) ->where('employees.client_id', $this->request->getGet('client_id'))
@ -3632,10 +3733,23 @@ class EmployeeRestController extends AdminController
} }
public function findThePolicyIsOpenForEnrollment($plicy_id) public function findThePolicyIsOpenForEnrollment($policy_id, $emp_code)
{ {
$policy = $this->clientPolicyModel->where('id',$plicy_id)->where('open_for_enrollment',1)->find(); // $policy = $this->clientPolicyModel->where('id',$plicy_id)->where('open_for_enrollment',1)->find();
$policy = $this->employeePolicyModel
->join('employees', 'employee_polices.employee_id = employees.id')
->where('employees.emp_code',$emp_code)
->where('employee_polices.client_policy_id',$policy_id)
->where('employee_polices.enrollment_open_date <= CURDATE()', null, false)
->where('employee_polices.enrollment_close_date >= CURDATE()', null, false)
->where('employee_polices.enrollment_open_date is not null')
->where('employee_polices.enrollment_close_date is not null')
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->whereIn('employee_polices.status', ['draft', 'enrolled'])
->whereIn('employees.emp_status', ['draft', 'enrolled'])
->first();
if($policy) if($policy)
return true; return true;
@ -3782,7 +3896,9 @@ class EmployeeRestController extends AdminController
->where('employees.is_active', 1) ->where('employees.is_active', 1)
->where('employee_polices.is_active', 1) ->where('employee_polices.is_active', 1)
->where('cp.enrolment_visibility', 1) ->where('cp.enrolment_visibility', 1)
->where('cp.open_for_enrollment', 1) // ->where('cp.open_for_enrollment', 1)
->where('employee_polices.enrollment_open_date <= CURDATE()', null, false)
->where('employee_polices.enrollment_close_date >= CURDATE()', null, false)
->where('cp.policy_status', 1) ->where('cp.policy_status', 1)
->whereIn('cp.policy_type_id', [1, 2, 3, 6, 7]) ->whereIn('cp.policy_type_id', [1, 2, 3, 6, 7])
->orderBy('employees.created_at', 'desc') ->orderBy('employees.created_at', 'desc')
@ -3834,7 +3950,9 @@ class EmployeeRestController extends AdminController
->where('employees.is_active', 1) ->where('employees.is_active', 1)
->where('employee_polices.is_active', 1) ->where('employee_polices.is_active', 1)
->where('cp.enrolment_visibility', 1) ->where('cp.enrolment_visibility', 1)
->where('cp.open_for_enrollment', 1) // ->where('cp.open_for_enrollment', 1)
->where('employee_polices.enrollment_open_date <= CURDATE()', null, false)
->where('employee_polices.enrollment_close_date >= CURDATE()', null, false)
->where('cp.policy_status', 1) ->where('cp.policy_status', 1)
->whereIn('cp.policy_type_id', [1, 2, 3, 6, 7]) ->whereIn('cp.policy_type_id', [1, 2, 3, 6, 7])
->orderBy('employees.created_at', 'desc'); ->orderBy('employees.created_at', 'desc');

View File

@ -1987,21 +1987,19 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$file = $this->fileModel->find($file_id); $file = $this->fileModel->find($file_id);
// dd($file); // dd($file);
$return = []; $return = [];
if(!isset($file)) if (!isset($file)) {
{
//file not found in DB //file not found in DB
return array('status' => false, 'msg' => 'file not found in DB'); return array('status' => false, 'msg' => 'file not found in DB');
} }
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name']; $file_name_with_path = WRITEPATH . "/uploads/excel/" . $file['file_name'];
//check physical file //check physical file
if(!file_exists($file_name_with_path)) if (!file_exists($file_name_with_path)) {
{
//file not found update status and reason //file not found update status and reason
$message = "Physical file not found"; $message = "Physical file not found";
// echo $message; // echo $message;
$this->myLogger->logme('error',($message . ' for file id ' . $file_id)); $this->myLogger->logme('error', ($message . ' for file id ' . $file_id));
$this->fileModel->where('id', $file_id)->set(['status' => 'failed','reason' => json_encode(['error_summary' => array_count_values([5]),'error_data' => $message])])->update(); $this->fileModel->where('id', $file_id)->set(['status' => 'failed', 'reason' => json_encode(['error_summary' => array_count_values([5]), 'error_data' => $message])])->update();
return array('error_summary' => [5], 'error_data' => $message); return array('error_summary' => [5], 'error_data' => $message);
} }
@ -2010,21 +2008,21 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$sheet = $spreadsheet->getActiveSheet(); $sheet = $spreadsheet->getActiveSheet();
$highestRowAndColumn = $sheet->getHighestRowAndColumn(); $highestRowAndColumn = $sheet->getHighestRowAndColumn();
$result = ['error_type' => 2,'error_summary' => [], 'error_data' => [] ]; $result = ['error_type' => 2, 'error_summary' => [], 'error_data' => []];
$columns_to_check = $this->enrollment_excel_columns; $columns_to_check = $this->enrollment_excel_columns;
$keys = array_keys($columns_to_check); $keys = array_keys($columns_to_check);
$allowedHighestColumn = end($columns_to_check); $allowedHighestColumn = end($columns_to_check);
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']); $excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
// print_r($keys);die(); // print_r($keys);die();
//get existing units in the current branch //get existing units in the current branch
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']); $existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'], client_branch_id: $file['client_branch_id']);
//remove header //remove header
unset($excel_data[0]); unset($excel_data[0]);
// dd($excel_data); // dd($excel_data);
$emp_emails = []; $emp_emails = [];
//check is welcome notification enabled //check is welcome notification enabled
$notification = $this->notificationModel->where('client_id',$file['client_id'])->where('template_name','member_welcome_mail')->first(); $notification = $this->notificationModel->where('client_id', $file['client_id'])->where('template_name', 'member_welcome_mail')->first();
// dd($notification); // dd($notification);
$client_details = $this->clientModel->where('id', $file['client_id'])->first(); $client_details = $this->clientModel->where('id', $file['client_id'])->first();
$policy_details = $this->clientPolicyModel->where('id', $file['policy_id'])->first(); $policy_details = $this->clientPolicyModel->where('id', $file['policy_id'])->first();
@ -2034,27 +2032,24 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
//get policy slab rates //get policy slab rates
// $slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']); // $slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($file['policy_id'],$file['client_id']);
// dd($slab_details); // dd($slab_details);
$parent_policy_mail_sended_emp_code = [];
foreach ($excel_data as $key => $row) foreach ($excel_data as $key => $row) {
{
$is_row_empty = check_row_is_empty_or_null($row); $is_row_empty = check_row_is_empty_or_null($row);
if(!$is_row_empty) if (!$is_row_empty) {
{
$value = []; $value = [];
$policy_data = []; $policy_data = [];
$temp_unit = ''; $temp_unit = '';
if(empty($row[12])) if (empty($row[12])) {
{
$temp_unit = $existing_units[0]; $temp_unit = $existing_units[0];
} }
$value['emp_code'] = $row[1]; $value['emp_code'] = $row[1];
$value['name'] = $row[2]; $value['name'] = $row[2];
$value['doj'] = (!empty($row[3]) ? change_date_format($row[3],'d-M-Y','Y-m-d') : null ); $value['doj'] = (!empty($row[3]) ? change_date_format($row[3], 'd-M-Y', 'Y-m-d') : null);
$value['gender'] = $row[4]; $value['gender'] = $row[4];
$value['relationship'] = ucfirst(trim($row[5])); $value['relationship'] = ucfirst(trim($row[5]));
$value['dob'] = change_date_format($row[6],'d-M-Y','Y-m-d'); $value['dob'] = change_date_format($row[6], 'd-M-Y', 'Y-m-d');
$value['email_corporate'] = $row[7]; $value['email_corporate'] = $row[7];
$value['mobile'] = $row[8]; $value['mobile'] = $row[8];
$value['band'] = $row[10]; $value['band'] = $row[10];
@ -2069,47 +2064,48 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
$value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model $value['temp']['emp_id'] = null; // dummy value for using exisitng funciton in model
if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'father') { if (strtolower(trim($value['relationship'])) === 'mother' || strtolower(trim($value['relationship'])) === 'father') {
$relation = 'parent'; $relation = 'parent';
} else if(strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter'){ } else if (strtolower(trim($value['relationship'])) === 'son' || strtolower(trim($value['relationship'])) === 'daughter') {
$relation = 'child'; $relation = 'child';
}else if((strtolower(trim($value['relationship'])) === 'father in law' || strtolower(trim($value['relationship'])) === 'mother in law') || (strtolower(trim($value['relationship'])) === 'father-in-law' || strtolower(trim($value['relationship'])) === 'mother-in-law')){ } else if ((strtolower(trim($value['relationship'])) === 'father in law' || strtolower(trim($value['relationship'])) === 'mother in law') || (strtolower(trim($value['relationship'])) === 'father-in-law' || strtolower(trim($value['relationship'])) === 'mother-in-law')) {
$relation = 'parent_in_law'; $relation = 'parent_in_law';
}else if(strtolower(trim($value['relationship'])) === 'spouse'){ } else if (strtolower(trim($value['relationship'])) === 'spouse') {
$relation = 'spouse'; $relation = 'spouse';
}else if(strtolower(trim($value['relationship'])) === 'self'){ } else if (strtolower(trim($value['relationship'])) === 'self') {
$relation = 'self'; $relation = 'self';
}else { } else {
$relation = ''; $relation = '';
} }
$value['family_floater_key'] = $relation; $value['family_floater_key'] = $relation;
$policy_data['basic_cover_si'] = $row[9]; $policy_data['basic_cover_si'] = $row[9];
$policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13],'d-M-Y','Y-m-d') : null; $policy_data['date_coverage'] = $row[13] != "" && $row[13] != null ? change_date_format($row[13], 'd-M-Y', 'Y-m-d') : null;
$policy_data['client_policy_id'] = $file['policy_id']; $policy_data['client_policy_id'] = $file['policy_id'];
$policy_data['enrollment_open_date'] = $file['enrollment_open_date'] ?? null;
$policy_data['enrollment_close_date'] = $file['enrollment_close_date'] ?? null;
$employee = $this->employeeModel->checkExistingEmployee($value,$file['client_branch_id']);
$employee = $this->employeeModel->checkExistingEmployee($value, $file['client_branch_id']);
unset($value['temp']); unset($value['temp']);
//save employee table //save employee table
// dd($employee['id']); // dd($employee['id']);
if($employee !== null) if ($employee !== null) {
{
$value['updated_by'] = $file['created_by']; $value['updated_by'] = $file['created_by'];
$value['id'] = $employee['id']; $value['id'] = $employee['id'];
$value['emp_status'] = 'draft'; $value['emp_status'] = 'draft';
$log_message = 'Enrollment Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id']; $log_message = 'Enrollment Update Employee - ' . $employee['name'] . '(' . $employee['emp_code'] . ') with PK ' . $employee['id'];
} } else {
else
{
$value['emp_status'] = 'draft'; $value['emp_status'] = 'draft';
$value['created_by'] = $file['created_by']; $value['created_by'] = $file['created_by'];
$log_message = 'Enrollment Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK '; $log_message = 'Enrollment Insert Employee- ' . $value['name'] . '(' . $value['emp_code'] . ') with PK ';
} }
$value = ExcelSanitizeHelper::sanitizeArrayData($value); $value = ExcelSanitizeHelper::sanitizeArrayData($value);
$this->employeeModel->save($value); $this->employeeModel->save($value);
if (isset($value['id'])) if (isset($value['id'])) {
{ $emp_id = $value['id']; } $emp_id = $value['id'];
else { $emp_id = $this->employeeModel->getInsertID(); } else {
$emp_id = $this->employeeModel->getInsertID();
$log_message .= $emp_id; $log_message .= $emp_id;
} }
@ -2117,47 +2113,42 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
// if($emp_id != 0){ $log_message .= $emp_id; } // if($emp_id != 0){ $log_message .= $emp_id; }
// else{ $emp_id = $employee['id']; } // else{ $emp_id = $employee['id']; }
$this->myLogger->logme('error',$log_message); $this->myLogger->logme('error', $log_message);
//save policy table //save policy table
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $file['policy_id']]); $employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id, 'client_policy_id' => $file['policy_id']]);
if(count($employee_policy)) if (count($employee_policy)) {
{
$policy_data['updated_by'] = $file['created_by']; $policy_data['updated_by'] = $file['created_by'];
$policy_data['id'] = $employee_policy[0]['id']; $policy_data['id'] = $employee_policy[0]['id'];
$policy_data['status'] = 'draft'; $policy_data['status'] = 'draft';
$policy_data['payable_employee'] = check_pay_by_employee_or_company($policy_details['policy_terms'], $value['relationship']); $policy_data['payable_employee'] = check_pay_by_employee_or_company($policy_details['policy_terms'], $value['relationship']);
$policy_data['file_id'] = isset($employee_policy[0]['file_id']) && $employee_policy[0]['file_id'] != '' ? $employee_policy[0]['file_id'] : $file_id ; $policy_data['file_id'] = isset($employee_policy[0]['file_id']) && $employee_policy[0]['file_id'] != '' ? $employee_policy[0]['file_id'] : $file_id;
$log_message = 'Update Employee Policy for '. $value['name'].'('. $value['emp_code'].') with PK- ' . $employee_policy[0]['id'] .' client policy ID '.$employee_policy[0]['client_policy_id'].' with SI '.$policy_data['basic_cover_si']; $log_message = 'Update Employee Policy for ' . $value['name'] . '(' . $value['emp_code'] . ') with PK- ' . $employee_policy[0]['id'] . ' client policy ID ' . $employee_policy[0]['client_policy_id'] . ' with SI ' . $policy_data['basic_cover_si'];
// echo 'insert policy'; // echo 'insert policy';
} } else {
else
{
$policy_data['employee_id'] = $emp_id; $policy_data['employee_id'] = $emp_id;
$policy_data['client_policy_id'] = $file['policy_id']; $policy_data['client_policy_id'] = $file['policy_id'];
$policy_data['created_by'] = $file['created_by']; $policy_data['created_by'] = $file['created_by'];
$policy_data['status'] = 'draft'; $policy_data['status'] = 'draft';
$policy_data['payable_employee'] = check_pay_by_employee_or_company($policy_details['policy_terms'], $value['relationship']); $policy_data['payable_employee'] = check_pay_by_employee_or_company($policy_details['policy_terms'], $value['relationship']);
$policy_data['file_id'] = $file_id; $policy_data['file_id'] = $file_id;
$log_message = 'Insert Employee Policy for '. $value['name'].'('. $value['emp_code'].') - client policy id -'. $file['policy_id'].' - with SI '.$policy_data['basic_cover_si']; $log_message = 'Insert Employee Policy for ' . $value['name'] . '(' . $value['emp_code'] . ') - client policy id -' . $file['policy_id'] . ' - with SI ' . $policy_data['basic_cover_si'];
// echo 'update policy'; // echo 'update policy';
} }
log_message('error',json_encode($policy_data)); log_message('error', json_encode($policy_data));
// dd($policy_data); // dd($policy_data);
$this->employeePolicyModel->save($policy_data); $this->employeePolicyModel->save($policy_data);
$emp_policy_id = $this->employeePolicyModel->getInsertID(); $emp_policy_id = $this->employeePolicyModel->getInsertID();
$this->myLogger->logme('error',$log_message); $this->myLogger->logme('error', $log_message);
$employeeRestController = new EmployeeRestController(); $employeeRestController = new EmployeeRestController();
$employeeRestController->updatePremiumAmount($file['policy_id'], $value['emp_code'], $file['client_branch_id']); $employeeRestController->updatePremiumAmount($file['policy_id'], $value['emp_code'], $file['client_branch_id']);
//save email of self for send mail later //save email of self for send mail later
if (isset($notification) && $notification['enabled'] == 1 && $notification['mail_content'] != '') if (isset($notification) && $notification['enabled'] == 1 && $notification['mail_content'] != '') {
{ if (strtolower($value['relationship']) == 'self' && $value['email_corporate'] != "") {
if(strtolower($value['relationship']) == 'self' && $value['email_corporate'] != "")
{
$params['dataToInsert'] = $value; //holds employee master data $params['dataToInsert'] = $value; //holds employee master data
$params['notification'] = $notification; $params['notification'] = $notification;
$params['client_data'] = $client_details; $params['client_data'] = $client_details;
@ -2169,11 +2160,50 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
'employee_id' => $emp_id, 'employee_id' => $emp_id,
'mail_type' => 'member_welcome_mail', 'mail_type' => 'member_welcome_mail',
]; ];
$params['enrollment_open_date'] = $file['enrollment_open_date'] ?? null;
$params['enrollment_close_date'] = $file['enrollment_close_date'] ?? null;
//store email and mail content via helper to send notification //store email and mail content via helper to send notification
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params); $emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
} else if ($policy_details['policy_type_id'] == 3 && $policy_details['is_addon'] == 3 && !in_array($row[1], $parent_policy_mail_sended_emp_code)) {
$sefData = $this->employeeModel
->where('is_active', 1)
->whereIn('emp_status', ['draft', 'enrolled'])
->where('family_floater_key', 'self')
->where('emp_code', $row[1])
->where('client_id', $file['client_id'])
->where('client_branch_id', $file['client_branch_id'])
->where('email_corporate is not null')
->first();
if (!empty($sefData)) {
$value['email_corporate'] = $sefData['email_corporate'];
$value['name'] = $sefData['name'];
$value['mobile'] = $sefData['mobile'];
$params['dataToInsert'] = $value; //holds employee master data
$params['notification'] = $notification;
$params['client_data'] = $client_details;
$params['common'] = [
'client_id' => $file['client_id'],
'client_branch_id' => $file['client_branch_id'],
'client_policy_id' => $file['policy_id'],
'employee_policy_id' => $emp_policy_id ?? null,
'employee_id' => $emp_id,
'mail_type' => 'member_welcome_mail',
];
$params['enrollment_open_date'] = $file['enrollment_open_date'] ?? null;
$params['enrollment_close_date'] = $file['enrollment_close_date'] ?? null;
//store email and mail content via helper to send notification
$emp_emails[] = sendMailNotification::sendMailNotification('member_welcome_mail', $params);
$parent_policy_mail_sended_emp_code[] = $row[1];
} }
} }
}// endof if row is empty check }
} // endof if row is empty check
} //end of for loop } //end of for loop
// dd($emp_emails); // dd($emp_emails);
@ -2189,13 +2219,13 @@ public function getFileMetaDataByFileId($file_id, $status = 'success'){
} }
} }
$this->fileModel->where('id', $file_id)->set(['status' => 'success','reason' => ''])->update(); $this->fileModel->where('id', $file_id)->set(['status' => 'success', 'reason' => ''])->update();
$this->myLogger->logme("error",'{file_id} uploaded success',['file_id' => $file_id]); $this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
$this->setPullNotification($this->getFileMetaDataByFileId($file_id,'success')); $this->setPullNotification($this->getFileMetaDataByFileId($file_id, 'success'));
return true; return true;
}//end of employeesEnrollmentInsert } //end of employeesEnrollmentInsert
} }

View File

@ -51,12 +51,23 @@ class sendMailNotification
$nhance_logo = $_ENV['NHANCE_LOGO']; $nhance_logo = $_ENV['NHANCE_LOGO'];
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
$enrollment_open_date = !empty($params['enrollment_open_date'] ?? null)
? change_date_format($params['enrollment_open_date'], 'Y-m-d', 'F d, Y')
: 'N/A';
$enrollment_close_date = !empty($params['enrollment_close_date'] ?? null)
? change_date_format($params['enrollment_close_date'], 'Y-m-d', 'F d, Y')
: 'N/A';
$mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content); $mail_content = str_replace(["[[client_logo]]", "{{client_logo}}"], "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
$mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content); $mail_content = str_replace(["[[nhance_logo]]", "{{nhance_logo}}"], "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
$mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content); $mail_content = str_replace(["[[member_name]]", "{{member_name}}"], $employee_name, $mail_content);
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content); $mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $employee_mobile_no, $mail_content);
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content); $mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
$mail_content = str_replace(["[[enrollment_open_date]]", "{{enrollment_open_date}}"], $enrollment_open_date, $mail_content);
$mail_content = str_replace(["[[enrollment_close_date]]", "{{enrollment_close_date}}"], $enrollment_close_date, $mail_content);
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content); $mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') { if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
@ -1247,6 +1258,13 @@ class sendMailNotification
$app_link = $_ENV['App_Url']; $app_link = $_ENV['App_Url'];
$nhance_logo = $_ENV['NHANCE_LOGO']; $nhance_logo = $_ENV['NHANCE_LOGO'];
$enrollment_open_date = !empty($params['enrollment_open_date'] ?? null)
? date('F d, Y', strtotime(str_replace('/', '-', $params['enrollment_open_date'] ?? '')))
: date('F d, Y');
$enrollment_close_date = !empty($params['enrollment_close_date'] ?? null)
? date('F d, Y', strtotime(str_replace('/', '-', $params['enrollment_close_date'] ?? '')))
: date('F d, Y', strtotime('+15 days'));
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo']; $client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
@ -1256,6 +1274,9 @@ class sendMailNotification
$mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content); $mail_content = str_replace(["[[member_mobile]]", "{{member_mobile}}"], $mobile, $mail_content);
$mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content); $mail_content = str_replace(["[[client_name]]", "{{client_name}}"], $client_data['client_name'], $mail_content);
$mail_content = str_replace(["[[enrollment_open_date]]", "{{enrollment_open_date}}"], $enrollment_open_date, $mail_content);
$mail_content = str_replace(["[[enrollment_close_date]]", "{{enrollment_close_date}}"], $enrollment_close_date, $mail_content);
$mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content); $mail_content = str_replace(["[[app_link]]", "{{app_link}}"], "<a href='$app_link'>Review Details</a>", $mail_content);
if ($mail != null || $mail != '') { if ($mail != null || $mail != '') {

View File

@ -556,7 +556,9 @@ if (!function_exists('change_date_format')) {
if ($source_format !== null && $output_format !== null) { if ($source_format !== null && $output_format !== null) {
$date = DateTime::createFromFormat($source_format, $date_str); $date = DateTime::createFromFormat($source_format, $date_str);
if (!$date) { if (!$date) {
throw new Exception("Invalid date string for source format: $source_format"); // throw new Exception("Invalid date string for source format: $source_format");
log_message('error', "❌ Date format error : Invalid date string | Params => date_str: {$date_str}, source_format: {$source_format}, output_format: {$output_format}");
return null;
} }
return $date->format($output_format); return $date->format($output_format);
} }
@ -565,7 +567,9 @@ if (!function_exists('change_date_format')) {
if ($source_format !== null && $output_format === null) { if ($source_format !== null && $output_format === null) {
$date = DateTime::createFromFormat($source_format, $date_str); $date = DateTime::createFromFormat($source_format, $date_str);
if (!$date) { if (!$date) {
throw new Exception("Invalid date string for source format: $source_format"); // throw new Exception("Invalid date string for source format: $source_format");
log_message('error', "❌ Date format error : Invalid date string | Params => date_str: {$date_str}, source_format: {$source_format}, output_format: {$output_format}");
return null;
} }
return $date->format('Y-m-d'); // MySQL default format return $date->format('Y-m-d'); // MySQL default format
} }
@ -580,10 +584,17 @@ if (!function_exists('change_date_format')) {
} }
// If no format matches, throw an exception // If no format matches, throw an exception
$allowed_placeholders = implode(', ', $allowed_formats); $allowed_placeholders = implode(', ', $allowed_formats);
throw new Exception("Invalid date string format. Allowed formats: $allowed_placeholders"); // throw new Exception("Invalid date string format. Allowed formats: $allowed_placeholders");
log_message(
'error',
"❌ Date format error: Invalid date string. Allowed formats: {$allowed_placeholders} | Params => date_str: {$date_str}, source_format: {$source_format}, output_format: {$output_format}"
);
return null;
} }
} catch (Exception $e) { } catch (Exception $e) {
return "Error: " . $e->getMessage(); // return "Error: " . $e->getMessage();
log_message('error', "❌ Date format error: {$e->getMessage()} | Params => date_str: {$date_str}, source_format: {$source_format}, output_format: {$output_format}");
return null;
} }
return null; return null;

View File

@ -160,8 +160,10 @@ class EmployeeModel extends Model
client_policy.id as ClientPolicyId, client_policy.id as ClientPolicyId,
client_policy.is_premium_summery, client_policy.is_premium_summery,
CASE CASE
WHEN client_policy.open_for_enrollment IS NULL THEN 0 WHEN employee_polices.enrollment_open_date <= CURDATE()
ELSE client_policy.open_for_enrollment AND employee_polices.enrollment_close_date >= CURDATE()
THEN 1
ELSE 0
END AS OpenForEnrollment, END AS OpenForEnrollment,
client_policy.disclaimer, client_policy.disclaimer,
client_policy.policy_type_id , client_policy.policy_type_id ,

View File

@ -35,7 +35,9 @@ class EmployeePolicyModel extends Model
"claim_status", "claim_status",
'ecard_sent_status', 'ecard_sent_status',
'payable_employee', 'payable_employee',
'file_id' 'file_id',
"enrollment_open_date",
"enrollment_close_date",
]; ];
// Callbacks // Callbacks

View File

@ -20,7 +20,9 @@ class FileModel extends Model
"policy_id", "policy_id",
"client_branch_id", "client_branch_id",
"uploaded_by", "uploaded_by",
"updated_by" "updated_by",
"enrollment_open_date",
"enrollment_close_date",
]; ];

View File

@ -156,7 +156,7 @@ input:checked + .slider:before {
<th>Client Branch</th> <th>Client Branch</th>
<!-- <th>TPA</th> --> <!-- <th>TPA</th> -->
<th>Date</th> <th>Date</th>
<th>Enrolment Status</th> <!-- <th>Enrolment Status</th> -->
<th>Status</th> <th>Status</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
@ -299,7 +299,8 @@ input:checked + .slider:before {
<label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Enable <label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Enable
Employee Enrolment Process</label> Employee Enrolment Process</label>
</div> --> </div> -->
<div class="form-group col-md-4" style="padding-top:50px;padding-bottom: 0px;">
<!-- <div class="form-group col-md-4" style="padding-top:50px;padding-bottom: 0px;">
<label for="inception_type" style=" position: relative;bottom: 5px;"> <label for="inception_type" style=" position: relative;bottom: 5px;">
<label class="switch"> <label class="switch">
<input id="inception_type" type="checkbox" name="inception_type"> <input id="inception_type" type="checkbox" name="inception_type">
@ -307,8 +308,9 @@ input:checked + .slider:before {
</label>Enable </label>Enable
Employee Enrolment Process Employee Enrolment Process
</label> </label>
</div> </div> -->
<div class="form-row">
<!-- <div class="form-row">
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="open_date">Open Date<span class="text-danger">*</span></label> <label for="open_date">Open Date<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control dateofdata" <input value="" type="text" class="form-control dateofdata"
@ -327,7 +329,8 @@ input:checked + .slider:before {
placeholder="Enter Remainder Dates( eg, 28,29,30 )" name="reminder_date" placeholder="Enter Remainder Dates( eg, 28,29,30 )" name="reminder_date"
id="reminder_date"> id="reminder_date">
</div> </div>
</div> </div> -->
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label for="disclaimer">Disclaimer<span class="text-danger">*</span></label> <label for="disclaimer">Disclaimer<span class="text-danger">*</span></label>
<textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer" <textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer"
@ -389,6 +392,7 @@ input:checked + .slider:before {
</label> </label>
Is LGBTQ Enable</label> Is LGBTQ Enable</label>
</div> </div>
<div class="form-group col-md-4" style="padding-top:50px;padding-bottom: 0px;"> <div class="form-group col-md-4" style="padding-top:50px;padding-bottom: 0px;">
<label for="is_premium_summery" style=" position: relative;bottom: 5px;"> <label for="is_premium_summery" style=" position: relative;bottom: 5px;">
<label class="switch"> <label class="switch">
@ -625,9 +629,9 @@ $(document).ready(function() {
<! -- <td>${item.insurer_short} - ${item.insurer_branch_name}</td> --> <! -- <td>${item.insurer_short} - ${item.insurer_branch_name}</td> -->
<td>${policy_name_data}</td> <td>${policy_name_data}</td>
<td>${item.branch_name ? item.branch_name : ' - '}</td> <td>${item.branch_name ? item.branch_name : ' - '}</td>
<! -- <td>${tpaValue}</td> --> <!-- <td>${tpaValue}</td> -->
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td> <td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td> <!-- <td style="text-align: center;">${(enrollmentStatus)}</td> -->
<td>${checkDateStatus(item.policy_end_date, 1)}</td> <td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td> <td>
<div class="btn-group dropdown"> <div class="btn-group dropdown">
@ -890,7 +894,7 @@ $("#policy_form").submit(function(event) {
<!-- <td>${tpaValue}</td> --> <!-- <td>${tpaValue}</td> -->
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td> <td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td style="text-align: center;">${(enrollmentStatus)}</td> <!-- <td style="text-align: center;">${(enrollmentStatus)}</td> -->
<td>${checkDateStatus(item.policy_end_date, 1)}</td> <td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td> <td>
<div class="btn-group dropdown"> <div class="btn-group dropdown">

View File

@ -71,6 +71,16 @@ option:disabled {
?> ?>
</select> </select>
</div> </div>
<div class="form-group col-md-4">
<label for="open_date">Enrollment Open Date<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Open Date " name="enrollment_open_date" id="enrollment_open_date" required>
</div>
<div class="form-group col-md-4">
<label for="close_date">Enrollment Close Date<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Close Date " name="enrollment_close_date" id="enrollment_close_date" required>
</div>
</div> </div>
<hr> <hr>
@ -180,6 +190,26 @@ $(document).ready(function() {
$("#policy_id").select2(); $("#policy_id").select2();
$("#branch_id").select2(); $("#branch_id").select2();
var enrollment_open_date = flatpickr("#enrollment_open_date", {
dateFormat: "d/m/Y",
allowInput: false,
minDate: "today",
onChange: function (selectedDates) {
if (selectedDates.length) {
enrollment_close_date.setDate(
new Date(selectedDates[0].getTime() + 15 * 24 * 60 * 60 * 1000),
true
);
}
}
});
var enrollment_close_date = flatpickr("#enrollment_close_date", {
dateFormat: "d/m/Y",
allowInput: false,
minDate: "today"
});
}); });
// Declare a global variable to store API response data // Declare a global variable to store API response data

View File

@ -44,8 +44,27 @@
// echo $reason; // echo $reason;
?> ?>
<tr> <td class="reload truncate"
<td><b><?php echo ($key + 1) ?></b></td> data-toggle="tooltip"
data-placement="top"
data-html="true"
title="<?php
echo 'Enrollment Open Date : ' .
(!empty($file['enrollment_open_date'])
? change_date_format($file['enrollment_open_date'], 'Y-m-d', 'd/m/Y')
: 'N/A'
) .
'<br>' .
'Enrollment Close Date : ' .
(!empty($file['enrollment_close_date'])
? change_date_format($file['enrollment_close_date'], 'Y-m-d', 'd/m/Y')
: 'N/A'
);
?>">
<b>
<?php echo ($key + 1) ?>
</b></td>
<td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>"> <td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>">
<?php echo $file['file_name']?> <?php echo $file['file_name']?>
</td> </td>
@ -53,7 +72,7 @@
<td><?php echo $file['branch_name'] ?></td> <td><?php echo $file['branch_name'] ?></td>
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> --> <!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td> <td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
<td><?php echo $file['action'] ?></td> <td><?= $file['action'] == 'enrollment' ? 'Enrolment' : $file['action'] ?></td>
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['first_name'] . '</strong>' ?> <td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['first_name'] . '</strong>' ?>
</td> </td>
<td> <td>

View File

@ -250,7 +250,7 @@
<select id="member_welcome_mailmodal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)"> <select id="member_welcome_mailmodal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;" onchange="copyToClipboard(this)">
<option value="">PlaceHolders</option> <option value="">PlaceHolders</option>
<?php foreach ($placeHolders as $value): ?> <?php foreach ($placeHolders as $value): ?>
<?php if ($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary') { ?> <?php if ($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'member_summary' || $value == 'enrollment_open_date' || $value == 'enrollment_close_date') { ?>
<?php $valueChange = str_replace('_', ' ', $value); <?php $valueChange = str_replace('_', ' ', $value);
$valueChange = ucwords($valueChange); ?> $valueChange = ucwords($valueChange); ?>
<option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option> <option value="{{<?php echo $value; ?>}}"><?php echo $valueChange; ?></option>