<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">

    <!-- Styles -->
    <link rel="stylesheet" href="{{ asset('css/bootstrap.css') }}">
    <link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ asset('css/app.css') }}">
    <link rel="stylesheet" href="{{ asset('css/mystyle.css') }}">

    <!-- Scripts -->
    <script type="text/javascript" src="{{ URL::asset('js/jquery-3.1.1.min.js') }}"></script>
    <script type="text/javascript" src="{{ URL::asset('js/bootstrap.min.js') }}"></script>
    <script type="text/javascript" src="{{ URL::asset('js/app.js') }}"></script>

</head>
<body>

<nav class="panel-primary navbar navbar-default navbar-static-top panel-primary">
    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand" href="{{ url('/home') }}">
                <img alt="logo" class="logo_img" src=" {{ asset('images/znak_obce.jpg') }}">
            </a>
            <!-- Collapsed Hamburger -->
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
                <span class="sr-only">Toggle Navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>

            <!-- Branding Image -->
            <a class="navbar-brand" href="{{ url('/home') }}">
                {{ config('app.name', 'Laravel') }}
            </a>
        </div>

        <div class="collapse navbar-collapse" id="app-navbar-collapse">
            <!-- Left Side Of Navbar -->
            <ul class="nav navbar-nav">
                <li><a href="{{ url('/filtering')}}">Vyhledávání</a></li>
                <li><a href="{{ url('/more_info') }}">Kam zajít v okolí</a></li>
                @if(Auth::check())
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Nastavení účtu<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{{ url('/change_password') }}">Změna hesla</a></li>
                            <li><a href="{{ url('/change_email') }}">Změna e-mailu</a></li>
                            <li><a href="{{ url('/delete_account') }}">Zrušení účtu</a></li>
                        </ul>
                    </li>
                    @if(Auth::user()->role == 'acco_admin')
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Správa ubytování<span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="{{ url('/edit_acco') }}">Ubytování</a></li>
                                @if(Auth::user()->accommodation_id != null)
                                    <li><a href="{{ url('/edit_rooms') }}">Pokoje</a></li>
                                    <li><a href="{{ url('/reservations_list') }}">Rezervace</a></li>
                                    <li><a href="{{ url('/customers_list') }}">Zákazníci</a></li>
                                    @if($accommodation <> null)
                                        <li><a href="{{ url('reviews_list/' . $accommodation->accommodation_id) }}">Recenze</a></li>
                                    @endif
                                    @if(Auth::user()->owner == 'true')
                                        <li><a href="{{ url('acco_admin_list/') }}">Správci ubytování</a></li>
                                    @endif
                                @endif
                            </ul>
                        </li>
                    @elseif(Auth::user()->role == 'admin')
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Možnosti správce<span class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="{{ url('/acco_list') }}">Správa ubytování</a></li>
                                <li><a href="{{ route('register') }}">Vytvořit administrátora</a></li>
                            </ul>
                        </li>

                    @endif
                @endif

            </ul>

            <!-- Right Side Of Navbar -->
            <ul class="nav navbar-nav navbar-right">
                <!-- Authentication Links -->
                @if (Auth::guest())
                    <li><a href="{{ route('login') }}">Přihlásit</a></li>
                    <li><a href="{{ route('register') }}">Registrovat</a></li>
                @else
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
                            {{ Auth::user()->name }} {{ Auth::user()->lname }} <span class="caret"></span>
                        </a>

                        <ul class="dropdown-menu" role="menu">
                            <li>
                                <a href="{{ route('logout') }}"
                                   onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                                    Odhlásit
                                </a>
                                <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                    {{ csrf_field() }}
                                </form>
                            </li>
                        </ul>
                    </li>
                @endif

            </ul>
        </div>
    </div>
</nav>
<div class="centered">
        <div class="container-fluid">
            <div class="row">
                <div class="content">
                    @yield('content')
                </div>
            </div>
        </div>
</div>


<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>
<script>
    $('div.alert').not('.alert-important').delay(6000).fadeOut(500);
</script>
</body>
</html>
