{{plugin-outlet name="advanced-search-options-above" args=(hash searchedTerms=searchedTerms) tagName=""}}

<div class="container advanced-search-posted-by-group">
  <div class="control-group pull-left">
    <label class="control-label" for="search-posted-by">{{i18n "search.advanced.posted_by.label"}}</label>
    <div class="controls">
      {{user-selector
        excludeCurrentUser=false
        usernames=searchedTerms.username
        single=true
        canReceiveUpdates=true
        class="user-selector"
      }}
    </div>
  </div>
  <div class="control-group pull-left">
    <label class="control-label" for="search-in-category">{{i18n "search.advanced.in_category.label"}}</label>
    <div class="controls">
      {{search-advanced-category-chooser
        value=searchedTerms.category.id
        onChange=(action "onChangeCategory")
      }}
    </div>
  </div>
</div>

<!-- disable these super-advanced searches for now
<div class="container">
  <div class="control-group pull-left">
    <label class="control-label" for="search-in-group">{{i18n "search.advanced.in_group.label"}}</label>
    <div class="controls">
      {{group-selector groupFinder=groupFinder groupNames=searchedTerms.group single="true" canReceiveUpdates="true"}}
    </div>
  </div>
  <div class="control-group pull-left">
    <label class="control-label" for="search-with-badge">{{i18n "search.advanced.with_badge.label"}}</label>
    <div class="controls">
      {{badge-selector badgeFinder=badgeFinder badgeNames=searchedTerms.badge single="true" canReceiveUpdates="true"}}
    </div>
  </div>
</div>
-->

{{#if siteSettings.tagging_enabled}}
  <div class="container advanced-search-tag-group">
    <div class="control-group">
      <label class="control-label" for="search-with-tags">{{i18n "search.advanced.with_tags.label"}}</label>
      <div class="controls">
        {{tag-chooser
          tags=searchedTerms.tags
          allowCreate=false
          filterPlaceholder=null
          everyTag=true
          unlimitedTagCount=true
          onChange=(action (mut searchedTerms.tags))
        }}
      <section class="field">
          <label>{{ input type="checkbox" class="all-tags" checked=searchedTerms.special.all_tags}} {{i18n "search.advanced.filters.all_tags"}} </label>
      </section>
      </div>
    </div>
  </div>
{{/if}}

<div class="container advanced-search-topics-posts-group">
  <div class="control-group pull-left">
    <label class="control-label" for="search-in-options">{{i18n "search.advanced.filters.label"}}</label>
    <div class="controls">
      {{#if currentUser}}
        <section class='field'>
          <label>{{input type="checkbox" class="in-title" checked=searchedTerms.special.in.title}} {{i18n "search.advanced.filters.title"}}</label>
          <label>{{input type="checkbox" class="in-likes" checked=searchedTerms.special.in.likes}} {{i18n "search.advanced.filters.likes"}}</label>
          <label>{{input type="checkbox" class="in-private" checked=searchedTerms.special.in.personal}} {{i18n "search.advanced.filters.private"}}</label>
          <label>{{input type="checkbox" class="in-seen" checked=searchedTerms.special.in.seen}} {{i18n "search.advanced.filters.seen"}}</label>
        </section>
      {{/if}}
      {{combo-box
        id="in"
        valueProperty="value"
        content=inOptions
        value=searchedTerms.in
        none="user.locale.any"
        onChange=(action (mut searchedTerms.in))
      }}
    </div>
  </div>
  <div class="control-group pull-left">
    <label class="control-label" for="search-status-options">{{i18n "search.advanced.statuses.label"}}</label>
    <div class="controls">
      {{combo-box
        id="status"
        valueProperty="value"
        content=statusOptions
        value=searchedTerms.status
        none="user.locale.any"
        onChange=(action (mut searchedTerms.status))
      }}
    </div>
  </div>
</div>

<div class="container advanced-search-date-count-group">
  <div class="control-group pull-left">
    <label class="control-label" for="search-post-date">{{i18n "search.advanced.post.time.label"}}</label>
    <div class="controls full-search-dates">
      {{combo-box
        id="postTime"
        valueProperty="value"
        content=postTimeOptions
        value=searchedTerms.time.when
        onChange=(action "onChangeWhenTime")
      }}
      {{date-input
        date=searchedTerms.time.days
        onChange=(action "onChangeWhenDate")
        id="search-post-date"
      }}
    </div>
  </div>
  <div class="control-group pull-left">
    <label class="control-label" for="search-min-post-count">{{i18n "search.advanced.post.count.label"}}</label>
    <div class="controls">
      {{input type="number" value=searchedTerms.min_post_count class="input-small" id='search-min-post-count'}}
    </div>
  </div>
</div>

{{plugin-outlet name="advanced-search-options-below" args=(hash searchedTerms=searchedTerms) tagName=""}}
