{% load staticfiles %}

<nav class="navbar navbar-fixed-top">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">
        <img src="{% static 'kfet/img/logo3.png' %}">
      </a>
    </div>
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><a href="{% url 'kfet.home' %}">Home</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        {% if user.username == 'kfet_genericteam' %}
          <li class="navbar-text">Équipe standard</li>
        {% endif %}
        {% if user.profile.account_kfet %}
          <li>
            <a href="{% url 'kfet.account.read' user.profile.account_kfet.trigramme %}">Mes infos</a>
          </li>
        {% endif %}
        {% if perms.kfet.is_team %}
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Admin <span class="caret"></span></a>
            <ul class="dropdown-menu">
              <li><a href="{% url 'kfet.kpsul' %}">K-Psul</a></li>
              <li><a href="{% url 'kfet.history' %}">Historique</a></li>
              <li><a href="{% url 'kfet.transfers' %}">Transferts</a></li>
              <li class="divider"></li>
              <li><a href="{% url 'kfet.account' %}">Comptes</a></li>
              <li><a href="{% url 'kfet.checkout' %}">Caisses</a></li>
              <li class="divider"></li>
              <li><a href="{% url 'kfet.article' %}">Articles</a></li>
              <li><a href="{% url 'kfet.inventory' %}">Inventaires</a></li>
              <li><a href="{% url 'kfet.order' %}">Commandes</a></li>
              {% if user.username != 'kfet_genericteam' %}
                <li class="divider"></li>
                <li><a href="{% url 'kfet.login.genericteam' %}" target="_blank" id="genericteam">Connexion standard</a></li>
              {% endif %}
              {% if perms.kfet.change_settings %}
                <li><a href="{% url 'kfet.settings' %}">Paramètres</a></li>
              {% endif %}
            </ul>
          </li>
        {% endif %}
        {% if user.is_authenticated %}
        <li><a href="{% url 'gestioncof.views.logout' %}?next=/k-fet/" title="Déconnexion"><span class="glyphicon glyphicon-log-out"></span></a></li>
        {% endif %}
      </ul>
    </div>
</nav>

<script type="text/javascript">

$(document).ready(function () {
    $('#genericteam').on('click', function () {
        setTimeout(function () { location.reload() }, 1000);
    });
});

</script>
