<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

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

    <title>Avalaces</title>

    <!-- Scripts -->
    <script src="{{ asset('storage/js/app.js') }}" defer></script>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Inter" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@700&display=swap" rel="stylesheet">

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

</head>

<body>
    <div id="app">
        <div class="container top-bar">
            <div class="line">
                <div class="logo">
                    <a href="{{ url('/') }}">Avalaces Store</a>
                </div>
                <div class="actions">
                    @guest
                    <div style="display: inline-block;">Для покупки войдите в аккаунт</div>
                    <a class="nav-link" href="{{ route('login') }}">Вход</a>
                    @if (Route::has('register'))
                    <a class="nav-link" href="{{ route('register') }}">Регистрация</a>
                    @endif
                    @else
                    {{ Auth::user()->name }}
                    @if(session()->has('last_order'))
                        <a class="nav-link" href="{{ url('order/' . session()->get('last_order')) }}">Повторить последний заказ</a>
                    @endif

                    <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                        <a class="nav-link" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                            Выйти
                        </a>

                        <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
                            @csrf
                        </form>
                    </div>

                    @endguest
                </div>
            </div>
        </div>

        <main>
            @yield('content')
        </main>

    </div>
</body>

</html>
