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

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

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

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

    <!-- Scripts -->
    <script>
        window.Laravel = {!! json_encode([
            'csrfToken' => csrf_token(),
        ]) !!};
    </script>

    @stack('scripts')
</head>
<body>
<div id="app">
    <nav class="navbar navbar-default navbar-static-top">

        <div class="container">

            <ul class="nav navbar-nav">
                @if(!Auth::guest())
                    @include('layouts.menu', array('items' => Menu::get('menu')->roots(), 'parent' => true))
                @endif
            </ul>

            <!-- Right Side Of Navbar -->
            <ul class="nav navbar-nav navbar-right">
                <!-- Authentication Links -->
                @if (Auth::guest())
                    @if(Route::current()->getName() !== 'login')
                        <li><a href="{{ route('login') }}">@lang('do.Login')</a></li>
                    @endif
                @else
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                           aria-expanded="false">
                            <span class="glyphicon glyphicon-user"></span>
                            {{ Auth::user()->name }} <span class="caret"></span>
                        </a>

                        <ul class="dropdown-menu" role="menu">
                            <li>
                                <a href="{{ route('user.show') }}">
                                    @lang('My Account')
                                </a>
                            </li>
                            <li>
                                <a href="{{ route('logout') }}"
                                   onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                                    @lang('do.Logout')
                                </a>

                                <form id="logout-form" action="{{ route('logout') }}" method="POST"
                                      style="display: none;">
                                    {{ csrf_field() }}
                                </form>
                            </li>
                        </ul>
                    </li>
                @endif
            </ul>

            @include('layouts.languages')
        </div>

    </nav>

    @yield('content')
</div>

@if(isset($canDelete) && $canDelete)
    @include('modals.delete')
@endif
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>
</body>
</html>
