{% extends 'base_public.html' %}
{% block header_navbar_menu %}
  {% if user.is_authenticated %}
  <ul class="nav navbar-nav">
    <li>
      <a href="{% url 'instances' %}"><i class="fa fa-desktop"></i> Instances</a>
    </li>
    <li>
      <a href="{% url 'services' %}"><i class="fa fa-gears"></i> Services</a>
    </li>
    <li>
      <a href="{% url 'checks' %}"><i class="fa fa-cog"></i> Checks</a>
    </li>
    <ul class="nav navbar-nav navbar-left">
      <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="download">New <span class="caret"></span></a>
        <ul class="dropdown-menu" aria-labelledby="New">
          <li>
            <a href="{% url 'create-service' %}"><i class="fa fa-gears"></i> Service</a>
          </li>
          <li>
            <a href="{% url 'create-instance' %}"><i class="fa fa-desktop"></i> Instance</a>
          </li>
          <li class="divider"></li>
          
          <!-- Custom check plugins buttons-->
          {% for checktype in custom_check_types %}
            <li>
              <a href="{% url checktype.creation_url %}?service={{ service.id }}&instance={{ instance.id }}" class="" title="Add new {{checktype.check_name|capfirst}} check"><i class="glyphicon {{checktype.icon_class|default:"glyphicon-ok"}}"></i> {{checktype.check_name|capfirst}} check</a>
            </li>
          {% endfor %}
        </ul>
      </li>
    </ul>
  </ul>
  <ul class="nav navbar-nav navbar-right">
          <li class="{% if not ENABLE_SUBSCRIPTION%}hidden{%endif%}">
            <a href="{% url 'subscriptions' %}"><i class="fa fa-table"></i> Alert subscriptions</a>
          </li>
          <li class="{% if not ENABLE_DUTY_ROTA%}hidden{%endif%}">
            <a href="{% url 'shifts' %}"><i class="glyphicon glyphicon-time"></i> Duty rota</a>
          </li>
          <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="download">{{ user.username }} <span class="caret"></span></a>
            <ul class="dropdown-menu" aria-labelledby="admin">
              <li>
                <a href="{% url "admin:auth_user_add" %}"><i class="glyphicon glyphicon-user"></i> Add user</a>
              </li>
              <li>
                <a href="{% url "user-profile" user.id %}"><i class="glyphicon glyphicon-wrench"></i> Profile Settings</a>
              </li>
              <li>
                <a href="{% url "plugin-settings-global" %}"><i class="glyphicon glyphicon-equalizer"></i> Plugin Settings</a>
              </li>
              <li class="divider"></li>
              <li>
                <a href="{% url "admin:index" %}"><i class="glyphicon glyphicon-lock"></i> Django admin</a>
              </li>
              <li class="divider"></li>
              <li>
                <a href="{% url "logout" %}"><i class="glyphicon glyphicon-log-out"></i> Log out</a>
              </li>
            </ul>
          </li>
        </ul>
  {% else %}
    {{ block.super }}
  {% endif %}
{% endblock header_navbar_menu %}
