feat: [leave] 휴가관리 Phase 1 구현
- Leave, LeavePolicy, LeaveGrant 모델 생성
- LeaveBalance 헬퍼 메서드 추가 (useLeave, restoreLeave, canUse)
- LeaveService 핵심 로직 (신청, 승인, 반려, 취소, 잔여연차, 통계)
- API 컨트롤러 (목록, 등록, 승인/반려/취소, 잔여연차, 통계, CSV 내보내기)
- 뷰 컨트롤러 + 라우트 등록 (web, api)
- Blade 뷰 (index + 3개 탭 partials: table, balance, stats)
2026-02-26 22:34:31 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\HR;
|
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
use App\Models\HR\Leave;
|
|
|
|
|
use App\Services\HR\LeaveService;
|
|
|
|
|
use Illuminate\Contracts\View\View;
|
|
|
|
|
use Illuminate\Http\Response;
|
2026-02-27 10:42:21 +09:00
|
|
|
use Illuminate\Support\Str;
|
feat: [leave] 휴가관리 Phase 1 구현
- Leave, LeavePolicy, LeaveGrant 모델 생성
- LeaveBalance 헬퍼 메서드 추가 (useLeave, restoreLeave, canUse)
- LeaveService 핵심 로직 (신청, 승인, 반려, 취소, 잔여연차, 통계)
- API 컨트롤러 (목록, 등록, 승인/반려/취소, 잔여연차, 통계, CSV 내보내기)
- 뷰 컨트롤러 + 라우트 등록 (web, api)
- Blade 뷰 (index + 3개 탭 partials: table, balance, stats)
2026-02-26 22:34:31 +09:00
|
|
|
|
|
|
|
|
class LeaveController extends Controller
|
|
|
|
|
{
|
|
|
|
|
public function __construct(
|
|
|
|
|
private LeaveService $leaveService
|
|
|
|
|
) {}
|
|
|
|
|
|
2026-02-26 22:56:57 +09:00
|
|
|
public function index(\Illuminate\Http\Request $request): View|Response
|
feat: [leave] 휴가관리 Phase 1 구현
- Leave, LeavePolicy, LeaveGrant 모델 생성
- LeaveBalance 헬퍼 메서드 추가 (useLeave, restoreLeave, canUse)
- LeaveService 핵심 로직 (신청, 승인, 반려, 취소, 잔여연차, 통계)
- API 컨트롤러 (목록, 등록, 승인/반려/취소, 잔여연차, 통계, CSV 내보내기)
- 뷰 컨트롤러 + 라우트 등록 (web, api)
- Blade 뷰 (index + 3개 탭 partials: table, balance, stats)
2026-02-26 22:34:31 +09:00
|
|
|
{
|
2026-02-26 22:56:57 +09:00
|
|
|
if ($request->header('HX-Request')) {
|
|
|
|
|
return response('', 200)->header('HX-Redirect', route('hr.leaves.index'));
|
|
|
|
|
}
|
|
|
|
|
|
feat: [leave] 휴가관리 Phase 1 구현
- Leave, LeavePolicy, LeaveGrant 모델 생성
- LeaveBalance 헬퍼 메서드 추가 (useLeave, restoreLeave, canUse)
- LeaveService 핵심 로직 (신청, 승인, 반려, 취소, 잔여연차, 통계)
- API 컨트롤러 (목록, 등록, 승인/반려/취소, 잔여연차, 통계, CSV 내보내기)
- 뷰 컨트롤러 + 라우트 등록 (web, api)
- Blade 뷰 (index + 3개 탭 partials: table, balance, stats)
2026-02-26 22:34:31 +09:00
|
|
|
$employees = $this->leaveService->getActiveEmployees();
|
|
|
|
|
$departments = $this->leaveService->getDepartments();
|
|
|
|
|
$typeMap = Leave::TYPE_MAP;
|
|
|
|
|
$statusMap = Leave::STATUS_MAP;
|
|
|
|
|
|
|
|
|
|
return view('hr.leaves.index', [
|
|
|
|
|
'employees' => $employees,
|
|
|
|
|
'departments' => $departments,
|
|
|
|
|
'typeMap' => $typeMap,
|
|
|
|
|
'statusMap' => $statusMap,
|
|
|
|
|
]);
|
|
|
|
|
}
|
2026-02-27 10:42:21 +09:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 휴가관리 가이드 도움말 모달
|
|
|
|
|
*/
|
|
|
|
|
public function helpGuide(): View
|
|
|
|
|
{
|
|
|
|
|
$guidePath = resource_path('markdown/휴가관리가이드.md');
|
|
|
|
|
|
|
|
|
|
if (file_exists($guidePath)) {
|
|
|
|
|
$markdown = file_get_contents($guidePath);
|
|
|
|
|
$htmlContent = Str::markdown($markdown);
|
|
|
|
|
} else {
|
|
|
|
|
$htmlContent = '<p class="text-gray-500">가이드를 찾을 수 없습니다.</p>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return view('hr.leaves.partials.help-modal', compact('htmlContent'));
|
|
|
|
|
}
|
feat: [leave] 휴가관리 Phase 1 구현
- Leave, LeavePolicy, LeaveGrant 모델 생성
- LeaveBalance 헬퍼 메서드 추가 (useLeave, restoreLeave, canUse)
- LeaveService 핵심 로직 (신청, 승인, 반려, 취소, 잔여연차, 통계)
- API 컨트롤러 (목록, 등록, 승인/반려/취소, 잔여연차, 통계, CSV 내보내기)
- 뷰 컨트롤러 + 라우트 등록 (web, api)
- Blade 뷰 (index + 3개 탭 partials: table, balance, stats)
2026-02-26 22:34:31 +09:00
|
|
|
}
|