{{ define "rows" }}
{{ range . }}
<tr>
  <td>{{ .FirstName }}</td>
  <td>{{ .LastName }}</td>
  <td>{{ .Date }}</td>
  <td>{{ .Time }}</td>
  <td>{{ .State }}</td>
  <td>{{ .Location }}</td>
  {{ range .Participants }}
  <td>{{ .FirstName }}</td>
  <td>{{ .LastName }}</td>
  <td>{{ .Company }}</td>
  {{ end }}
</tr>
{{ end }}
{{ end }}

{{ define "content" }}
<form>
  <label for="search-input">Suche</label>
  <input type="text" name="search" id="search-input" hx-post="/search/" hx-target="#results" hx-swap="innerHTML"
    hx-trigger="keyup changed delay:200ms" />
</form>

<form>
  <button type="submit" hx-post="/new-briefing/" hx-target="#content" hx-swap="innerHTML">
    Neue Unterweisung
  </button>
</form>

<table>
  <thead>
    <tr>
      <th colspan="2">Unterweiser</th>
      <th>Datum</th>
      <th>Uhrzeit</th>
      <th>Stand</th>
      <th>Ort</th>
      <th colspan="2">Teilnehmer</th>
      <th>Firma</th>
    </tr>
  </thead>

  <tbody id="results">
    {{ template "rows" . }}
  </tbody>
</table>
{{ end }}
