@php
    $breadcrumbs = [
        ['label' => __('common.home'), 'url' => route('dashboard.index')],
        ['label' => __('common.hr')],
        ['label' => __('permission_requests.title'), 'url' => route('hr.permission-requests.index')],
        ['label' => __('permission_requests.create_title')],
    ];
    $employeeOptions = $employees->mapWithKeys(fn ($e) => [$e->id => $e->full_name])->all();
@endphp

<x-ui.layout.page
    :title="__('permission_requests.create_title')"
    page-icon="fe fe-plus"
    :breadcrumbs="$breadcrumbs"
>
    <x-slot:actions>
        <x-ui.buttons.secondary :href="route('hr.permission-requests.index')" icon="fe fe-arrow-left">
            {{ __('common.back') }}
        </x-ui.buttons.secondary>
    </x-slot:actions>

    <div class="card">
        <div class="card-body">
            <form method="POST" action="{{ route('hr.permission-requests.store') }}" class="row g-3">
                @csrf
                <div class="col-md-6">
                    <x-ui.form.search-select
                        name="employee_id"
                        lookup="employees"
                        :label="__('permission_requests.fields.employee')"
                        :options="$employeeOptions"
                        :selected="old('employee_id')"
                        :placeholder="__('common.select')"
                        required
                    />
                </div>
                <div class="col-md-6">
                    <x-ui.form.select
                        name="type"
                        :label="__('permission_requests.fields.type')"
                        :options="$types"
                        :selected="old('type')"
                        required
                    />
                </div>
                <div class="col-md-4">
                    <x-ui.form.input name="request_date" type="date" :label="__('permission_requests.fields.request_date')" :value="old('request_date')" required />
                </div>
                <div class="col-md-4">
                    <x-ui.form.input name="start_at" type="datetime-local" :label="__('permission_requests.fields.start_at')" :value="old('start_at')" />
                </div>
                <div class="col-md-4">
                    <x-ui.form.input name="end_at" type="datetime-local" :label="__('permission_requests.fields.end_at')" :value="old('end_at')" />
                </div>
                <div class="col-12">
                    <x-ui.form.input name="reason" :label="__('permission_requests.fields.reason')" :value="old('reason')" />
                </div>
                <div class="col-12">
                    <x-ui.buttons.primary type="submit" icon="fe fe-send">
                        {{ __('permission_requests.actions.submit') }}
                    </x-ui.buttons.primary>
                </div>
            </form>
        </div>
    </div>
</x-ui.layout.page>
