{% load static %}
<!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 rel="stylesheet" href="{% static 'css/app.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">
    <div class="content columns has-text-centered">
      <div class="column margin-auto">
        <p>
          <strong>La Chariotte</strong> | version {{ version }}
        </p>
        <p>
          <a href="{% url 'legal_notice' %}">Mentions légales</a>
        </p>
      </div>
      <div class="column is-size-6 columns">
        <div class="column margin-auto">
          <p>Contact : <a href="mailto:laetitia@chariotte.fr">laetitia@chariotte.fr</a>
          <p>Suivez <strong>la Chariotte</strong> sur :</p>
        </div>
        <div class="column">
          <a href="https://www.facebook.com/profile.php?id=100091984176981" target="_blank" rel="noopener">
            <i class="fa fa-facebook-square mr-2" aria-hidden="true"></i>Facebook
          </a><br>
          <a href="https://www.linkedin.com/company/la-chariotte-commandes-groupees/" target="_blank" rel="noopener">
            <i class="fa fa-linkedin-square mr-3" aria-hidden="true"></i>Linkedin
          </a><br>
          <a href="https://mastodon.scop.coop/@la_chariotte" target="_blank" rel="noopener">
            <i class="fa fa-mastodon-square mr-3" aria-hidden="true"></i>Mastodon
          </a>
        </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>