{{define "deliveries_rows"}}
<div id="deliveries-rows" data-poll aria-live="polite"
     hx-get="/deliveries/rows?domain={{.FilterDomain | urlquery}}&app={{.FilterApp | urlquery}}&p={{.Page}}"
     hx-trigger="load" hx-swap="outerHTML">
  {{if .Rows}}
  <table>
    <thead>
      <tr><th>Time</th><th>From</th><th>To</th><th>Subject</th><th>Status</th><th></th></tr>
    </thead>
    <tbody>
      {{range .Rows}}
      <tr>
        <td class="time muted">{{.CreatedAt.Format "2006-01-02 15:04:05"}}</td>
        <td>{{.From}}</td>
        <td>{{.To}}</td>
        <td class="subject"><span title="{{.Subject}}">{{.Subject}}</span></td>
        <td class="status"><span class="st st-{{.Level}}">{{.Status}}</span></td>
        <td class="actions"><a href="/deliveries/{{.ID}}?domain={{$.FilterDomain | urlquery}}&app={{$.FilterApp | urlquery}}&p={{$.Page}}">Details</a></td>
      </tr>
      {{end}}
    </tbody>
  </table>
  <p class="muted">
    Page {{.Page}}{{if .LastPage}} of {{.LastPage}}{{end}}
    {{if .HasPrev}} &middot; <a href="/deliveries?domain={{.FilterDomain | urlquery}}&app={{.FilterApp | urlquery}}&p={{.PrevPage}}">&larr; Newer</a>{{end}}
    {{if .HasNext}} &middot; <a href="/deliveries?domain={{.FilterDomain | urlquery}}&app={{.FilterApp | urlquery}}&p={{.NextPage}}">Older &rarr;</a>{{end}}
  </p>
  {{else}}
  <p class="muted">No messages logged yet.</p>
  {{end}}
</div>
{{end}}
