<%= link_to t("admin.budget_investments.index.download_current_selection"),
            admin_budget_budget_investments_path(csv_params),
            class: "float-right small clear" %>

<% if params[:filter] == 'winners' %>
  <% if display_calculate_winners_button?(@budget) %>
    <%= link_to calculate_winner_button_text(@budget),
                calculate_winners_admin_budget_path(@budget),
                method: :put,
                class: "button hollow float-right clear" %>
  <% else %>
    <span class="button hollow disabled float-right clear">
      <%= t("admin.budgets.winners.calculate")%>
    </span>
    <div class="callout warning clear">
      <%= t("admin.budget_investments.index.cannot_calculate_winners") %>
    </div>
  <% end %>
<% end %>

<% if @investments.any? %>
  <h3 class="inline-block"><%= page_entries_info @investments %></h3><br>

  <%= render "filters_description", i18n_namespace: "admin.budget_investments.index" %>

  <table class="table-for-mobile">
    <thead>
      <tr>
        <th><%= link_to_investments_sorted_by t("admin.budget_investments.index.list.id")  %></th>
        <th class="small-3"><%= link_to_investments_sorted_by t("admin.budget_investments.index.list.title") %></th>
        <th><%= link_to_investments_sorted_by t("admin.budget_investments.index.list.supports") %></th>
        <th><%= t("admin.budget_investments.index.list.admin") %></th>
        <th>
          <%= t("admin.budget_investments.index.list.valuation_group") %>
          <%= t("admin.budget_investments.index.list.valuator") %>
        </th>
        <th><%= t("admin.budget_investments.index.list.geozone") %></th>
        <th><%= t("admin.budget_investments.index.list.feasibility") %></th>
        <th class="text-center"><%= t("admin.budget_investments.index.list.valuation_finished") %></th>
        <th class="text-center"><%= t("admin.budget_investments.index.list.visible_to_valuators") %></th>
        <th class="text-center"><%= t("admin.budget_investments.index.list.selected") %></th>
        <% if params[:filter]  == "selected" %>
          <th class="text-center"><%= t("admin.budget_investments.index.list.incompatible") %></th>
        <% end %>
      </tr>
    </thead>

    <tbody>
      <% @investments.each do |investment| %>
        <tr id="<%= dom_id(investment) %>" class="budget_investment">
          <%= render '/admin/budget_investments/select_investment', investment: investment %>
        </tr>
      <% end %>
    </tbody>
  </table>

  <%= paginate @investments %>
<% else %>
  <div class="callout primary clear">
    <%= t("admin.budget_investments.index.no_budget_investments") %>
  </div>
<% end %>
