<%= render "admin/shared/globalize_locales", resource: @poll %>

<%= translatable_form_for [:admin, @poll] do |f| %>
  <%= render "shared/errors", resource: @poll %>

  <div class="clear">
    <div class="small-12 medium-6 column">
      <%= f.text_field :starts_at,
                        value: @poll.starts_at.present? ? l(@poll.starts_at.to_date) : nil,
                        class: "js-calendar-full" %>
    </div>

    <div class="small-12 medium-6 column">
      <%= f.text_field :ends_at,
                        value: @poll.ends_at.present? ? l(@poll.ends_at.to_date) : nil,
                        class: "js-calendar-full" %>
    </div>
  </div>


  <%= f.translatable_fields do |translations_form| %>
    <div class="small-12 medium-6 column">
      <%= translations_form.text_field :name %>
    </div>

    <div class="small-12 column">
      <%= translations_form.text_area :summary, rows: 4 %>
    </div>

    <div class="small-12 column">
      <%= translations_form.text_area :description, rows: 8 %>
    </div>
  <% end %>

  <div class="small-12 column">
    <%= render 'images/admin_image', imageable: @poll, f: f %>
  </div>

  <div class="clear">
    <div class="small-6 medium-6 column">
      <%= f.check_box :geozone_restricted, data: { checkbox_toggle: "#geozones" } %>
    </div>
  </div>

  <div id="geozones" style="<%= @poll.geozone_restricted? ? '' : 'display:none' %>">
    <div class="row">
      <%= f.collection_check_boxes(:geozone_ids, @geozones, :id, :name) do |b| %>
        <div class="small-6 medium-3 column">
          <%= b.label do %>
            <%= b.check_box + b.text %>
          <% end %>
        </div>
      <% end %>
    </div>
  </div>

  <div class="clear">
    <div class="small-12 medium-4 large-2 column">
      <%= f.submit t("admin.polls.#{admin_submit_action(@poll)}.submit_button"),
                   class: "button success expanded margin-top" %>
    </div>
  </div>
<% end %>
