<%= form_with url: admin_portal_audit_trails_path, method: :get, local: true do |f| %>
<%= f.label :user_id, "User", class: "form-label text-secondary small" %>
<%= f.select :user_id,
options_from_collection_for_select(@users, :id, :display_name, params[:user_id]),
{ include_blank: "All users" },
class: "form-select form-select-sm slim-select",
data: { controller: "slim-select", slim_select_target: "select" }
%>
<%= f.label :entity, "Entity", class: "form-label text-secondary small" %>
<%= f.select :entity,
options_for_select(@entities.map { |e| [e.titleize, e] }, params[:entity]),
{ include_blank: "All entities" },
class: "form-select form-select-sm rounded-pill" %>
<%= f.label :action_type, "Action", class: "form-label text-secondary small" %>
<%= f.select :action_type,
options_for_select(%w[create update delete show approve reject send_registration_link], params[:action_type]),
{ include_blank: "All actions" },
class: "form-select form-select-sm rounded-pill" %>
<%= f.label :start_date, "From", class: "form-label text-secondary small" %>
<%= f.date_field :start_date,
value: params[:start_date],
class: "form-control form-control-sm rounded-pill" %>
<%= f.label :end_date, "To", class: "form-label text-secondary small" %>
<%= f.date_field :end_date,
value: params[:end_date],
class: "form-control form-control-sm rounded-pill" %>
<%= f.submit "Apply",
data: { turbo: false },
class: "btn btn-primary btn-sm rounded-pill px-4" %>
<%= link_to "Clear",
admin_portal_audit_trails_path,
data: { turbo: false },
class: "btn btn-warning btn-sm rounded-pill px-4" %>