GWM : add dependent api
This commit is contained in:
parent
e75c769801
commit
4479e94e41
@ -230,19 +230,23 @@ class EmployeeRestController extends AdminController
|
|||||||
try {
|
try {
|
||||||
$data = $this->request->getJSON();
|
$data = $this->request->getJSON();
|
||||||
|
|
||||||
// dd($data);
|
//enrolment check
|
||||||
|
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id);
|
||||||
|
if($openForEnrollment == false){
|
||||||
|
return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => 'Enrollment closed.'], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
//dependent duplicate check
|
||||||
if ( ! isset($data[0]->id) ) {
|
if ( ! isset($data[0]->id) ) {
|
||||||
$validationFailed = $this->employeeHelper->validation_addEmployeeAndDependence($data);
|
$validationFailed = $this->employeeHelper->validation_addEmployeeAndDependence($data);
|
||||||
|
|
||||||
if($validationFailed){
|
if($validationFailed){
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "validation_addEmployeeAndDependence failed ..!!"], 404);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => "Relation already exists."], 404);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id);
|
|
||||||
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
|
|
||||||
|
|
||||||
if ($data) {
|
if ($data) {
|
||||||
|
|
||||||
@ -291,14 +295,14 @@ class EmployeeRestController extends AdminController
|
|||||||
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code , $data[0]->client_branch_id);
|
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code , $data[0]->client_branch_id);
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
return $this->respond(['status' => 'success','code' => 200,'data' => $result,'message' => "Successfully updated."], 200);
|
||||||
} else {
|
} else {
|
||||||
$result = "No Matches";
|
$result = "No Matches";
|
||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => $result,'message' => "Action failed."], 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(),'message' => "Action failed."], 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user