<div class="ma-0 pa-0">
    <div class="jumbotron px-2 py-2 box-shadow">
        <div class="container">
            <h1 class="display-4">Rezervácia miesta v termíne školenia</h1>
            <hr class="my-sm-4">
            <h4>{{$udalost->nazov}}</h4>
            <p class="lead">Termín "{{ $udalost->druh->label }}" sa uskutoční v <strong>{{$udalost->miesto_konania}}</strong> so začiatkom <strong>{{$udalost->datum_od->format('d.m.Y H:i')}}</strong> do <strong>{{$udalost->datum_do->format('d.m.Y H:i')}}</strong></p>
            @if($udalost->popis)<p class="lead">{{$udalost->popis}}</p>@endif
            <p class="lead">Pre dokončenie rezervácie miesta na termín je potrebné vyplniť rezervačný formulár.</p>
        </div>
    </div>
    <form action="{{route('registrations.store', ['id' => request('id')])}}" method="post">
        <div class="card box-shadow">
            <div class="card-header">
                Formulár rezervácie
            </div>
            <div class="card-body">
                @if(!$udalost->is_accessible)
                    <div class="alert alert-warning h4 text-center">Nie je možná rezervácia miesta, kapacita školenia bola naplnená alebo je po termíne.</div>
                @else
                    {{csrf_field()}}
                    <div class="form-row">
                        <div class="form-group required col-sm-4">
                            <label for="tek_code">Číslo technika</label>
                            <input type="text" class="form-control" id="tek_code" name="code" placeholder="číslo technika (vzor 0123-456)" pattern="\d{4}-\d{1,3}" value="{{old('code')}}" required>
                            <small class="form-text text-muted">Zadajte prosím číslo technika emisnej kontroly.</small>
                            @if($errors->has('code'))
                                <small class="form-text alert-danger">
                                    <ul>
                                        @foreach($errors->get('code') as $message)
                                            <li class="list-unstyled">{{$message}}</li>
                                        @endforeach
                                    </ul>
                                </small>
                            @endif
                        </div>
                        <div class="form-group required col-sm-4">
                            <label for="tek_firstname">Meno</label>
                            <input type="text" class="form-control" id="tek_firstname" name="first_name" placeholder="meno technika" value="{{old('first_name')}}" required>
                            <small class="form-text text-muted">Zadajte prosím krstné meno technika emisnej kontroly.</small>
                            @if($errors->has('first_name'))
                                <small class="form-text alert-danger">
                                    <ul>
                                        @foreach($errors->get('first_name') as $message)
                                            <li class="list-unstyled">{{$message}}</li>
                                        @endforeach
                                    </ul>
                                </small>
                            @endif
                        </div>
                        <div class="form-group required col-sm-4">
                            <label for="tek_lastname">Priezvisko</label>
                            <input type="text" class="form-control" id="tek_lastname" name="last_name" placeholder="priezvisko technika" value="{{old('last_name')}}" required>
                            <small class="form-text text-muted">Zadajte prosím priezvisko technika emisnej kontroly.</small>
                            @if($errors->has('last_name'))
                                <small class="form-text alert-danger">
                                    <ul>
                                        @foreach($errors->get('last_name') as $message)
                                            <li class="list-unstyled">{{$message}}</li>
                                        @endforeach
                                    </ul>
                                </small>
                            @endif
                        </div>
                    </div>
                @endif
            </div>
            <div class="card-footer">
                <a href="{{route('schedules.index')}}" class="btn btn-outline-secondary float-left btn-xs-block">&lt;&nbsp;Späť na zoznam termínov</a>
                @if($udalost->is_accessible)
                    <button type="submit" class="btn btn-success float-right btn-xs-block">Rezervovať miesto</button>
                @endif
            </div>
        </div>
    </form>
    @includeWhen(!empty($registrations) ,'registrations.list')
</div>