
{% import "includes/macros.html" as macros %}

<!DOCTYPE html>
<html>
<head>
	<title>{% if title %}{{ title }} - {% endif %}{{ config.SITE_NAME }}</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="{{ url_for('/static/app.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('/static/icomoon.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('/static/purecss.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('/static/side-menu.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ url_for('/static/flash.min.css') }}">

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

</head>
<body>
    {% if config.DEMO_MODE %}
    <div class="header">
        <div class="home-menu pure-menu pure-menu-horizontal pure-menu-fixed demo-mode">
            <p class="pure-menu-heading">Le site est en mode démo. <a href="{{ url_for('desactivate_demo') }}">désactiver</a></p>
        </div>
    </div>
    {% endif %}

    <div id="layout">
        <a href="#menu" id="menuLink" class="menu-link">
            <span></span>
        </a>
        {% if request.user %}
        <div id="menu">
            <div class="pure-menu">
                <h1 id="sitename">{{ config.SITE_NAME }}</h1>
                <ul class="pure-menu-list">
                    <li class="pure-menu-item">
                        <a href="{{ url_for('home') }}"><i class="icon-happy"></i>&nbsp;Voir les distrib</a>
                    </li>
                    {% if request.user and request.user.is_staff %}
                    <li class="pure-menu-item">
                        <a href="{{ url_for('new_delivery') }}"><i class="icon-hotairballoon"></i>&nbsp;Nouvelle distribution</a>
                    </li>
                    {% endif %}
                    {% if request.user and (request.user.is_staff or not config.HIDE_GROUPS_LINK) %}
                    <li class="pure-menu-item">
                        <a class="pure-menu-link" href="{{ url_for('groups') }}"><i class="icon-globe"></i>&nbsp;Gérer les groupes</a>
                    </li>
                    {% endif %}
                    <li class="pure-menu-item">
                        <a href="{{ url_for('logout') }}"><i class="icon-lock"></i>&nbsp;Se déconnecter</a>
                    </li>
                </ul>
            </div>
        </div>
        {% else %}
        <h1 id="sitename">{{ config.SITE_NAME }}</h1>
        {% endif %}
        <div class="toplink">
        {% block toplink %}{% endblock %}
        </div>
        <div id="main">
            <div class="content {% block is_wide %}narrow{% endblock %}">
                {% block body %}
                {% endblock body %}
            </div>
        </div>
    </div>


    <script src="{{ url_for('/static/js/flash.min.js') }}"></script>
    <script src="{{ url_for('/static/js/app.js') }}"></script>
    {% if message %}
    <script>
    new window.FlashMessage("{{ message[0] }}", "{{ message[1] }}", {
        progress: true,
        interactive: true,
        timeout: 8000,
        theme: "dark"
    });
    </script>
    {% endif %}
</body>
</html>
