@extends('layouts.app')
@section('content')
    <div class="panel panel-primary">
        <div class="panel-heading">Vytvořte Vaše ubytování</div>
        <div class="panel-body">
            @include('flash::message')
            {{ Form::open(['route' => 'storeAccommodation', 'class' => 'form-horizontal', 'files' => true, 'enctype'=>'multipart/form-data']) }}

            <div class="form-group{{ $errors->has('accommodation_name') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Název ubytování</label>

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

            <div class="form-group{{ $errors->has('accommodation_description') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Popis</label>

                <div class="col-md-6">
                    {{Form::textarea('accommodation_description', null,  ['size' => '30x5', 'class' => 'form-control']) }} @if ($errors->has('accommodation_description'))
                        <span class="help-block">
                            <strong>{{ $errors->first('accommodation_description') }}</strong>
                        </span>
                    @endif
                </div>
            </div>

            <div class="form-group{{ $errors->has('website') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Webová stránka ubytování</label>

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

            <div class="form-group{{ $errors->has('accommodation_email') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">E-mail ubytování</label>

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

            <div class="form-group{{ $errors->has('accommodation_phone_number') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Telefon ubytování</label>

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

            <div class="form-group">
                <label class="col-md-4 control-label">Vybavení ubytování</label>

                <div class="col-md-6">
                    <table>
                        @foreach($equipment as $equip)
                            <tr>
                                <td class="td_width">{{$equip->equipment_name}}</td>
                                <td>{{Form::checkbox('equip[]', $equip->equipment_id, false)}}
                            </tr>
                        @endforeach
                    </table>

                </div>
            </div>

            <div class="form-group{{ $errors->has('town') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Město</label>

                <div class="col-md-6">

                    {{ Form::text('town', null,  ['class' => 'form-control'])  }}  @if ($errors->has('town'))
                        <span class="help-block">
                            <strong>{{ $errors->first('town') }}</strong>
                        </span>
                    @endif
                </div>
            </div>

            <div class="form-group{{ $errors->has('street_name') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Ulice</label>

                <div class="col-md-6">

                    {{ Form::text('street_name', null,  ['class' => 'form-control'])  }} @if ($errors->has('street_name'))
                        <span class="help-block">
                            <strong>{{ $errors->first('street_name') }}</strong>
                        </span>
                    @endif
                </div>
            </div>

            <div class="form-group{{ $errors->has('street_number') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Číslo domu</label>
                <div class="col-md-6">

                    {{ Form::text('street_number', null,  ['class' => 'form-control'])  }}  @if ($errors->has('street_number'))
                        <span class="help-block">
                            <strong>{{ $errors->first('street_number') }}</strong>
                        </span>
                    @endif
                </div>
            </div>


            <div class="form-group{{ $errors->has('image') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Titulní obrázek</label>
                <div class="col-md-6">

                    {{ Form::file('image', ['enctype' => 'multipart/form-data', 'class' => 'form-control'])  }}  @if ($errors->has('image'))
                        <span class="help-block">
                            <strong>{{ $errors->first('image') }}</strong>
                        </span>
                    @endif
                </div>
            </div>

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

            {{Form::close()  }}
        </div>
    </div>
@endsection
