{% extends "base.html" %}

{% block content %}


  <section class="block-list">
    <header class="block-list__header">
      <h1 class="block-list__title">Activity History</h1>
    </header>

    <ul>
      {% for event in audit_events %}
        <li class="block-list__item">
          <article class='audit-log__item'>
            <div class='audit-log__item__timestamp'>
              <local-datetime timestamp='{{ event.time_created }}'></local-datetime>
            </div>

            <div>
              <h2 class='h4 audit-log__item__name'>
                {{ event.user.full_name if event.user else "ATAT System" }}
              </h2>
              {{ event.action }} {{ event.resource_type }} <code>{{ event.resource_id }}</code>
              {% if event.display_name %}
                ({{ event.display_name }})
              {% endif %}

              <br>

              {% if event.workspace %}
                in Workspace <code>{{ event.workspace_id }}</code> ({{ event.workspace.name }})
              {% elif event.request %}
                on Request <code>{{ event.request_id }}</code> ({{ event.request.displayname }})
              {% endif %}
            </div>
          </article>
        </li>
      {% endfor %}
    </ul>

  </section>


{% endblock %}
