{% load static i18n %}
{% load bootstrap5 %}

{# Display django.contrib.messages as Bootstrap alerts #}
{% bootstrap_messages %}

{% get_current_language as LANGUAGE_CODE %}

<!DOCTYPE html>
<html lang="{{LANGUAGE_CODE}}">
  <head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="description" content="uncloud by ungleich" />
    <meta name="author" content="ungleich glarus ag" />
    <title>
      uncloud - {% block title %} made in Switzerland {% endblock %}
    </title>

    {% block css_extra %} {% endblock css_extra %}
    {% block head_extra %} {% endblock head_extra %}

    {# Load CSS and JavaScript #}
    {% bootstrap_css %}
    {% bootstrap_javascript %}

  </head>

  <body>
    <div id="main-wrapper">
      <nav class="navbar sticky-top navbar-expand-lg navbar-light bg-light">
        <div class="container">
          <a class="navbar-brand" href="{% url 'uncloudindex' %}">uncloud</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">
              {% if user.is_authenticated %}
              <span class="navbar-text">Logged in as {{ user }}. Your balance:
              {{ balance }} CHF. </span>
              <li class="nav-item">
                <a class="nav-link" href="{% url 'logout' %}">Logout</a>
              </li>
              {% else %}
              <li class="nav-item">
                <a class="nav-link" href="{% url 'login' %}">Login</a>
              </li>
              {% endif %}
            </ul>
          </div>
        </div>
        </nav>
      {% block content %} {% endblock %}
    </div>

    {% block js_extra %} {% endblock js_extra %}
  </body>
</html>
