From 0ef6b72d8e0eb4f3c706f2ee626d3dc3d49795ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Tue, 10 Mar 2026 00:37:10 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20[hr]=20=EC=97=B0=EC=B0=A8=EC=B4=89?= =?UTF-8?q?=EC=A7=84=20=EA=B4=80=EB=A6=AC=EC=97=90=201=EC=B0=A8/2=EC=B0=A8?= =?UTF-8?q?=20=EC=B4=89=EC=A7=84=EA=B8=B0=EA=B0=84=20=EC=BB=AC=EB=9F=BC=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 근로기준법 제61조 기준 입사일 기반 촉진기간 자동 계산 - 1차 촉진기간: 연차만료 6개월 전 ~ +10일 - 2차 촉진기간 마감: 연차만료 2개월 전 - 잔여일수 다음에 촉진기간 표시 --- app/Services/HR/LeaveService.php | 23 +++++++++++++++++-- .../views/hr/leave-promotions/index.blade.php | 18 ++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) 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 - + 잔여 연차가 있는 대상자가 없습니다.