{{define "audit_detail"}}{{template "base" .}}{{end}}
{{define "title"}}Event #{{.Event.ID}} — MCIAS{{end}}
{{define "content"}}
<div class="page-header d-flex align-center justify-between">
  <div>
    <h1>Audit Event #{{.Event.ID}}</h1>
    <p class="text-muted text-small"><code>{{.Event.EventType}}</code></p>
  </div>
  <a class="btn btn-secondary" href="/audit">&larr; Audit Log</a>
</div>
<div class="card">
  <dl style="display:grid;grid-template-columns:140px 1fr;gap:.5rem .75rem;font-size:.9rem">
    <dt class="text-muted">Event ID</dt>
    <dd>{{.Event.ID}}</dd>
    <dt class="text-muted">Time</dt>
    <dd>{{formatTime .Event.EventTime}}</dd>
    <dt class="text-muted">Event Type</dt>
    <dd><code>{{.Event.EventType}}</code></dd>
    <dt class="text-muted">Actor</dt>
    <dd>{{if .Event.ActorUsername}}{{.Event.ActorUsername}}{{else}}&mdash;{{end}}</dd>
    <dt class="text-muted">Target</dt>
    <dd>{{if .Event.TargetUsername}}{{.Event.TargetUsername}}{{else}}&mdash;{{end}}</dd>
    <dt class="text-muted">IP Address</dt>
    <dd>{{if .Event.IPAddress}}{{.Event.IPAddress}}{{else}}&mdash;{{end}}</dd>
    <dt class="text-muted">Details</dt>
    <dd>{{if .Event.Details}}<pre style="margin:0;white-space:pre-wrap;word-break:break-all;background:#f8f9fa;padding:.5rem;border-radius:4px;font-size:.85rem"><code>{{prettyJSON .Event.Details}}</code></pre>{{else}}&mdash;{{end}}</dd>
  </dl>
</div>
{{end}}
