feat: [leaves] 휴가신청 → 전자결재 자동 연동

- LeaveService: 휴가 신청 시 결재 자동 생성+상신
- LeaveService: approveByApproval/rejectByApproval 메서드 추가
- LeaveService: deletePendingLeave 시 연결된 결재 자동 취소
- ApprovalService: 승인/반려/회수/전결 시 휴가 상태 자동 동기화
- Leave 모델: approval_id, approval() 관계 추가
- UI: pending 휴가에 결재 상세 링크 추가, 승인/반려 버튼 제거
This commit is contained in:
김보곤
2026-02-28 15:54:41 +09:00
parent 4aea02b085
commit 34b8a75b08
5 changed files with 331 additions and 26 deletions

View File

@@ -8,7 +8,7 @@
<div class="flex flex-col lg:flex-row lg:justify-between lg:items-center gap-4 mb-6">
<div>
<h1 class="text-2xl font-bold text-gray-800">휴가관리</h1>
<p class="text-sm text-gray-500 mt-1">휴가 신청, 승인/반려 연차 현황을 관리합니다.</p>
<p class="text-sm text-gray-500 mt-1">휴가 신청 결재가 자동 생성되며, 결재 승인/반려 따라 휴가가 처리됩니다.</p>
</div>
<div class="flex flex-wrap items-center gap-2 sm:gap-3">
<button type="button" onclick="openLeaveModal()"

View File

@@ -91,8 +91,21 @@
{{-- 액션 --}}
<td class="px-6 py-4 whitespace-nowrap text-center">
@if($leave->status === 'pending')
<div class="flex items-center justify-center gap-1">
<div class="flex items-center justify-center gap-1">
@if($leave->approval_id)
<a href="{{ route('approvals.show', $leave->approval_id) }}"
class="px-2.5 py-1 text-xs font-medium text-blue-700 bg-blue-50 hover:bg-blue-100 rounded transition-colors">
결재 상세
</a>
@endif
@if($leave->status === 'approved')
<button type="button" onclick="cancelLeave({{ $leave->id }})"
class="px-2.5 py-1 text-xs font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded transition-colors">
취소
</button>
@elseif($leave->status === 'pending' && !$leave->approval_id)
{{-- 결재 연동 없는 기존 pending 건만 직접 승인/반려 허용 --}}
<button type="button" onclick="approveLeave({{ $leave->id }})"
class="px-2.5 py-1 text-xs font-medium text-emerald-700 bg-emerald-50 hover:bg-emerald-100 rounded transition-colors">
승인
@@ -101,15 +114,10 @@ class="px-2.5 py-1 text-xs font-medium text-emerald-700 bg-emerald-50 hover:bg-e
class="px-2.5 py-1 text-xs font-medium text-red-700 bg-red-50 hover:bg-red-100 rounded transition-colors">
반려
</button>
</div>
@elseif($leave->status === 'approved')
<button type="button" onclick="cancelLeave({{ $leave->id }})"
class="px-2.5 py-1 text-xs font-medium text-gray-700 bg-gray-100 hover:bg-gray-200 rounded transition-colors">
취소
</button>
@else
<span class="text-xs text-gray-400">-</span>
@endif
@elseif(!$leave->approval_id && $leave->status !== 'pending' && $leave->status !== 'approved')
<span class="text-xs text-gray-400">-</span>
@endif
</div>
</td>
</tr>
@empty