@extends('layouts.app')
@section('content')
    <div class="panel panel-primary">
        <div class="panel-heading">Editujte Vaše ubytování</div>
        <div class="panel-body">
            @include('flash::message')
            {{ Form::open(['route' => 'editAcco', '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', $accommodation->accommodation_name,  ['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('website') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Webová stránka ubytování</label>

                <div class="col-md-6">
                    {{ Form::text('website', $accommodation->website,  ['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_description') ? ' has-error' : '' }}">
                <label class="col-md-4 control-label">Popis</label>

                <div class="col-md-6">
                    {{ Form::textarea('accommodation_description', $accommodation->accommodation_description,  ['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('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', $accommodation->accommodation_email,  ['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', $accommodation->accommodation_phone_number,  ['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, in_array($equip->equipment_id, $all_data))}}
                            </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', $address->town,  ['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', $address->street_name,  ['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', $address->street_number,  ['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">Změnit současný titulní obrázek</label>
                <div class="col-md-6">

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

            {{ Form::hidden('accommodation_id', $accommodation->accommodation_id) }}

            <div class="form-group">
                <div class="col-md-6 col-md-offset-4">
                    {{ Form::submit('Upravit ubytování', array('class'=>'btn btn-primary')) }}
                </div>
            </div>

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