@extends('layouts.app')
@section('content')
    <div class="panel panel-primary">
        <div class="panel-heading">Recenze na ubytování: {{$accommodation->accommodation_name}}
            <a class="float_right " href="{{ url('create_review/' . $accommodation->accommodation_id) }}">
                <div class="btn right_btn">Vytvořit recenzi</div>
            </a>
        </div>
        <div class="panel-body">
            @include('flash::message')
            <div class="table-responsive">
                @if(!$reviews->isEmpty())
                    <table class="table">
                        @foreach($reviews as $review)
                            <div class="panel panel-primary">
                                <div class="panel panel-heading">
                                    {{$review->customer_fname}} {{$review->customer_lname}} ({{$review->date}})
                                    <div class="float_right">
                                        @if(Auth::check())
                                            @if(Auth::user()->accommodation_id == $accommodation->accommodation_id)
                                                {{ Form::open(array('method'=>'delete', 'class' => 'float_right', 'route' => array('deleteReview', $review->review_id))) }}

                                                {{ Form::submit('Odstranit', array('class'=>'btn btn-primary')) }}
                                                {{ Form::close() }}
                                            @endif
                                        @endif
                                    </div>
                                </div>
                                <div class="panel panel-body">
                                    {{$review->review_text}}
                                </div>
                            </div>
                        @endforeach
                    </table>
                @else
                    <div class="panel-info">
                        V tuto chvíli nejsou k ubytování vytvořeny žádné recenze
                    </div>
                @endif
            </div>
        </div>
    </div>
@endsection
