<%= form_for(@track) do |f| %>
<div class="form-group">
  <% if @track.errors.any? %>
    <div class="alert alert-danger %>">
      <p><strong>Track could not be saved.</strong></p>
      <ul>
      <% @track.errors.each do |error| -%>
        <li><%= error.attribute.to_s.humanize %>: <%= error.message %></li>
      <% end -%>
      </ul>
    </div>
  <% end %>
</div>

<div class="form-group">
  <div class="row">
    <div class="col">
      <%= f.label :name, "Name" %>
      <%= f.text_field :name, class: "form-control" %>
    </div>
  </div>
</div>

<div class="form-group">
  <div class="row">
    <div class="col">
      <%= f.label :short_name, "Short name" %>
      <%= f.text_field :short_name, class: "form-control" %>
    </div>
    <div class="col">
      <%= f.label :code, "Code" %>
      <%= f.text_field :code, class: "form-control" %>
    </div>
    <div class="col"></div>
  </div>

</div>

<div class="form-group">
  <div class="row">
    <%
      @aeics, aeics2 = @aeics.each_slice( (@aeics.size/2.0).round ).to_a if @aeics.size > 10
    %>
    <div class="col">
      <%= f.label :aeic, "AEiCs" %>
      <%= f.collection_check_boxes(:aeic_ids, @aeics, :id, :full_name)  do |b|
            b.label(class: "label-container-check-box") { b.check_box(class: "form-check-inline") + b.text }
          end %>
    </div>

    <div class="col">
      <br>
      <%= f.collection_check_boxes(:aeic_ids, aeics2, :id, :full_name)  do |b|
            b.label(class: "label-container-check-box") { b.check_box(class: "form-check-inline") + b.text }
          end if aeics2 %>
    </div>
    <div class="col"></div>
  </div>
</div>

<div class="form-actions">
  <%= f.submit class: "btn paper-submit" %>
</div>
<% end %>
