<%= form_tag(home_search_path, method: :get, remote: true, id: 'filter_form') do %>
<div class="card card-primary card-outline">
  <div class="card-header">
    <h4 class="card-title" style="font-size: 1.1rem; text-align: center;">Użyj filtrów, aby szybko odnaleźć interesującą Cię dotację</h4>
  </div>
  <div class="card-body">
    <% unless params[:search].blank? %>
    <div class="row">
      <div class="col-md-12">
        <%= link_to raw('<i class="fa fa-file-pdf"></i> Zapisz jako PDF'), "/zestawienie_dotacji/plik.pdf", class: 'btn btn-navy btn-block' %>
      </div>
    </div>
    <br />
    <% end %>
    <div class="row">
      <div class="col-md-12">
        <p><strong>Wyszukiwana fraza:</strong><br />
        <%= params[:search] %></p>
        <%= hidden_field_tag :search, params[:search] %>
      </div>
    </div>
    <div class="row">
      <div class="col-md-12">
        <div id="accordion">
          <div class="card card-secondary">
            <div class="card-header">
              <h4 class="card-title w-100">
                <a class="d-block w-100 collapsed" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
                  Wielkość firmy
                </a>
              </h4>
            </div>
            <div id="collapseOne" class="collapse show" data-parent="#accordion" style="">
              <div class="card-body">
                <div class="form-group">
                  <% @company_sizes.each do |company_size| %>
                  <div class="form-check">
                    <%= check_box_tag("company_size[]", company_size.id, @company_size_chk.include?(company_size.id.to_s) , class: 'form-check-input', onchange: "formSubmit()") %>
                    <label class="form-check-label" data-toggle="tooltip" data-placement="top" title="<%= company_size.description %>"><%= company_size.name %></label>
                  </div>
                  <% end %>
                </div>
              </div>
            </div>
          </div>
          <div class="card card-secondary">
            <div class="card-header">
              <h4 class="card-title w-100">
                <a class="d-block w-100" data-toggle="collapse" href="#collapseTwo" aria-expanded="true">
                  Działalność firmy
                </a>
              </h4>
            </div>
            <div id="collapseTwo" class="collapse show" data-parent="#accordion">
              <div class="card-body">
                <div class="form-group">
                  <% @company_activities.each do |company_activity| %>
                    <div class="form-check">
                      <%= check_box_tag("company_activity[]", company_activity.id, @company_activity_chk.include?(company_activity.id.to_s) , class: 'form-check-input', onchange: "formSubmit()") %>
                      <label class="form-check-label" data-toggle="tooltip" data-placement="top" title="<%= company_activity.description %>"><%= company_activity.name %></label>
                    </div>
                  <% end %>
                </div>
              </div>
            </div>
          </div>
          <div class="card card-secondary">
            <div class="card-header">
              <h4 class="card-title w-100">
                <a class="d-block w-100" data-toggle="collapse" href="#collapseThree" aria-expanded="true">
                  Rodzaj przedsięwzięcia
                </a>
              </h4>
            </div>
            <div id="collapseThree" class="collapse show" data-parent="#accordion">
              <div class="card-body">
                <div class="form-group">
                  <% @projects.each do |project| %>
                    <div class="form-check">
                      <%= check_box_tag("project[]", project.id, @project_chk.include?(project.id.to_s) , class: 'form-check-input', onchange: "formSubmit()") %>
                      <label class="form-check-label" data-toggle="tooltip" data-placement="top" title="<%= project.description %>"><%= project.name %></label>
                    </div>
                  <% end %>
                </div>
              </div>
            </div>
          </div>
          <%#
          <div class="card card-primary">
            <div class="card-header">
              <h4 class="card-title w-100">
                <a class="d-block w-100 collapsed" data-toggle="collapse" href="#collapseFour" aria-expanded="true">
                  Lokalizacja
                </a>
              </h4>
            </div>
            <div id="collapseFour" class="collapse show" data-parent="#accordion" style="">
              <div class="card-body">
                <div class="form-group">
                  <label for="localization">Lokalizacja projektu</label>
                 text_field_tag(:localization, params[:localization], class: 'form-control', placeholder: 'Wpisz tu lokalizację')
                </div>
              </div>
            </div>
          </div>
          %>
          <div class="card card-secondary">
            <div class="card-header">
              <h4 class="card-title w-100">
                <a class="d-block w-100 collapsed" data-toggle="collapse" href="#collapseFive" aria-expanded="true">
                  Wartość przedsięwzięcia
                </a>
              </h4>
            </div>
            <div id="collapseFive" class="collapse show" data-parent="#accordion" style="">
              <div class="card-body">
                <div class="form-group">
                  <label for="ammount_price">Minimalna wartość</label>
                  <%= number_field_tag(:ammount_price, params[:ammount_price], class: 'form-control', placeholder: 'Wpisz tu wartość') %>
                </div>
                <div class="form-group">
                  <label for="ammount_price">lub wybierz z listy</label>
                  <%= select_tag "ammount_chk", options_for_select(Dotation::AMMOUNT_ON_PROJECT_HASH, params[:ammount_chk]), class: 'form-control', onchange: "formSubmit()" %>
                </div>
              </div>
            </div>

          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-12">
        <button type="submit" class="btn btn-block btn-outline-navy" id="submit_form_btn">
          <i class="fas fa-bullhorn"></i> Zastosuj filtry
        </button>
      </div>
    </div>
    <hr />
  </div>
</div>
<% end %>
