@php use App\Models\ChaosEvents; @endphp
@extends('layout.app')
@section('scripts')
    <script>
        const i18n = {
            common: {
                error_occurred: "{{ __('app.common.error_occurred') }}"
            }
        };
    </script>
    <script src="{{ asset('/js/preapplication/preapplication.js') }}"></script>
@endsection

@section('content')
    <h1>{{ __('app.preapplication.title') }}</h1>

    <p>{!! __('app.preapplication.content') !!}</p>

    @forelse (ChaosEvents::getActiveEvents() as $event)
        <div class="eingabemaske">
            <table class="eingabetabelle">
                <tr>
                    <td>{{ __('app.preapplication.region') }}:</td>
                    <td><select name="district_region" id="district_region">
                            <option value="{{ $event->id }}">{{ $event->name }} ({{ $event->from_date_visible->format('Y-m-d') }} - {{ $event->to_date_visible->format('Y-m-d') }})</option>
                        </select></td>
                </tr>
                <tr>
                    <td>{{ __('app.preapplication.passport_type') }}:</td>
                    <td>
                        <select name="passport_type" id="passport_type">
                            <option value="d">{{ __('app.preapplication.passport.standard') }}</option>
                            <option value="k">{{ __('app.preapplication.passport.kid') }}</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>{{ __('app.preapplication.mail') }}:</td>
                    <td><input type="text" id="mail" name="mail" placeholder="{{ __('app.preapplication.mail') }}" required></td>
                </tr>
                <tr>
                    <td>{{ __('app.preapplication.firstname') }}:</td>
                    <td><input type="text" id="firstname" name="firstname" placeholder="{{ __('app.preapplication.firstname') }}" required></td>
                </tr>
                <tr>
                    <td>{{ __('app.preapplication.lastname') }}:</td>
                    <td><input type="text" id="lastname" name="lastname" placeholder="{{ __('app.preapplication.lastname') }}" required></td>
                </tr>
                <tr>
                    <td>{{ __('app.preapplication.location') }}:</td>
                    <td><input type="text" id="location" name="location" placeholder="{{ __('app.preapplication.location') }}" required></td>
                </tr>
            </table>
            <br />
            <button id="apply" onclick="vorantragAbschicken()">{{ __('app.preapplication.apply') }}</button>

        </div>

    @empty
        <p><b>{{ __('app.preapplication.noevent') }}</b></p>
    @endforelse

@endsection
