<% provide :title, t("budgets.results.page_title", budget: @budget.name) %>
<% content_for :meta_description do %><%= @budget.description_finished %><% end %>
<% provide :social_media_meta_tags do %>
<%= render "shared/social_media_meta_tags",
            social_url: budget_results_url(@budget),
            social_title: @budget.name,
            social_description: @budget.description_finished %>
<% end %>
<% content_for :canonical do %>
  <%= render "shared/canonical", href: budget_results_url(@budget) %>
<% end %>

<div class="budgets-stats">
  <div class="expanded no-margin-top padding header">
    <div class="row">
      <div class="small-12 column text-center">
        <%= back_link_to budget_path(@budget) %>
        <h1 class="title"><%= t("budgets.results.heading") %><br><%= @budget.name %></h1>
      </div>
    </div>
  </div>
</div>

<div class="row margin-top">
  <div class="small-12 column">
    <ul class="tabs">
      <li class="tabs-title is-active">
        <span class="show-for-sr"><%= t("shared.you_are_in") %></span>
        <%= link_to t("budgets.results.link"), budget_results_path(@budget), class: "is-active"  %>
      </li>
      <li class="tabs-title">
        <%# link_to t("budgets.stats.link"), budget_stats_path(@budget)%>
      </li>
    </ul>
  </div>
</div>

<div class="row">
  <div class="small-12 medium-3 large-2 column">
    <h3 class="margin-bottom">
      <%= t("budgets.results.heading_selection_title") %>
    </h3>
    <ul class="menu vertical no-margin-top no-padding-top">


      <% @budget.headings.order('id ASC').each do |heading| %>
        <li>
          <%= link_to heading.name,
                      budget_results_path(@budget, heading_id: heading.to_param),
                      class: heading.to_param == @heading.to_param ? 'active' : '' %>
        </li>
      <% end %>
    </ul>
  </div>

  <span class="float-right"><%= link_to t("budgets.results.show_all_link"), "#", class: "js-toggle-link button hollow margin-bottom", data: {'toggle-selector' => '.js-discarded', 'toggle-text' => t("budgets.results.hide_discarded_link")} %></span>


  <%= render 'results_table', results_type: :compatible,
                              title: @heading.name,
                              heading_price: @heading.price,
                              investments: @investments.compatible %>

  <% if @investments.incompatible.present? %>
    <%= render 'results_table', results_type: :incompatible,
                                title: t("budgets.results.incompatibles"),
                                heading_price: @heading.price,
                                investments: @investments.incompatible %>
  <% end %>
</div>
