<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<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>@yield('title', 'MISSING TITLE') - datatable.directory</title>

  <!-- Scripts -->
  <script src="{{ asset('js/app.js') }}" defer></script>
  <script>
    function ready(fn) {
      document.addEventListener('DOMContentLoaded', fn);
    }
    ready(function() {
      $('noscript').remove();
      $('.noscript-hide').removeClass('noscript-hide');
    });
  </script>
  @stack('scripts')

  <!-- Styles -->
  <link
    rel="stylesheet"
    id="theme-style"
    href="{{ asset(dark_mode('css/app-dark.css', 'css/app.css')) }}"
    data-light-url="{{ asset('css/app.css') }}"
    data-dark-url="{{ asset('css/app-dark.css') }}">
  <link href="{{ asset('fonts/fa-dtbl-1.css') }}" rel="stylesheet">
</head>
<body>
<div id="app">
  @include('layouts.main-nav')

  <main class="py-4">
    <div class="container">
      {{-- Warning about not activated account --}}
      @auth
        @if(!user()->confirmed)
          <div class="alert alert-warning alert-important" role="alert" >
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true" >&times;</button>
            Your account is not activated yet, some options are locked!<br/>
            @if(user()->emailConfirmations()->valid()->exists())
              {{--
              There is a pending confirmation, whose e-mail may differ from what
              the user has saved in the rpofile (due to email change attempt)
              --}}
              Check your e-mail (<u>{{user()->emailConfirmations()->valid()->first()->email}}</u>) for the confirmation link, or <a href="{{route('resend-email-confirmation')}}">request a new one</a>.
              The confirmation message could fall into your Spam folder.<br>
              If this address is not correct, you can fix it in your <a href="{{route('account.edit')}}">account settings</a>.
            @else
              {{-- There are no pending confirmations --}}
              @if(user()->email)
                {{-- User has e-mail set in the profile, probably from registration --}}
                You can confirm your e-mail (<u>{{$user->email}}</u>) by <a href="{{route('resend-email-confirmation')}}">requesting a confirmation link</a>.
                If this address is not correct, you can fix it in your <a href="{{route('account.edit')}}">account settings</a>.
              @else
                {{-- User has no e-mail, maybe registered through a provider without e-mails --}}
                Set your e-mail in <a href="{{route('account.edit')}}">account settings</a> and you
                will receive a confirmation link.
              @endif
            @endif
          </div>
        @endif
      @endauth

      @include('flash::message')
      @yield('content')
    </div>
  </main>

  @include('layouts.footer')
</div>
</body>
</html>