{{ template "base" . }}
{{ define "title" }}Admin - Users{{ end }}
{{ define "header" }}<a class="whitespace-pre" href="../admin">Admin - Users</a>{{ end }}
{{ define "content" }}
<div class="overflow-x-auto">
  <div class="inline-block min-w-full overflow-hidden rounded shadow">
    <table class="min-w-full leading-normal bg-white dark:bg-gray-700 text-sm">
      <thead class="text-gray-800 dark:text-gray-400">
        <tr>
          <th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800 w-12">
            {{ template "svg/add" }}
          </th>
          <th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800">User</th>
          <th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800 text-center">
            Permissions
          </th>
          <th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800 w-48">Created</th>
        </tr>
      </thead>
      <tbody class="text-black dark:text-white">
        {{ if not .Data }}
        <tr>
          <td class="text-center p-3" colspan="2">No Results</td>
        </tr>
        {{ end }}
        {{ range $user := .Data }}
        <tr>
          <td class="p-3 border-b border-gray-200 text-gray-800 dark:text-gray-400">{{ template "svg/delete" }}</td>
          <td class="p-3 border-b border-gray-200">
            <p>{{ $user.ID }}</p>
          </td>
          <td class="p-3 border-b border-gray-200 text-center min-w-40">
            <span class="px-2 py-1 rounded-md text-white dark:text-black {{ if $user.Admin }}bg-gray-800 dark:bg-gray-100{{ else }}bg-gray-400 dark:bg-gray-600 cursor-pointer{{ end }}">admin</span>
            <span class="px-2 py-1 rounded-md text-white dark:text-black {{ if $user.Admin }}bg-gray-400 dark:bg-gray-600 cursor-pointer{{ else }}bg-gray-800 dark:bg-gray-100{{ end }}">user</span>
          </td>
          <td class="p-3 border-b border-gray-200">
            <p>{{ $user.CreatedAt }}</p>
          </td>
        </tr>
        {{ end }}
      </tbody>
    </table>
  </div>
</div>
{{ end }}
