diff --git a/app/Services/HR/LeaveService.php b/app/Services/HR/LeaveService.php index 76387094..5b9b01fc 100644 --- a/app/Services/HR/LeaveService.php +++ b/app/Services/HR/LeaveService.php @@ -845,10 +845,10 @@ public function getPromotionCandidates(int $year): Collection } } - // 4. 잔여일수 > 0 필터링 + 통지 상태 결합 + // 4. 잔여일수 > 0 필터링 + 통지 상태 결합 + 촉진기간 계산 return $balances ->filter(fn ($b) => ($b->total_days - $b->used_days) > 0) - ->map(function ($balance) use ($sentMap) { + ->map(function ($balance) use ($sentMap, $year) { $userId = $balance->user_id; $sent = $sentMap[$userId] ?? ['1st' => null, '2nd' => null]; @@ -860,6 +860,25 @@ public function getPromotionCandidates(int $year): Collection default => 'not_sent', }; + // 촉진기간 계산 (근로기준법 제61조 — 입사일 기준) + $hireDate = $balance->employee?->hire_date; + if ($hireDate) { + $hire = Carbon::parse($hireDate); + // 연차 만료일: 입사기념일(year+1) 전날 + $anniversary = $hire->copy()->setYear($year + 1); + $expiryDate = $anniversary->copy()->subDay(); + + // 1차 촉진기간: 만료 6개월 전 ~ +10일 + $balance->first_promotion_start = $expiryDate->copy()->subMonths(6); + $balance->first_promotion_end = $expiryDate->copy()->subMonths(6)->addDays(10); + // 2차 촉진 마감: 만료 2개월 전 + $balance->second_promotion_deadline = $expiryDate->copy()->subMonths(2); + } else { + $balance->first_promotion_start = null; + $balance->first_promotion_end = null; + $balance->second_promotion_deadline = null; + } + return $balance; }) ->values(); diff --git a/resources/views/hr/leave-promotions/index.blade.php b/resources/views/hr/leave-promotions/index.blade.php index f9b35633..b29a5175 100644 --- a/resources/views/hr/leave-promotions/index.blade.php +++ b/resources/views/hr/leave-promotions/index.blade.php @@ -87,6 +87,8 @@ class="inline-flex items-center gap-2 px-4 py-2 bg-red-500 hover:bg-red-600 text 발생일수 사용일수 잔여일수 + 1차 촉진기간 + 2차 촉진기간 사용률 상태 1차 통지 @@ -110,6 +112,20 @@ class="employee-checkbox rounded border-gray-300 text-blue-600" {{ $candidate->total_days }}일 {{ $candidate->used_days }}일 {{ $remaining }}일 + + @if($candidate->first_promotion_start) + {{ $candidate->first_promotion_start->format('m/d') }} ~ {{ $candidate->first_promotion_end->format('m/d') }} + @else + - + @endif + + + @if($candidate->second_promotion_deadline) + ~ {{ $candidate->second_promotion_deadline->format('m/d') }} + @else + - + @endif +
@@ -152,7 +168,7 @@ class="employee-checkbox rounded border-gray-300 text-blue-600" @empty - + 잔여 연차가 있는 대상자가 없습니다.