<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{% block title %}Default title{% endblock title %}</title>
    <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />

    <script src="/static/js/popper.min.js" type="text/javascript"></script>
    <script src="/static/js/jquery.min.js" type="text/javascript"></script>
    <script src="/static/css/bootstrap.min.js" type="text/javascript"></script>
    <script src="/static/js/Chart.min.js" type="text/javascript"></script>
    <script src="/static/js/auto-complete.min.js" type="text/javascript"></script>
    <script src="/static/js/ion.rangeSlider.min.js" type="text/javascript"></script>
    <script src="/static/js/lodash.min.js" type="text/javascript"></script>
    <script src="/static/js/inspire-tree.min.js" type="text/javascript"></script>
    <script src="/static/js/inspire-tree-dom.min.js" type="text/javascript"></script>

    <link href="/static/css/fontawesome-all.min.css" rel="stylesheet" type="text/css">
    <link href="/static/css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="/static/css/auto-complete.css" rel="stylesheet" type="text/css">
    <link href="/static/css/ion.rangeSlider.css" rel="stylesheet" type="text/css">
    <link href="/static/css/ion.rangeSlider.skinFlat.css" rel="stylesheet" type="text/css">
    <link href="/static/css/inspire-tree-light.css" rel="stylesheet" type="text/css">

    {% block imports %}{% endblock %}

    <style>
        .info-table {
            width: 100%;
        }

        .info-table pre {
            padding: 6px;
            margin: 4px;
            white-space: unset;
        }

        .info-table td {
            padding: 4px;
        }

        .card {
            margin-top: 1em;
        }

        .flex-grow {
            flex: 1 0 auto;
        }

    </style>
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-light" style="background: #F7F7F7; border-bottom: solid 1px #dfdfdf;">
    <a class="navbar-brand" href="/"><i class="fa fa-search"></i> Search</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-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">
        <ul class="navbar-nav mr-auto">
            <li class="nav-item">
                <a class="nav-link {% if "directory" == active_page %}active{% endif %}" href="/directory">Directories</a>
            </li>
            <li class="nav-item">
                <a class="nav-link {% if "task" == active_page %}active{% endif %}" href="/task">Tasks</a>
            </li>
            <li class="nav-item">
                <a class="nav-link {% if "user" == active_page %}active{% endif %}" href="/user">Users</a>
            </li>
            <li class="nav-item">
                <a class="nav-link {% if "dashboard" == active_page %}active{% endif %}" href="/dashboard">Dashboard</a>
            </li>
        </ul>

        {% if session["username"] %}
            <span>
            Logged in as <i>{{ session["username"] }}</i>
            {% if session["admin"] %}(Admin){% endif %}
            </span>
            <a href="/logout" class="btn btn-outline-warning" style="margin-left: 8px">Logout</a>
        {% else %}
            <form class="form-inline my-2 my-lg-0" method="POST" action="/login">
                <input class="form-control mr-sm-2" placeholder="Username" name="username">
                <input class="form-control mr-sm-2" type="password" placeholder="Password" name="password">
                <button class="btn btn-outline-success my-2 my-sm-0">Login</button>
            </form>
        {% endif %}
    </div>
</nav>

{% block alert_messages %}


    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            <div class="container" style="margin-top: 1em">
                {% for category, message in messages %}
                    <div class="alert alert-{{ category }}">
                        <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                        {{ message | safe }}
                    </div>
                {% endfor %}
            </div>
        {% endif %}
    {% endwith %}
{% endblock %}

{% block body %}
{% endblock body %}


</body>
</html>
