Files
nairobi/app/views/officing/results/new.html.erb
Javi Martín 1632990838 Extract component to render officing results form
In a couple of commits we're going to add some styles for this form, and
it's easier to know where to add these styles when there's a component.
2025-04-03 15:00:12 +02:00

43 lines
1.4 KiB
Plaintext

<% if @officer_assignments.any? %>
<h2><%= t("officing.results.new.title", poll: @poll.name) %></h2>
<%= render Officing::Results::FormComponent.new(@poll, @officer_assignments) %>
<% else %>
<h2><%= @poll.name %></h2>
<div class="callout alert">
<%= t("officing.results.new.not_allowed") %>
</div>
<% end %>
<% if @partial_results.present? %>
<hr>
<h3><%= t("officing.results.new.results_list") %></h3>
<table>
<thead>
<th><%= t("officing.results.new.date") %></th>
<th><%= t("officing.results.new.booth") %></th>
<th>&nbsp;</th>
</thead>
<tbody>
<% results_by_booth = @partial_results.group_by(&:booth_assignment_id) %>
<% results_by_booth.keys.each do |booth_assignment| %>
<% results_by_booth[booth_assignment].group_by(&:date).keys.each do |date| %>
<tr id="results_<%= booth_assignment %>_<%= date.strftime("%Y%m%d") %>">
<td>
<%= l(date, format: :long) %>
</td>
<td>
<%= results_by_booth[booth_assignment].first.booth_assignment.booth.name %>
</td>
<td>
<%= link_to t("officing.results.new.see_results"), officing_poll_results_path(@poll, date: l(date), booth_assignment_id: booth_assignment) %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<% end %>