@extends('layouts.app')
@section('content')
    <div class="panel panel-primary">
        <div class="panel-heading">Vytvořte rezervaci pokoje: {{$room->room_name}} ({{$accommodation}})</div>
        <div class="panel-body">
            @include('flash::message')
            {{ Form::open(['route' => 'createReservation', 'class' => 'form-horizontal']) }}

            <div class="form-group{{ $errors->has('fname') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Jméno</label>
                <div class="col-md-6">
                    {{ Form::text('fname', null, ['class'=>'form-control']) }} @if ($errors->has('fname'))
                        <span class="help-block">
                            <strong>{{ $errors->first('fname') }}</strong>
                        </span>
                    @endif
                </div>
            </div>

            <div class="form-group{{ $errors->has('lname') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Příjmení</label>
                <div class="col-md-6">
                    {{ Form::text('lname', null, ['class'=>'form-control']) }} @if ($errors->has('lname'))
                        <span class="help-block">
                            <strong>{{ $errors->first('lname') }}</strong>
                        </span>
                    @endif
                </div>
            </div>

            <!-- EMAIL -->
            <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">E-mail</label>
                <div class="col-md-6">
                    {{ Form::text('email', null, ['class'=>'form-control']) }} @if ($errors->has('email'))
                        <span class="help-block">
                            <strong>{{ $errors->first('email') }}</strong>
                        </span>
                    @endif
                </div>
            </div>

            <!-- TELEPHONE NUMBER -->
            <div class="form-group{{ $errors->has('phone_number') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Telefonní číslo</label>
                <div class="col-md-6">
                    {{ Form::text('phone_number', null, ['class' => 'form-control']) }} @if ($errors->has('phone_number'))
                        <span class="help-block">
                            <strong>{{ $errors->first('phone_number') }}</strong>
                        </span>
                    @endif
                </div>
            </div>

            <hr>

            <div class="form-group{{ $errors->has('date_start') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Datum od</label>
                <div class="col-md-6">
                    {{ Form::date('date_start', $date_start,  ['class' => 'form-control']) }} @if ($errors->has('date_start'))
                        <span class="help-block">
                            <strong>{{ $errors->first('date_start') }}</strong>
                        </span>
                    @endif
                </div>
				<label class="control-label">(RRRR-MM-DD)</label>
            </div>

            <div class="form-group{{ $errors->has('date_end') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Datum do</label>
                <div class="col-md-6">
                    {{ Form::date('date_end', $date_end,  ['class' => 'form-control']) }} @if ($errors->has('date_end'))
                        <span class="help-block">
                            <strong>{{ $errors->first('date_end') }}</strong>
                        </span>
                    @endif
                </div>
				<label class="control-label">(RRRR-MM-DD)</label>
            </div>

            <div class="form-group{{ $errors->has('persons') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Počet osob</label>

                <div class="col-md-6">
                    {{ Form::selectRange('persons', 1, $room->beds, $room->beds, ['class' => 'form-control']) }} @if ($errors->has('persons'))
                        <span class="help-block">
                            <strong>{{ $errors->first('persons') }}</strong>
                        </span>
                    @endif
                </div>
            </div>


            {{ Form::hidden('room_id', $room->room_id) }}

            <div class="form-group">
                <div class="col-md-6 col-md-offset-4">
                    {{ Form::submit('Vytvořit rezervaci', array('class'=>'btn btn-primary')) }}
                </div>
            </div>

            {{ Form::close() }}

            <div class="panel panel-info">
                <div class="panel panel-body">
                    <div class="smaller_size">
                        Rezervace jsou pouze předběžné a je nutné je potvrdit na e-mailu konkrétního ubytování do dvou dnů od vytvoření rezervace. Správci ubytování Vám poté Vaši rezervaci potvrdí.
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
