<%= stylesheet_link_tag "school_calendar_events" %>

<div class="widget-body no-padding">
  <%= simple_form_for :filter, { url: school_calendar_school_calendar_events_path, method: :get, html: { class: 'filterable_search_form' } } do |f| %>
  <div class="table-responsive">
    <table class="table table-bordered table-only-inner-bordered table-striped table-condensed table-hover" id="resources">
      <thead>
        <tr>
          <th scope="col" style="width: 180px"><%= f.input :by_date, as: :date, label: false, placeholder: t('.by_date') %></th>
          <th scope="col"><%= f.input :by_description, label: false, placeholder: t('.by_description') %></th>
          <th scope="col"><%= f.input :by_type, label: false, as: :select2, elements: EventTypes.to_select.to_json, placeholder: t('.by_type') %></th>
          <th scope="col"><%= f.input :by_grade, as: :select2, elements: grades, label: false, placeholder: t('.by_grade') %></th>
          <th scope="col"><%= f.input :by_classroom, label: false, placeholder: t('.by_classroom') %></th>
          <th scope="col" class="actions" style="width: 160px;">
            <div class="btn-group">
              <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
                <%= t('.new_html') %> <span class="caret"></span>
              </button>
              <ul class="dropdown-menu">
                <% EventCoverageType.to_a.each do |t, v| %>
                  <li>
                    <%= link_to t, new_school_calendar_school_calendar_event_path(coverage: v) %>
                  </li>
                <% end %>
              </ul>
            </div>
          </th>
        </tr>
        <tr>
          <th scope="col"><%= SchoolCalendarEvent.human_attribute_name :duration %></th>
          <th scope="col"><%= SchoolCalendarEvent.human_attribute_name :description %></th>
          <th scope="col"><%= SchoolCalendarEvent.human_attribute_name :event_type %></th>
          <th scope="col"><%= SchoolCalendarEvent.human_attribute_name :grade %></th>
          <th scope="col"><%= SchoolCalendarEvent.human_attribute_name :classroom %></th>
          <th scope="col"></th>
        </tr>
      </thead>

      <%= render 'resources' %>
      <tfoot id="paginator" class="remote">
        <td colspan="6">
          <div id="page_entries_info" class="pull-left hidden-xs">
            <%= page_entries_info @school_calendar_events %>
          </div>
          <div class="pull-right">
            <%= paginate @school_calendar_events %>
          </div>
        </td>
      </tfoot>
    </table>
  </div>
  <% end %>
</div>
