{% load static %}
{% load settings %}
{% load sass_tags %}
<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta property="og:type" content="website">
    <meta property="og:locale" content="fr_FR" />
    <meta property="og:site_name" content="La chariotte">
    <meta property="og:url" content="{{ BASE_URL }}{{ request.path }}">
    <title>
      {% block title %}{% endblock %}
    - La Chariotte</title>
    {% block css %}
      <link href="{% sass_src 'sass/style.sass' %}"
            rel="stylesheet"
            type="text/css" />
      <link rel="stylesheet"
            href="{% static 'fork-awesome/css/fork-awesome.min.css' %}">
      {% block extra_css %}
      {% endblock extra_css %}
    {% endblock css %}
    <link rel="shortcut icon" href="{% static 'img/icons/chariotte.ico' %}">
  </head>
  <body>
    <main>
      <!-- Top navbar -->
      <nav class="top-nav navbar">
        <!-- Navbar brand : always visible (all screen sizes)-->
        <div class="navbar-brand">
          <p class="navbar-item is-size-4 has-text-weight-semibold">
            {% block content_title %}Bienvenue :){% endblock %}
          </p>
        </div>
        <div class="navbar-menu">
          <div class="navbar-end">
            <div class="navbar-item">
              <div class="buttons">
                {% if user.is_authenticated %}
                  <p class="mr-4">{{ user.get_full_name }}</p>
                  <a class="button is-light" href="{% url 'accounts:logout' %}">
                    <i class="fa fa-sign-out mr-3" aria-hidden="true"></i>Se déconnecter
                  </a>
                {% else %}
                  <a class="button is-light" href="{% url 'accounts:signup' %}">
                    <i class="fa fa-user-plus mr-3" aria-hidden="true"></i><strong>Créer un compte</strong>
                  </a>
                  <a class="button is-primary" href="{% url 'accounts:login' %}">
                    <i class="fa fa-sign-in mr-3" aria-hidden="true"></i>Se connecter
                  </a>
                {% endif %}
              </div>
            </div>
          </div>
        </div>
      </nav>
      <!-- End Top navbar -->
      <!-- Side navbar -->
      <nav class="side-nav navbar is-fixed-top is-flex-desktop"
           role="navigation"
           aria-label="main navigation">
        <!-- Navbar brand : always visible (all screen sizes)-->
        <div class="navbar-brand">
          <a class="navbar-item" href="{% url 'dashboard' %}">
            <img src="{% static 'img/logos/logo_la_chariotte.png' %}">
          </a>
          <a role="button"
             class="navbar-burger"
             aria-label="menu"
             aria-expanded="false"
             data-target="navbarBasicExample">
            <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
          </a>
        </div>
        <!-- Navbar menu : only visible on desktop-->
        <div id="navbarBasicExample" class="navbar-menu">
          <div class="navbar-start">
            <a class="navbar-item" href="{% url 'dashboard' %}">
              <i class="fa fa-home mr-3" aria-hidden="true"></i>Tableau de bord
            </a>
            {% if user.is_authenticated %}
              <a class="navbar-item" href="{% url 'order:index' %}">
                <i class="fa fa-shopping-basket mr-3" aria-hidden="true"></i>Mes commandes groupées
              </a>
            {% endif %}
            <a class="navbar-item" href="{% url 'about_chariotte' %}">
              <i class="fa fa-info-circle mr-3" aria-hidden="true"></i>La Chariotte, c'est quoi&nbsp;?
            </a>
            <a class="navbar-item" href="{% url 'notice' %}">
              <i class="fa fa-cog mr-3" aria-hidden="true"></i>Comment ça marche&nbsp;?
            </a>
            <a class="navbar-item" href="https://blog.chariotte.fr/last">
              <i class="fa fa-newspaper-o mr-3" aria-hidden="true"></i>Actualités</a>
          </div>
          <hr>
          <div class="navbar-item desktop-hidden">
            <div class="buttons">
              {% if user.is_authenticated %}
                <a class="button is-light" href="{% url 'accounts:logout' %}">
                  <i class="fa fa-sign-out mr-3" aria-hidden="true"></i>Se déconnecter
                </a>
              {% else %}
                <a class="button is-light" href="{% url 'accounts:signup' %}">
                  <strong>Créer un compte</strong>
                </a>
                <a class="button is-primary" href="{% url 'accounts:login' %}">
                  <i class="fa fa-sign-in mr-3" aria-hidden="true"></i>Se connecter
                </a>
              {% endif %}
            </div>
          </div>
        </div>
      </nav>
      <!-- End Navbar -->
      <div class="content">
        {% block content %}{% endblock %}
      </div>
    </main>
    <footer class="footer section">
      <div class="container">
        <div class="columns is-multiline is-justify-content-center">
          <div class="column is-4-desktop is-4-tablet">
            <div class="widget mb-0">
              <div class="logo mb-4">
                <p>
                  {% settings_value "PROJECT_NAME" %}
                  | <a href='{% settings_value "GITLAB_LINK" %}'>version {{ version }}</a>
                </p>
              </div>
              <ul class="list-unstyled footer-menu lh-35">
                <li>
                  <a href="mailto:{% settings_value "CONTACT_MAIL" %}"><i class="fa fa-envelope-square mr-2 fa-fw text-muted"></i>
                    {% settings_value "CONTACT_MAIL" %}
                  </a>
                </li>
                <li>
                  <a href="{% url 'legal_notice' %}"><i class="fa fa-legal mr-2 fa-fw text-muted"></i>Mentions légales</a>
                </li>
              </ul>
            </div>
          </div>
          <div class="column is-2-desktop is-4-tablet">
            <div class="widget mb-0">
              <h4 class="mb-4">Suivez nous</h4>
              <ul class="list-unstyled footer-socials">
                <li>
                  <a href="https://mailman.alwaysdata.com/postorius/lists/news.chariotte.fr/"><i class="fa fa-email-bulk mr-2 fa-fw text-muted"></i>Chariotte news</a>
                </li>
                <li>
                  <a href="https://mastodon.scop.coop/@la_chariotte"><i class="fa fa-mastodon-square mr-2 fa-fw text-muted"></i>Mastodon</a>
                </li>
                <li>
                  <a href="https://www.facebook.com/profile.php?id=100091984176981"><i class="fa fa-facebook-square mr-2 fa-fw text-muted"></i>Facebook</a>
                </li>
                <li>
                  <a href="https://www.linkedin.com/company/la-chariotte-commandes-groupees/"><i class="fa fa-linkedin-square mr-2 fa-fw text-muted"></i>LinkedIn</a>
                </li>
              </ul>
            </div>
          </div>
          <div class="column is-3-desktop is-4-tablet">
            <div class="widget mb-0">
              <h4 class="mb-4">Soutenez-nous</h4>
              <ul class="list-unstyled">
                <li>
                  <a href="https://framaforms.org/votre-avis-sur-la-chariotte-1709742328"><i class="fa fa-comments mr-2 text-muted"></i>Que pensez-vous de la Chariotte ?</a>
                </li>
                <li>
                  <a href="https://www.helloasso.com/associations/la-chariotte/"><i class="fa fa-heart mr-2 text-muted"></i>Faire un (petit) don</a>
                </li>
              </ul>
            </div>
          </div>
        </div>
      </div>
    </footer>
  </body>
</html>
<script>
  // For responsive menu
  document.addEventListener('DOMContentLoaded', () => {

    // Get all "navbar-burger" elements
    const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);

    // Add a click event on each of them
    $navbarBurgers.forEach(el => {
      el.addEventListener('click', () => {

        // Get the target from the "data-target" attribute
        const target = el.dataset.target;
        const $target = document.getElementById(target);

        // Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
        el.classList.toggle('is-active');
        $target.classList.toggle('is-active');

      });
    });
  });
  {% block extra_js %} {% endblock %}
</script>
