<%if false %>
<div class="toolbar">
  <form class="form-inline" action="<%= admin_logs_path %>" method="GET">
    <div class="form-group">
      <%= select_tag(:action_type, options_for_select(AuditLog.action_options, params[:action_type]), include_blank: "All actions", class: "form-control") %>
    </div>

    <div class="form-group">
      <input name="q" type="text" class="form-control" placeholder="Search action" value="<%= params[:q] %>" />
    </div>

    <div class="form-group">
      <button type="submit" class="btn btn-primary">Search</button>
    </div>
  </form>
</div>
<% end %>

<% content_for :title, 'Audit Logs' %>
<!-- This example requires Tailwind CSS v2.0+ -->
<div class="flex flex-col">
  <div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
    <div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
      <div class="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
        <table class="min-w-full divide-y divide-gray-200">
          <thead class="bg-gray-50">
            <tr>
              <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                Operator
              </th>
              <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                Action
              </th>
              <th scope="col" class="px-6 py-3 w-1/4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                Record
              </th>
              <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                Date
              </th>
              <th scope="col" class="relative px-6 py-3">
                <span class="sr-only">Edit</span>
              </th>
            </tr>
          </thead>
          <tbody>
            <!-- Odd row -->
            <% @logs.each_with_index do |log, i| %>
            <tr class="<%= i.odd? ? 'bg-white' : 'bg-gray-50' %>">
              <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
                <%= log.user_name %>
              </td>
              <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                <%= log.action_name %>
              </td>
              <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                <% if log.record.is_a?(Article) %>
                  <%= link_to log.record.title, article_path(log.record), class: "text-blue-600" %>
                <% elsif log.record.is_a?(User) %>
                  <%= log.record.username %>
                <% else %>
                <% end %>
                
              </td>
              <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
                <%= log.created_at %>
              </td>
              <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
                <%= link_to "View", admin_log_path(log), class: "text-indigo-600 hover:text-indigo-900" %>
              </td>
            </tr>
            <% end %>

            <!-- More people... -->
          </tbody>
        </table>
      </div>
    </div>
    <div class="py-2 px-8">
       <%== pagy_nav(@pagy) %>
    </div>
  </div>
</div>
