CHANGES-IN-GETPOLICYAPI:GWM
This commit is contained in:
parent
1efa7306e3
commit
39374c0b4b
@ -213,7 +213,7 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi
|
||||
|
||||
|
||||
|
||||
$routes->get("getClientPolicy", "EmployeeRestController::getClientPolicy");
|
||||
|
||||
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
|
||||
|
||||
@ -193,6 +193,8 @@ class EmployeeRestController extends AdminController
|
||||
public function deleteDependence()
|
||||
{
|
||||
try {
|
||||
if($this->request->getGet('id'))
|
||||
{
|
||||
$delete = $this->employeeModel->where('id', $this->request->getGet('id'))->delete();
|
||||
|
||||
if ($delete) {
|
||||
@ -200,6 +202,10 @@ class EmployeeRestController extends AdminController
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
|
||||
}
|
||||
}else{
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [] ], 404);
|
||||
}
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
@ -211,31 +217,15 @@ class EmployeeRestController extends AdminController
|
||||
public function getEmployeeAndDependenceByClientId()
|
||||
{
|
||||
try {
|
||||
|
||||
$empData = $this->employeeModel->where('client_id', $this->request->getGet('client_id'))
|
||||
->where('relationship !=', null)
|
||||
->orderBy('emp_code')->orderBy('id')->findAll();
|
||||
|
||||
// $result = [];
|
||||
|
||||
// foreach ($empData as $employee) {
|
||||
// $employeeDependence = $this->employeeModel
|
||||
// ->where('emp_code', $employee['emp_code'])
|
||||
// ->where('relationship !=', 'self')
|
||||
// ->findAll();
|
||||
|
||||
// // Use object notation to access properties and set 'dependence'
|
||||
// $employee['dependence'] = $employeeDependence ?: [];
|
||||
|
||||
// $result[] = $employee;
|
||||
// }
|
||||
|
||||
// You probably meant to check $result, not $data
|
||||
if ($empData) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||
}
|
||||
$empData = $this->employeePolicyModel->getEmployeePolicy( $this->request->getGet('client_id'), $this->request->getGet('client_policy_id'));
|
||||
// $empData = $this->employeeModel->where('client_id', $this->request->getGet('client_id'))
|
||||
// ->where('relationship !=', null)
|
||||
|
||||
if ($empData) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $empData], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||
}
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
@ -251,10 +241,12 @@ class EmployeeRestController extends AdminController
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->findAll();
|
||||
|
||||
|
||||
$result[] = $ClientPolicyData[0];
|
||||
$result[] = $ClientPolicyData[2];
|
||||
// You probably meant to check $result, not $data
|
||||
if ($ClientPolicyData) {
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $ClientPolicyData], 200);
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);
|
||||
}
|
||||
@ -271,9 +263,12 @@ class EmployeeRestController extends AdminController
|
||||
{
|
||||
try {
|
||||
$id = $this->request->getGet('id');
|
||||
$emp_code = $this->request->getGet('emp_code');
|
||||
|
||||
$keysToRemove = ["removable_keys"];
|
||||
|
||||
$empPolicy = $this->employeeModel->getEmployeePolicy($id);
|
||||
$empData = $this->employeeModel->where('emp_code',$emp_code)->findAll();
|
||||
// dd($empPolicy);
|
||||
if ($empPolicy) {
|
||||
|
||||
@ -320,6 +315,27 @@ class EmployeeRestController extends AdminController
|
||||
array_splice($array->SlabRates, $index, 1);
|
||||
array_unshift($array->SlabRates, $element);
|
||||
}
|
||||
|
||||
//map family floates array to employee and dependent
|
||||
$familyFloates = $array->Policy_Terms->family_floaters;
|
||||
$data = [];
|
||||
foreach ($familyFloates as $familyFloatesValue) {
|
||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
if(count($empData)){
|
||||
foreach ($empData as $key => $value) {
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$temp['family_floater_key'] = $familyFloatesValue;
|
||||
$temp['label'] = $value['relationship'];
|
||||
$temp['name'] = $value['name'];
|
||||
array_push($data,$temp);
|
||||
unset($empData[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$array->mapped_family_floaters = $data;
|
||||
|
||||
}
|
||||
|
||||
$result[] = $array;
|
||||
|
||||
@ -70,6 +70,7 @@ class RestAuthenticationController extends AdminController
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$randomNumber = rand(100000, 999999);
|
||||
$randomNumber = 123456;
|
||||
|
||||
$employeeData = $this->employeeModel->where('mobile', $mobile_number)->where('relationship', 'self')->first();
|
||||
|
||||
@ -129,7 +130,7 @@ class RestAuthenticationController extends AdminController
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$randomNumber = rand(100000, 999999);
|
||||
|
||||
$randomNumber = 123456;
|
||||
$HrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
|
||||
|
||||
if ($HrData) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user