diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 75432ed..d606525 100755 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -1515,11 +1515,11 @@ class EmployeeRestController extends AdminController public function getGmcParrentsPolicy($GmcParrentsPolicy,$emp_code,$client_id,$client_branch_id) { - $employeeData = $this->employeeModel->where('emp_code',$emp_code) - ->where('client_id',$client_id) - ->where('client_branch_id',$client_branch_id) - ->where('is_active', 1 ) - ->where('is_addon_value',0)->findAll(); + // $employeeData = $this->employeeModel->where('emp_code',$emp_code) + // ->where('client_id',$client_id) + // ->where('client_branch_id',$client_branch_id) + // ->where('is_active', 1 ) + // ->where('is_addon_value',0)->findAll(); // return $employeeData; foreach ($GmcParrentsPolicy as $key => $array) { @@ -1528,8 +1528,18 @@ class EmployeeRestController extends AdminController // Reset employee array - $empData = $employeeData; - + // $empData = $employeeData; + $empData = $this->employeeModel + ->select('employees.*') + ->join('employee_polices', 'employee_polices.employee_id = employees.id') + ->where('employees.emp_code',$emp_code) + ->where('employees.client_id',$client_id) + ->where('employees.client_branch_id',$client_branch_id) + ->where('employee_polices.client_policy_id',$array->ClientPolicyId) + ->where('employees.is_active', 1 ) + ->where('employee_polices.is_active', 1 ) + ->where('employees.is_addon_value',0) + ->findAll(); $array->Policy_Terms = json_decode($array->Policy_Terms); @@ -1543,6 +1553,7 @@ class EmployeeRestController extends AdminController ->join('employee_polices', 'employee_polices.employee_id = employees.id') ->where('employees.emp_code',$emp_code) ->where('employees.is_active',1) + ->where('employee_polices.is_active',1) ->where('employee_polices.client_policy_id',$array->ClientPolicyId) ->get() ->getResult(); @@ -1659,29 +1670,29 @@ class EmployeeRestController extends AdminController // Add family floter buttons placement data for FE validation if(count($floters)){ - foreach ($floters as $familyFloatesValue) { + foreach ($floters as $familyFloatesValue) { - $temp2['is_value_exist'] = false; - $temp2['data']['family_floater_key'] = $familyFloatesValue; - $temp2['data']['relationship'] = ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $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); - $temp2['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue); - array_push($data,$temp2); + $temp2['is_value_exist'] = false; + $temp2['data']['family_floater_key'] = $familyFloatesValue; + $temp2['data']['relationship'] = ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $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); + $temp2['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue); + array_push($data,$temp2); - array_push($array->to_be_added_relationship,['relationship'=>$temp2['data']['relationship'],'age_validation'=>$temp2['data']['age_validation']]); - $array->to_be_added_relationship = array_values( - array_map('unserialize', - array_unique( - array_map('serialize', $array->to_be_added_relationship) + array_push($array->to_be_added_relationship,['relationship'=>$temp2['data']['relationship'],'age_validation'=>$temp2['data']['age_validation']]); + $array->to_be_added_relationship = array_values( + array_map('unserialize', + array_unique( + array_map('serialize', $array->to_be_added_relationship) + ) ) - ) - ); + ); + } } - } $array->relationship = []; foreach ($array->to_be_added_relationship as $key => $value) {