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

        <title>@yield('title') | {{ UserConfig::get('app_name') }}</title>
        <base href="{{ $appBaseUrl }}">

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

        {{-- Cannot use $theme_url here: if a theme uses the base layout, it would also have to provide all these dependencies! --}}
        {{-- As these files are shipped with core (not a theme) use the main app.version instead of the current theme's version --}}
        @if (App::environment() == 'production')
            <link href="css/blue-twilight.min.css?v={{ $app_version_url }}" rel="stylesheet" />
        @else
            <link href="css/blue-twilight.css?v={{ $app_version_url }}" rel="stylesheet" />
        @endif

        @if (Theme::hasStylesheet())
            <link href="{{ $theme_url }}/theme.css?v={{ $app_version_url }}" rel="stylesheet">
        @endif

        @stack('styles')
    </head>
    <body>
        @include(Theme::viewName('partials.navbar'))

        {{-- Render breadcrumb within a container if present in the sub-view --}}
        @if (View::hasSection('breadcrumb'))
            <div class="container">
                <div class="row">
                    <div class="col">
                        <ol class="breadcrumb">
                            @yield('breadcrumb')
                        </ol>
                    </div>
                </div>
            </div>
        @endif

        @if (isset($error))
            <div class="container">
                <div class="alert alert-danger alert-dismissable fade show" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <strong><i class="fa fa-exclamation-circle fa-fw"></i></strong> {{ $error }}
                </div>
            </div>
        @endif

        @if (isset($warning))
            <div class="container">
                <div class="alert alert-warning alert-dismissable fade show" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <strong><i class="fa fa-warning fa-fw"></i></strong> {{ $warning }}
                </div>
            </div>
        @endif

        @if (isset($success))
            <div class="container">
                <div class="alert alert-success alert-dismissable fade show" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <strong><i class="fa fa-info-circle fa-fw"></i></strong> {{ $success }}
                </div>
            </div>
        @endif

        @if (isset($info))
            <div class="container">
                <div class="alert alert-info alert-dismissable fade show" role="alert">
                    <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <strong><i class="fa fa-info-circle fa-fw"></i></strong> {{ $info }}
                </div>
            </div>
        @endif

        @yield('content')

        @can('photo.quick_upload')
            @include(Theme::viewName('partials.quick_upload'))
        @endcan

        @if (isset($is_admin) && $is_admin)
            @include(\App\Facade\Theme::viewName('partials.copyright_admin'))
        @elseif (!\App\Facade\UserConfig::get('remove_copyright'))
            @include(\App\Facade\Theme::viewName('partials.copyright_gallery'))
        @endif

        {{-- Cannot use $theme_url here: if a theme uses the base layout, it would also have to provide all these dependencies! --}}
        {{-- As these files are shipped with core (not a theme) use the main app.version instead of the current theme's version --}}
        @if (App::environment() == 'production')
            <script type="text/javascript" src="js/blue-twilight.min.js?v={{ $app_version_url }}"></script>
        @else
            <script type="text/javascript" src="js/blue-twilight.js?v={{ $app_version_url }}"></script>
        @endif
        <script type="text/javascript">
            function _bt_showLoadingModal() {
                bootbox.dialog({
                    closeButton: false,
                    message: '<center><img src="{{ asset('ripple.svg') }}"/></center>',
                    title: '@lang('global.please_wait')'
                });
            }

            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            // Quick upload
            $(document).ready(function()
            {
                $('#quick-upload-form').submit(function()
                {
                    $('.modal-footer', '#quick-upload-modal').html('<center><img src="{{ asset('ripple.svg') }}"/></center>');
                });

                $('[data-toggle="tooltip"]').tooltip();
            });
        </script>
        @stack('scripts')
        {!! \App\Facade\UserConfig::get('analytics_code') !!}
    </body>
</html>
