{% from "components/sidenav_item.html" import SidenavItem %}

<div class="global-navigation sidenav {% if workspace %}global-navigation__context--workspace{% endif %}">
  <ul>
    {% if g.dev %}
      {{ SidenavItem("Styleguide",
        href="/styleguide",
        icon="visible",
        active=g.matchesPath('/styleguide'),
        subnav=[
          {"label":"Subnav 1", "href":"/styleguide?subnav1", "icon": "plus", "active": g.matchesPath('/styleguide?subnav1')},
          {"label":"Subnav 2", "href":"/styleguide?subnav2", "active": g.matchesPath('/styleguide?subnav2')},
        ]) }}
    {% endif %}

    {{ SidenavItem("Requests",
      href="/requests",
      icon="document",
      active=g.matchesPath('/requests'),
      subnav=[
        {"label":"New Request", "href":url_for("requests.requests_form_new", screen=1), "icon": "plus", "active": g.matchesPath('/requests/new')},
      ]
      ) }}

    {% if g.current_user.has_workspaces %}
      {{ SidenavItem("Workspaces", href="/workspaces", icon="cloud", active=g.matchesPath('/workspaces')) }}
    {% endif %}

    {% if g.Authorization.has_atat_permission(g.current_user, g.Permissions.VIEW_AUDIT_LOG) %}
      {{ SidenavItem("Activity History", url_for('atst.activity_history'), icon="time", active=g.matchesPath('/activity-history')) }}
    {% endif %}
  </ul>
</div>
