Files
grecia/app/views/admin/poll/booth_assignments/show.html.erb
2017-01-30 20:42:30 +01:00

88 lines
3.5 KiB
Plaintext

<%= link_to admin_poll_path(@poll, anchor: 'tab-booths') do %>
<span class="icon-angle-left"></span>
<%= @poll.name %>
<% end %>
<h2><%= @booth_assignment.booth.name %></h2>
<% if @booth_assignment.booth.location.present? %>
<p>
<strong><%= t("admin.poll_booth_assignments.show.location") %></strong>:
<%= @booth_assignment.booth.location %>
</p>
<% end %>
<div class="tabs-content" data-tabs-content="booths-tabs">
<ul class="tabs" data-tabs id="booths-tabs">
<li class="tabs-title is-active">
<%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %>
</li>
<li class="tabs-title">
<%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %>
</li>
</ul>
<div class="tabs-panel is-active" id="tab-officers">
<% if @booth_assignment.officers.empty? %>
<div class="callout primary margin-top">
<%= t("admin.poll_booth_assignments.show.no_officers") %>
</div>
<% else %>
<h3><%= t("admin.poll_booth_assignments.show.officers_list") %></h3>
<table id="officers_list">
<tbody>
<% @booth_assignment.officers.uniq.each do |officer| %>
<tr id="officer_<%= officer.id %>" class="officer">
<td><%= link_to officer.name, admin_officer_assignments_path(officer: officer, poll: @poll) %></td>
<td><%= officer.email %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
<div class="tabs-panel" id="tab-recounts">
<% if @booth_assignment.recounts.empty? %>
<div class="callout primary margin-top">
<%= t("admin.poll_booth_assignments.show.no_recounts") %>
</div>
<% else %>
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
<table id="recounts_list">
<thead>
<tr>
<th><%= t("admin.poll_booth_assignments.show.date") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_by_officer") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_final") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_by_system") %></th>
</tr>
</thead>
<tbody>
<% (@poll.starts_at.to_date..@poll.ends_at.to_date).each do |voting_date| %>
<% recount = recount_for_date(@booth_assignment.recounts, voting_date) %>
<% final_recount = final_recount_for_date(@booth_assignment.final_recounts, voting_date) %>
<% system_count = @voters_by_date[voting_date].present? ? @voters_by_date[voting_date].size : 0 %>
<tr id="recounting_<%= voting_date.strftime('%Y%m%d') %>">
<td><%= l voting_date %></td>
<% if recount.present? %>
<td class="text-center <%= 'count-error' if recount.count != system_count %>" title="<%= recount.officer_assignment.officer.name %>"><%= recount.count %></td>
<% else %>
<td class="text-center" title=""> - </td>
<% end %>
<% if final_recount.present? %>
<td class="text-center <%= 'count-error' if final_recount.count != system_count %>" title="<%= final_recount.officer_assignment.officer.name %>"><%= final_recount.count %></td>
<% else %>
<td class="text-center" title=""> - </td>
<% end %>
<td class="text-center"><%= system_count %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
</div>