<script>
  if(document.querySelectorAll("#orbit-bar").length==0) location.reload();
</script>

<table class="table main-list">
  <thead>
    <tr class="sort-header">
      <% @table_fields.each do |f| %>
        <% if f == 'seminar.title' %>
          <th class='span4'><%= t(f)%></th>
        <% else %>
          <%= thead(f) %>
        <% end %>
      <% end %>
    </tr>
  </thead>
  <tbody>
    <% @seminars.each do |seminar| %>
      <tr>
        <td><%= seminar.category.title %></td>
        <td>
            <a href="<%= (seminar.enable_custom_template ? (page_for_seminar(seminar) + "/home") : (page_for_seminar(seminar) + "?method=show_data")) %>" target="_blank"><%= seminar.title %></a>
          <div class="quick-edit">
            <ul class="nav nav-pills">
              <% if admin_for_seminar(seminar) %>
                <li><a href="/admin/seminars/<%=seminar.id.to_s%>/edit"><%= t(:edit) %></a></li>
                <li><a href="/admin/seminars/<%=seminar.id.to_s%>/copy"><%= t("seminar.copy") %></a></li>
                <li><a href="<%= admin_seminar_item_contents_path(:seminar_main_id=>seminar.id.to_s) %>"><%= t('seminar.set_seminar_item_content') %></a></li>
                <li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup_field"><%= t('seminar.set_seminar_signup_field') %></a></li>
                <li><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_submission_field"><%= t('seminar.set_seminar_submission_field') %></a></li>
                <li><a href="<%=reviewer_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.reviewer_setting') %></a></li>
                <li><a href="<%=template_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.template_setting') %></a></li>
                <li><a href="<%=sub_page_setting_admin_seminar_path(seminar.id)%>"><%= t('seminar.sub_page_setting') %></a></li>
                <li><a href="<%=admin_custom_announcements_path + "/seminar-#{seminar.uid}"%>"><%= t('seminar.announcement_manage') %>(<%=seminar.annc_count%>)</a></li>
                <li><a href="<%=admin_custom_galleries_path + "/seminar-#{seminar.uid}"%>"><%= t('seminar.album_manage') %>(<%=seminar.album_count%>)</a></li>
                <li><a href="#" class="delete text-error" rel="/admin/seminars/<%=seminar.id.to_s%>"><%= t(:delete_) %></a></li>
              <% end %>
            </ul>
          </div>
        </td>
        <td><%= SeminarMain.time_range(seminar.seminar_start_date, seminar.seminar_end_date) %></td>
        <td><%= SeminarMain.time_range(seminar.signup_start_date, seminar.signup_end_date) %></td>
        <td><a href="/admin/seminars/<%=seminar.id.to_s%>/seminar_signup">
          <% @seminar_review = seminar.seminar_reviews.where(:reviewer_id => current_user.member_profile_id.to_s).first %>
          <% if @seminar_review.present? && !@can_edit %>
            <%= @seminar_review.get_all_seminar_signup_ids.count %>
          <% else %>
            <%= seminar.seminar_signups.count %>
          <% end %>
          </a></td>
        <td>
          <% if can_see_seminar_signup(seminar) %>
            <a href="/admin/seminars/<%=seminar.id.to_s%>/export?format=xlsx" target="_blank"><%= t('seminar.export') %></a>
          <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<%=
  content_tag :div, class: "bottomnav clearfix" do
    content_tag :div, paginate(@seminars), class: "pagination pagination-centered"
  end
%>