@extends('layouts.app')
@section('content')
    <div class="panel panel-primary">
        <div class="panel-heading">
            {{$accommodation->accommodation_name}}
            <a class="float_right " href="{{ url('reviews_list/' . $accommodation->accommodation_id) }}">
                <div class="btn right_btn">Zobrazit recenze</div>
            </a>

        </div>
        <div class="panel-body">
            @include('flash::message')

            <div class="panel panel-title">{{$accommodation->accommodation_description}}
                <hr>
                <div class="centered">
                    @if($equipment != null)
                        <table class="table table-responsive table-hover" >
                            @if($beds != null)
                                <tr>
                                    <td> <b>Počet lůžek: </b></td>
                                    <td class="">{{$beds}}</td>
                                </tr>
                            @endif
                            @if($rooms_number != null)
                                <tr>
                                    <td> <b>Počet pokojů: </b></td>
                                    <td class="">{{$rooms_number}}</td>
                                </tr>
                            @endif
                            <tr>
                                <th class="">Vybavení:</th>
                                <td class="">
                                    @foreach($equipment as $equip)
                                        <b> > </b>{{$equip->equipment_name}}
                                    @endforeach
                                </td>
                            </tr>
                        </table>

                    @endif
                </div>

            </div>
            <br />
            @if($rooms != null)
                @foreach($rooms as $room)
                    <div class="row">
                        <div class="panel panel-primary">
                            <div class="panel-heading">
                                {{$room->room_name}}
                                <a href="{{ url('create_reservation/' . $room->room_id) }}" class="float_right">
                                    <div class="btn right_btn">Vytvořit rezervaci</div>
                                </a>
                            </div>
                            <div class="panel-body">
                                <div class="float_left col-md-6">
                                    <div class="room_info">
                                        <table class="table float_left table-hover">
                                            <tr>
                                                <td class="col-md-1"> <b>Počet lůžek: </b></td>
                                                <td class="col-md-1">{{$room->beds}}</td>
                                            </tr>
                                            <tr>
                                                <td class="col-md-1"><b>Cena za lůžko a noc [Kč]:</b> </td>
                                                <td class="col-md-1">{{$room->price}}
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                                <div class="float_right col-md-5">
                                    @if($room->image_id != null)
                                        <img alt="playground" class="float_right image_width  " src="data:image/jpeg;base64,{{base64_encode($room->image)}}">
                                    @else
                                        <img alt="playground" class="float_right col-md-7" src="{{ asset('images/img_placeholder.png') }}">
                                    @endif
                                </div>
                            </div>
                        </div>
                    </div>
                @endforeach

                <div class="panel panel-primary">
                    <div class="panel panel-heading">Kontaktní údaje</div>
                    <div class="panel panel-body box">
                        <div class="centered">
                            <table class="table table-responsive table-hover">
                                <tr>
                                    <th>Kontaktní osoba</th>
                                    <td>{{$user->name}} {{$user->lname}}</td>
                                </tr>
                                <tr>
                                    <th> Telefonní číslo</th>
                                    <td>{{$accommodation->accommodation_phone_number}}</td>
                                </tr>
                                <tr>
                                    <th>E-mail</th>
                                    <td>{{$accommodation->accommodation_email}} </td>
                                </tr>
                                <tr>
                                    <th>Webové stránky</th>
                                    <td><a href='http://{{$accommodation->website}}'>Odkaz na web</a></td>
                                </tr>

                                <tr>
                                    <th>Město</th>
                                    <td>{{$address->town}} </td>
                                </tr>
                                <tr>
                                    <th>Ulice</th>
                                    <td>{{$address->street_name}}</td>
                                </tr>
                                <tr>
                                    <th>Číslo popisné</th>
                                    <td>{{$address->street_number}}</td>
                                </tr>
                            </table>
                        </div>
                        <div class="mapper" style="height: 400px;">
                            {!! Mapper::render() !!}
                        </div>
                    </div>
                </div>
            @else
                <div class="panel-body">
                    <h3>V ubytování v současné době nejsou vytvořeny žádné pokoje</h3>
                </div>
            @endif
        </div>
    </div>
@endsection
