Files
nairobi/app/components/admin/poll/shifts/form_component.html.erb
Javi Martín ddaf320d8a Add proper labels to shift date selectors
We were using one label for both date selectors, but it wasn't
associated with any of them.

So we're now rendering one label per control and, just like we only show
one of these date selectors at a time, we're only showing one label at a
time.
2024-11-12 15:58:26 +01:00

50 lines
2.0 KiB
Plaintext

<%= form_for shift, as: :shift, url: admin_booth_shifts_path do |f| %>
<%= render "shared/errors", resource: shift %>
<fieldset class="fieldset">
<legend>
<%= t("admin.poll_shifts.new.new_shift") %>
</legend>
<div class="small-12 medium-3 column highlight padding">
<strong><%= t("admin.poll_shifts.new.officer") %></strong>
<br><%= officer.name %>
<%= f.hidden_field :officer_id, value: officer.id %>
</div>
<div class="small-12 medium-3 column">
<%= f.select :task,
Poll::Shift.tasks.map { |k, v| [t("admin.poll_shifts.#{k}"), k] },
{ prompt: t("admin.poll_shifts.new.select_task") },
class: "js-poll-shifts" %>
</div>
<div class="small-12 medium-3 column">
<%= label_tag :shift_date_vote_collection_date,
t("admin.poll_shifts.new.date"),
class: "js-shift-vote-collection-dates" %>
<%= select "shift[date]", "vote_collection_date",
options_for_select(shift_vote_collection_dates),
{ prompt: voting_polls.present? ? t("admin.poll_shifts.new.select_date") : t("admin.poll_shifts.new.no_voting_days") },
class: "js-shift-vote-collection-dates" %>
<%= label_tag :shift_date_recount_scrutiny_date,
t("admin.poll_shifts.new.date"),
class: "js-shift-recount-scrutiny-dates",
hidden: "hidden" %>
<%= select "shift[date]", "recount_scrutiny_date",
options_for_select(shift_recount_scrutiny_dates),
{ prompt: t("admin.poll_shifts.new.select_date") },
class: "js-shift-recount-scrutiny-dates",
hidden: "hidden" %>
</div>
<%= f.hidden_field :booth_id, value: booth.id %>
<div class="small-12 medium-3 column">
<%= f.submit t("admin.poll_shifts.new.add_shift"),
class: "button expanded margin-top" %>
</div>
</fieldset>
<% end %>