{% import 'admin/layout.html' as layout with context -%}
{% import 'admin/static.html' as admin_static with context %}
<!DOCTYPE html>
<html>
<head>
  <title>{% block title %}{% if admin_view.category %}{{ admin_view.category }} - {% endif %}{{ admin_view.name }} - {{ admin_view.admin.name }}{% endblock title%}</title>

  {% block head_meta %}
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
  {% endblock head_meta %}

  {% block head_css %}
  <!-- Bootstrap 3.3.6 -->
  <link href="{{ admin_static.url(filename='bootstrap/bootstrap3/css/bootstrap.min.css') }}" rel="stylesheet">
  <!-- <link href="{{url_for('static',filename='admin/css/bootstrap.min.css')}}" rel="stylesheet"></link> -->
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Theme style -->
  <link href="{{url_for('static',filename='admin/css/AdminLTE.min.css')}}" rel="stylesheet"></link>
  <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. -->
  <link href="{{url_for('static',filename='admin/css/skins/_all-skins.min.css')}}" rel="stylesheet"></link>
  <!-- bootstrap wysihtml5 - text editor -->
  <link href="{{url_for('static',filename='admin/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css')}}" rel="stylesheet"></link>
  <!-- Flask-admin admin styles -->
  <link href="{{ admin_static.url(filename='admin/css/bootstrap3/admin.css', v='1.1.1') }}" rel="stylesheet">
  <link rel="stylesheet" href="{{url_for('static', filename='admin/css/styles.css')}}">
  {% if admin_view.extra_css %}
  {% for css_url in admin_view.extra_css %}
  <link href="{{ css_url }}" rel="stylesheet">
  {% endfor %}
  {% endif %}

  {% endblock head_css%}

  {% block head %}
  {% endblock head%}

  {% block head_tail %}
  {% endblock head_tail%}

</head>
<body class="hold-transition skin-blue sidebar-mini">

  {% block page_body %}

  <!-- TOP NAVBAR -->
  <div class="wrapper">
    {% if current_user.is_authenticated %}
    <header class="main-header">
      <!-- Logo -->
      {% block brand %}
      
      <a href="{{ admin_view.admin.url }}" class="logo">
        <!-- mini logo for sidebar mini 50x50 pixels -->
        <span class="logo-mini"><b>{{ admin_view.admin.name }}</b></span>
        <!-- logo for regular state and mobile devices -->
        <span class="logo-lg"><b>{{ admin_view.admin.name }}</b></span>
      </a>
      {% endblock brand%}

      <!-- Header Navbar: style can be found in header.less -->
      <nav class="navbar navbar-static-top">
        <!-- Sidebar toggle button-->
        <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
          <span class="sr-only">Toggle navigation</span>
        </a>

        <div class="navbar-custom-menu">
          <ul class="nav navbar-nav">
            <!-- Notifications: style can be found in dropdown.less -->

            <!-- Control Sidebar Toggle Button -->
            <li>
              <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a>
            </li>
            <li>
              {% block access_control %}
              {% endblock %}
            </li>
          </ul>

          {% block menu_links %}
          <ul class="nav navbar-nav navbar-right">
            {{ layout.menu_links() }}
          </ul>
          {% endblock %}
        </div>
      </nav>
    </header>
    <!-- / TOP NAVBAR -->

    <!-- LEFT MENU -->
    <aside class="main-sidebar">
      <!-- sidebar: style can be found in sidebar.less -->
      <section class="sidebar">
        <!-- Sidebar user panel -->
        <div class="user-panel">
          <div class="pull-left image">
            <i class="fa fa-user-circle" style="color: white; font-size: 2.5em;"></i>
          </div>
          <div class="pull-left info">
            <p>
             {% if current_user.name -%}
             {{ current_user.name }}
             {% else -%}
             {{ current_user.email }}
             {%- endif %}
           </p>
           <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
         </div>
       </div>
       <!-- search form -->
       <form action="#" method="get" class="sidebar-form">
        <div class="input-group">
          <input type="text" name="q" class="form-control" placeholder="Search...">
          <span class="input-group-btn">
            <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
            </button>
          </span>
        </div>
      </form>
      <!-- /.search form -->
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <ul class="sidebar-menu">
        <li class="header">MAIN NAVIGATION</li>
        {% block main_menu %}
        {{ layout.menu() }}
        {% endblock %}
        <li>
          <a href="/admin/logout/">
            <i class="fa fa-sign-out"></i> <span>Logout</span>
          </a>
        </li>
      </ul>
    </section>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content color white-->
  <div class="content-wrapper" id="main_content">
    {% endif %}

    {% block messages %}
    {{ layout.messages() }}
    {% endblock messages %}

    {# store the jinja2 context for form_rules rendering logic #}
    {% set render_ctx = h.resolve_ctx() %}


    {% block body %}

    {% endblock body %}

    {% if current_user.is_authenticated %}
  </div>
  <!-- / Content Wrapper. color white -->

  <!-- Control Sidebar -->
  <aside class="control-sidebar control-sidebar-dark">
    <!-- Create the tabs -->
    <ul class="nav nav-tabs nav-justified control-sidebar-tabs">
      <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-cog"></i></a></li>
    </ul>
    <!-- Tab panes -->
    <div class="tab-content">
      <!-- Stats tab content -->
      <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
      <!-- /.tab-pane -->
      <!-- Settings tab content -->
      <div class="tab-pane" id="control-sidebar-settings-tab">
        <form method="post"></form>
      </div>
      <!-- /.tab-pane -->
    </div>
  </aside>
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
  immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>

  <footer class="main-footer">
     <strong><a href="https://github.com/navycut/navycut">Navycut Project</a></strong> -
    <strong>Check the official documentation at <a href="https://navycut.github.io">navycut.github.io</a>.</strong>
    <div class="pull-right hidden-xs">
      <b>Version</b> 1.0.0
    </div>
  </footer>
  {% endif %}

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

{% endblock page_body%}

{% block tail_js %}
<!-- jQuery 2.2.3 -->
<script src="{{url_for('static',filename='admin/plugins/jQuery/jquery-2.2.3.min.js')}}"></script>
<!-- jQuery UI 1.11.4 -->
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
<script>
  $.widget.bridge('uibutton', $.ui.button);
</script>
<!-- Bootstrap 3.3.6 -->
<script src="{{ admin_static.url(filename='bootstrap/bootstrap3/js/bootstrap.min.js') }}"></script>
<script src="{{ admin_static.url(filename='vendor/select2/select2.min.js', v='3.5.2') }}" type="text/javascript"></script>

{% if admin_view.extra_js %}
{% for js_url in admin_view.extra_js %}
<script src="{{ js_url }}" type="text/javascript"></script>
{% endfor %}
{% endif %}

<!-- Morris.js charts -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<!-- AdminLTE App -->
<script src="{{url_for('static',filename='admin/js/app.min.js')}}"></script>
<!-- AdminLTE for demo purposes -->
<script src="{{url_for('static',filename='admin/js/demo.min.js')}}"></script>


{% endblock tail_js%}

{% block tail %}
{% endblock tail %}

</body>
</html>