<% content_for :page_specific_css do %>
  <%= stylesheet_link_tag "lib/main-forms" %>
  <%= stylesheet_link_tag "lib/fileupload" %>
  <%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
  <%= javascript_include_tag "lib/bootstrap-fileupload" %>
  <%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
  <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
  <%= javascript_include_tag "lib/file-type" %>
  <%= javascript_include_tag "lib/module-area" %>  
<% end %>
<%= form_for @seminar_signup_admin_setting, url: update_seminar_signup_admin_setting_admin_seminar_path, html: {class: "form-horizontal main-forms"} do |f| %>
  <h3>
    <% if @seminar %>
      <%= @seminar.title %>
    <% else %>
      <%= t("seminar.enquiry_for_applicants_display_fields_setting") %>
    <% end %> 
  </h3>
  <fieldset>
    <!-- Input Area -->
    <div class="input-area">
        <h4><%= t('seminar.display_field') %></h4>
        <% render :partial => "get_display_fields" %>
        <% max_length = 10 %>
        <% @field_name_translations.each_with_index do |trans,i|%>
          <% if i % max_length == 0 %>
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th class="span2"><%= trans %></th>
          <% else %>
                  <th class="span2"><%= trans %></th>
          <% end %>
          <% if ((i % max_length) == (max_length - 1) || i == (@field_name_translations.count - 1)) %>
                </tr>
              </thead>
              <tbody>
                  <% @field_names[((i/max_length) *max_length) ..i].each do |fn|%>
                    <td><%= check_box_tag "#{f.object_name}[display_field][]",fn , @display_field.include?(fn) %></td>
                  <% end %>
              </tbody>
            </table>
          <% end %>
        <% end %>
        <%= hidden_field_tag :id, params[:id] %>
        <%= hidden_field_tag :page, params[:page] %>
    </div>

    <!-- Form Actions -->
    <div class="form-actions">
      <%= f.submit t('submit'), class: 'btn btn-primary' %>
      <input type="hidden" name="referer_url" value="<%= get_referer_url %>">
      <%= link_to t('cancel'), seminar_signup_admin_seminar_path(params[:id]), :class=>"btn" %>  
    </div>
  </fieldset>
<% end %>