adds booth_assignment show with officers and recounts info

This commit is contained in:
Juanjo Bazán
2017-01-04 21:00:36 +01:00
parent 2bd6e121c7
commit 70b86170a2
10 changed files with 127 additions and 105 deletions

View File

@@ -0,0 +1,73 @@
<%= 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>
<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>
<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_by_system") %></th>
</tr>
</thead>
<tbody>
<% @booth_assignment.recounts.sort_by{|r| r.date}.each do |recount| %>
<tr id="recount_<%= recount.id %>" class="<%= 'count-error' if recount.count != 0 %>">
<td><%= l recount.date.to_date %></td>
<td class="text-center" title="<%= recount.officer_assignment.officer.name %>"><%= recount.count %></td>
<td class="text-center">0</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
</div>
</div>

View File

@@ -3,92 +3,10 @@
<div class="clear"></div>
<h2 class="inline-block">
Poll 3: <%= @booth.name %>
<%= @booth.name %>
</h2>
<p>
<strong><%= t("admin.booths.show.location") %></strong>:
<%= @booth.location %>
</p>
<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 "#tab-officers" do %>
Presidentes de mesa
<% end %>
</li>
<li class="tabs-title">
<%= link_to "#tab-count" do %>
Recuentos
<% end %>
</li>
</ul>
<div class="tabs-panel is-active" id="tab-officers">
<h3>Lista de presidentes de mesa</h3>
<div class="small-12 medium-6 large-4">
<select>
<option>Seleccionar fecha</option>
</select>
</div>
<table>
<thead>
<tr>
<th>Fecha</th>
<th>Presidente de mesa</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>13/02/2016</td>
<td>Clemente Padilla Otero</td>
<td>user5@consul.dev</td>
</tr>
<tr>
<td>13/02/2016</td>
<td>Ana Luisa Ceja Benítez</td>
<td>user7@consul.dev</td>
</tr>
<tr>
<td>14/02/2016</td>
<td>Clemente Padilla Otero</td>
<td>user5@consul.dev</td>
</tr>
</tbody>
</table>
</div>
<div class="tabs-panel" id="tab-count">
<h3>Lista de recuentos</h3>
<table>
<thead>
<tr>
<th>Fecha</th>
<th class="text-center">Votos (Presidente de mesa)</th>
<th class="text-center">Votos (Admin)</th>
</tr>
</thead>
<tbody>
<tr>
<td>13/02/2016</td>
<td class="text-center">320</td>
<td class="text-center">320</td>
</tr>
<tr class="count-error">
<td>14/02/2016</td>
<td class="text-center">160</td>
<td class="text-center">140</td>
</tr>
<tr>
<td>15/02/2016</td>
<td class="text-center">226</td>
<td class="text-center">226</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@@ -1,6 +1,6 @@
<h3><%= t("admin.polls.show.booths_title") %></h3>
<% if @poll.booths.empty? %>
<% if @poll.booth_assignments.empty? %>
<div class="callout primary margin-top">
<%= t("admin.polls.show.no_booths") %>
</div>
@@ -12,19 +12,19 @@
<th class="text-center"><%= t("admin.polls.show.table_assignment") %></th>
</thead>
<tbody>
<% @poll.booths.each do |booth| %>
<tr id="booth_<%= booth.id %>" class="booth">
<% @poll.booth_assignments.each do |booth_assignment| %>
<tr id="<%= dom_id(booth_assignment) %>" class="booth">
<td>
<strong>
<%= link_to booth.name, admin_booth_path(booth) %>
<%= link_to booth_assignment.booth.name, admin_poll_booth_assignment_path(@poll, booth_assignment) %>
</strong>
</td>
<td>
<%= booth.location %>
<%= booth_assignment.booth.location %>
</td>
<td class="text-center">
<%= link_to t("admin.polls.show.remove_booth"),
admin_booth_assignment_path(poll: @poll, booth: booth),
admin_booth_assignment_path(booth_assignment),
method: :delete,
class: "button hollow alert" %>
</td>