<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Stag | Pro</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="/AdminLTE-3.0.5/plugins/fontawesome-free/css/all.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="/AdminLTE-3.0.5/dist/css/adminlte.min.css">
    <!-- overlayScrollbars -->
    <link rel="stylesheet" href="/AdminLTE-3.0.5/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">

    <style>
        .loading-rotate {
            -webkit-animation:spin 0.3s linear infinite;
            -moz-animation:spin 0.3s linear infinite;
            animation:spin 0.3s linear infinite;
        }
        @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
        @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
        @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
    </style>
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">

    <!-- Navbar -->
    <nav class="main-header navbar navbar-expand navbar-white navbar-light">
        <!-- Left navbar links -->
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
            </li>
        </ul>

        <!-- SEARCH FORM -->
        <form class="form-inline ml-3 w-25">
            <div class="input-group input-group-sm w-100">
                <input class="form-control form-control-navbar" type="search" placeholder="Search" aria-label="Search">
                <div class="input-group-append">
                    <button class="btn btn-navbar" type="submit">
                        <i class="fas fa-search"></i>
                    </button>
                </div>
            </div>
        </form>

        <!-- Right navbar links -->
        <ul class="navbar-nav mr-auto ml-2">
            <li class="nav-item">
                <a id="reload-icon" class="nav-link" href="#" role="button" onclick="window.location.reload(); return false">
                    <i class="fa fa-sync"></i>
                </a>
            </li>
            {{--<li class="nav-item">
                <a class="nav-link" href="/pro/logout" role="button">
                    <i class="fas fa-sign-out-alt"></i>
                </a>
            </li>--}}
        </ul>
    </nav>
    <!-- /.navbar -->

    <!-- Main Sidebar Container -->
    <aside class="main-sidebar sidebar-dark-primary elevation-4">
        <!-- Brand Logo -->
        <a href="/AdminLTE-3.0.5/index3.html" class="brand-link">
            <img src="/AdminLTE-3.0.5/dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
                 style="opacity: .8">
            <span class="brand-text font-weight-light">Stag | Pro</span>
        </a>

        <!-- Sidebar -->
        <div class="sidebar">

            <!-- Sidebar Menu -->
            <nav class="mt-2">
                <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false" id="main-sidenav">
                    <li class="nav-item">
                        <a href="/dashboard" class="nav-link {{ request()->route()->getActionName() === 'App\Http\Controllers\ProController@dashboard' ? 'active' : '' }}">
                            <i class="nav-icon fa fa-palette"></i>
                            <p>
                                Dashboard
                            </p>
                        </a>
                    @if(\Illuminate\Support\Facades\View::exists('layouts.generated-links'))
                        @include('layouts.generated-links')
                    @endif
                </ul>
            </nav>
            <!-- /.sidebar-menu -->
        </div>
        <!-- /.sidebar -->
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="container-fluid py-3">
                <div class="row mb-2">
                    <div class="col-12" id="main-content">
                        @yield('content')
                    </div>
                </div>
            </div><!-- /.container-fluid -->
        </section>
        <!-- /.content -->
    </div>

</div>
<!-- ./wrapper -->

<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">

<!-- jQuery -->
<script src="/AdminLTE-3.0.5/plugins/jquery/jquery.min.js"></script>
<!-- overlayScrollbars -->
<script src="/AdminLTE-3.0.5/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<!-- AdminLTE App -->
<script src="/AdminLTE-3.0.5/dist/js/adminlte.js"></script>

<!-- unpoly -->
<script src="/unpoly-0.62.0/es6-promise.min.js"></script>
<script src="/unpoly-0.62.0/es6-promise.auto.min.js"></script>
<script src="/unpoly-0.62.0/unpoly.min.js"></script>
<link rel="stylesheet" href="/unpoly-0.62.0/unpoly.min.css">

<style>
    .up-modal-content {
        padding: 0;
    }
    .up-modal-close {
        display: none;
    }
    .up-modal-dialog {
        border-radius: 8px;
        overflow: hidden;
    }
</style>

<script>
    if(window === window.top) {
        window.location.href = '/mc' + window.location.pathname;
    }
</script>

<script>
    // Prevent variables from being global
    $(document).ready(function () {
        function gotoTarget(target, pushState) {
            $.get('/' + target, function(_data) {
                var received = $(_data);
                // $('#main-sidenav').replaceWith($(_data).find('#main-sidenav'));
                var activeHref = $(_data).find('#main-sidenav').find('.nav-link.active').attr('href');
                $('#main-sidenav a.nav-link.active').removeClass('active').blur();
                $('#main-sidenav a[href="' + activeHref + '"]').addClass('active');
                $('#main-content').replaceWith($(_data).find('#main-content'));
                $(window).scrollTop(0);
                if(pushState) {
                    window.top.history.pushState(target, null, '/mc/' + target);
                }
                $('#reload-icon').removeClass('loading-rotate');
            });
        }
        $(document).on('click', 'a:not([href="#"]):not([up-modal]):not([up-close])', function() {
            $('#reload-icon').addClass('loading-rotate');
            var target = this.href;
            if(target.indexOf('//') !== -1) {
                target = target.split('//')[1];
                if(target.indexOf('/') !== -1) {
                    target = target.substr(target.indexOf('/') + 1);
                }
            }
            gotoTarget(target, true);
            return false;
        });
        $(document).on('submit', 'form[action="/post-to-api"]:not(.custom-submit)', function() {
            $('#reload-icon').addClass('loading-rotate');
            $.post(this.action, $(this).serialize(), function(_data) {
                $('#main-content').replaceWith($(_data).find('#main-content'));
                $(window).scrollTop(0);
                $('#reload-icon').removeClass('loading-rotate');
            });
            return false;
        });
        window.top.addEventListener('popstate', function(event) {
            if(!!event.state) {
                gotoTarget(event.state, false);
            }
        });
    });
</script>

</body>
</html>
