feat: [esign] 근로계약서 사원불러오기 최신 연봉정보 반영
- 백엔드: salary_effective_date 추가 반환, 이력 fallback 로직 추가 - 프론트: 연봉계약 시작/종료일을 최신 연봉 적용일 기준으로 계산 - 근로계약은 입사일 기준, 연봉계약은 연봉 적용일 기준으로 분리
This commit is contained in:
@@ -114,6 +114,18 @@ public function searchEmployees(Request $request): JsonResponse
|
||||
|
||||
$salaryInfo = $emp->getSalaryInfo();
|
||||
|
||||
// 최신 연봉 정보 결정: 현재값 우선, 없으면 이력에서 최신 탐색
|
||||
$annualSalary = $salaryInfo['annual_salary'] ?? null;
|
||||
$salaryEffectiveDate = $salaryInfo['effective_date'] ?? null;
|
||||
|
||||
if ($annualSalary === null && ! empty($salaryInfo['history'])) {
|
||||
$latest = collect($salaryInfo['history'])
|
||||
->sortByDesc('effective_date')
|
||||
->first();
|
||||
$annualSalary = $latest['annual_salary'] ?? null;
|
||||
$salaryEffectiveDate = $latest['effective_date'] ?? null;
|
||||
}
|
||||
|
||||
return [
|
||||
'id' => $emp->id,
|
||||
'name' => $emp->user?->name,
|
||||
@@ -127,7 +139,8 @@ public function searchEmployees(Request $request): JsonResponse
|
||||
'birth_year' => $birthYear,
|
||||
'birth_month' => $birthMonth,
|
||||
'birth_day' => $birthDay,
|
||||
'annual_salary' => $salaryInfo['annual_salary'] ?? null,
|
||||
'annual_salary' => $annualSalary,
|
||||
'salary_effective_date' => $salaryEffectiveDate,
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user