{{--
    휴가/근태신청/사유서 전용 폼
    Props:
        $employees (Collection) - 활성 사원 목록
--}}
@php
    $employees = $employees ?? collect();
    $currentUserId = auth()->id();
@endphp

<div id="leave-form-container" style="display: none;" class="mb-4">
    <div class="space-y-4">
        {{-- 신청자 --}}
        <div>
            <label class="block text-sm font-medium text-gray-700 mb-1">신청자 <span class="text-red-500">*</span></label>
            <select id="leave-user-id"
                    class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
                    style="max-width: 300px;">
                @foreach($employees as $emp)
                    <option value="{{ $emp->user_id }}" {{ $emp->user_id == $currentUserId ? 'selected' : '' }}>
                        {{ $emp->display_name }}
                    </option>
                @endforeach
            </select>
        </div>

        {{-- 유형 --}}
        <div>
            <label class="block text-sm font-medium text-gray-700 mb-1">유형 <span class="text-red-500">*</span></label>
            <select id="leave-type"
                    class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"
                    style="max-width: 300px;">
            </select>
        </div>

        {{-- 시작일 / 종료일 --}}
        <div class="flex gap-4 flex-wrap">
            <div style="flex: 1 1 200px; max-width: 300px;">
                <label class="block text-sm font-medium text-gray-700 mb-1"><span id="leave-start-label">시작일</span> <span class="text-red-500">*</span></label>
                <input type="date" id="leave-start-date"
                       class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
            </div>
            <div style="flex: 1 1 200px; max-width: 300px;">
                <label class="block text-sm font-medium text-gray-700 mb-1"><span id="leave-end-label">종료일</span> <span class="text-red-500">*</span></label>
                <input type="date" id="leave-end-date"
                       class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
            </div>
        </div>

        {{-- 사유 --}}
        <div>
            <label class="block text-sm font-medium text-gray-700 mb-1">사유</label>
            <textarea id="leave-reason" rows="3" placeholder="사유를 입력하세요..."
                      class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
        </div>
    </div>
</div>
