{% from "macros.jinja2" import
	get_conceptscheme_label
  %}
{% set app_package = app_package|default('atramhasis', true) %}

<div class="large-6 columns home-search-placer">
  <div class="home-img_position">
    <form onsubmit="return validateForm()" id="search-form" action="#" method="get" name="searchForm">

      <select id="scheme">
        <option value="" selected>{% trans %}select_scheme{% endtrans %}</option>
        {% for item in conceptschemes %}
          <option value="{{ request.route_path('search_result', scheme_id=item.id) }}">
            {{ get_conceptscheme_label(item.conceptscheme, request.locale_name) }}
          </option>
        {% endfor %}
      </select>

      <select id="type"  name="type" >
        <option value="all" selected>{% trans %}select_type{% endtrans %}</option>
        <option value="all">{% trans %}type_all{% endtrans %}</option>
        <option value="concept">{% trans %}type_concept{% endtrans %}</option>
        <option value="collection">{% trans %}type_collection{% endtrans %}</option>
      </select>

      <input type="text" name="label" id="label" placeholder="{% trans %}search_for{% endtrans %} {% trans %}labels{% endtrans %}">

      <div class="text-center">
        <button type="submit"><span class="ico ico-mglass-large"></span></button>
      </div>
      <script>
        function validateForm() {
          var scheme = $('#scheme');
          var schemeVal = scheme.val();
          if (schemeVal && schemeVal !== '') {
            return true;
          }
          scheme.addClass('highlightError');
          $('.highlightErrorText').remove();
          var msg = $('<small class="highlightErrorText">{% trans %}select_scheme_error{% endtrans %}</small>').insertAfter(scheme);
          scheme.one('change', function () {
            scheme.removeClass('highlightError');
            msg.remove();
          });
          return false;
        }
      </script>
    </form>
    <div class="text-center">
      <img src="{{ request.static_path(app_package + ':static/img/headimg.png') }}" width="230">
    </div>
  </div>
</div>
