<%# url %>

<%= search_form_for(url) do |f| %>
  <%= f.input :antecedent_name_ilike, label: "From", input_html: { value: params[:search][:antecedent_name_ilike], data: { autocomplete: "tag" } } %>
  <%= f.input :consequent_name_ilike, label: "To", input_html: { value: params[:search][:consequent_name_ilike], data: { autocomplete: "tag" } } %>
  <%= f.input :reason_ilike, label: "Reason", input_html: { value: params[:search][:reason_ilike] } %>
  <%= f.simple_fields_for :antecedent_tag do |fa| %>
    <%= fa.input :category, label: "From Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true, selected: params.dig(:search, :antecedent_tag, :category) %>
  <% end %>
  <%= f.simple_fields_for :consequent_tag do |fa| %>
    <%= fa.input :category, label: "To Category", collection: TagCategory.canonical_mapping.to_a, include_blank: true, selected: params.dig(:search, :consequent_tag, :category) %>
  <% end %>
  <%= f.input :status, label: "Status", collection: %w[Active Deleted Retired], include_blank: true, selected: params[:search][:status] %>
  <%= f.input :order, label: "Order", collection: [%w[Created created_at], %w[Updated updated_at], %w[Name name], %w[Tag\ count tag_count]], include_blank: true, selected: params[:search][:order] %>
  <%= f.submit "Search" %>
<% end %>
