From efebd1e1f8f352ba082295e31ff606e8133f3bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Fri, 27 Feb 2026 11:20:40 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[leave]=20=EA=B7=BC=EC=86=8D=20=EA=B8=B0?= =?UTF-8?q?=EA=B0=84=20=ED=91=9C=EC=8B=9C=20=ED=98=95=EC=8B=9D=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 소수점 float 대신 "1년 3개월", "2개월" 형태로 표시 - 1개월 미만인 경우 "1개월 미만" 표시 --- .../hr/leaves/partials/balance.blade.php | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/resources/views/hr/leaves/partials/balance.blade.php b/resources/views/hr/leaves/partials/balance.blade.php index c569fed6..2a380573 100644 --- a/resources/views/hr/leaves/partials/balance.blade.php +++ b/resources/views/hr/leaves/partials/balance.blade.php @@ -21,7 +21,13 @@ $displayName = $employee?->display_name ?? $balance->user?->name ?? '-'; $department = $employee?->department; $hireDate = $employee?->hire_date; - $yearsWorked = $hireDate ? \Carbon\Carbon::parse($hireDate)->diffInYears(now()) : null; + $tenureParts = null; + if ($hireDate) { + $hire = \Carbon\Carbon::parse($hireDate); + $tenureYears = (int) $hire->diffInYears(now()); + $tenureMonths = (int) $hire->copy()->addYears($tenureYears)->diffInMonths(now()); + $tenureParts = ['years' => $tenureYears, 'months' => $tenureMonths]; + } $remaining = $balance->total_days - $balance->used_days; $rate = $balance->total_days > 0 ? round(($balance->used_days / $balance->total_days) * 100) : 0; $barColor = $rate >= 90 ? 'bg-red-500' : ($rate >= 70 ? 'bg-amber-500' : 'bg-blue-500'); @@ -49,8 +55,16 @@ {{-- 근속 --}} - @if($yearsWorked !== null) - {{ $yearsWorked }}년 + @if($tenureParts !== null) + @if($tenureParts['years'] > 0 && $tenureParts['months'] > 0) + {{ $tenureParts['years'] }}년 {{ $tenureParts['months'] }}개월 + @elseif($tenureParts['years'] > 0) + {{ $tenureParts['years'] }}년 + @elseif($tenureParts['months'] > 0) + {{ $tenureParts['months'] }}개월 + @else + 1개월 미만 + @endif @else - @endif