Merge branch 'dev' of bitbucket.org:jubilian/nhance into test
This commit is contained in:
commit
1f52582293
@ -112,6 +112,7 @@ $routes->group("/employee", ["filter" => "authMVC"], function($routes){
|
|||||||
$routes->get("upload", "EmployeeController::employeesUplodWithEvents");
|
$routes->get("upload", "EmployeeController::employeesUplodWithEvents");
|
||||||
$routes->post("upload", "EmployeeController::employeesUplodWithEvents");
|
$routes->post("upload", "EmployeeController::employeesUplodWithEvents");
|
||||||
$routes->get("excel_error/(:any)", "EmployeeController::getExcelFileErrors/$1");
|
$routes->get("excel_error/(:any)", "EmployeeController::getExcelFileErrors/$1");
|
||||||
|
$routes->get("endorsement-list", "EmployeeController::endorsementList");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -206,6 +207,7 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
|
|||||||
$routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
|
$routes->get("policy-premium", "ClientController::getpolicyGridData/$1");
|
||||||
$routes->get("update-policy-status", "ClientController::updateClientPolicyStatus/$1");
|
$routes->get("update-policy-status", "ClientController::updateClientPolicyStatus/$1");
|
||||||
$routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
|
$routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
|
||||||
|
$routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1");
|
||||||
$routes->post("import-export", "EmployeeController::importExport");
|
$routes->post("import-export", "EmployeeController::importExport");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -230,9 +232,6 @@ $routes->group("/api", ["filter" => "authJWT"], function($routes){
|
|||||||
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
$routes->get("/getEmployeeProfile", "EmployeeRestController::getEmployeeProfile/$1");
|
||||||
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
$routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfile");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
||||||
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||||
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
||||||
@ -245,6 +244,9 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
|||||||
$routes->get("deleteDependence", "EmployeeRestController::deleteDependence");
|
$routes->get("deleteDependence", "EmployeeRestController::deleteDependence");
|
||||||
$routes->get("getEmployeeAndDependenceByClientId", "EmployeeRestController::getEmployeeAndDependenceByClientId");
|
$routes->get("getEmployeeAndDependenceByClientId", "EmployeeRestController::getEmployeeAndDependenceByClientId");
|
||||||
$routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy");
|
$routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy");
|
||||||
|
$routes->get("getClientDetails", "EmployeeRestController::getClientDetails");
|
||||||
|
$routes->get("getAddOnPolicy", "EmployeeRestController::getAddOnPolicy");
|
||||||
|
$routes->get("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
$routes->post("sendEmail", "EmployeeRestController::send_email");
|
||||||
|
|||||||
@ -308,6 +308,8 @@ class ClientController extends AdminController
|
|||||||
$data['is_download_btn'] = 1;
|
$data['is_download_btn'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print_r($data);die;
|
||||||
|
|
||||||
$update = $this->clientModel->update($id,$data);
|
$update = $this->clientModel->update($id,$data);
|
||||||
|
|
||||||
|
|
||||||
@ -934,73 +936,102 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
||||||
$policy_name = $data[0]->policy_name;
|
$policy_name = $data[0]->policy_name;
|
||||||
$pattern = '/gmc/i';
|
$gmc_pattern = '/gmc/i';
|
||||||
|
$gpa_pattern = '/gpa/i';
|
||||||
$subject = $data[0]->policy_type;
|
$subject = $data[0]->policy_type;
|
||||||
if (preg_match($pattern, $subject)) {
|
if (preg_match($gmc_pattern, $subject)) {
|
||||||
$search_term = 'GMC';
|
$search_term = 'GMC';
|
||||||
} else {
|
} else if (preg_match($gpa_pattern, $subject)){
|
||||||
$search_term = 'GPA';
|
$search_term = 'GPA';
|
||||||
|
}else{
|
||||||
|
$search_term = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
|
$results = $this->policyGridModel->like('policy_type', $search_term)->findAll();
|
||||||
|
|
||||||
if($search_term === 'GPA'){
|
if($search_term === 'GPA'){
|
||||||
|
|
||||||
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||||
|
|
||||||
}else{
|
}else if($search_term === 'GMC'){
|
||||||
|
|
||||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$premiumData = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// echo $record['client_id'];
|
// echo $record['client_id'];
|
||||||
// echo "-----";
|
// echo "-----";
|
||||||
// echo $client_policy_id;
|
// echo $client_policy_id;
|
||||||
// print_r($premiumData);die;
|
// print_r($premiumData);die;
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// echo $family_floater;
|
// echo $family_floater;
|
||||||
$resultss = [];
|
|
||||||
if ($family_floater == 1) {
|
|
||||||
|
|
||||||
foreach ($results as $index => $record) {
|
if($search_term === 'GMC'){
|
||||||
if ($index == '8' || $index == '7') {
|
|
||||||
// Clearing the $results array
|
$resultss = [];
|
||||||
|
if ($family_floater == 1) {
|
||||||
|
|
||||||
|
foreach ($results as $index => $record) {
|
||||||
|
if ($index == '8' || $index == '7') {
|
||||||
|
// Clearing the $results array
|
||||||
|
$resultss[$index] = $record;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if($family_floater == 0){
|
||||||
|
foreach ($results as $index => $record) {
|
||||||
|
if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6') {
|
||||||
|
// Clearing the $results array
|
||||||
|
$resultss[$index] = $record;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
foreach ($results as $index => $record) {
|
||||||
$resultss[$index] = $record;
|
$resultss[$index] = $record;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if($family_floater == 0){
|
$premiumDataa ='';
|
||||||
foreach ($results as $index => $record) {
|
if ($family_floater == 0) {
|
||||||
if ($index == '0' || $index == '1' || $index == '2' || $index == '3' || $index == '4' || $index == '5' || $index == '6') {
|
// print_r($premiumData);die;
|
||||||
// Clearing the $results array
|
if (count($premiumData) == 0) {
|
||||||
$resultss[$index] = $record;
|
$premiumDataa = $premiumData;
|
||||||
}
|
}else if ($premiumData[0]['policy_grid_id'] == '3' || $premiumData[0]['policy_grid_id'] == '4' || $premiumData[0]['policy_grid_id'] == '5' || $premiumData[0]['policy_grid_id'] == '6' || $premiumData[0]['policy_grid_id'] == '7' || $premiumData[0]['policy_grid_id'] == '8' || $premiumData[0]['policy_grid_id'] == '9' ) {
|
||||||
|
$premiumDataa = $premiumData;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
else if($family_floater == 1){
|
||||||
foreach ($results as $index => $record) {
|
if(count($premiumData) == 0){
|
||||||
$resultss[$index] = $record;
|
$premiumDataa = $premiumData;
|
||||||
|
}else if ($premiumData[0]['policy_grid_id'] == '10' || $premiumData[0]['policy_grid_id'] == '11') {
|
||||||
|
$premiumDataa = $premiumData;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$premiumDataa = $premiumData;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$premiumDataa ='';
|
if($premiumDataa == ""){
|
||||||
if ($family_floater == 0) {
|
$premiumDataa = $premiumData;
|
||||||
|
}
|
||||||
|
|
||||||
// print_r($premiumData);die;
|
// print_r($premiumData);die;
|
||||||
if (count($premiumData) == 0) {
|
|
||||||
$premiumDataa = $premiumData;
|
// print_r($data[0]->policy_type); die;
|
||||||
}else if ($premiumData[0]['policy_grid_id'] == '3' || $premiumData[0]['policy_grid_id'] == '4' || $premiumData[0]['policy_grid_id'] == '5' || $premiumData[0]['policy_grid_id'] == '6' || $premiumData[0]['policy_grid_id'] == '7' || $premiumData[0]['policy_grid_id'] == '8' || $premiumData[0]['policy_grid_id'] == '9' ) {
|
// echo "hello";
|
||||||
$premiumDataa = $premiumData;
|
// return json_encode($premiumData);
|
||||||
}
|
|
||||||
}
|
return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
|
||||||
else if($family_floater == 1){
|
|
||||||
if(count($premiumData) == 0){
|
}else if($search_term === 'GPA'){
|
||||||
$premiumDataa = $premiumData;
|
|
||||||
}else if ($premiumData[0]['policy_grid_id'] == '10' || $premiumData[0]['policy_grid_id'] == '11') {
|
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
|
||||||
$premiumDataa = $premiumData;
|
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
$premiumDataa = $premiumData;
|
|
||||||
|
return $this->respond(['status' => false,'code' => 200,'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// print_r($premiumData);die;
|
|
||||||
|
|
||||||
// print_r($data[0]->policy_type); die;
|
|
||||||
// echo "hello";
|
|
||||||
// return json_encode($premiumData);
|
|
||||||
return $this->respond(['status' => true,'code' => 200,'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name,], 200);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function policyGMCTerms()
|
public function policyGMCTerms()
|
||||||
@ -1311,7 +1342,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$termsData = $this->clientPolicyModel->where(['id' => $client_policy_id, 'is_active' => 1])->first();
|
$termsData = $this->clientPolicyModel->where(['id' => $client_policy_id, 'is_active' => 1])->first();
|
||||||
if(empty($termsData['policy_terms'])){
|
if(empty($termsData['policy_terms'])){
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'This Policy does not Create Terms'], 200);
|
return $this->respond(['status' => false,'code' => 200,'message' => 'Please define policy terms '], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1338,11 +1369,21 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
if($racRate == 0){
|
if($racRate == 0){
|
||||||
|
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'The Policy has no Data for Rac Rate'], 200);
|
return $this->respond(['status' => false,'code' => 200,'message' => 'Please define policy premium'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
$policy_status = $this->clientPolicyModel->where('id', $client_policy_id )->set('policy_status', 1)->update();
|
$policy_status = $this->clientPolicyModel->where('id', $client_policy_id )->set('policy_status', 1)->update();
|
||||||
return $this->respond(['status' => true,'code' => 200, 'message' => 'Policy Status Updated Successfully', 'data' => $termsData, 'racRate' => $racRate], 200);
|
$json_data ='';
|
||||||
|
$open_for_enrollment = $this->clientPolicyModel->where('id', $client_policy_id )->set('open_for_enrollment', 1)->update();
|
||||||
|
if ($open_for_enrollment) {
|
||||||
|
$open_for_enrollment_1 = $this->clientPolicyModel->where('id', $client_policy_id )->find();
|
||||||
|
$open_for_enrollment_value = $open_for_enrollment_1[0]['open_for_enrollment'];
|
||||||
|
$client_policy_id_value = $client_policy_id;
|
||||||
|
|
||||||
|
$json_data = json_encode(['open_for_enrollment' => $open_for_enrollment_value, 'client_policy_id' => $client_policy_id_value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => true,'code' => 200, 'message' => 'Policy Status Updated Successfully', 'data' => $termsData, 'racRate' => $racRate, 'open_for_enrollment' => $json_data], 200);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -162,9 +162,17 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
public function generateExcelForCorrection($export_data)
|
public function generateExcelForCorrection($export_data)
|
||||||
{
|
{
|
||||||
|
$ids = [];
|
||||||
|
|
||||||
$objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getCorrectionEmployeesDataForExportExcel($export_data);
|
||||||
// dd($objects);
|
|
||||||
|
foreach ($objects as $obj) {
|
||||||
|
$ids[] = $obj->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($objects); die;
|
||||||
|
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
$export_data['count'] = $count;
|
$export_data['count'] = $count;
|
||||||
$this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
|
$this->myLogger->logme('error','Correction export data count : {data}', ['data'=> $count ]);
|
||||||
@ -201,6 +209,14 @@ class EmpDataServiceController extends BaseController
|
|||||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||||
if($return){
|
if($return){
|
||||||
|
|
||||||
|
foreach ($ids as $key => $id) {
|
||||||
|
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||||
|
if ($group_key) {
|
||||||
|
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set the appropriate headers for Excel file download
|
// Set the appropriate headers for Excel file download
|
||||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||||
@ -228,9 +244,15 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
public function generateExcelForSIEnhancement($export_data)
|
public function generateExcelForSIEnhancement($export_data)
|
||||||
{
|
{
|
||||||
|
$ids = [];
|
||||||
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getSIEnhancementEmployeesDataForExportExcel($export_data);
|
||||||
|
|
||||||
|
foreach ($objects as $obj) {
|
||||||
|
$ids[] = $obj->endorsement_primarykey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($ids); die;
|
||||||
// dd($objects);
|
// dd($objects);
|
||||||
|
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
@ -280,6 +302,13 @@ class EmpDataServiceController extends BaseController
|
|||||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||||
if($return){
|
if($return){
|
||||||
|
|
||||||
|
foreach ($ids as $key => $id) {
|
||||||
|
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||||
|
if ($group_key) {
|
||||||
|
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the appropriate headers for Excel file download
|
// Set the appropriate headers for Excel file download
|
||||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||||
@ -306,8 +335,18 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
public function generateExcelForDeletion($export_data)
|
public function generateExcelForDeletion($export_data)
|
||||||
{
|
{
|
||||||
// dd($export_data['client_id']);
|
$ids = [];
|
||||||
|
|
||||||
$objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($export_data);
|
$objects = $this->employeePolicyModel->getDeletionEmployeeDataForExportExcel($export_data);
|
||||||
|
|
||||||
|
foreach ($objects as $obj) {
|
||||||
|
$ids[] = $obj->endorsement_primarykey;
|
||||||
|
}
|
||||||
|
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($ids);
|
||||||
|
// print_r($objects); die;
|
||||||
|
|
||||||
$count = count($objects);
|
$count = count($objects);
|
||||||
$export_data['count'] = $count;
|
$export_data['count'] = $count;
|
||||||
|
|
||||||
@ -351,6 +390,13 @@ class EmpDataServiceController extends BaseController
|
|||||||
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
$return = $this->batchFilesAndBatchListEntry($export_data, $objects);
|
||||||
if( $return){
|
if( $return){
|
||||||
|
|
||||||
|
foreach ($ids as $key => $id) {
|
||||||
|
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $id)->first();
|
||||||
|
if ($group_key) {
|
||||||
|
$this->empEndorsementModel->where('group_key', $group_key)->set('status', 'inprogress')->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the appropriate headers for Excel file download
|
// Set the appropriate headers for Excel file download
|
||||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||||
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
header('Content-Disposition: attachment;filename="' . $export_data['file_name'] . '"');
|
||||||
@ -560,7 +606,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
// $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id);
|
// $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id);
|
||||||
|
|
||||||
$queryData = $this->empEndorsementModel->select('emp_endorsement.*')
|
$queryData = $this->empEndorsementModel->select('emp_endorsement.*, employees.id as emp_id')
|
||||||
->join('employees', 'employees.id = emp_endorsement.pk')
|
->join('employees', 'employees.id = emp_endorsement.pk')
|
||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
@ -578,7 +624,11 @@ class EmpDataServiceController extends BaseController
|
|||||||
$emp_id = $endorsementData['emp_id'];
|
$emp_id = $endorsementData['emp_id'];
|
||||||
$field_name = $endorsementData['field_name'];
|
$field_name = $endorsementData['field_name'];
|
||||||
$new_value = $endorsementData['new_value'];
|
$new_value = $endorsementData['new_value'];
|
||||||
$this->empEndorsementModel->where('id', $emp_endoresment_id)->set('endorsement_id', $endorsement_id)->update();
|
$endoresment_udate_data = [
|
||||||
|
'endorsement_id' => $endorsement_id,
|
||||||
|
'status' => 'complete',
|
||||||
|
];
|
||||||
|
$this->empEndorsementModel->where('id', $emp_endoresment_id)->set($endoresment_udate_data)->update();
|
||||||
$this->employeeModel->where('id', $emp_id)->set($field_name, $new_value)->update();
|
$this->employeeModel->where('id', $emp_id)->set($field_name, $new_value)->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,7 +667,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$import_data['created_by'] = get_session_userid();
|
$import_data['created_by'] = get_session_userid();
|
||||||
$import_data['file_name'] = $filename;
|
$import_data['file_name'] = $filename;
|
||||||
$insert = $this->batchFileModel->insert($import_data);
|
$insert = $this->batchFileModel->insert($import_data);
|
||||||
$batch_file_batch_code = $this->batchFileModel->where('id', 2)->first();
|
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
|
||||||
|
|
||||||
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
|
||||||
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
$batch_code_for_batch_list['created_by'] = get_session_userid();
|
||||||
@ -725,8 +775,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
$this->cashDepositCalculationForSIEnhancement($depositeData);
|
$this->cashDepositCalculationForSIEnhancement($depositeData);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -801,18 +849,18 @@ class EmpDataServiceController extends BaseController
|
|||||||
array_push($employeeIds, $id);
|
array_push($employeeIds, $id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$updateData = [
|
// $updateData = [
|
||||||
'emp_code' =>$emp_code,
|
// 'emp_code' =>$emp_code,
|
||||||
'client_id' =>$client_id,
|
// 'client_id' =>$client_id,
|
||||||
'client_policy_id' =>$client_policy_id,
|
// 'client_policy_id' =>$client_policy_id,
|
||||||
'emp_name' =>$emp_name,
|
// 'emp_name' =>$emp_name,
|
||||||
'endorsement_id' =>$endorsement_id,
|
// 'endorsement_id' =>$endorsement_id,
|
||||||
];
|
// ];
|
||||||
|
|
||||||
$this->employeePolicyModel->updateEndoresmentIdForDeletion($updateData);
|
// $this->employeePolicyModel->updateEndoresmentIdForDeletion($updateData);
|
||||||
|
|
||||||
$deletionDataForEmployee = $this->empEndorsementModel
|
$deletionDataForEmployee = $this->empEndorsementModel
|
||||||
->select('emp_endorsement.new_value, employees.id')
|
->select('emp_endorsement.new_value, emp_endorsement.id as ee_id, employees.id')
|
||||||
->join('employees', 'emp_endorsement.emp_code = employees.emp_code')
|
->join('employees', 'emp_endorsement.emp_code = employees.emp_code')
|
||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->where('emp_endorsement.emp_code', $emp_code)
|
->where('emp_endorsement.emp_code', $emp_code)
|
||||||
@ -825,6 +873,13 @@ class EmpDataServiceController extends BaseController
|
|||||||
$deletionDataForEmployee['updated_by'] = get_session_userid();
|
$deletionDataForEmployee['updated_by'] = get_session_userid();
|
||||||
$this->employeeModel->save($deletionDataForEmployee);
|
$this->employeeModel->save($deletionDataForEmployee);
|
||||||
|
|
||||||
|
$e_Data = [
|
||||||
|
'endorsement_id'=> $endorsement_id,
|
||||||
|
'status'=> 'complete',
|
||||||
|
];
|
||||||
|
$group_key = $this->empEndorsementModel->select('group_key')->where('id', $deletionDataForEmployee['ee_id'])->first();
|
||||||
|
$this->empEndorsementModel->where('group_key', $group_key)->set($e_Data)->update();
|
||||||
|
|
||||||
$fetchData = [
|
$fetchData = [
|
||||||
'emp_code'=> $emp_code,
|
'emp_code'=> $emp_code,
|
||||||
'client_policy_id'=> $client_policy_id,
|
'client_policy_id'=> $client_policy_id,
|
||||||
@ -835,11 +890,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
$deletionDataForEmployeePolicy['updated_by'] = get_session_userid();
|
$deletionDataForEmployeePolicy['updated_by'] = get_session_userid();
|
||||||
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
|
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
|
||||||
|
|
||||||
// echo '<pre>';
|
|
||||||
// print_r($deletionDataForEmployeePolicy); die;
|
|
||||||
|
|
||||||
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
|
|
||||||
|
|
||||||
// $query = $this->employeePolicyModel->getLastQuery();
|
// $query = $this->employeePolicyModel->getLastQuery();
|
||||||
// echo $query . "<br>";
|
// echo $query . "<br>";
|
||||||
|
|
||||||
@ -918,6 +968,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function cashDepositCalculationForSIEnhancement($arrayData)
|
public function cashDepositCalculationForSIEnhancement($arrayData)
|
||||||
{
|
{
|
||||||
if (!empty($arrayData)) {
|
if (!empty($arrayData)) {
|
||||||
@ -954,13 +1005,14 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function cashDepositCalculationForDeletion($arrayData)
|
public function cashDepositCalculationForDeletion($arrayData)
|
||||||
{
|
{
|
||||||
// print_r($arrayData);
|
// print_r($arrayData);
|
||||||
if (!empty($arrayData)) {
|
if (!empty($arrayData)) {
|
||||||
|
|
||||||
echo '<pre>';
|
// echo '<pre>';
|
||||||
print_r($arrayData); die;
|
// print_r($arrayData); die;
|
||||||
$amount = $this->employeePolicyModel->query("
|
$amount = $this->employeePolicyModel->query("
|
||||||
SELECT
|
SELECT
|
||||||
SUM(ROUND((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, employee_polices.date_of_exit)) / 365, 2) +
|
SUM(ROUND((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, employee_polices.date_of_exit)) / 365, 2) +
|
||||||
@ -968,7 +1020,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
FROM employee_polices
|
FROM employee_polices
|
||||||
WHERE id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
WHERE id IN (" . implode(',', $arrayData['employeeIds']) . ")
|
||||||
")->getRow();
|
")->getRow();
|
||||||
print_r($amount);die;
|
|
||||||
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
$insurer_id = $this->clientPolicyModel->where('id', $arrayData['client_policy_id'])->first();
|
||||||
$description = 'The following amount of ' . $amount->total_sum . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
$description = 'The following amount of ' . $amount->total_sum . ' has been credited for the ' . $arrayData['count'] . ' employees at ' . remove_underscore_capitalize_first_letter($arrayData['event']) . ' to ' . remove_underscore_capitalize_first_letter($arrayData['policy_name']) . '.';
|
||||||
|
|
||||||
@ -996,11 +1048,175 @@ class EmpDataServiceController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPolicyNameUsingClientPolicyId($client_policy_id){
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Below function retrieves the policy name associated with a given client policy ID.
|
||||||
|
*
|
||||||
|
* @param int $client_policy_id The ID of the client policy.
|
||||||
|
* @return mixed Returns the policy name if found, otherwise null.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getPolicyNameUsingClientPolicyId($client_policy_id)
|
||||||
|
{
|
||||||
return $this->clientPolicyModel->select('policies.name as policy_name')
|
return $this->clientPolicyModel->select('policies.name as policy_name')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
->where('client_policy.id', $client_policy_id)
|
->where('client_policy.id', $client_policy_id)
|
||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Below function converts row data into column data format for SI enhancement.
|
||||||
|
*
|
||||||
|
* This function takes an array of data containing information about SI enhancement
|
||||||
|
* and calculates additional fields such as pro rata premium, GST, and total.
|
||||||
|
*
|
||||||
|
* @param array $data The array of data containing SI enhancement information.
|
||||||
|
* @return array Returns the converted data in column format.
|
||||||
|
*/
|
||||||
|
public function convertRowTColumnForSIEnhancement($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
foreach ($data as $obj) {
|
||||||
|
|
||||||
|
$pro_rata_premium = round(($obj->difference_premium * $obj->no_of_days / 365), 2);
|
||||||
|
$gst = round(($pro_rata_premium * 18 / 100), 2);
|
||||||
|
$total = round(($pro_rata_premium + $gst), 2);
|
||||||
|
|
||||||
|
$old_total = round(($obj->old_rata + $obj->old_gst), 2);
|
||||||
|
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Basic Cover SI',
|
||||||
|
"old_value" => $obj->old_basic_cover_si,
|
||||||
|
"new_value" => $obj->new_basic_cover_si
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Premium',
|
||||||
|
"old_value" => $obj->old_si_premium,
|
||||||
|
"new_value" => $obj->new_si_premium
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'SI Enhancement Date',
|
||||||
|
"old_value" => change_date_format($obj->old_date, 'Y-m-d', 'd-M-Y'),
|
||||||
|
"new_value" => change_date_format($obj->date_of_coverage, 'Y-m-d', 'd-M-Y')
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Difference Premium',
|
||||||
|
"old_value" => ' --- ',
|
||||||
|
"new_value" => $obj->difference_premium
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'No of Days',
|
||||||
|
"old_value" => $obj->old_days,
|
||||||
|
"new_value" => $obj->no_of_days
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Pro Rata Premium',
|
||||||
|
"old_value" => $obj->old_rata,
|
||||||
|
"new_value" => $pro_rata_premium
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'GST(18%)',
|
||||||
|
"old_value" => $obj->old_gst,
|
||||||
|
"new_value" => $gst
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Total',
|
||||||
|
"old_value" => $old_total,
|
||||||
|
"new_value" => $total
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Below function converts row data into column data format for deletion records.
|
||||||
|
*
|
||||||
|
* This function takes an array of data containing information about deletion records
|
||||||
|
* and converts it into a column format. It also calculates additional fields such as
|
||||||
|
* period of non-coverage, premium for non-coverage period, GST, total amount, and
|
||||||
|
* claim status based on the exist_reason field.
|
||||||
|
*
|
||||||
|
* @param array $data The array of data containing deletion records information.
|
||||||
|
* @return array Returns the converted data in column format.
|
||||||
|
*/
|
||||||
|
public function convertRowTColumnForDeletion($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
foreach ($data as $obj) {
|
||||||
|
|
||||||
|
$old_total = round(($obj->old_rata + $obj->old_gst), 2);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Policy Period',
|
||||||
|
"data" => change_date_format($obj->start_date, 'Y-m-d', 'd-M-Y') . ' - <br> ' . change_date_format($obj->end_date, 'Y-m-d', 'd-M-Y'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Exit on',
|
||||||
|
"data" => change_date_format($obj->date_of_leaving, 'Y-m-d', 'd-M-Y'),
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Reason',
|
||||||
|
"data" => $obj->exist_reason,
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($obj->exist_reason != 'death'){
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Period of non coverage',
|
||||||
|
"data" => $obj->no_of_days
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Premium for non coverage period',
|
||||||
|
"data" => $obj->pro_rata_premium
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'GST(18%)',
|
||||||
|
"data" => $obj->gst
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Total Amount',
|
||||||
|
"data" => $obj->total
|
||||||
|
);
|
||||||
|
|
||||||
|
$result[] = array(
|
||||||
|
"field_name" => 'Claim',
|
||||||
|
"data" => '---',
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,10 +61,12 @@ class EmployeeController extends AdminController
|
|||||||
{
|
{
|
||||||
// $model = new UserModel();
|
// $model = new UserModel();
|
||||||
$data = [];
|
$data = [];
|
||||||
|
$data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'expired' => 'Expired'];
|
||||||
if(count($this->request->getGet()))
|
if(count($this->request->getGet()))
|
||||||
{
|
{
|
||||||
$filterData = $this->request->getGet();
|
$filterData = $this->request->getGet();
|
||||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(client_id: $filterData['client_id'],policy_id: $filterData['policy_id']);
|
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(client_id: $filterData['client_id'],policy_id: $filterData['policy_id'], status: $filterData['status']);
|
||||||
|
$data['getData'] = $filterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error','list called');
|
$this->myLogger->logme('error','list called');
|
||||||
@ -125,7 +127,7 @@ class EmployeeController extends AdminController
|
|||||||
// print_r($this->request->getPost('upload-action-type'));
|
// print_r($this->request->getPost('upload-action-type'));
|
||||||
// die();
|
// die();
|
||||||
// $empServiceController = new EmployeeServiceController();
|
// $empServiceController = new EmployeeServiceController();
|
||||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '38']);
|
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '42']);
|
||||||
// dd($res);
|
// dd($res);
|
||||||
|
|
||||||
// $empServiceController = new EmployeeServiceController();
|
// $empServiceController = new EmployeeServiceController();
|
||||||
@ -195,7 +197,7 @@ class EmployeeController extends AdminController
|
|||||||
//start validation process
|
//start validation process
|
||||||
|
|
||||||
$empServiceController = new EmployeeServiceController();
|
$empServiceController = new EmployeeServiceController();
|
||||||
$result = $empServiceController->excelFileFormatValidation($file_id);
|
$result = $empServiceController->excelFileFormatValidation(['file_id' => $file_id]);
|
||||||
//endof validation process
|
//endof validation process
|
||||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||||
{
|
{
|
||||||
@ -217,9 +219,9 @@ class EmployeeController extends AdminController
|
|||||||
$data['fileList'] = $this->fileModel
|
$data['fileList'] = $this->fileModel
|
||||||
->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name'])
|
->select(['files.*','up.emp_code','up.first_name','pm.name as policy_name','c.short_name'])
|
||||||
->join('user_profiles up','files.created_by = up.id')
|
->join('user_profiles up','files.created_by = up.id')
|
||||||
->join('client_policy cp','files.policy_id = cp.id')
|
->join('client_policy cp','files.policy_id = cp.id','left')
|
||||||
->join('policies pm','cp.policy_id = pm.id')
|
->join('policies pm','cp.policy_id = pm.id','left')
|
||||||
->join('clients c','files.client_id = c.id and files.client_id = cp.client_id')
|
->join('clients c','files.client_id = c.id and files.client_id = cp.client_id','left')
|
||||||
->where('files.created_by',get_session_userid())->orderBy('files.created_at','desc')->findAll();
|
->where('files.created_by',get_session_userid())->orderBy('files.created_at','desc')->findAll();
|
||||||
|
|
||||||
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name')
|
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name')
|
||||||
@ -451,4 +453,92 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Below function displays the endorsement list page.
|
||||||
|
*
|
||||||
|
* This method retrieves filter data from the request and fetches the endorsement list
|
||||||
|
* based on the provided filters such as client ID, policy ID, and status.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function endorsementList()
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data['status'] = ['pending' => 'Pending', 'inprogress' => 'In-Progress', 'complete'=>'Complete'];
|
||||||
|
if(count($this->request->getGet()))
|
||||||
|
{
|
||||||
|
$filterData = $this->request->getGet();
|
||||||
|
$data['employees'] = $this->employeePolicyModel->getEmployeeEndorsementList(client_id: $filterData['client_id'],policy_id: $filterData['policy_id'], status: $filterData['status']);
|
||||||
|
$data['getData'] = $filterData;
|
||||||
|
// echo "<pre>";
|
||||||
|
// print_r($data); die;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->myLogger->logme('error','list called');
|
||||||
|
$this->loadLayout('endorsement_list',$data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Beleo function retrieves employee endorsement (emp_endorsement table) data.
|
||||||
|
*
|
||||||
|
* This method fetches endorsement data based on the provided ID.
|
||||||
|
* It determines the type of endorsement action (SI enhancement, deletion, or other),
|
||||||
|
* formats the data accordingly, and returns it as a response.
|
||||||
|
*
|
||||||
|
* @param int|null $id The ID of the endorsement entry to retrieve.
|
||||||
|
* @return \CodeIgniter\HTTP\Response Returns a JSON response containing the endorsement entry data.
|
||||||
|
*/
|
||||||
|
public function getEmpEndoresmentEntry($id = null)
|
||||||
|
{
|
||||||
|
// Create instance of EmpDataServiceController
|
||||||
|
$empDataServiceController = new EmpDataServiceController();
|
||||||
|
|
||||||
|
// Check if $id is provided
|
||||||
|
if ($id) {
|
||||||
|
// Retrieve group key and actions based on $id
|
||||||
|
$group_key_actions = $this->empEndorsementModel->select('group_key, actions')->where('id', $id)->first();
|
||||||
|
$groupedData = $this->empEndorsementModel->where('group_key', $group_key_actions['group_key'])->findAll();
|
||||||
|
|
||||||
|
// If group key and actions are found
|
||||||
|
if ($group_key_actions) {
|
||||||
|
// Retrieve endorsement data based on actions
|
||||||
|
switch ($group_key_actions['actions']) {
|
||||||
|
case 'si':
|
||||||
|
$data = $this->empEndorsementModel->getDataForEnodrsementListinSIEnhancement($group_key_actions['group_key']);
|
||||||
|
$formatedData = $empDataServiceController->convertRowTColumnForSIEnhancement($data);
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
$data = $this->empEndorsementModel->getDataForEnodrsementListinDeletion($group_key_actions['group_key']);
|
||||||
|
$formatedData = $empDataServiceController->convertRowTColumnForDeletion($data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$formatedData = $groupedData;
|
||||||
|
$formatedData[0]['field_name'] = remove_underscore_capitalize_first_letter($formatedData[0]['field_name']);
|
||||||
|
$formatedData[0]['old_value'] = formatDateOrReturn($formatedData[0]['old_value']);
|
||||||
|
$formatedData[0]['new_value'] = formatDateOrReturn($formatedData[0]['new_value']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return response with data
|
||||||
|
return $this->respond([
|
||||||
|
'dataStatus' => true,
|
||||||
|
'code' => 200,
|
||||||
|
'data' => $formatedData,
|
||||||
|
'data2' => $groupedData
|
||||||
|
], 200);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Return response if group key and actions are not found
|
||||||
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Return response if $id is not provided
|
||||||
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -145,7 +145,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
$id = $item->id;
|
$id = $item->id;
|
||||||
$item->dob = $this->convertDateFormat($item->dob);
|
$item->dob = $this->convertDateFormatYMD($item->dob);
|
||||||
$employee = $this->employeeModel->update($id, (array)$item);
|
$employee = $this->employeeModel->update($id, (array)$item);
|
||||||
if ($employee) {
|
if ($employee) {
|
||||||
$updatedCount++;
|
$updatedCount++;
|
||||||
@ -179,7 +179,7 @@ class EmployeeRestController extends AdminController
|
|||||||
//update old data
|
//update old data
|
||||||
$id = $item->id;
|
$id = $item->id;
|
||||||
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
||||||
$item->dob = $this->convertDateFormat($item->dob);
|
$item->dob = $this->convertDateFormatYMD($item->dob);
|
||||||
$employee = $this->employeeModel->update($id, (array)$item);
|
$employee = $this->employeeModel->update($id, (array)$item);
|
||||||
if ($employee) {
|
if ($employee) {
|
||||||
$Count++;
|
$Count++;
|
||||||
@ -187,7 +187,7 @@ class EmployeeRestController extends AdminController
|
|||||||
}else{
|
}else{
|
||||||
//create new data
|
//create new data
|
||||||
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
$item->family_floater_key = $this->RelationshipMap($item->relationship);
|
||||||
$item->dob = $this->convertDateFormat($item->dob);
|
$item->dob = $this->convertDateFormatYMD($item->dob);
|
||||||
$employee = $this->employeeModel->insert($item);
|
$employee = $this->employeeModel->insert($item);
|
||||||
if ($employee) {
|
if ($employee) {
|
||||||
$Count++;
|
$Count++;
|
||||||
@ -224,24 +224,32 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function convertDateFormat($dateString)
|
private function convertDateFormatYMD($dateString)
|
||||||
{
|
{
|
||||||
// Attempt to create a DateTime object from the provided date string
|
// Attempt to create a DateTime object from the provided date string
|
||||||
$dateTime = \DateTime::createFromFormat('d-m-Y', $dateString);
|
$dateTime = \DateTime::createFromFormat('d-m-Y', $dateString);
|
||||||
|
|
||||||
// Check if the conversion was successful and the date string is in the format dd-mm-yyyy
|
|
||||||
if ($dateTime instanceof \DateTime) {
|
if ($dateTime instanceof \DateTime) {
|
||||||
// Format the date to yyyy-mm-dd
|
|
||||||
return $dateTime->format('Y-m-d');
|
return $dateTime->format('Y-m-d');
|
||||||
} else {
|
} else {
|
||||||
// If the date string is not in the format dd-mm-yyyy, return null
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function convertDateFormatDMY($dateString)
|
||||||
|
{
|
||||||
|
// Attempt to create a DateTime object from the provided date string
|
||||||
|
$dateTime = \DateTime::createFromFormat('Y-m-d', $dateString);
|
||||||
|
|
||||||
|
if ($dateTime instanceof \DateTime) {
|
||||||
|
return $dateTime->format('d-m-Y');
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function deleteDependence()
|
public function deleteDependence()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
print_r($this->rquest);die;
|
|
||||||
if($this->request->getGet('id'))
|
if($this->request->getGet('id'))
|
||||||
{
|
{
|
||||||
$delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete();
|
$delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete();
|
||||||
@ -286,14 +294,23 @@ class EmployeeRestController extends AdminController
|
|||||||
public function getClientPolicy()
|
public function getClientPolicy()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name')
|
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, policies.id as policy_id,policies.policy_type_id as policy_type_id, policies.name as policy_name , client_policy.is_addon as is_addon')
|
||||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||||
->findAll();
|
->findAll();
|
||||||
|
$result = [];
|
||||||
|
foreach ($ClientPolicyData as $key => $value) {
|
||||||
|
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard( $value['client_policy_id'],$value['client_id']);
|
||||||
|
if($value['is_addon'] == 1){
|
||||||
|
$value['type'] = 'AddOn';
|
||||||
|
}else{
|
||||||
|
$value['type'] = $getSlabAndGridData['grid_master']['policy_type'];
|
||||||
|
}
|
||||||
|
|
||||||
$result[] = $ClientPolicyData[0];
|
array_push($result,$value);
|
||||||
$result[] = $ClientPolicyData[2];
|
|
||||||
// You probably meant to check $result, not $data
|
|
||||||
|
}
|
||||||
if ($ClientPolicyData) {
|
if ($ClientPolicyData) {
|
||||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||||
} else {
|
} else {
|
||||||
@ -308,134 +325,134 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEmployeePolicy()
|
// public function getEmployeePolicy()
|
||||||
{
|
// {
|
||||||
try {
|
// try {
|
||||||
$id = $this->request->getGet('id');
|
// $id = $this->request->getGet('id');
|
||||||
$emp_code = $this->request->getGet('emp_code');
|
// $emp_code = $this->request->getGet('emp_code');
|
||||||
|
|
||||||
$keysToRemove = ["removable_keys"];
|
// $keysToRemove = ["removable_keys"];
|
||||||
|
|
||||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
// $empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||||
|
|
||||||
$empData = $this->employeeModel->where('emp_code',$emp_code)->findAll();
|
// $empData = $this->employeeModel->where('emp_code',$emp_code)->findAll();
|
||||||
if ($empPolicy) {
|
// if ($empPolicy) {
|
||||||
|
|
||||||
$result = [];
|
// $result = [];
|
||||||
foreach ($empPolicy as $array) {
|
// foreach ($empPolicy as $array) {
|
||||||
|
|
||||||
$decodedArray = json_decode($array->Policy_Terms);
|
// $decodedArray = json_decode($array->Policy_Terms);
|
||||||
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
// $refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||||
|
|
||||||
|
|
||||||
$array->Policy_Terms = $refusingData;
|
// $array->Policy_Terms = $refusingData;
|
||||||
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
// $getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
||||||
$array->SlabRates = $getSlabAndGridData['slab_rates'];
|
// $array->SlabRates = $getSlabAndGridData['slab_rates'];
|
||||||
$array->GridMaster = $getSlabAndGridData['grid_master'];
|
// $array->GridMaster = $getSlabAndGridData['grid_master'];
|
||||||
|
|
||||||
if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
// if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
||||||
$default_si = $array->Policy_Terms->sumInsured2;
|
// $default_si = $array->Policy_Terms->sumInsured2;
|
||||||
$index = -1;
|
// $index = -1;
|
||||||
foreach ($array->SlabRates as $key => $value) {
|
// foreach ($array->SlabRates as $key => $value) {
|
||||||
if ($value['si'] == $default_si) {
|
// if ($value['si'] == $default_si) {
|
||||||
$index = $key;
|
// $index = $key;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if ($index >= 0) {
|
// if ($index >= 0) {
|
||||||
$element =$array->SlabRates[$index];
|
// $element =$array->SlabRates[$index];
|
||||||
array_splice($array->SlabRates, $index, 1);
|
// array_splice($array->SlabRates, $index, 1);
|
||||||
array_unshift($array->SlabRates, $element);
|
// array_unshift($array->SlabRates, $element);
|
||||||
}
|
// }
|
||||||
|
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$id)->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
// $employee_policy = $this->employeePolicyModel->where('employee_id',$id)->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
||||||
if($employee_policy){
|
// if($employee_policy){
|
||||||
$gpaSI['family_floater_key'] = 'self';
|
// $gpaSI['family_floater_key'] = 'self';
|
||||||
$gpaSI['label'] = 'Self';
|
// $gpaSI['label'] = 'Self';
|
||||||
$gpaSI['employee_id'] = $employee_policy->employee_id;
|
// $gpaSI['employee_id'] = $employee_policy->employee_id;
|
||||||
$gpaSI['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
// $gpaSI['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||||
$gpaSI['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
// $gpaSI['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||||
$gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
// $gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
||||||
|
|
||||||
$array->mapped_family_floaters = $gpaSI;
|
// $array->mapped_family_floaters = $gpaSI;
|
||||||
}else{
|
// }else{
|
||||||
$gpaSI['family_floater_key'] = 'self';
|
// $gpaSI['family_floater_key'] = 'self';
|
||||||
$gpaSI['label'] = 'Self';
|
// $gpaSI['label'] = 'Self';
|
||||||
$gpaSI['employee_id'] = $id;
|
// $gpaSI['employee_id'] = $id;
|
||||||
$gpaSI['basic_cover_si'] = null;
|
// $gpaSI['basic_cover_si'] = null;
|
||||||
$gpaSI['premium'] = null;
|
// $gpaSI['premium'] = null;
|
||||||
$gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
// $gpaSI['client_policy_id'] = $array->ClientPolicyId;
|
||||||
|
|
||||||
$array->mapped_family_floaters = $gpaSI;
|
// $array->mapped_family_floaters = $gpaSI;
|
||||||
}
|
// }
|
||||||
|
|
||||||
}else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
// }else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
||||||
|
|
||||||
// re-arranging order of si
|
// // re-arranging order of si
|
||||||
$default_si = $array->Policy_Terms->sum_insured;
|
// $default_si = $array->Policy_Terms->sum_insured;
|
||||||
// Filter the array using the callback function
|
// // Filter the array using the callback function
|
||||||
$getPremium = array_filter($array->SlabRates , function ($value) use ($default_si) { return $value['si'] == $default_si; } );
|
// $getPremium = array_filter($array->SlabRates , function ($value) use ($default_si) { return $value['si'] == $default_si; } );
|
||||||
$default_premium = $getPremium[0]['premium'];
|
// $default_premium = $getPremium[0]['premium'];
|
||||||
|
|
||||||
$index = -1;
|
// $index = -1;
|
||||||
foreach ($array->SlabRates as $key => $value) {
|
// foreach ($array->SlabRates as $key => $value) {
|
||||||
if ($value['si'] == $default_si) {
|
// if ($value['si'] == $default_si) {
|
||||||
$index = $key;
|
// $index = $key;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if ($index >= 0) {
|
// if ($index >= 0) {
|
||||||
$element =$array->SlabRates[$index];
|
// $element =$array->SlabRates[$index];
|
||||||
array_splice($array->SlabRates, $index, 1);
|
// array_splice($array->SlabRates, $index, 1);
|
||||||
array_unshift($array->SlabRates, $element);
|
// array_unshift($array->SlabRates, $element);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//map family floates array to employee and dependent
|
// //map family floates array to employee and dependent
|
||||||
$familyFloates = $array->Policy_Terms->family_floaters;
|
// $familyFloates = $array->Policy_Terms->family_floaters;
|
||||||
$data = [];
|
// $data = [];
|
||||||
foreach ($familyFloates as $familyFloatesValue) {
|
// foreach ($familyFloates as $familyFloatesValue) {
|
||||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
// $dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||||
if(count($empData)){
|
// if(count($empData)){
|
||||||
foreach ($empData as $key => $value) {
|
// foreach ($empData as $key => $value) {
|
||||||
if ($value['family_floater_key'] === $dependent) {
|
// if ($value['family_floater_key'] === $dependent) {
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
// $employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->get()->getRow();
|
||||||
$temp['family_floater_key'] = $familyFloatesValue;
|
// $temp['family_floater_key'] = $familyFloatesValue;
|
||||||
$temp['label'] = $value['relationship'];
|
// $temp['label'] = $value['relationship'];
|
||||||
$temp['name'] = $value['name'];
|
// $temp['name'] = $value['name'];
|
||||||
$temp['employee_id'] = $value['id'];
|
// $temp['employee_id'] = $value['id'];
|
||||||
$temp['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
// $temp['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||||
$temp['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
// $temp['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||||
$temp['client_policy_id'] = $array->ClientPolicyId;
|
// $temp['client_policy_id'] = $array->ClientPolicyId;
|
||||||
array_push($data,$temp);
|
// array_push($data,$temp);
|
||||||
unset($empData[$key]);
|
// unset($empData[$key]);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
$array->mapped_family_floaters = $data;
|
// $array->mapped_family_floaters = $data;
|
||||||
|
|
||||||
$temp2=[];
|
// $temp2=[];
|
||||||
foreach ($array->SlabRates as $key => $value) {
|
// foreach ($array->SlabRates as $key => $value) {
|
||||||
$value['additional_premium'] = $value['premium'] - $default_premium;
|
// $value['additional_premium'] = $value['premium'] - $default_premium;
|
||||||
array_push($temp2,$value);
|
// array_push($temp2,$value);
|
||||||
}
|
// }
|
||||||
$array->SlabRates = $temp2;
|
// $array->SlabRates = $temp2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
$result[] = $array;
|
// $result[] = $array;
|
||||||
}
|
// }
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
// return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||||
}else{
|
// }else{
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
// return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||||
}
|
// }
|
||||||
} catch (\Exception $e) {
|
// } catch (\Exception $e) {
|
||||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
// return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Get the RelationShip list
|
// Get the RelationShip list
|
||||||
|
|
||||||
@ -451,17 +468,21 @@ class EmployeeRestController extends AdminController
|
|||||||
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
||||||
->where('client_policy_id', $value->client_policy_id)
|
->where('client_policy_id', $value->client_policy_id)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($value->client_policy_id,$value->client_id);
|
||||||
|
$SlabRatesArray = $getSlabAndGridData['slab_rates'];
|
||||||
|
$premium = $this->findPremiumAmount($SlabRatesArray, $value->basic_cover_si);
|
||||||
|
|
||||||
// dd($checkIfExist);
|
// dd($checkIfExist);
|
||||||
if ($checkIfExist) {
|
if ($checkIfExist) {
|
||||||
|
|
||||||
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si,$value->premium);
|
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si,$premium);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
$data['employee_id']= $value->employee_id;
|
$data['employee_id']= $value->employee_id;
|
||||||
$data['client_policy_id']= $value->client_policy_id;
|
$data['client_policy_id']= $value->client_policy_id;
|
||||||
$data['basic_cover_si']= $value->basic_cover_si;
|
$data['basic_cover_si']= $value->basic_cover_si;
|
||||||
$data['premium']= $value->premium;
|
$data['premium']= $premium;
|
||||||
|
|
||||||
$this->employeePolicyModel->insert($data);
|
$this->employeePolicyModel->insert($data);
|
||||||
}
|
}
|
||||||
@ -473,7 +494,15 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findPremiumAmount($slabArray,$siAmount)
|
||||||
|
{
|
||||||
|
foreach ($slabArray as $key => $value) {
|
||||||
|
if($value['si'] == $siAmount){
|
||||||
|
return $value['premium'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public function relationshipList()
|
public function relationshipList()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -499,12 +528,17 @@ class EmployeeRestController 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');
|
||||||
|
|
||||||
$token = $this->request->headers()['Auth']->getValue();
|
$jwt = $this->request->getHeader('Authorization');
|
||||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
$jwtParts = explode(' ', $jwt);
|
||||||
|
$token = $jwtParts[1];
|
||||||
|
|
||||||
|
|
||||||
|
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||||
// get the employee id from token
|
// get the employee id from token
|
||||||
$employee_id = $decodedPayload['id'];
|
$employee_id = $decodedPayload['id'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
||||||
|
|
||||||
if ($client_policy) {
|
if ($client_policy) {
|
||||||
@ -677,6 +711,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$basic_cover_si[]= $basic_cover_si_value;
|
$basic_cover_si[]= $basic_cover_si_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$count = 0;
|
||||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||||
{
|
{
|
||||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||||
@ -753,10 +788,23 @@ class EmployeeRestController extends AdminController
|
|||||||
$data['policy_name']=$policy['name'];
|
$data['policy_name']=$policy['name'];
|
||||||
|
|
||||||
$message = view('mail_welcome', $data);
|
$message = view('mail_welcome', $data);
|
||||||
|
|
||||||
|
if ($dataToInsert[$a]['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||||
|
$count++;
|
||||||
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $message];
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($wholeData);
|
||||||
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
||||||
// $job_details = new Jobs();
|
if($count == 20 || $a == count($dataToInsert)-1){
|
||||||
// $r = Jobs::addJob(['job_name' => 'send_email','payload' => ['mail' => $mail, 'subject' => $subject,'message'=> $message]]);
|
$job_details = new Jobs();
|
||||||
// }
|
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||||
|
// $wholeData[]= $r;
|
||||||
|
|
||||||
|
// Mailhelper::bulk_mail($wholeData);
|
||||||
|
$wholeData = [];
|
||||||
|
$count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// print_r($r);//die();
|
// print_r($r);//die();
|
||||||
// $jobWorker = new JobWorker();
|
// $jobWorker = new JobWorker();
|
||||||
@ -778,6 +826,397 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------
|
||||||
|
|
||||||
|
public function getEmployeePolicy()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$id = $this->request->getGet('id');
|
||||||
|
$emp_code = $this->request->getGet('emp_code');
|
||||||
|
|
||||||
|
// This is an array containing keys to be removed from the terms and conditions array
|
||||||
|
$keysToRemove = ["removable_keys"];
|
||||||
|
// Retrieve employee policy data by passing the employee primary key
|
||||||
|
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||||
|
// Retrieve employee and dependents data by passing the employee code
|
||||||
|
$employeeData = $this->employeeModel->where('emp_code',$emp_code)->where('is_addon_value',0)->findAll();
|
||||||
|
|
||||||
|
|
||||||
|
if ($empPolicy) {
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
foreach ($empPolicy as $array) {
|
||||||
|
// Reset employee array
|
||||||
|
$empData = $employeeData;
|
||||||
|
|
||||||
|
// Removes specific keys from the decoded array and assigns the result to $refusingData
|
||||||
|
$decodedArray = json_decode($array->Policy_Terms);
|
||||||
|
$refusingData = (object) array_diff_key((array) $decodedArray, array_flip($keysToRemove));
|
||||||
|
$array->Policy_Terms = $refusingData;
|
||||||
|
|
||||||
|
// Retrieve slab rate and grid master data by passing the ClientPolicyId and ClientId
|
||||||
|
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array->ClientPolicyId,$array->ClientId);
|
||||||
|
$array->SlabRates = $getSlabAndGridData['slab_rates'];
|
||||||
|
$array->GridMaster = $getSlabAndGridData['grid_master'];
|
||||||
|
|
||||||
|
// Construct value for policy type GPA
|
||||||
|
if($getSlabAndGridData['grid_master']['policy_type'] == "GPA"){
|
||||||
|
|
||||||
|
// Filter employee data where the family_floater_key is 'self'
|
||||||
|
$selfData = array_filter($empData, fn($arr) => trim(strtolower($arr['family_floater_key'])) === 'self');
|
||||||
|
$self['is_value_exist'] = true;
|
||||||
|
$self['data']['family_floater_key'] = 'self';
|
||||||
|
$self['data']['employee_id'] = $id;
|
||||||
|
$self['data']['relationship'] = 'Self';
|
||||||
|
$self['data']['name'] = $selfData[0]['name'];
|
||||||
|
$self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']);
|
||||||
|
$self['data']['mobile'] = $selfData[0]['mobile'];
|
||||||
|
$self['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
|
|
||||||
|
$array->mapped_family_floaters = $self;
|
||||||
|
|
||||||
|
// Return result
|
||||||
|
if($this->request->getGet('policy') == 'GPA')
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $array], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Construct value for policy type GMC
|
||||||
|
}else if($getSlabAndGridData['grid_master']['policy_type'] == "GMC"){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Map family floaters that already exist in the employee table
|
||||||
|
$familyFloates = $array->Policy_Terms->family_floaters;
|
||||||
|
// Generate Notes string based on familyFloates terms
|
||||||
|
$array->notes = $this->FloterNotesConvertion($familyFloates);
|
||||||
|
// Convert familyFloaters terms data to plain array
|
||||||
|
$floters = $this->FloterConvertion($familyFloates);
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
foreach ($floters as $familyFloatesValue) {
|
||||||
|
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||||
|
if(count($empData)){
|
||||||
|
foreach ($empData as $key => $value) {
|
||||||
|
if ($value['family_floater_key'] === $dependent) {
|
||||||
|
$temp['is_value_exist'] = true;
|
||||||
|
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||||
|
$temp['data']['employee_id'] = $value['id'];
|
||||||
|
$temp['data']['relationship'] = $value['relationship'];
|
||||||
|
$temp['data']['name'] = $value['name'];
|
||||||
|
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||||
|
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
|
$temp['data']['form_type'] = $dependent;
|
||||||
|
array_push($data,$temp);
|
||||||
|
unset($empData[$key]);
|
||||||
|
$floters = array_diff($floters, [$familyFloatesValue]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove Unwanted floter key from floters array based on either-parents-pil term value
|
||||||
|
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
|
||||||
|
{
|
||||||
|
$count_parent = 0;
|
||||||
|
$count_parent_in_law = 0;
|
||||||
|
foreach ($floters as $value) {
|
||||||
|
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
|
||||||
|
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
|
||||||
|
}
|
||||||
|
if($count_parent != 2) {
|
||||||
|
$floters = array_filter($floters, fn($value) => strpos($value, 'parent_in_law') === false);
|
||||||
|
}
|
||||||
|
if($count_parent_in_law != 2) {
|
||||||
|
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add family floter buttons placement data for FE validation
|
||||||
|
if(count($floters)){
|
||||||
|
foreach ($floters as $familyFloatesValue) {
|
||||||
|
|
||||||
|
$temp2['is_value_exist'] = false;
|
||||||
|
$temp2['data']['family_floater_key'] = $familyFloatesValue;
|
||||||
|
$temp2['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
|
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
|
||||||
|
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
|
||||||
|
|
||||||
|
array_push($data,$temp2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$array->mapped_family_floaters = $data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($this->request->getGet('policy') == 'GMC'){
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => $array], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$result[] = $array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function FloterConvertion($array){
|
||||||
|
|
||||||
|
$result = [];
|
||||||
|
foreach ($array as $key => $value) {
|
||||||
|
if ($value > 0) {
|
||||||
|
if ($value != 0 && $key === 'childrens') {
|
||||||
|
for ($i = 1; $i <= $value; $i++) {
|
||||||
|
$result[] = "child" . $i;
|
||||||
|
}
|
||||||
|
} else if($value != 0 && $key ==='parents') {
|
||||||
|
for ($i = 1; $i <= $value; $i++) {
|
||||||
|
$result[] = "parent" . $i;
|
||||||
|
}
|
||||||
|
}else if($value != 0 && $key ==='parents-in-law') {
|
||||||
|
for ($i = 1; $i <= $value; $i++) {
|
||||||
|
$result[] = "parent_in_law" . $i;
|
||||||
|
}
|
||||||
|
}else if($value != 0 && $key ==='either-parents-pil') {
|
||||||
|
for ($i = 1; $i <= 2; $i++) {
|
||||||
|
$result[] = "parent" . $i;
|
||||||
|
$result[] = "parent_in_law" . $i;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
$result[] = $key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function FloterNotesConvertion($array){
|
||||||
|
|
||||||
|
$result = 'Can Add Self ';
|
||||||
|
foreach ($array as $key => $value) {
|
||||||
|
if ($value > 0) {
|
||||||
|
if($value != 0 && $key ==='either-parents-pil') {
|
||||||
|
$result .= ' + Either 2 Parents or 2 Parents in law';
|
||||||
|
}else if($value != 0 && $key ==='spouse') {
|
||||||
|
$string = str_replace('-', ' ', $key);
|
||||||
|
$string = ucwords($string);
|
||||||
|
$result .= ' + '.$string;
|
||||||
|
}else if($value != 0 && $key ==='self') {
|
||||||
|
}else{
|
||||||
|
$string = str_replace('-', ' ', $key);
|
||||||
|
$string = ucwords($string);
|
||||||
|
$result .= ' + '.$value.' '.$string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getClientDetails()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$client = $this->clientModel->where('id',$this->request->getGet('client_id'))->first();
|
||||||
|
if($client) {
|
||||||
|
$client['client_logo'] = base_url().'public/uploads/logo/'.$client['client_logo'];
|
||||||
|
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => ['client'=>$client,'client_policy'=>$clientPolicy]], 200);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAddOnPolicy()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$addOnEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',1)->findAll();
|
||||||
|
$GMCEmployeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))->where('is_addon_value',0)->findAll();
|
||||||
|
|
||||||
|
|
||||||
|
$clientPolicy = $this->clientPolicyModel->where('client_id',$this->request->getGet('client_id'))->findAll();
|
||||||
|
// dd($clientPolicy);
|
||||||
|
if(count($clientPolicy))
|
||||||
|
{
|
||||||
|
$PolicyData = [];
|
||||||
|
foreach ($clientPolicy as $key => $array) {
|
||||||
|
|
||||||
|
|
||||||
|
$decodedArray = json_decode($array['policy_terms']);
|
||||||
|
$policy_terms = $decodedArray;
|
||||||
|
$getSlabAndGridData = $this->policesModel->getPolicySlabRatesForEmpOnboard($array['id'],$array['client_id']);
|
||||||
|
|
||||||
|
if($array['is_addon'] == 1)
|
||||||
|
{
|
||||||
|
$responce['policy_name'] = $this->policesModel->where('id',$array['policy_id'])->get()->getRow()->name;
|
||||||
|
$responce['SlabRates'] = $getSlabAndGridData['slab_rates'];
|
||||||
|
$responce['GridMaster'] = $getSlabAndGridData['grid_master'];
|
||||||
|
$responce['client_id'] = $array['client_id'];
|
||||||
|
$responce['client_policy_id'] = $array['id'];
|
||||||
|
$responce['is_addon'] = $array['is_addon'];
|
||||||
|
$responce['open_for_enrollment'] = $array['open_for_enrollment'];
|
||||||
|
$responce['policy_terms'] = $decodedArray;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Map family floaters that already exist in the employee table
|
||||||
|
$familyFloates = $policy_terms->family_floaters;
|
||||||
|
// Convert familyFloaters terms data to plain array
|
||||||
|
$floters = $this->FloterConvertion($familyFloates);
|
||||||
|
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$dependent_and_si_value = null;
|
||||||
|
$dependent_and_si_premium_value = null;
|
||||||
|
foreach ($floters as $familyFloatesValue) {
|
||||||
|
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||||
|
if(count($addOnEmployeeData)){
|
||||||
|
foreach ($addOnEmployeeData as $key => $value) {
|
||||||
|
if ($value['family_floater_key'] === $dependent) {
|
||||||
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->get()->getRow();
|
||||||
|
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = $employee_policy->basic_cover_si; }
|
||||||
|
if(isset($employee_policy->premium)){ $dependent_and_si_premium_value = $employee_policy->premium;}
|
||||||
|
|
||||||
|
$temp['is_value_exist'] = true;
|
||||||
|
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||||
|
$temp['data']['employee_id'] = $value['id'];
|
||||||
|
$temp['data']['relationship'] = $value['relationship'];
|
||||||
|
$temp['data']['name'] = $value['name'];
|
||||||
|
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||||
|
$temp['data']['client_policy_id'] = $array['id'];
|
||||||
|
$temp['data']['form_type'] = $dependent;
|
||||||
|
$temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||||
|
$temp['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||||
|
array_push($data,$temp);
|
||||||
|
unset($addOnEmployeeData[$key]);
|
||||||
|
$floters = array_diff($floters, [$familyFloatesValue]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Remove Unwanted floter key from floters array based on either-parents-pil term value
|
||||||
|
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
|
||||||
|
{
|
||||||
|
if(count($addOnEmployeeData) == 0)
|
||||||
|
{
|
||||||
|
$GMCEmpData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
|
||||||
|
->where('is_addon_value',0)
|
||||||
|
->where('family_floater_key','parent')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
if(count($GMCEmpData) > 0){
|
||||||
|
$floters = array_diff($floters, ["parent1","parent2"]);
|
||||||
|
}else{
|
||||||
|
$floters = array_diff($floters, ["parent_in_law1","parent_in_law2"]);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$count_parent = 0;
|
||||||
|
$count_parent_in_law = 0;
|
||||||
|
foreach ($floters as $value) {
|
||||||
|
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
|
||||||
|
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
|
||||||
|
}
|
||||||
|
if($count_parent != 2) {
|
||||||
|
$floters = array_filter($floters, fn($value) => strpos($value, 'parent_in_law') === false);
|
||||||
|
}
|
||||||
|
if($count_parent_in_law != 2) {
|
||||||
|
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Add family floter buttons placement data for FE validation
|
||||||
|
if(count($floters)){
|
||||||
|
foreach ($floters as $familyFloatesValue) {
|
||||||
|
|
||||||
|
$temp2['is_value_exist'] = false;
|
||||||
|
$temp2['data']['family_floater_key'] = $familyFloatesValue;
|
||||||
|
$temp2['data']['client_policy_id'] = $array['id'];
|
||||||
|
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
|
||||||
|
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
|
||||||
|
|
||||||
|
array_push($data,$temp2);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$responce['family_floaters_of_dependent_and_si_array'] = $data;
|
||||||
|
$responce['family_floaters_of_dependent_and_si_value'] = $dependent_and_si_value;
|
||||||
|
$responce['family_floaters_of_dependent_and_si_premium_value'] = $dependent_and_si_premium_value;
|
||||||
|
|
||||||
|
|
||||||
|
$only_si_array = [];
|
||||||
|
$only_si_value = null;
|
||||||
|
$only_si_premium_value = null;
|
||||||
|
foreach ($GMCEmployeeData as $key => $value) {
|
||||||
|
|
||||||
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array['id'])->get()->getRow();
|
||||||
|
if(isset($employee_policy->basic_cover_si)){ $only_si_value = $employee_policy->basic_cover_si; }
|
||||||
|
if(isset($employee_policy->premium)){ $only_si_premium_value = $employee_policy->premium;}
|
||||||
|
$temp3['is_value_exist'] = true;
|
||||||
|
$temp3['data']['employee_id'] = $value['id'];
|
||||||
|
$temp3['data']['relationship'] = $value['relationship'];
|
||||||
|
$temp3['data']['name'] = $value['name'];
|
||||||
|
$temp3['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||||
|
$temp3['data']['client_policy_id'] = $array['id'];
|
||||||
|
$temp3['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : null;
|
||||||
|
$temp3['data']['premium'] = isset($employee_policy->premium) ? $employee_policy->premium : null;
|
||||||
|
array_push($only_si_array,$temp3);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$responce['family_floaters_of_only_si_array'] = $only_si_array;
|
||||||
|
$responce['family_floaters_of_only_si_value'] = $only_si_value;
|
||||||
|
$responce['family_floaters_of_only_si_premium_value'] = $only_si_premium_value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
array_push($PolicyData, $responce);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => ['addon_policy'=>$responce]], 200);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 404);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function iAgreeForAddOn()
|
||||||
|
{
|
||||||
|
return $this->respond(['status' => 'success','code' => 200,'data' => [] ], 200);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -89,9 +89,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||||
|
// dd($highestRowAndColumn);
|
||||||
|
|
||||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
|
||||||
// dd($this->si_enhance_excel_columns);
|
|
||||||
$columns_to_check = [];
|
$columns_to_check = [];
|
||||||
if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; }
|
if($file['action'] == 'inception'){ $columns_to_check = $this->inception_excel_columns; }
|
||||||
if($file['action'] == 'addition'){ $columns_to_check = $this->inception_excel_columns; }
|
if($file['action'] == 'addition'){ $columns_to_check = $this->inception_excel_columns; }
|
||||||
@ -100,6 +99,15 @@ class EmployeeServiceController extends AdminController
|
|||||||
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
if($file['action'] == 'correction'){ $columns_to_check = $this->correction_excel_columns; }
|
||||||
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
if($file['action'] == 'si_enhancement'){ $columns_to_check = $this->si_enhance_excel_columns; }
|
||||||
|
|
||||||
|
|
||||||
|
$result = ['error_type' => 1,'error_summary' => [], 'error_data' => [] ];
|
||||||
|
$keys = array_keys($columns_to_check);
|
||||||
|
|
||||||
|
$allowedHighestColumn = end($columns_to_check);
|
||||||
|
// dd($allowedHighestColumn);
|
||||||
|
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||||
|
// !dd(array_chunk($excel_data,20)[0]);
|
||||||
|
|
||||||
//check no of columns in excel
|
//check no of columns in excel
|
||||||
$total_defined_columns = count($columns_to_check);
|
$total_defined_columns = count($columns_to_check);
|
||||||
$excel_columns = ($excel_data[0]);
|
$excel_columns = ($excel_data[0]);
|
||||||
@ -129,9 +137,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
return array('error_summary' => [6], 'error_data' => $message);
|
return array('error_summary' => [6], 'error_data' => $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
//start other checks
|
|
||||||
$result = ['error_type' => 1,'error_summary' => [], 'error_data' => [] ];
|
|
||||||
$keys = array_keys($columns_to_check);
|
|
||||||
// dd($columns_to_check);die();
|
// dd($columns_to_check);die();
|
||||||
|
|
||||||
// get policy and rack details
|
// get policy and rack details
|
||||||
@ -268,8 +274,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
//proceed next data level validation in JOB queue
|
//proceed next data level validation in JOB queue
|
||||||
$job_details = new Jobs();
|
$job_details = new Jobs();
|
||||||
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
$r = Jobs::addJob(['job_name' => 'excelFileDataValidation','payload' => ['file_id' => $file_id]]);
|
||||||
$jobWorker = new JobWorker();
|
// $jobWorker = new JobWorker();
|
||||||
JobWorker::processJob($r);
|
// JobWorker::processJob($r);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
@ -321,10 +327,11 @@ class EmployeeServiceController extends AdminController
|
|||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
|
||||||
// dd($excel_data);
|
|
||||||
$result = ['error_type' => 2,'error_summary' => [], 'error_data' => [] ];
|
$result = ['error_type' => 2,'error_summary' => [], 'error_data' => [] ];
|
||||||
$keys = array_keys($columns_to_check);
|
$keys = array_keys($columns_to_check);
|
||||||
|
|
||||||
|
$allowedHighestColumn = end($columns_to_check);
|
||||||
|
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||||
// print_r($keys);die();
|
// print_r($keys);die();
|
||||||
|
|
||||||
//remove header
|
//remove header
|
||||||
@ -493,7 +500,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
$allowedHighestColumn = end($columns_to_check);
|
||||||
|
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||||
unset($excel_data[0]);
|
unset($excel_data[0]);
|
||||||
|
|
||||||
|
|
||||||
@ -574,12 +582,13 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
$file_name_with_path = WRITEPATH."/uploads/excel/".$file['file_name'];
|
||||||
|
|
||||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($file_name_with_path);
|
||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||||
|
$allowedHighestColumn = end($this->deletion_excel_columns);
|
||||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||||
|
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||||
|
|
||||||
unset($excel_data[0]);
|
unset($excel_data[0]);
|
||||||
// dd($excel_data);
|
// dd($excel_data);
|
||||||
@ -589,15 +598,16 @@ class EmployeeServiceController extends AdminController
|
|||||||
//make closure funciton which is going to use only by this method
|
//make closure funciton which is going to use only by this method
|
||||||
$endorsement = function($data,$file,$row){
|
$endorsement = function($data,$file,$row){
|
||||||
|
|
||||||
|
$group_key = rand(100000, 999999);
|
||||||
//for emp table
|
//for emp table
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'emp_status','old_value' => $data['emp_status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
$this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'emp_status','old_value' => $data['emp_status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key]);
|
||||||
// dd( $this->empEndorsementModel->getLastQuery());
|
// dd( $this->empEndorsementModel->getLastQuery());
|
||||||
// $this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'change_event','old_value' => $data['change_event'],'new_value' => 'deletion','created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
// $this->empEndorsementModel->save(['pk' => (int)$data['emp_id'],'emp_code' => $data['emp_code'],'table_name' => 'employees','actions' => 'd','name' => $data['name'],'field_name' => 'change_event','old_value' => $data['change_event'],'new_value' => 'deletion','created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
||||||
|
|
||||||
// for employee policy table
|
// for employee policy table
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'date_of_exit','old_value' => $data['date_of_exit'],'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'date_of_exit','old_value' => $data['date_of_exit'],'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key]);
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'reason_for_exit','old_value' => $data['reason_for_exit'],'new_value' => $row[5],'created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'reason_for_exit','old_value' => $data['reason_for_exit'],'new_value' => $row[5],'created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key]);
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'status','old_value' => $data['status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion']);
|
$this->empEndorsementModel->save(['pk' => (int)$data['emp_policy_id'],'emp_code' => $data['emp_code'],'table_name' => 'employee_polices','actions' => 'd','name' => $data['name'],'field_name' => 'status','old_value' => $data['status'],'new_value' => 'deactivate','created_by' => $file['created_by'],'remarks' => 'general deletion','group_key' => $group_key]);
|
||||||
};
|
};
|
||||||
//iterate each row
|
//iterate each row
|
||||||
foreach ($excel_data as $col_key => $row)
|
foreach ($excel_data as $col_key => $row)
|
||||||
@ -671,8 +681,9 @@ class EmployeeServiceController extends AdminController
|
|||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||||
|
$allowedHighestColumn = end($this->correction_excel_columns);
|
||||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||||
|
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||||
|
|
||||||
unset($excel_data[0]);
|
unset($excel_data[0]);
|
||||||
// dd($excel_data);
|
// dd($excel_data);
|
||||||
@ -702,7 +713,8 @@ class EmployeeServiceController extends AdminController
|
|||||||
//make entry in endorsement table
|
//make entry in endorsement table
|
||||||
if(!count($existing_endorsements))
|
if(!count($existing_endorsements))
|
||||||
{
|
{
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employees','actions' => 'c','name' => $employee['name'],'field_name' => $field_name,'old_value' => $employee[ $field_name ],'new_value' => $field_value,'created_by' => $file['created_by'],'remarks' => $row[7],'date_of_correction' => change_date_format($row[5],'d-M-Y','Y-m-d')]);
|
$group_key = rand(100000, 999999);
|
||||||
|
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employees','actions' => 'c','name' => $employee['name'],'field_name' => $field_name,'old_value' => $employee[ $field_name ],'new_value' => $field_value,'created_by' => $file['created_by'],'remarks' => $row[7],'date_of_correction' => change_date_format($row[5],'d-M-Y','Y-m-d'),'group_key' => $group_key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -727,8 +739,9 @@ class EmployeeServiceController extends AdminController
|
|||||||
$sheet = $spreadsheet->getActiveSheet();
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
|
||||||
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
$highestRowAndColumn = $sheet->getHighestRowAndColumn();
|
||||||
|
$allowedHighestColumn = end($this->si_enhance_excel_columns);
|
||||||
$excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
$excel_data = $sheet->rangeToArray('A1:' . $allowedHighestColumn['col_cell_name'] . $highestRowAndColumn['row']);
|
||||||
|
// $excel_data = $sheet->rangeToArray('A1:' . $highestRowAndColumn['column'] . $highestRowAndColumn['row']);
|
||||||
|
|
||||||
unset($excel_data[0]);
|
unset($excel_data[0]);
|
||||||
// dd($excel_data);
|
// dd($excel_data);
|
||||||
@ -763,9 +776,10 @@ class EmployeeServiceController extends AdminController
|
|||||||
{
|
{
|
||||||
if($slab_value['si'] == $row[3])
|
if($slab_value['si'] == $row[3])
|
||||||
{
|
{
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement']);
|
$group_key = rand(100000, 999999);
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement']);
|
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $row[3],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key]);
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement']);
|
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key]);
|
||||||
|
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => change_date_format($row[4],'d-M-Y','Y-m-d'),'created_by' => $file['created_by'],'remarks' => 'general si enhancement','group_key' => $group_key]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -797,10 +811,11 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
$employee = $this->employeeModel->checkExistingEmp($value);
|
$employee = $this->employeeModel->checkExistingEmp($value);
|
||||||
$policy_data = $value['policy_details'];
|
$policy_data = $value['policy_details'];
|
||||||
|
$temp = $value['temp'];
|
||||||
unset($value['policy_details']);
|
unset($value['policy_details']);
|
||||||
unset($value['temp']);
|
unset($value['temp']);
|
||||||
|
|
||||||
if($file['id'] == null && (strtolower($value['relationship']) == 'self' && $value['temp']['source'] == 'db' && $value['temp']['emp_id'] != null && $value['temp']['emp_policy_id'] != null))
|
if($file['id'] == null && (strtolower($value['relationship']) == 'self' && $temp['source'] == 'db' && $temp['emp_id'] != null && $temp['emp_policy_id'] != null))
|
||||||
{
|
{
|
||||||
//check existing si and new si
|
//check existing si and new si
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||||
@ -824,10 +839,11 @@ class EmployeeServiceController extends AdminController
|
|||||||
{
|
{
|
||||||
if($slab_value['si'] == $policy_data['si'])
|
if($slab_value['si'] == $policy_data['si'])
|
||||||
{
|
{
|
||||||
|
$group_key = rand(100000, 999999);
|
||||||
//add new premimum details in endorsement table
|
//add new premimum details in endorsement table
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $policy_data['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']);
|
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'basic_cover_si','old_value' => $employee_policy['basic_cover_si'],'new_value' => $policy_data['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']);
|
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'premium','old_value' => $employee_policy['premium'],'new_value' => $slab_value['premium'],'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
|
||||||
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => ($policy_data['date_coverage']),'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement']);
|
$this->empEndorsementModel->save(['pk' => (int)$employee['id'],'emp_code' => $employee['emp_code'],'table_name' => 'employee_polices','actions' => 'si','name' => $employee['name'],'field_name' => 'si_enhancement_date','old_value' => null,'new_value' => ($policy_data['date_coverage']),'created_by' => $file['created_by'],'remarks' => 'da auto si enhancement','group_key' => $group_key]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class JobWorker extends AdminController
|
|||||||
* Constructs the class
|
* Constructs the class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']];
|
private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper'],'bulk_mail' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']];
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// echo 'HiC';//die();
|
// echo 'HiC';//die();
|
||||||
@ -57,7 +57,7 @@ class JobWorker extends AdminController
|
|||||||
//sleep(1);
|
//sleep(1);
|
||||||
|
|
||||||
SELF::processjob(['id' => $job->id,'uuid' => $job->uuid]);
|
SELF::processjob(['id' => $job->id,'uuid' => $job->uuid]);
|
||||||
usleep( 500000 );
|
// usleep( 500000 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -199,4 +199,7 @@ class JobWorker extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,15 +18,7 @@ class AuthJWT implements FilterInterface
|
|||||||
{
|
{
|
||||||
public function before(RequestInterface $request, $arguments = null)
|
public function before(RequestInterface $request, $arguments = null)
|
||||||
{
|
{
|
||||||
|
$jwt = $request->getHeader('Authorization');
|
||||||
$jwt ='';
|
|
||||||
|
|
||||||
if($request->headers()['Auth']){
|
|
||||||
$jwt = $request->headers()['Auth'];
|
|
||||||
}else{
|
|
||||||
$jwt = $request->getHeader('Authorization');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($jwt) {
|
if ($jwt) {
|
||||||
if (JWTToken::validateJWT($jwt)) {
|
if (JWTToken::validateJWT($jwt)) {
|
||||||
|
|||||||
@ -9,6 +9,8 @@ use PHPMailer\PHPMailer\PHPMailer;
|
|||||||
use PHPMailer\PHPMailer\SMTP;
|
use PHPMailer\PHPMailer\SMTP;
|
||||||
use PHPMailer\PHPMailer\Exception;
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
use App\Models\JobModel;
|
||||||
|
|
||||||
|
|
||||||
class MailHelper
|
class MailHelper
|
||||||
{
|
{
|
||||||
@ -18,6 +20,7 @@ class MailHelper
|
|||||||
$subject = $params['subject'];
|
$subject = $params['subject'];
|
||||||
$message = $params['message'];
|
$message = $params['message'];
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$email = \Config\Services::email();
|
$email = \Config\Services::email();
|
||||||
$email->setMailType('html');
|
$email->setMailType('html');
|
||||||
$email->setFrom('bbone@venbait.in', 'Nhance');
|
$email->setFrom('bbone@venbait.in', 'Nhance');
|
||||||
@ -37,5 +40,26 @@ class MailHelper
|
|||||||
return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500);
|
return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function bulk_mail(array $mails = [])
|
||||||
|
{
|
||||||
|
$model = new JobModel();
|
||||||
|
$start = microtime(true);
|
||||||
|
$runtime= 0;
|
||||||
|
try {
|
||||||
|
foreach ( $mails as $index=>$mail) {
|
||||||
|
$runtime = microtime(true) - $start;
|
||||||
|
$send_mail = self::send_email($mail);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...'],200);
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return json_encode(['status' => 'failed','code' => 500],500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -87,9 +87,9 @@ if (!function_exists('generate_excel')) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Save Excel file to the specified path
|
// Save Excel file to the specified path
|
||||||
// $writer->save($filename);
|
$writer->save($filename);
|
||||||
$filePath = WRITEPATH."/uploads/import_excel/" . $filename;
|
// $filePath = WRITEPATH."/uploads/import_excel/" . $filename;
|
||||||
$writer->save($filePath);
|
// $writer->save($filePath);
|
||||||
return true; // Return true if file was successfully saved
|
return true; // Return true if file was successfully saved
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// Log or handle the exception
|
// Log or handle the exception
|
||||||
@ -394,7 +394,126 @@ if (! function_exists('generate_filename')) {
|
|||||||
if (!function_exists('remove_underscore_capitalize_first_letter')) {
|
if (!function_exists('remove_underscore_capitalize_first_letter')) {
|
||||||
function remove_underscore_capitalize_first_letter($word) {
|
function remove_underscore_capitalize_first_letter($word) {
|
||||||
// Remove underscore and capitalize first letter of each word
|
// Remove underscore and capitalize first letter of each word
|
||||||
|
$pattern = '/dob/i';
|
||||||
|
if (preg_match($pattern, $word)) {
|
||||||
|
$formattedEvent = 'DOB';
|
||||||
|
return $formattedEvent;
|
||||||
|
}
|
||||||
$formattedEvent = ucwords(str_replace('_', ' ', $word));
|
$formattedEvent = ucwords(str_replace('_', ' ', $word));
|
||||||
return $formattedEvent;
|
return $formattedEvent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('formatDateOrReturn')) {
|
||||||
|
function formatDateOrReturn($value)
|
||||||
|
{
|
||||||
|
// Check if the value is a valid date
|
||||||
|
$timestamp = strtotime($value);
|
||||||
|
if ($timestamp !== false) {
|
||||||
|
// Format the date
|
||||||
|
return date('d-M-Y', $timestamp);
|
||||||
|
} else {
|
||||||
|
// Return the original value
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!function_exists('format_Excel_BasedOn_Client'))
|
||||||
|
{
|
||||||
|
function format_Excel_BasedOn_Client($objects, $client_excel_header)
|
||||||
|
{
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
|
||||||
|
// Initialize serial number
|
||||||
|
$serialNumber = 1;
|
||||||
|
|
||||||
|
// Iterate through each object
|
||||||
|
foreach ($objects as $obj)
|
||||||
|
{
|
||||||
|
// Extract all values for the object based on the header order
|
||||||
|
$rowData = [];
|
||||||
|
foreach ($client_excel_header as $header) {
|
||||||
|
|
||||||
|
$normalizedHeader = strtolower(str_replace(' ', '', $header));
|
||||||
|
|
||||||
|
switch ($normalizedHeader) {
|
||||||
|
case 's.no':
|
||||||
|
$rowData[] = $serialNumber++; // Serial Number
|
||||||
|
break;
|
||||||
|
case 'empid':
|
||||||
|
$rowData[] = $obj->emp_code; // Employee Code
|
||||||
|
break;
|
||||||
|
case 'nameofemp/dep':
|
||||||
|
$rowData[] = $obj->emp_name; // Employee Name
|
||||||
|
break;
|
||||||
|
case 'emp/deptype':
|
||||||
|
$rowData[] = $obj->emp_type; // Employee Type
|
||||||
|
break;
|
||||||
|
case 'relation':
|
||||||
|
$rowData[] = $obj->emp_relationship_code; // RELATION
|
||||||
|
break;
|
||||||
|
case 'dob':
|
||||||
|
$rowData[] = $obj->emp_dob; // Employee DOB
|
||||||
|
break;
|
||||||
|
case 'gender':
|
||||||
|
$rowData[] = $obj->emp_gender; //Employee GENDER
|
||||||
|
break;
|
||||||
|
case 'preexistingailments':
|
||||||
|
$rowData[] = $obj->pre_existing_alignments; // PRE EXISTING AILMENTS
|
||||||
|
break;
|
||||||
|
case 'basiccoversi':
|
||||||
|
$rowData[] = $obj->basic_cover_si; // Employee BASIC COVER SI
|
||||||
|
break;
|
||||||
|
case 'dateofcoverage':
|
||||||
|
$rowData[] = $obj->date_coverage; // DATE OF COVERAGE
|
||||||
|
break;
|
||||||
|
case 'age':
|
||||||
|
$rowData[] = $obj->emp_age; // Employee AGE
|
||||||
|
break;
|
||||||
|
case 'relationship':
|
||||||
|
$rowData[] = $obj->emp_relationship; // Employee RELATIONSHIP
|
||||||
|
break;
|
||||||
|
case 'remarks':
|
||||||
|
$rowData[] = $obj->change_event; // REMARKS
|
||||||
|
break;
|
||||||
|
case 'policyenddate':
|
||||||
|
$rowData[] = $obj->policy_end_date; // POLICY END DATE
|
||||||
|
break;
|
||||||
|
case 'noofdays':
|
||||||
|
$rowData[] = $obj->days; // NO OF DAYS
|
||||||
|
break;
|
||||||
|
case 'tpaid':
|
||||||
|
$rowData[] = ''; // TPA ID
|
||||||
|
break;
|
||||||
|
case 'uhid':
|
||||||
|
$rowData[] = ''; // UHID
|
||||||
|
break;
|
||||||
|
case 'premium':
|
||||||
|
$rowData[] = $obj->premium; // PREMIUM
|
||||||
|
break;
|
||||||
|
case 'proratapremium':
|
||||||
|
$rowData[] = $obj->rata_premimum; // PR0 RATA PREMIUM
|
||||||
|
break;
|
||||||
|
case 'gst':
|
||||||
|
$rowData[] = $obj->gst; // GST
|
||||||
|
break;
|
||||||
|
case 'total':
|
||||||
|
$rowData[] = $obj->total; // TOTAL
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// If the header doesn't match any property, add an empty string
|
||||||
|
$rowData[] = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Append the row data to the main data array
|
||||||
|
$data[] = $rowData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -347,6 +347,7 @@ if (!function_exists('check_dependent_conflict'))
|
|||||||
|
|
||||||
// $temp_string = implode(" ",$policy_terms['family_floaters']);
|
// $temp_string = implode(" ",$policy_terms['family_floaters']);
|
||||||
$temp = $policy_terms['family_floaters'];
|
$temp = $policy_terms['family_floaters'];
|
||||||
|
$temp = is_array($temp) ? $temp : (is_object($temp) ? (array)$temp : []);
|
||||||
$allowed_child_count = $temp['childrens'];
|
$allowed_child_count = $temp['childrens'];
|
||||||
$allowed_spouse_count = $temp['spouse'];
|
$allowed_spouse_count = $temp['spouse'];
|
||||||
$allowed_adults = $temp['either-parents-pil'];
|
$allowed_adults = $temp['either-parents-pil'];
|
||||||
@ -902,3 +903,18 @@ if (!function_exists('transform_db_data_to_excel'))
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//comparre excel cell names and return range of chars between them
|
||||||
|
if (!function_exists('compare_excel_cell_range'))
|
||||||
|
{
|
||||||
|
function compare_excel_cell_range($highestColumnAllowed, $highestColumnReceivedInExcel) {
|
||||||
|
$highestColumnAllowed = strtoupper($highestColumnAllowed);
|
||||||
|
$highestColumnReceivedInExcel = strtoupper($highestColumnReceivedInExcel);
|
||||||
|
|
||||||
|
if ($highestColumnAllowed < $highestColumnReceivedInExcel) {
|
||||||
|
$range = range($highestColumnAllowed, $highestColumnReceivedInExcel);
|
||||||
|
return $range;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -86,31 +86,34 @@ if (!function_exists('compressImage')) {
|
|||||||
if (!function_exists('fancy_date_time_format'))
|
if (!function_exists('fancy_date_time_format'))
|
||||||
{
|
{
|
||||||
function fancy_date_time_format($datetime,$return_type = 'fancy') {
|
function fancy_date_time_format($datetime,$return_type = 'fancy') {
|
||||||
|
date_default_timezone_set('Asia/Kolkata');
|
||||||
|
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new DateTime();
|
||||||
$passedDateTime = new DateTime($datetime);
|
$passedDateTime = new DateTime($datetime);
|
||||||
|
|
||||||
|
// Calculate the interval between the current time and the passed datetime
|
||||||
|
$interval = $currentDateTime->diff($passedDateTime);
|
||||||
|
|
||||||
// Calculate the interval between the current time and the passed datetime
|
// If the interval is more than 1 month or the year is different, return the original datetime
|
||||||
$interval = $currentDateTime->diff($passedDateTime);
|
if ($interval->m > 1 || $interval->y != 0) {
|
||||||
// return change_date_format($datetime,'Y-m-d H:i:s','d M Y h:i a');
|
if ($return_type == 'fancy') {
|
||||||
// If the interval is more than 1 month, return the original datetime
|
return change_date_format($datetime, 'Y-m-d H:i:s', 'd M Y h:i a');
|
||||||
if ($interval->m > 1 || $interval->y > 0) {
|
|
||||||
if($return_type = 'fancy'){ return change_date_format($datetime,'Y-m-d H:i:s','d M Y h:i a'); }
|
|
||||||
return $datetime;
|
|
||||||
} elseif ($interval->m == 1 && $interval->y == 0) {
|
|
||||||
return "1 month ago";
|
|
||||||
} elseif ($interval->d >= 7) {
|
|
||||||
$weeks = floor($interval->d / 7);
|
|
||||||
return $weeks == 1 ? "1 week ago" : "$weeks weeks ago";
|
|
||||||
} elseif ($interval->d >= 1) {
|
|
||||||
return $interval->d == 1 ? "1 day ago" : $interval->d . " days ago";
|
|
||||||
} elseif ($interval->h >= 1) {
|
|
||||||
return $interval->h == 1 ? "1 hour ago" : $interval->h . " hours ago";
|
|
||||||
} elseif ($interval->i >= 1) {
|
|
||||||
return $interval->i == 1 ? "1 minute ago" : $interval->i . " minutes ago";
|
|
||||||
} else {
|
|
||||||
return "Just now";
|
|
||||||
}
|
}
|
||||||
|
return $datetime;
|
||||||
|
} elseif ($interval->m == 1 && $interval->y == 0) {
|
||||||
|
return "1 month ago";
|
||||||
|
} elseif ($interval->d >= 7) {
|
||||||
|
$weeks = floor($interval->d / 7);
|
||||||
|
return $weeks == 1 ? "1 week ago" : "$weeks weeks ago";
|
||||||
|
} elseif ($interval->d >= 1) {
|
||||||
|
return $interval->d == 1 ? "1 day ago" : $interval->d . " days ago";
|
||||||
|
} elseif ($interval->h >= 1) {
|
||||||
|
return $interval->h == 1 ? "1 hour ago" : $interval->h . " hours ago";
|
||||||
|
} elseif ($interval->i >= 1) {
|
||||||
|
return $interval->i == 1 ? "1 minute ago" : $interval->i . " minutes ago";
|
||||||
|
} else {
|
||||||
|
return "Just now";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -129,3 +132,5 @@ if(!function_exists('check_string_date'))
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -71,6 +71,7 @@ class ClientPolicyModel extends Model
|
|||||||
->select('policy_type.policy_type as policy_type_name')
|
->select('policy_type.policy_type as policy_type_name')
|
||||||
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
|
->select('insurer_branch.branch_name as insurer_branch_name, insurer_branch.branch_code as insurer_branch_code')
|
||||||
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
||||||
|
->select('policy_type.policy_type as policy_type_name')
|
||||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||||
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
||||||
->join('tpa', 'tpa.id = client_policy.tpa_id')
|
->join('tpa', 'tpa.id = client_policy.tpa_id')
|
||||||
|
|||||||
@ -11,6 +11,7 @@ class EmpEndorsementModel extends Model
|
|||||||
protected $allowedFields = [
|
protected $allowedFields = [
|
||||||
'id',
|
'id',
|
||||||
'pk',
|
'pk',
|
||||||
|
'group_key',
|
||||||
'endorsement_id',
|
'endorsement_id',
|
||||||
'emp_code',
|
'emp_code',
|
||||||
'table_name',
|
'table_name',
|
||||||
@ -27,4 +28,173 @@ class EmpEndorsementModel extends Model
|
|||||||
"remarks"
|
"remarks"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = [];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = [];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
|
||||||
|
// protected function afterFind(array $data)
|
||||||
|
// {
|
||||||
|
// foreach ($data as &$row) {
|
||||||
|
// // Format date_of_coverage field to Indian date format
|
||||||
|
// if (isset($row['field_name'])) {
|
||||||
|
// $row['field_name'] = remove_underscore_capitalize_first_letter($row['field_name']);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return $data;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
public function getDataForEnodrsementListinSIEnhancement($group_key){
|
||||||
|
$query = "
|
||||||
|
SELECT
|
||||||
|
employee_polices.days as old_days,
|
||||||
|
employee_polices.rata_premimum as old_rata,
|
||||||
|
employee_polices.gst as old_gst,
|
||||||
|
client_policy.policy_start_date as old_date,
|
||||||
|
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'basic_cover_si' THEN emp_endorsement.new_value ELSE NULL END) AS new_basic_cover_si,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) AS new_si_premium,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value ELSE NULL END) AS date_of_coverage,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'basic_cover_si' THEN emp_endorsement.old_value ELSE NULL END) AS old_basic_cover_si,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END) AS old_si_premium,
|
||||||
|
|
||||||
|
(MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) - MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END)) AS difference_premium,
|
||||||
|
|
||||||
|
DATEDIFF(employee_polices.policy_end_date, MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value END)) + 1 AS no_of_days,
|
||||||
|
|
||||||
|
ROUND(
|
||||||
|
(
|
||||||
|
(
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value END) -
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value END)
|
||||||
|
) *
|
||||||
|
DATEDIFF(
|
||||||
|
employee_polices.policy_end_date,
|
||||||
|
MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value END)
|
||||||
|
) / 365
|
||||||
|
),
|
||||||
|
2
|
||||||
|
) AS pro_rata_premimum,
|
||||||
|
|
||||||
|
ROUND(((MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) - MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END)) * DATEDIFF(employee_polices.policy_end_date, MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value ELSE NULL END)) / 365) * 0.18, 2) AS gst,
|
||||||
|
ROUND(((MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) - MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END)) * DATEDIFF(employee_polices.policy_end_date, MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value ELSE NULL END)) / 365), 2) +
|
||||||
|
ROUND(((MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.new_value ELSE NULL END) - MAX(CASE WHEN emp_endorsement.field_name = 'premium' THEN emp_endorsement.old_value ELSE NULL END)) * DATEDIFF(employee_polices.policy_end_date, MAX(CASE WHEN emp_endorsement.field_name = 'si_enhancement_date' THEN emp_endorsement.new_value ELSE NULL END)) / 365) * 0.18, 2) AS total
|
||||||
|
|
||||||
|
FROM emp_endorsement
|
||||||
|
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
||||||
|
JOIN client_policy ON client_policy.id = employee_polices.client_policy_id
|
||||||
|
WHERE group_key = '{$group_key}'
|
||||||
|
";
|
||||||
|
|
||||||
|
$results = $this->db->query($query)->getResult();
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getDataForEnodrsementListinDeletion($group_key){
|
||||||
|
$query = "
|
||||||
|
SELECT
|
||||||
|
|
||||||
|
employee_polices.days as old_days,
|
||||||
|
employee_polices.rata_premimum as old_rata,
|
||||||
|
employee_polices.gst as old_gst,
|
||||||
|
employee_polices.policy_end_date as end_date,
|
||||||
|
client_policy.policy_start_date as start_date,
|
||||||
|
|
||||||
|
MAX(CASE WHEN a.field_name = 'date_of_exit' THEN a.new_value ELSE NULL END) AS date_of_leaving,
|
||||||
|
MAX(CASE WHEN a.field_name = 'reason_for_exit' THEN a.new_value ELSE NULL END) AS exist_reason,
|
||||||
|
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) AS no_of_days,
|
||||||
|
ROUND((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium,
|
||||||
|
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst,
|
||||||
|
ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total
|
||||||
|
FROM
|
||||||
|
emp_endorsement a
|
||||||
|
LEFT JOIN
|
||||||
|
employees ON a.emp_code = employees.emp_code
|
||||||
|
LEFT JOIN
|
||||||
|
employee_polices ON employees.id = employee_polices.employee_id
|
||||||
|
LEFT JOIN
|
||||||
|
client_policy ON client_policy.id = employee_polices.client_policy_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
aa.emp_code,
|
||||||
|
aa.new_value AS 'empstatus',
|
||||||
|
bb.new_value AS 'changeevent',
|
||||||
|
cc.new_value AS 'dateofexit',
|
||||||
|
dd.new_value AS 'reasonforexit',
|
||||||
|
ee.new_value AS 'status'
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
a1.emp_code,
|
||||||
|
a1.field_name,
|
||||||
|
a1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS a1
|
||||||
|
WHERE
|
||||||
|
a1.field_name = 'emp_status'
|
||||||
|
) aa
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
b1.emp_code,
|
||||||
|
b1.field_name,
|
||||||
|
b1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS b1
|
||||||
|
WHERE
|
||||||
|
b1.field_name = 'change_event'
|
||||||
|
) bb ON aa.emp_code = bb.emp_code
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
c1.emp_code,
|
||||||
|
c1.field_name,
|
||||||
|
c1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS c1
|
||||||
|
WHERE
|
||||||
|
c1.field_name = 'date_of_exit'
|
||||||
|
) cc ON aa.emp_code = cc.emp_code
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
d1.emp_code,
|
||||||
|
d1.field_name,
|
||||||
|
d1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS d1
|
||||||
|
WHERE
|
||||||
|
d1.field_name = 'reason_for_exit'
|
||||||
|
) dd ON aa.emp_code = dd.emp_code
|
||||||
|
LEFT JOIN
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
e1.emp_code,
|
||||||
|
e1.field_name,
|
||||||
|
e1.new_value
|
||||||
|
FROM
|
||||||
|
emp_endorsement AS e1
|
||||||
|
WHERE
|
||||||
|
e1.field_name = 'status'
|
||||||
|
) ee ON aa.emp_code = ee.emp_code
|
||||||
|
) AS deletiondata ON a.emp_code = deletiondata.emp_code
|
||||||
|
WHERE group_key = '{$group_key}';
|
||||||
|
";
|
||||||
|
|
||||||
|
$results = $this->db->query($query)->getResult();
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,7 +35,8 @@ class EmployeeModel extends Model
|
|||||||
"updated_by",
|
"updated_by",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
"is_active",
|
"is_active",
|
||||||
"file_id"
|
"file_id",
|
||||||
|
"is_addon_value"
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id,$policy_id)
|
public function getEmployeePolicy($client_id,$policy_id,$status)
|
||||||
{
|
{
|
||||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active'])
|
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active'])
|
||||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
@ -79,8 +79,13 @@ class EmployeePolicyModel extends Model
|
|||||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
||||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||||
->where('emp.client_id',$client_id)
|
->where('emp.client_id',$client_id)
|
||||||
->where('employee_polices.client_policy_id',$policy_id)
|
->where('employee_polices.client_policy_id',$policy_id);
|
||||||
->findAll();
|
|
||||||
|
if($status != 0 && !empty($status)){
|
||||||
|
$result->where('employee_polices.status', $status);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $result->findAll();
|
||||||
return ($result);
|
return ($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +235,7 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
SELECT
|
SELECT
|
||||||
|
a.id as endorsement_primarykey,
|
||||||
employee_polices.id AS primaryKey,
|
employee_polices.id AS primaryKey,
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
employees.emp_code AS emp_code,
|
employees.emp_code AS emp_code,
|
||||||
@ -336,6 +342,7 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
SELECT
|
SELECT
|
||||||
|
a.id as endorsement_primarykey,
|
||||||
employee_polices.id as primaryKey,
|
employee_polices.id as primaryKey,
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
employees.emp_code AS emp_code,
|
employees.emp_code AS emp_code,
|
||||||
@ -451,7 +458,7 @@ class EmployeePolicyModel extends Model
|
|||||||
UPDATE emp_endorsement
|
UPDATE emp_endorsement
|
||||||
JOIN employees ON employees.id = emp_endorsement.pk
|
JOIN employees ON employees.id = emp_endorsement.pk
|
||||||
JOIN employee_polices ON employees.id = employee_polices.employee_id
|
JOIN employee_polices ON employees.id = employee_polices.employee_id
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
||||||
WHERE employees.emp_code = '$emp_code'
|
WHERE employees.emp_code = '$emp_code'
|
||||||
AND employee_polices.uhid = '$uhid'
|
AND employee_polices.uhid = '$uhid'
|
||||||
";
|
";
|
||||||
@ -463,15 +470,15 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$client_id = $update_data['client_id'];
|
$client_id = $update_data['client_id'];
|
||||||
$client_policy_id = $update_data['client_policy_id'];
|
$client_policy_id = $update_data['client_policy_id'];
|
||||||
$emp_name = $update_data['name'];
|
$emp_name = $update_data['emp_name'];
|
||||||
$emp_code = $update_data['emp_code'];
|
$emp_code = $update_data['emp_code'];
|
||||||
$endorsement_id = $update_data['uhid'];
|
$endorsement_id = $update_data['endorsement_id'];
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
UPDATE emp_endorsement
|
UPDATE emp_endorsement
|
||||||
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
||||||
JOIN employees ON employee_polices.employee_id = employees.id
|
JOIN employees ON employee_polices.employee_id = employees.id
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
||||||
WHERE emp_endorsement.emp_code = '$emp_code'
|
WHERE emp_endorsement.emp_code = '$emp_code'
|
||||||
AND employees.client_id = '$client_id'
|
AND employees.client_id = '$client_id'
|
||||||
AND employee_polices.client_policy_id = '$client_policy_id'
|
AND employee_polices.client_policy_id = '$client_policy_id'
|
||||||
@ -483,19 +490,20 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function updateEndoresmentIdForDeletion($update_data){
|
public function updateEndoresmentIdForDeletion($update_data)
|
||||||
|
{
|
||||||
|
|
||||||
$client_id = $update_data['client_id'];
|
$client_id = $update_data['client_id'];
|
||||||
$client_policy_id = $update_data['client_policy_id'];
|
$client_policy_id = $update_data['client_policy_id'];
|
||||||
$emp_name = $update_data['name'];
|
$emp_name = $update_data['emp_name'];
|
||||||
$emp_code = $update_data['emp_code'];
|
$emp_code = $update_data['emp_code'];
|
||||||
$endorsement_id = $update_data['uhid'];
|
$endorsement_id = $update_data['endorsement_id'];
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
UPDATE emp_endorsement
|
UPDATE emp_endorsement
|
||||||
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
|
||||||
JOIN employees ON employee_polices.employee_id = employees.id
|
JOIN employees ON employee_polices.employee_id = employees.id
|
||||||
SET emp_endorsement.endorsement_id = '$endorsement_id'
|
SET emp_endorsement.endorsement_id = '$endorsement_id', emp_endorsement.status = 'complete'
|
||||||
WHERE employees.emp_code = '$emp_code'
|
WHERE employees.emp_code = '$emp_code'
|
||||||
AND employees.client_id = '$client_id'
|
AND employees.client_id = '$client_id'
|
||||||
AND employee_polices.client_policy_id = '$client_policy_id'
|
AND employee_polices.client_policy_id = '$client_policy_id'
|
||||||
@ -508,7 +516,7 @@ class EmployeePolicyModel extends Model
|
|||||||
public function fetchEmpEndorsementData($fetch_data)
|
public function fetchEmpEndorsementData($fetch_data)
|
||||||
{
|
{
|
||||||
$client_policy_id = $fetch_data['client_policy_id'];
|
$client_policy_id = $fetch_data['client_policy_id'];
|
||||||
$emp_name = $fetch_data['name'];
|
$emp_name = $fetch_data['emp_name'];
|
||||||
$emp_code = $fetch_data['emp_code'];
|
$emp_code = $fetch_data['emp_code'];
|
||||||
|
|
||||||
// Your raw SQL query
|
// Your raw SQL query
|
||||||
@ -560,6 +568,79 @@ class EmployeePolicyModel extends Model
|
|||||||
$this->query($query);
|
$this->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
|
||||||
|
public function getEmployeeEndorsementList($client_id, $policy_id, $status)
|
||||||
|
{
|
||||||
|
$query1 = $this->db->table('emp_endorsement e');
|
||||||
|
$query1->select('
|
||||||
|
e.id,
|
||||||
|
e.pk,
|
||||||
|
e.emp_code,
|
||||||
|
e.name,
|
||||||
|
e.actions,
|
||||||
|
e.status,
|
||||||
|
e.remarks,
|
||||||
|
e.endorsement_id,
|
||||||
|
ep.client_policy_id,
|
||||||
|
policies.name as policy_name,
|
||||||
|
insurers.short_name as insurer_short_name
|
||||||
|
');
|
||||||
|
$query1->distinct();
|
||||||
|
$query1->join('employee_polices ep', 'ep.id = e.pk', 'left');
|
||||||
|
$query1->join('employees', 'employees.id = ep.employee_id', 'left');
|
||||||
|
$query1->join('client_policy', 'client_policy.id = ep.client_policy_id', 'left');
|
||||||
|
$query1->join('policies', 'policies.id = client_policy.policy_id', 'left');
|
||||||
|
$query1->join('insurers', 'insurers.id = policies.insurer_id', 'left');
|
||||||
|
$query1->whereIn('e.actions', ['c']);
|
||||||
|
$query1->where('ep.client_policy_id', $client_id);
|
||||||
|
$query1->where('employees.client_id', $policy_id);
|
||||||
|
if($status != 0 && !empty($status)){
|
||||||
|
|
||||||
|
$query1->where('e.status', $status);
|
||||||
|
}
|
||||||
|
$query1->orderBy('e.id', 'desc');
|
||||||
|
|
||||||
|
$results1 = $query1->get()->getResultArray();
|
||||||
|
|
||||||
|
$query2 = $this->db->table('emp_endorsement e');
|
||||||
|
|
||||||
|
$query2->select('
|
||||||
|
e.id,
|
||||||
|
e.pk,
|
||||||
|
e.emp_code,
|
||||||
|
e.name,
|
||||||
|
e.actions,
|
||||||
|
e.status,
|
||||||
|
e.endorsement_id,
|
||||||
|
e.remarks,
|
||||||
|
ep.client_policy_id,
|
||||||
|
policies.name as policy_name,
|
||||||
|
insurers.short_name as insurer_short_name
|
||||||
|
');
|
||||||
|
$query2->join('employee_polices ep', 'ep.id = e.pk', 'left');
|
||||||
|
$query2->join('employees', 'employees.id = ep.employee_id', 'left');
|
||||||
|
$query2->join('client_policy', 'client_policy.id = ep.client_policy_id', 'left');
|
||||||
|
$query2->join('policies', 'policies.id = client_policy.policy_id', 'left');
|
||||||
|
$query2->join('insurers', 'insurers.id = policies.insurer_id', 'left');
|
||||||
|
$query2->whereIn('e.actions', ['si', 'd']);
|
||||||
|
$query2->where('ep.client_policy_id', $client_id);
|
||||||
|
$query2->where('employees.client_id', $policy_id);
|
||||||
|
if($status != 0 && !empty($status)){
|
||||||
|
|
||||||
|
$query2->where('e.status', $status);
|
||||||
|
}
|
||||||
|
$query2->groupBy('e.emp_code, e.name, e.actions');
|
||||||
|
$query2->orderBy('e.id', 'desc');
|
||||||
|
|
||||||
|
$results2 = $query2->get()->getResultArray();
|
||||||
|
|
||||||
|
$results = array_merge($results1, $results2);
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
<style>
|
<style>
|
||||||
|
|
||||||
body {
|
body {
|
||||||
.multiselect-native-select {
|
.multiselect-native-select {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -25,7 +24,15 @@ body {
|
|||||||
.multiselect-selected-text{
|
.multiselect-selected-text{
|
||||||
float: left !important;
|
float: left !important;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table th,
|
||||||
|
.table td {
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.dataTable tbody td {
|
||||||
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<!-- End ADD and EDIT Page HTML -->
|
<!-- End ADD and EDIT Page HTML -->
|
||||||
|
|||||||
@ -36,8 +36,8 @@
|
|||||||
<form role="form" class="parsley-examples" method="post" id="policy_form"
|
<form role="form" class="parsley-examples" method="post" id="policy_form"
|
||||||
enctype="multipart/form-data">
|
enctype="multipart/form-data">
|
||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey"/>
|
||||||
<input type="hidden" id="policy_form_action" />
|
<input type="hidden" id="policy_form_action"/>
|
||||||
<input type="hidden" name="policy_type_id" id="policy_type_id"/>
|
<input type="hidden" name="policy_type_id" id="policy_type_id"/>
|
||||||
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -94,11 +94,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <hr> -->
|
|
||||||
|
|
||||||
<div id="policy_fields"></div>
|
<div id="policy_fields"></div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||||
@ -159,6 +157,7 @@
|
|||||||
|
|
||||||
|
|
||||||
$('.btnAdd').click(function(){
|
$('.btnAdd').click(function(){
|
||||||
|
$('#policy_form')[0].reset();
|
||||||
$('#add_form').show();
|
$('#add_form').show();
|
||||||
$('#table_list').hide();
|
$('#table_list').hide();
|
||||||
$('.btnBack').show();
|
$('.btnBack').show();
|
||||||
@ -170,14 +169,13 @@
|
|||||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||||
$('#is_addon').prop('checked', false);
|
$('#is_addon').prop('checked', false);
|
||||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||||
|
$('#policy_status_field').hide()
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('.btnBack').click(function(){
|
$('.btnBack').click(function(){
|
||||||
|
$('#policy_form')[0].reset();
|
||||||
$('#GMC').remove();
|
|
||||||
$('#GPA').remove();
|
|
||||||
$('#add_form').hide();
|
$('#add_form').hide();
|
||||||
$('#table_list').show();
|
$('#table_list').show();
|
||||||
$('.btnBack').hide();
|
$('.btnBack').hide();
|
||||||
@ -194,10 +192,22 @@
|
|||||||
if (policy_PrimaryKey !== '') {
|
if (policy_PrimaryKey !== '') {
|
||||||
var policyTable = '';
|
var policyTable = '';
|
||||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||||
|
// console.log('client_policy_data',data)
|
||||||
data.forEach(function(item) {
|
data.forEach(function(item) {
|
||||||
// console.log("----------------------------");
|
console.log(item.open_for_enrollment);
|
||||||
|
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||||
|
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||||
|
var subject = item.policy_type_name;
|
||||||
|
|
||||||
// console.log(item);
|
if (patternGMC.test(subject)) {
|
||||||
|
search_term = 'GMC';
|
||||||
|
} else if (patternGPA.test(subject)) {
|
||||||
|
search_term = 'GPA';
|
||||||
|
} else {
|
||||||
|
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('search_term :', search_term)
|
||||||
|
|
||||||
policyTable += `
|
policyTable += `
|
||||||
<tr>
|
<tr>
|
||||||
@ -211,10 +221,15 @@
|
|||||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal" id="${item.policy_type_id}"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
`;
|
||||||
</div>
|
if (item.open_for_enrollment == 0) {
|
||||||
|
policyTable +=`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
||||||
|
}else{
|
||||||
|
policyTable +=`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="pointer-events:none; background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
||||||
|
}
|
||||||
|
policyTable += ` </div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -271,7 +286,7 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
console.log(res);
|
console.log(res);
|
||||||
|
$('#policy_form')[0].reset();
|
||||||
if (res.status === false) {
|
if (res.status === false) {
|
||||||
toastr.error('Policy Dose Not Create', 'Error');
|
toastr.error('Policy Dose Not Create', 'Error');
|
||||||
return;
|
return;
|
||||||
@ -295,10 +310,25 @@
|
|||||||
$('#policy_table tr').remove();
|
$('#policy_table tr').remove();
|
||||||
var policyTable = '';
|
var policyTable = '';
|
||||||
$.each(res.data, function(index, item) {
|
$.each(res.data, function(index, item) {
|
||||||
|
|
||||||
|
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||||
|
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||||
|
var subject = item.policy_type_name;
|
||||||
|
|
||||||
|
if (patternGMC.test(subject)) {
|
||||||
|
search_term = 'GMC';
|
||||||
|
} else if (patternGPA.test(subject)) {
|
||||||
|
search_term = 'GPA';
|
||||||
|
} else {
|
||||||
|
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('search_term :', search_term)
|
||||||
|
|
||||||
policyTable += `
|
policyTable += `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${item.policy_name}</td>
|
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||||
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
@ -307,8 +337,8 @@
|
|||||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" class="dropdown-item btnPolicyMaster" data-toggle="modal" id="${item.policy_type_id}"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -482,13 +512,28 @@
|
|||||||
client_policy_id : client_policy_id,
|
client_policy_id : client_policy_id,
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
// console.log(res);
|
console.log(res);
|
||||||
if(res) {
|
if(res) {
|
||||||
|
if (res.open_for_enrollment) {
|
||||||
|
var json_decode=JSON.parse(res.open_for_enrollment);
|
||||||
|
var open_for_enrollment=json_decode.open_for_enrollment;
|
||||||
|
var client_policy_id=json_decode.client_policy_id;
|
||||||
|
if (open_for_enrollment == 1) {
|
||||||
|
// console.log($('[data-id="' + client_policy_id + '"]');
|
||||||
|
$('.btnOpenEnroll').each(function(index, element) {
|
||||||
|
if ($(element).data('id') == client_policy_id) {
|
||||||
|
$(element).css({'background-color': 'lightgrey', 'pointer-events': 'none'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if(res.status === true){
|
if(res.status === true){
|
||||||
toastr.success(res.message, 'Success');
|
toastr.success(res.message, 'Success');
|
||||||
|
|
||||||
}else if(res.status === false){
|
}else if(res.status === false){
|
||||||
toastr.warning(res.message, 'Warning');
|
toastr.warning(res.message, 'Warning');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,23 +22,34 @@ table.dataTable tbody td {
|
|||||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<!-- <div class="text-center"> -->
|
<!-- <div class="text-center"> -->
|
||||||
<div class="row">
|
<div class="form-row">
|
||||||
<div class="col-md-6 col-xl-3">
|
<div class="form-group col-md-4">
|
||||||
<div class="form-group mb-3">
|
<label>Client</label> <br />
|
||||||
<label>Client</label> <br />
|
<select class="form-control" id="clients">
|
||||||
<select class="form-control" id="clients">
|
<option value="0">Select</option>
|
||||||
<option value="0">Select</option>
|
</select>
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-xl-3">
|
|
||||||
<div class="form-group mb-3">
|
<div class="form-group col-md-4">
|
||||||
<label>Policy</label> <br />
|
<label>Policy</label> <br />
|
||||||
<select class="form-control" id="policies">
|
<select class="form-control" id="policies">
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Status</label> <br />
|
||||||
|
<select class="form-control" id="status2">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php foreach($status as $key => $value) { ?>
|
||||||
|
<option value="<?= $key ?>"
|
||||||
|
<?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
||||||
|
<?= $value ?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-12" style="text-align: right;">
|
||||||
@ -98,7 +109,19 @@ table.dataTable tbody td {
|
|||||||
<td><?php echo $employee['insurer_short_name']?></td>
|
<td><?php echo $employee['insurer_short_name']?></td>
|
||||||
<td><?php echo $employee['tpa_id']?></td>
|
<td><?php echo $employee['tpa_id']?></td>
|
||||||
<td><?php echo $employee['uhid']?></td>
|
<td><?php echo $employee['uhid']?></td>
|
||||||
<td><span class="badge badge-success">active</span></td>
|
<td>
|
||||||
|
<?php
|
||||||
|
if ($employee['status'] == 'draft') {
|
||||||
|
echo '<span class="badge badge-secondary">' . $employee['status'] . '</span>';
|
||||||
|
} elseif ($employee['status'] == 'active') {
|
||||||
|
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||||
|
} elseif ($employee['status'] == 'inactive') {
|
||||||
|
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||||
|
}elseif ($employee['status'] == 'expired') {
|
||||||
|
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
<td><?php echo $employee['premium']?></td>
|
<td><?php echo $employee['premium']?></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
@ -134,6 +157,8 @@ table.dataTable tbody td {
|
|||||||
<script>
|
<script>
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
var clientPolicies = [];
|
||||||
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
console.log("document loaded");
|
console.log("document loaded");
|
||||||
@ -144,7 +169,6 @@ $(document).ready(function() {
|
|||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
console.log("window loaded");
|
console.log("window loaded");
|
||||||
fetchClientPolicies();
|
fetchClientPolicies();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -167,8 +191,21 @@ function fetchClientPolicies() {
|
|||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
clientPolicies = (response.data);
|
clientPolicies = (response.data);
|
||||||
// console.log(clientPolicies);
|
console.log('1',clientPolicies);
|
||||||
appendClients(clientPolicies);
|
appendClients(clientPolicies);
|
||||||
|
|
||||||
|
//this function for reselect the policy
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_id != 0 ) {
|
||||||
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
console.log(typeof item.id)
|
||||||
|
return item.id == client_id;
|
||||||
|
});
|
||||||
|
appendPolicies(foundPolicies.policies);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
//end
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing API response data:', error);
|
console.error('Error parsing API response data:', error);
|
||||||
}
|
}
|
||||||
@ -188,29 +225,43 @@ function fetchClientPolicies() {
|
|||||||
|
|
||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
$('#clients').append($('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.client_name
|
text: item.client_name
|
||||||
}));
|
});
|
||||||
|
if (clientID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#clients').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies(data) {
|
function appendPolicies(data) {
|
||||||
|
|
||||||
$('#policies').empty();
|
$('#policies').empty();
|
||||||
$('#policies').append($('<option>', {
|
$('#policies').append($('<option>', {
|
||||||
value: '0',
|
value: '0',
|
||||||
text: 'Select'
|
text: 'Select'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
||||||
|
console.log(PolicyID)
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
$('#policies').append($('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.name
|
text: item.name
|
||||||
}));
|
});
|
||||||
|
if (PolicyID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#policies').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$('#clients').on('change', function() {
|
$('#clients').on('change', function() {
|
||||||
var selectedClient = $(this).val();
|
var selectedClient = $(this).val();
|
||||||
console.log(selectedClient);
|
console.log(selectedClient);
|
||||||
@ -224,16 +275,20 @@ $('#clients').on('change', function() {
|
|||||||
appendPolicies(foundPolicies.policies);
|
appendPolicies(foundPolicies.policies);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Function to convert object to query parameters
|
// Function to convert object to query parameters
|
||||||
function objectToQueryString(obj) {
|
function objectToQueryString(obj) {
|
||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function fetchEmpolyeeList(event) {
|
function fetchEmpolyeeList(event) {
|
||||||
event.preventDefault(); // Prevent default action
|
event.preventDefault(); // Prevent default action
|
||||||
|
|
||||||
var client_id = $('#clients').val();
|
var client_id = $('#clients').val();
|
||||||
var policy_id = $('#policies').val();
|
var policy_id = $('#policies').val();
|
||||||
|
var status = $('#status2').val();
|
||||||
|
|
||||||
console.log(client_id + '-' + policy_id);
|
console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
if (client_id == '0' || policy_id == '0') {
|
||||||
alert('Please select values in both dropdowns.');
|
alert('Please select values in both dropdowns.');
|
||||||
@ -241,8 +296,10 @@ function fetchEmpolyeeList(event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
|
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
policy_id: policy_id
|
policy_id: policy_id,
|
||||||
|
status : status,
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
@ -268,9 +325,11 @@ function fetchEmpolyeeList(event) {
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||||
var icon = document.getElementById('icon');
|
var icon = document.getElementById('icon');
|
||||||
icon.classList.toggle('mdi-chevron-down');
|
icon.classList.toggle('mdi-chevron-down');
|
||||||
icon.classList.toggle('mdi-chevron-up');
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -1,12 +1,12 @@
|
|||||||
<style>
|
<style>
|
||||||
.table th,
|
.table th,
|
||||||
.table td {
|
.table td {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -22,23 +22,34 @@
|
|||||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<!-- <div class="text-center"> -->
|
<!-- <div class="text-center"> -->
|
||||||
<div class="row">
|
<div class="form-row">
|
||||||
<div class="col-md-6 col-xl-3">
|
<div class="form-group col-md-4">
|
||||||
<div class="form-group mb-3">
|
<label>Client</label> <br />
|
||||||
<label>Client</label> <br />
|
<select class="form-control" id="clients">
|
||||||
<select class="form-control" id="clients">
|
<option value="0">Select</option>
|
||||||
<option value="0">Select</option>
|
</select>
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-xl-3">
|
|
||||||
<div class="form-group mb-3">
|
<div class="form-group col-md-4">
|
||||||
<label>Policy</label> <br />
|
<label>Policy</label> <br />
|
||||||
<select class="form-control" id="policies">
|
<select class="form-control" id="policies">
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Status</label> <br />
|
||||||
|
<select class="form-control" id="status1">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
<?php foreach($status as $key => $value) { ?>
|
||||||
|
<option value="<?= $key ?>"
|
||||||
|
<?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
||||||
|
<?= $value ?>
|
||||||
|
</option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-12" style="text-align: right;">
|
||||||
@ -74,11 +85,11 @@
|
|||||||
<th class="font-weight-medium">SNO</th>
|
<th class="font-weight-medium">SNO</th>
|
||||||
<th class="font-weight-medium">Name/code</th>
|
<th class="font-weight-medium">Name/code</th>
|
||||||
<th class="font-weight-medium">Policy name</th>
|
<th class="font-weight-medium">Policy name</th>
|
||||||
<th class="font-weight-medium">Insurar name</th>
|
<th class="font-weight-medium">Endorsement ID</th>
|
||||||
<th class="font-weight-medium">TPA ID</th>
|
<th class="font-weight-medium">Insurer name</th>
|
||||||
<th class="font-weight-medium">UHID ID</th>
|
<th class="font-weight-medium">Remarks</th>
|
||||||
<th class="font-weight-medium">Policy status</th>
|
<th class="font-weight-medium">Endorsement Type</th>
|
||||||
<th class="font-weight-medium">Premium</th>
|
<th class="font-weight-medium">Status</th>
|
||||||
<th class="font-weight-medium">Action</th>
|
<th class="font-weight-medium">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -91,32 +102,37 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><b><?php echo ($key + 1)?></b></td>
|
<td><b><?php echo ($key + 1)?></b></td>
|
||||||
<!-- <td><?php echo $employee['emp_code']?></td> -->
|
|
||||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
||||||
<td><?php echo $employee['policy_name']?></td>
|
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?></td>
|
||||||
<td><?php echo $employee['insurer_short_name']?></td>
|
<td><?php echo $employee['endorsement_id']?></td>
|
||||||
<td><?php echo $employee['tpa_id']?></td>
|
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
||||||
<td><?php echo $employee['uhid']?></td>
|
</td>
|
||||||
<td><span class="badge badge-success">active</span></td>
|
<td><?php echo $employee['remarks']?></td>
|
||||||
<td><?php echo $employee['premium']?></td>
|
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<?php
|
||||||
<a href="javascript: void(0);"
|
if ($employee['actions'] == 'c') {
|
||||||
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
|
echo 'Correction';
|
||||||
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
} elseif ($employee['actions'] == 'si') {
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
echo 'SI Enhancement';
|
||||||
<a class="dropdown-item" href="#"><i
|
} elseif ($employee['actions'] == 'd') {
|
||||||
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
echo 'Deletion';
|
||||||
Ticket</a>
|
}
|
||||||
<a class="dropdown-item" href="#"><i
|
?>
|
||||||
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
|
</td>
|
||||||
<a class="dropdown-item" href="#"><i
|
<td>
|
||||||
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
|
<?php
|
||||||
<a class="dropdown-item" href="#"><i
|
if ($employee['status'] == 'pending') {
|
||||||
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
|
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||||
Unread</a>
|
} elseif ($employee['status'] == 'inprogress') {
|
||||||
</div>
|
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||||
</div>
|
} elseif ($employee['status'] == 'complete') {
|
||||||
|
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td class="text-center"><a href="#" data-id="<?php echo $employee['id']?>"
|
||||||
|
class="fa fa-eye emp_data_model" aria-hidden="true" data-toggle="modal"
|
||||||
|
data-target="#centermodal"></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php }}?>
|
<?php }}?>
|
||||||
@ -127,27 +143,48 @@
|
|||||||
</div>
|
</div>
|
||||||
</div><!-- end col -->
|
</div><!-- end col -->
|
||||||
</div>
|
</div>
|
||||||
<!-- end row -->
|
|
||||||
<div id="loader" class="loader" style="display:none;">SPINNER</div>
|
|
||||||
|
|
||||||
|
<!-- Center modal content -->
|
||||||
|
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header" style="background-color: gainsboro;">
|
||||||
|
<h4 class="modal-title" id="myCenterModalLabel">Endorsement Details <span id="heading"></span></h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" id="modal_body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-hover mb-0">
|
||||||
|
<thead id="table_head_data">
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
<tbody id="table_data">
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div> <!-- end table-responsive-->
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
var clientPolicies = [];
|
||||||
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
$(document).ready(function() {
|
|
||||||
console.log("document loaded");
|
|
||||||
//fetchClientPolicies();
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$(window).on("load", function() {
|
$(window).on("load", function() {
|
||||||
console.log("window loaded");
|
console.log("window loaded");
|
||||||
fetchClientPolicies();
|
fetchClientPolicies();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function fetchClientPolicies() {
|
function fetchClientPolicies() {
|
||||||
|
|
||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||||
console.log('fetchClientPolicies');
|
console.log('fetchClientPolicies');
|
||||||
@ -166,8 +203,21 @@ function fetchClientPolicies() {
|
|||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
clientPolicies = (response.data);
|
clientPolicies = (response.data);
|
||||||
// console.log(clientPolicies);
|
console.log(clientPolicies);
|
||||||
appendClients(clientPolicies);
|
appendClients(clientPolicies);
|
||||||
|
|
||||||
|
//this function for reselect policy
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_id) {
|
||||||
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
console.log(typeof item.id)
|
||||||
|
return item.id == client_id;
|
||||||
|
});
|
||||||
|
appendPolicies(foundPolicies.policies);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
//end
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing API response data:', error);
|
console.error('Error parsing API response data:', error);
|
||||||
}
|
}
|
||||||
@ -187,26 +237,40 @@ function fetchClientPolicies() {
|
|||||||
|
|
||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
|
|
||||||
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
$('#clients').append($('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.client_name
|
text: item.client_name
|
||||||
}));
|
});
|
||||||
|
if (clientID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#clients').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies(data) {
|
function appendPolicies(data) {
|
||||||
|
|
||||||
$('#policies').empty();
|
$('#policies').empty();
|
||||||
$('#policies').append($('<option>', {
|
$('#policies').append($('<option>', {
|
||||||
value: '0',
|
value: '0',
|
||||||
text: 'Select'
|
text: 'Select'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
||||||
|
console.log(PolicyID)
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
$('#policies').append($('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
text: item.name
|
text: item.name
|
||||||
}));
|
});
|
||||||
|
if (PolicyID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#policies').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,6 +297,7 @@ function fetchEmpolyeeList(event) {
|
|||||||
|
|
||||||
var client_id = $('#clients').val();
|
var client_id = $('#clients').val();
|
||||||
var policy_id = $('#policies').val();
|
var policy_id = $('#policies').val();
|
||||||
|
var status = $('#status1').val();
|
||||||
console.log(client_id + '-' + policy_id);
|
console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
if (client_id == '0' || policy_id == '0') {
|
||||||
alert('Please select values in both dropdowns.');
|
alert('Please select values in both dropdowns.');
|
||||||
@ -241,7 +306,8 @@ function fetchEmpolyeeList(event) {
|
|||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
policy_id: policy_id
|
policy_id: policy_id,
|
||||||
|
status: status,
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
@ -256,4 +322,160 @@ document.getElementById('toggleIcon').addEventListener('click', function() {
|
|||||||
icon.classList.toggle('mdi-chevron-down');
|
icon.classList.toggle('mdi-chevron-down');
|
||||||
icon.classList.toggle('mdi-chevron-up');
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.emp_data_model').click(function() {
|
||||||
|
var myVal = $(this).data('id');
|
||||||
|
console.log(myVal);
|
||||||
|
fetchEmpEndorsementData(myVal)
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function fetchEmpEndorsementData(id) {
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
var apiURL = '<?php echo base_url();?>' + 'util/get-emp-endorsement/' + id;
|
||||||
|
console.log('fetchEmpEndorsementData');
|
||||||
|
console.log(apiURL);
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
console.log(response);
|
||||||
|
if (response.code === 200 && response.dataStatus === true) {
|
||||||
|
try {
|
||||||
|
endorsementData = (response.data);
|
||||||
|
endorsementData2 = (response.data2);
|
||||||
|
|
||||||
|
e_actions = endorsementData2[0]['actions'];
|
||||||
|
|
||||||
|
|
||||||
|
var heading = "";
|
||||||
|
if (endorsementData2[0]['actions'] == 'si') {
|
||||||
|
heading = ' - ' + 'SI Enhancement';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
} else if (endorsementData2[0]['actions'] == 'd') {
|
||||||
|
heading = ' - ' + 'Deletion';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
} else if (endorsementData2[0]['actions'] == 'c') {
|
||||||
|
heading = ' - ' + 'Correction';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#heading').html(heading);
|
||||||
|
|
||||||
|
$('#table_data').empty();
|
||||||
|
$('#table_head_data').empty();
|
||||||
|
|
||||||
|
|
||||||
|
if(e_actions == 'd'){
|
||||||
|
|
||||||
|
$.each(endorsementData, function(index, item) {
|
||||||
|
var tableHtml = `
|
||||||
|
<tr>
|
||||||
|
<td>${item.field_name}</td>
|
||||||
|
<td>${formatNumberToIndianLocale(item.data, item.field_name, e_actions)}</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
$('#table_data').append(tableHtml);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var table_head = `
|
||||||
|
<tr>
|
||||||
|
<th class="font-weight-medium"></th>
|
||||||
|
<th class="font-weight-medium">Old Value</th>
|
||||||
|
<th class="font-weight-medium">New Value</th>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
$('#table_head_data').append(table_head);
|
||||||
|
|
||||||
|
$.each(endorsementData, function(index, item) {
|
||||||
|
var tableHtml = `
|
||||||
|
<tr>
|
||||||
|
<td>${item.field_name}</td>
|
||||||
|
<td>${formatNumberToIndianLocale(item.old_value, item.field_name)}</td>
|
||||||
|
<td>${formatNumberToIndianLocale(item.new_value, item.field_name, e_actions)}</td>
|
||||||
|
</tr>
|
||||||
|
`;
|
||||||
|
$('#table_data').append(tableHtml);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing API response data:', error);
|
||||||
|
}
|
||||||
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
|
console.error('no data found', response);
|
||||||
|
} else {
|
||||||
|
console.error('Something went wrong!');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data from API:', error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatNumberToIndianLocale(value, field_name, action) {
|
||||||
|
|
||||||
|
// Check if the value is a valid number (either as a number or as a string)
|
||||||
|
if (!isNaN(value) && !isNaN(parseFloat(value)) && field_name != 'No of Days') {
|
||||||
|
|
||||||
|
// Convert the value to a number and format it using Indian English locale
|
||||||
|
var return_val = parseFloat(value).toLocaleString('en-IN');
|
||||||
|
|
||||||
|
if(field_name == 'Period of non coverage'){
|
||||||
|
|
||||||
|
return value + ' days';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(field_name == 'Total Amount'){
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(field_name == 'Total'){
|
||||||
|
|
||||||
|
if(action == 'd'){
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||||
|
|
||||||
|
}else if(action == 'si'){
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be paid )';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return '₹ ' + return_val;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Return the original value if it's not a valid number
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.close').click(function(){
|
||||||
|
|
||||||
|
$('#table_data').empty();
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@ -14,6 +14,7 @@
|
|||||||
<th class="font-weight-medium">File name</th>
|
<th class="font-weight-medium">File name</th>
|
||||||
<th class="font-weight-medium">Client</th>
|
<th class="font-weight-medium">Client</th>
|
||||||
<th class="font-weight-medium">policy</th>
|
<th class="font-weight-medium">policy</th>
|
||||||
|
<th class="font-weight-medium">Event</th>
|
||||||
<th class="font-weight-medium">User/Time</th>
|
<th class="font-weight-medium">User/Time</th>
|
||||||
<th class="font-weight-medium">Status</th>
|
<th class="font-weight-medium">Status</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -34,6 +35,7 @@
|
|||||||
<td><?php echo $file['file_name']?></td>
|
<td><?php echo $file['file_name']?></td>
|
||||||
<td><?php echo $file['short_name']?></td>
|
<td><?php echo $file['short_name']?></td>
|
||||||
<td><?php echo $file['policy_name']?></td>
|
<td><?php echo $file['policy_name']?></td>
|
||||||
|
<td><?php echo $file['action']?></td>
|
||||||
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?></td>
|
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?></td>
|
||||||
<td><?php echo $file['status']; if($file['status'] == 'failed')
|
<td><?php echo $file['status']; if($file['status'] == 'failed')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>nHANCE</title>
|
<title>nHANCE</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
|
<meta content="A fully featured CRM" name="description" />
|
||||||
<meta content="Coderthemes" name="author" />
|
<meta content="Venba info tech" name="author" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<!-- App favicon -->
|
<!-- App favicon -->
|
||||||
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/favicon.ico">
|
<link rel="shortcut icon" href="<?= base_url()."public"; ?>/assets/images/favicon.ico">
|
||||||
|
|||||||
@ -643,9 +643,9 @@ var grid_html = '';
|
|||||||
|
|
||||||
|
|
||||||
var gmc_policy_type_id = $(this).attr('id');
|
var gmc_policy_type_id = $(this).attr('id');
|
||||||
|
console.log(gmc_policy_type_id)
|
||||||
|
|
||||||
|
if(gmc_policy_type_id == 'GMC'){
|
||||||
if(gmc_policy_type_id >= 2){
|
|
||||||
|
|
||||||
$('#policyGMCTerms').css('display', '');
|
$('#policyGMCTerms').css('display', '');
|
||||||
$('#police-tab').css('display', 'none');
|
$('#police-tab').css('display', 'none');
|
||||||
@ -802,6 +802,8 @@ var grid_html = '';
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}else if(gmc_policy_type_id != 'GPA' && gmc_policy_type_id != 'GMC'){
|
||||||
|
// toastr.warning('The terms has no data ', 'warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -446,7 +446,7 @@
|
|||||||
var gpa_policy_type_id = $(this).attr('id');
|
var gpa_policy_type_id = $(this).attr('id');
|
||||||
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
// console.log('gpa_policy_type_id', gpa_policy_type_id)
|
||||||
|
|
||||||
if(gpa_policy_type_id == '1'){
|
if(gpa_policy_type_id == 'GPA'){
|
||||||
|
|
||||||
$('#policyGPATermsForm').css('display', '');
|
$('#policyGPATermsForm').css('display', '');
|
||||||
$('#police-tab').css('display', 'none');
|
$('#police-tab').css('display', 'none');
|
||||||
@ -548,6 +548,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}else if(gpa_policy_type_id != 'GPA' && gpa_policy_type_id != 'GMC'){
|
||||||
|
toastr.warning("This policy has no policy terms.", 'warning');
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,6 +7,9 @@
|
|||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<div class="text-center" id="no_data"></div>
|
||||||
|
|
||||||
<form role="form" class="parsley-examples" method="post" id="GridForm" enctype="multipart/form-data">
|
<form role="form" class="parsley-examples" method="post" id="GridForm" enctype="multipart/form-data">
|
||||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"/>
|
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"/>
|
||||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||||
@ -14,7 +17,7 @@
|
|||||||
<input type="hidden" id="grid_emp_count"/>
|
<input type="hidden" id="grid_emp_count"/>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="emp_code">Policy Premium Type<span class="text-danger">*</span></label>
|
<label for="emp_code">Policy Premium Type<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="grid" name="policy_grid_id" onchange="addGridHTML(event)" required>
|
<select class="form-control" id="grid" name="policy_grid_id" onchange="addGridHTML(event)" required>
|
||||||
@ -565,106 +568,125 @@
|
|||||||
|
|
||||||
var client_policy_id = $(this).data('id');
|
var client_policy_id = $(this).data('id');
|
||||||
$('#client_policy_id').val(client_policy_id);
|
$('#client_policy_id').val(client_policy_id);
|
||||||
|
console.log('client_policy_id',client_policy_id)
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
var policy_type_string = $(this).attr('id');
|
||||||
$('.loader-mask').fadeIn();
|
console.log('policy_type_string', policy_type_string)
|
||||||
|
|
||||||
$.ajax({
|
if(policy_type_string == 'GPA' || policy_type_string == 'GMC'){
|
||||||
url: '<?= base_url("util/policy-premium") ?>' ,
|
|
||||||
type: "GET",
|
|
||||||
data: { client_policy_id: client_policy_id},
|
|
||||||
dataType: 'json',
|
|
||||||
success: function (res) {
|
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
}, 1000);
|
|
||||||
console.log('res',res);
|
|
||||||
var temp_for_premiumData = JSON.parse(res.premiumData);
|
|
||||||
|
|
||||||
res.premiumData= JSON.parse(res.premiumData);
|
$('#GridForm').show();
|
||||||
|
$('#no_data').html('');
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
$.ajax({
|
||||||
$('#grid_emp_count').val(res.count);
|
url: '<?= base_url("util/policy-premium") ?>' ,
|
||||||
|
type: "GET",
|
||||||
|
data: { client_policy_id: client_policy_id},
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (res) {
|
||||||
|
setTimeout(function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
}, 1000);
|
||||||
|
console.log('policy grid responce',res);
|
||||||
|
var temp_for_premiumData = JSON.parse(res.premiumData);
|
||||||
|
|
||||||
if (res.status === false) {
|
res.premiumData= JSON.parse(res.premiumData);
|
||||||
toastr.error(res.status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var policy_grid_id_value = '';
|
$('#nameOfThePolicy').html(' - ' + res.policy_name);
|
||||||
if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) {
|
$('#grid_emp_count').val(res.count);
|
||||||
policy_grid_id_value = res.premiumData[0].policy_grid_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#grid_content_input').empty();
|
if (res.status === false) {
|
||||||
var policeGridOptionHTML = '';
|
toastr.error(res.status);
|
||||||
policeGridOptionHTML += ` <option value="">Select Premium Type</option>`;
|
return;
|
||||||
$.each(res.data, function(index, item) {
|
|
||||||
policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>';
|
|
||||||
});
|
|
||||||
$('#grid').html(policeGridOptionHTML);
|
|
||||||
|
|
||||||
var si_or_bp_value = '';
|
|
||||||
if (res.premiumData && res.premiumData.length > 0) {
|
|
||||||
|
|
||||||
if(res.premiumData[0].si_or_bp){
|
|
||||||
si_or_bp_value = res.premiumData[0].si_or_bp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value);
|
var policy_grid_id_value = '';
|
||||||
|
if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) {
|
||||||
|
policy_grid_id_value = res.premiumData[0].policy_grid_id;
|
||||||
|
}
|
||||||
|
|
||||||
res.premiumData.shift();
|
$('#grid_content_input').empty();
|
||||||
$.each(res.premiumData, function(index, item){
|
var policeGridOptionHTML = '';
|
||||||
if (item.si_or_bp == '1') {
|
policeGridOptionHTML += ` <option value="">Select Premium Type</option>`;
|
||||||
appendGridtHtml('1', item);
|
$.each(res.data, function(index, item) {
|
||||||
}else{
|
policeGridOptionHTML += '<option data-id="'+ item.ui_type +'" value="' + item.id + '" ' + (policy_grid_id_value === item.id ? 'selected="selected"' : '') + '>' + item.policy_grid_type + '</option>';
|
||||||
appendGridtHtml(item.policy_grid_id, item);
|
});
|
||||||
|
$('#grid').html(policeGridOptionHTML);
|
||||||
|
|
||||||
|
var si_or_bp_value = '';
|
||||||
|
if (res.premiumData && res.premiumData.length > 0) {
|
||||||
|
|
||||||
|
if(res.premiumData[0].si_or_bp){
|
||||||
|
si_or_bp_value = res.premiumData[0].si_or_bp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id, si_or_bp_value);
|
||||||
|
|
||||||
|
res.premiumData.shift();
|
||||||
|
$.each(res.premiumData, function(index, item){
|
||||||
|
if (item.si_or_bp == '1') {
|
||||||
|
appendGridtHtml('1', item);
|
||||||
|
}else{
|
||||||
|
appendGridtHtml(item.policy_grid_id, item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log("res.premiumData is undefined, null, or empty.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#bs-example-modal-lg').modal('show');
|
||||||
|
|
||||||
|
|
||||||
|
$("#gpa_si").trigger("keyup");
|
||||||
|
$("#gpa_premium").trigger("keyup");
|
||||||
|
$('#basic_pay').trigger('keyup');
|
||||||
|
$('#4_si').trigger('keyup');
|
||||||
|
|
||||||
|
$('input[name="gpa_sum_si[]"]').each(function() {
|
||||||
|
$(this).trigger('keyup');
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
$('input[name="gpa_sum_premium[]"]').each(function() {
|
||||||
console.log("res.premiumData is undefined, null, or empty.");
|
$(this).trigger('keyup');
|
||||||
|
});
|
||||||
|
|
||||||
|
var id_for_trigger =temp_for_premiumData[0].policy_grid_id;
|
||||||
|
$(`input[name="${id_for_trigger}_si[]"]`).each(function() {
|
||||||
|
console.log($(this));
|
||||||
|
$(this).trigger('keyup');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(`input[name="${id_for_trigger}_premium[]"]`).each(function() {
|
||||||
|
console.log($(this));
|
||||||
|
$(this).trigger('keyup');
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
setTimeout(function() {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
toastr.warning('Something Wrong!', 'warning');
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('#bs-example-modal-lg').modal('show');
|
} else{
|
||||||
|
|
||||||
|
$('#grid').empty();
|
||||||
|
$('#nameOfThePolicy').html('');
|
||||||
|
$('#GridForm').hide();
|
||||||
|
$('#no_data').html('The policy has no Policy Rac Rate');
|
||||||
|
toastr.warning("The policy has no Policy Rac Rate", "Warning")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$("#gpa_si").trigger("keyup");
|
|
||||||
$("#gpa_premium").trigger("keyup");
|
|
||||||
$('#basic_pay').trigger('keyup');
|
|
||||||
$('#4_si').trigger('keyup');
|
|
||||||
|
|
||||||
$('input[name="gpa_sum_si[]"]').each(function() {
|
|
||||||
$(this).trigger('keyup');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('input[name="gpa_sum_premium[]"]').each(function() {
|
|
||||||
$(this).trigger('keyup');
|
|
||||||
});
|
|
||||||
|
|
||||||
var id_for_trigger =temp_for_premiumData[0].policy_grid_id;
|
|
||||||
$(`input[name="${id_for_trigger}_si[]"]`).each(function() {
|
|
||||||
console.log($(this));
|
|
||||||
$(this).trigger('keyup');
|
|
||||||
});
|
|
||||||
|
|
||||||
$(`input[name="${id_for_trigger}_premium[]"]`).each(function() {
|
|
||||||
console.log($(this));
|
|
||||||
$(this).trigger('keyup');
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: function (xhr, status, error) {
|
|
||||||
console.error(xhr.responseText);
|
|
||||||
console.error(status, error);
|
|
||||||
setTimeout(function() {
|
|
||||||
$('.loader').fadeOut();
|
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
|
||||||
toastr.warning('Something Wrong!', 'warning');
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -673,7 +695,6 @@
|
|||||||
var client_policy_id =$('#client_policy_id')[0].value;
|
var client_policy_id =$('#client_policy_id')[0].value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
@ -1042,6 +1063,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function removebutton(index, type) {
|
function removebutton(index, type) {
|
||||||
|
|
||||||
if(index == 0){
|
if(index == 0){
|
||||||
|
|||||||
@ -157,7 +157,7 @@ paths:
|
|||||||
summary: 'Add a new EmployeeUpload to the store'
|
summary: 'Add a new EmployeeUpload to the store'
|
||||||
operationId: EmployeeUpload
|
operationId: EmployeeUpload
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -317,7 +317,7 @@ paths:
|
|||||||
summary: 'RelationshipList'
|
summary: 'RelationshipList'
|
||||||
operationId: RelationshipList
|
operationId: RelationshipList
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -340,7 +340,7 @@ paths:
|
|||||||
summary: 'GetEmployeeAndDependence'
|
summary: 'GetEmployeeAndDependence'
|
||||||
operationId: GetEmployeeAndDependence
|
operationId: GetEmployeeAndDependence
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -368,7 +368,7 @@ paths:
|
|||||||
summary: 'EditEmployeeAndDependence'
|
summary: 'EditEmployeeAndDependence'
|
||||||
operationId: EditEmployeeAndDependence
|
operationId: EditEmployeeAndDependence
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -461,7 +461,7 @@ paths:
|
|||||||
summary: 'AddEmployeeAndDependence'
|
summary: 'AddEmployeeAndDependence'
|
||||||
operationId: AddEmployeeAndDependence
|
operationId: AddEmployeeAndDependence
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -551,7 +551,7 @@ paths:
|
|||||||
summary: 'GetEmployeePolicy'
|
summary: 'GetEmployeePolicy'
|
||||||
operationId: GetEmployeePolicy
|
operationId: GetEmployeePolicy
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -584,7 +584,7 @@ paths:
|
|||||||
summary: 'CreateOrUpdateEmployeePolicySiAmount'
|
summary: 'CreateOrUpdateEmployeePolicySiAmount'
|
||||||
operationId: CreateOrUpdateEmployeePolicySiAmount
|
operationId: CreateOrUpdateEmployeePolicySiAmount
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -627,7 +627,7 @@ paths:
|
|||||||
summary: 'DeleteDependence'
|
summary: 'DeleteDependence'
|
||||||
operationId: DeleteDependence
|
operationId: DeleteDependence
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -655,7 +655,7 @@ paths:
|
|||||||
summary: 'GetEmployeeAndDependenceByClientId'
|
summary: 'GetEmployeeAndDependenceByClientId'
|
||||||
operationId: GetEmployeeAndDependenceByClientId
|
operationId: GetEmployeeAndDependenceByClientId
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -688,7 +688,7 @@ paths:
|
|||||||
summary: 'GetClientPolicy'
|
summary: 'GetClientPolicy'
|
||||||
operationId: GetClientPolicy
|
operationId: GetClientPolicy
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@ -50,10 +50,10 @@ class CheckDependentConflictTest extends CIUnitTestCase
|
|||||||
$this->assertTrue($result['status']);
|
$this->assertTrue($result['status']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsNull()
|
// public function testIsNull()
|
||||||
{
|
// {
|
||||||
$i = null;
|
// $i = null;
|
||||||
$this->assertTrue($i);
|
// $this->assertTrue($i);
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user