<%= render "shared/back_link" %>

<h2><%= t("valuation.spending_proposals.show.heading") %> <%= @spending_proposal.id %> </h2>
<h1><%= @spending_proposal.title %></h1>

<%= safe_html_with_links @spending_proposal.description %>

<% if @spending_proposal.external_url.present? %>
  <p><%= text_with_links @spending_proposal.external_url %></p>
<% end %>

<h2><%= t("valuation.spending_proposals.show.info") %></h2>

<p><strong><%= t("valuation.spending_proposals.show.by") %>:</strong>
  <%= link_to @spending_proposal.author.name, user_path(@spending_proposal.author) %>
</p>

<% if @spending_proposal.association_name.present? %>
  <p><strong><%= t("valuation.spending_proposals.show.association_name") %>:</strong>
    <%= @spending_proposal.association_name %>
  </p>
<% end %>

<p><strong><%= t("valuation.spending_proposals.show.geozone") %>:</strong>
  <%= geozone_name(@spending_proposal) %>
</p>

<p><strong><%= t("valuation.spending_proposals.show.sent") %>:</strong>
  <%= l @spending_proposal.created_at, format: :datetime %>
</p>

<h2><%= t("valuation.spending_proposals.show.responsibles") %></h2>

<p><strong><%= t("valuation.spending_proposals.show.assigned_admin") %>:</strong>
  <% if @spending_proposal.administrator.present? %>
    <%= @spending_proposal.administrator.name_and_email %>
  <% else %>
    <%= t("valuation.spending_proposals.show.undefined") %></li>
  <% end %>
</p>

<p><strong><%= t("valuation.spending_proposals.show.assigned_valuators") %>:</strong></p>
<div id="assigned_valuators">
  <ul>
    <% @spending_proposal.valuators.each do |valuator| %>
      <li><%= valuator.name_and_email %></li>
    <% end %>

    <% if @spending_proposal.valuators.empty? %>
      <li><%= t("valuation.spending_proposals.show.undefined") %></li>
    <% end %>
  </ul>
</div>

<h2><%= t("valuation.spending_proposals.show.dossier") %></h2>

<p>
  <%= link_to t("valuation.spending_proposals.show.edit_dossier"), edit_valuation_spending_proposal_path(@spending_proposal) %>
</p>

<%= render 'written_by_valuators' %>