- 휴가 신청 모달에 결재선 드롭다운 + 미리보기 UI 추가 - 선택된 결재선으로 결재 생성 (미선택 시 기본결재선 fallback) - 휴가 목록에 결재진행 컬럼 추가 (원형 아이콘: ✓승인/✗반려/숫자대기/파랑현재) - approval.steps.approver eager load 추가
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\HR;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Approvals\ApprovalLine;
|
|
use App\Models\HR\Leave;
|
|
use App\Services\HR\LeaveService;
|
|
use Illuminate\Contracts\View\View;
|
|
use Illuminate\Http\Response;
|
|
use Illuminate\Support\Str;
|
|
|
|
class LeaveController extends Controller
|
|
{
|
|
public function __construct(
|
|
private LeaveService $leaveService
|
|
) {}
|
|
|
|
public function index(\Illuminate\Http\Request $request): View|Response
|
|
{
|
|
if ($request->header('HX-Request')) {
|
|
return response('', 200)->header('HX-Redirect', route('hr.leaves.index'));
|
|
}
|
|
|
|
$employees = $this->leaveService->getActiveEmployees();
|
|
$departments = $this->leaveService->getDepartments();
|
|
$typeMap = Leave::TYPE_MAP;
|
|
$statusMap = Leave::STATUS_MAP;
|
|
|
|
$tenantId = session('selected_tenant_id', 1);
|
|
$approvalLines = ApprovalLine::where('tenant_id', $tenantId)
|
|
->orderByDesc('is_default')
|
|
->orderBy('name')
|
|
->get(['id', 'name', 'steps', 'is_default']);
|
|
|
|
return view('hr.leaves.index', [
|
|
'employees' => $employees,
|
|
'departments' => $departments,
|
|
'typeMap' => $typeMap,
|
|
'statusMap' => $statusMap,
|
|
'approvalLines' => $approvalLines,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 휴가관리 가이드 도움말 모달
|
|
*/
|
|
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'));
|
|
}
|
|
}
|