<div class="sidenav">
  <ul>
    <li>
      <a class="sidenav__link" href="/requests">&#8249; All requests</a>
    </li>
  </ul>

  <ul>
    {% for i,s in enumerate(screens) %}
      {% if s["show"] %}
        <li>
          {% if i+1==current %}
          <a class="sidenav__link sidenav__link--active" href="{{ reverse_url('request_form_update', i+1, request_id) if request_id else reverse_url('request_form_new',i+1) }}">
            {{ i+1 }}. {{ s['title'] }}
          </a>
          {% if s.get('subitems') %}
          <ul>
            {% for j,t in enumerate(s['subitems']) %}
            <li><a class="sidenav__link" href="#{{ t['id'] }}">{{ t['title'] }}</a></li>
            {% end %}
          </ul>
          {% end %}

          {% else %}
          <a class="sidenav__link" href="{{ reverse_url('request_form_update', i+1, request_id) if request_id else reverse_url('request_form_new',i+1) }}">
            {{ i+1 }}. {{ s['title'] }}
          </a>
          {% end %}
        </li>
      {% end %}
    {% end %}
  </ul>
</div>
