<%= form_for @search, as: :bookmark_search, url: search_bookmarks_path,
    html: { class: "search", method: :get } do |f| %>
  <fieldset>
    <legend><%= ts("Bookmarked Item") %></legend>
    <h3 class="landmark heading"><%= ts("Bookmarked Item") %></h3>
    <dl>
      <dt>
        <%= f.label :bookmarkable_query, ts("Any field on work") %>
        <%= link_to_help "bookmark-search-text-help" %>
      </dt>
      <dd>
        <%= f.text_field :bookmarkable_query %>
      </dd>
      <dt>
        <%= f.label :other_tag_names, ts("Work tags") %>
        <%= link_to_help "bookmark-search-work-tag" %>
      </dt>
      <dd>
        <%= f.text_field :other_tag_names, autocomplete_options("tag") %>
      </dd>
      <dt>
        <%= f.label :bookmarkable_type, ts("Type") %>
        <%= link_to_help "bookmark-search-type-help" %>
      </dt>
      <dd>
        <%= f.select :bookmarkable_type,
                     options_for_select(["", "Work", "Series", "External Work"],
                                        @search.bookmarkable_type) %>
      </dd>
      <dt>
        <%= f.label :language_id, ts("Work language") %>
      </dt>
      <dd>
        <%= f.select(:language_id, language_options_for_select(@languages, "short"), include_blank: true) %>
      </dd>
      <dt>
        <%= f.label :bookmarkable_date, ts("Date updated") %>
        <%= link_to_help "bookmark-search-date-updated-help" %>
      </dt>
      <dd>
        <%= f.text_field :bookmarkable_date %>
      </dd>
    </dl>
  </fieldset>

  <fieldset>
    <legend><%= ts("Bookmark") %></legend>
    <h3 class="landmark heading"><%= ts("Bookmark") %></h3>
    <dl>
      <dt>
        <%= f.label :bookmark_query, ts("Any field on bookmark") %>
        <%= link_to_help "bookmark-search-text-help" %>
      </dt>
      <dd>
        <%= f.text_field :bookmark_query %>
      </dd>
      <dt>
        <%= f.label :other_bookmark_tag_names, ts("Bookmarker's tags") %>
        <%= link_to_help "bookmark-search-bookmarker-tag" %>
      </dt>
      <dd>
        <%= f.text_field :other_bookmark_tag_names, autocomplete_options("tag") %>
      </dd>
      <dt>
        <%= f.label :bookmarker, ts("Bookmarker") %>
        <%= link_to_help "bookmark-search-text-help" %>
      </dt>
      <dd>
        <%= f.text_field :bookmarker %>
      </dd>
      <dt>
        <%= f.label :bookmark_notes, ts("Notes") %>
        <%= link_to_help "bookmark-search-text-help" %>
      </dt>
      <dd>
        <%= f.text_field :bookmark_notes %>
      </dd>
      <dt>
        <%= ts("Bookmark type") %>
      </dt>
      <dd>
        <ul>
          <li>
            <%= f.check_box :rec  %>
            <%= f.label :rec, ts("Rec") %>
            <%= link_to_help "bookmark-search-rec-help" %>
          </li>
          <li>
            <%= f.check_box :with_notes  %>
            <%= f.label :with_notes, ts("With notes") %>
            <%= link_to_help "bookmark-search-notes-help" %>
          </li>
        </ul>
      </dd>
      <dt>
        <%= f.label :date, ts("Date bookmarked") %>
        <%= link_to_help "bookmark-search-date-bookmarked-help" %>
      </dt>
      <dd>
        <%= f.text_field :date %>
      </dd>
    </dl>
  </fieldset>

  <fieldset>
    <legend><%= ts("Search") %></legend>
    <h3 class="landmark heading"><%= ts("Search") %></h3>
    <dl>
      <dt>
        <%= f.label :sort_column, ts("Sort by") %>
      </dt>
      <dd>
        <%= f.select :sort_column,
                     options_for_select(@search.sort_options,
                                        @search.sort_column),
                     { include_blank: ts("Best Match") } %>
      </dd>
    </dl>
    <p class="submit"><%= f.submit ts("Search Bookmarks") %></p>
  </fieldset>
<% end %>
