<!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>{{ config('app.name', 'Laravel') }}</title>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//fonts.gstatic.com">
    <link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">

    <!-- Scripts -->
    @vite(['resources/sass/app.scss', 'resources/js/app.js'])

</head>
<body>
    <div id="app">
        <nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
            <div class="container-fluid">
                <a class="navbar-brand" href="{{ url('/') }}">
                    {{ config('app.name', 'Laravel') }}
                </a>

                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
                    <span class="navbar-toggler-icon"></span>
                </button>

                <div class="collapse navbar-collapse" id="navbarSupportedContent">
                    <!-- Left Side Of Navbar -->
                    <ul class="navbar-nav me-auto">
                        @if(\Illuminate\Support\Facades\Session::get('user')['role'] == 1)
                            <li class="nav-item"><a href="#" onclick="document.getElementById('import-form').click()" class="nav-link">Импорт из XLS</a></li>
                        @endif
                    </ul>

                    <!-- Right Side Of Navbar -->
                    <ul class="navbar-nav ms-auto">
                        <!-- Authentication Links -->
                        <li class="nav-item">
                            @php
                                $user = session('user', ['role' => 99, 'sname' => 'blank', 'tname' => 'blank', 'fname' => 'blank', 'username' => 'blank']);
                            @endphp
                            @if($user['role'] == '1')
                                Администратор:
                            @else
                                Менеджер:
                            @endif
                            {{ $user['sname'] }} {{ $user['fname'] }} {{ $user['tname'] }}
                            (логин: {{ $user['username'] }})
                        </li>
                        <li class="nav-item ms-3">
                            <a href="{{ route('logout') }}" class="">Выход</a>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>

        <main class="py-4">
            @yield('content')
        </main>
    </div>

    <form action="{{ route('upload_xls') }}" method="post" enctype="multipart/form-data" class="visually-hidden"
          onchange="this.submit()">
        @csrf
        <input class="form-control" type="file" id="import-form" name="file">
    </form>

</body>
</html>
