adds poll shift management to admin
This commit is contained in:
64
app/views/admin/poll/officer_assignments/index.html.erb
Normal file
64
app/views/admin/poll/officer_assignments/index.html.erb
Normal file
@@ -0,0 +1,64 @@
|
||||
<%= link_to @poll.name, admin_poll_path(@poll, anchor: 'tab-officers') %>
|
||||
<h2><%= @officer.name %> - <%= @officer.email %></h2>
|
||||
|
||||
<%= form_tag(admin_officer_assignments_path, {id: "officer_assignment_form"}) do %>
|
||||
<fieldset class="fieldset">
|
||||
<legend><%= t("admin.poll_officer_assignments.index.new_assignment") %></legend>
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.poll_officer_assignments.index.date") %></label>
|
||||
<%= select_tag :date,
|
||||
poll_dates_select_options(@poll),
|
||||
{ prompt: t("admin.poll_officer_assignments.index.select_date"),
|
||||
label: false } %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label><%= t("admin.poll_officer_assignments.index.booth") %></label>
|
||||
<%= select_tag :booth_id,
|
||||
poll_booths_select_options(@poll),
|
||||
{ prompt: t("admin.poll_officer_assignments.index.select_booth"),
|
||||
label: false } %>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<%= hidden_field_tag :officer_id, @officer.id %>
|
||||
<%= hidden_field_tag :poll_id, @poll.id %>
|
||||
<%= submit_tag t("admin.poll_officer_assignments.index.add_assignment"),
|
||||
class: "button expanded hollow margin-top" %>
|
||||
</div>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if @officer_assignments.empty? %>
|
||||
<div class="callout primary margin-top">
|
||||
<%= t("admin.poll_officer_assignments.index.no_assignments") %>
|
||||
</div>
|
||||
<% else %>
|
||||
<h3><%= t("admin.poll_officer_assignments.index.assignments") %></h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.poll_officer_assignments.index.date") %></th>
|
||||
<th colspan="2"><%= t("admin.poll_officer_assignments.index.booth") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @officer_assignments.each do |officer_assignment| %>
|
||||
<tr id="<%= dom_id officer_assignment %>">
|
||||
<td><%= l officer_assignment.date.to_date %></td>
|
||||
<td><%= booth_name_with_location(officer_assignment.booth_assignment.booth) %></td>
|
||||
<td class="text-right">
|
||||
<%= link_to t("admin.poll_officer_assignments.index.remove_assignment"),
|
||||
admin_officer_assignment_path(officer_assignment),
|
||||
method: :delete,
|
||||
class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<tr id="officer_<%= officer.id %>" class="officer">
|
||||
<td>
|
||||
<strong>
|
||||
<%= officer.name %>
|
||||
<%= link_to officer.name, admin_officer_assignments_path(officer: officer, poll: @poll) %>
|
||||
</strong>
|
||||
</td>
|
||||
<td>
|
||||
@@ -25,66 +25,4 @@
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<!-- Assign booths to officer -->
|
||||
<h2>Clemente padilla Otero</h2>
|
||||
<p>user2@consul.dev</p>
|
||||
|
||||
|
||||
<fieldset class="fieldset">
|
||||
<legend>Nuevo turno</legend>
|
||||
<div class="small-12 medium-4 column">
|
||||
<label>Fecha</label>
|
||||
<select>
|
||||
<option>Seleccionar día</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<label>Urna</label>
|
||||
<select>
|
||||
<option>Seleccionar urna</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column">
|
||||
<input type="submit" value="Añadir turno" class="button expanded hollow margin-top">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<a class="float-right">Añadir nuevo turno</a>
|
||||
|
||||
<h3>Turnos asignados</h3>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Fecha</th>
|
||||
<th colspan="2">Urna</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>13/02/2016</td>
|
||||
<td>Urna Moncloa</td>
|
||||
<td class="text-right">
|
||||
<%= link_to "Eliminar turno", "#", class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>14/02/2016</td>
|
||||
<td>Urna Moncloa</td>
|
||||
<td class="text-right">
|
||||
<%= link_to "Eliminar turno", "#", class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>15/02/2016</td>
|
||||
<td>Urna Chamartín</td>
|
||||
<td class="text-right">
|
||||
<%= link_to "Eliminar turno", "#", class: "button hollow alert" %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- /. Assign booths to officer -->
|
||||
<% end %>
|
||||
@@ -14,7 +14,15 @@
|
||||
<%= user.email %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
|
||||
<% if @poll.officer_ids.include?(user.poll_officer.id) %>
|
||||
<%= link_to t("admin.polls.show.edit_officer_assignments"),
|
||||
admin_officer_assignments_path(poll: @poll, officer: user.poll_officer),
|
||||
class: "button hollow alert" %>
|
||||
<% else %>
|
||||
<%= link_to t("admin.polls.show.add_officer_assignments"),
|
||||
admin_officer_assignments_path(poll: @poll, officer: user.poll_officer),
|
||||
class: "button hollow" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user