<div class="widget-body no-padding">
  <%= simple_form_for @attendance_record_report_form, url: attendance_record_report_path, method: :post, html: { class: 'smart-form', target: '_blank' } do |f| %>
    <div class="alert alert-danger hidden" id="exam-rule-not-found-alert">
      <i class="fa fa-exclamation-circle fa-fw"></i>
      <%= t('.exam_rule_not_found') %>
    </div>

    <%= f.error_notification unless @attendance_record_report_form.errors[:daily_frequencies].any? %>

    <div class="alert alert-danger <%= 'hidden' unless @attendance_record_report_form.errors[:daily_frequencies].any? %>">
      <i class="fa fa-exclamation-circle fa-fw"></i>
      <%= @attendance_record_report_form.errors[:daily_frequencies].first %>
    </div>

    <fieldset>
      <div class="row">
        <div class="col col-sm-4">
          <%= f.input :unity_id, as: :select2, elements: @unities, user: current_user, readonly: !current_user.admin? %>
        </div>

        <div class="col col-sm-4">
          <%= f.input :classroom_id, as: :select2, elements: @classrooms, user: current_user,
                input_html: { value: @attendance_record_report_form.classroom_id }%>
        </div>

        <div class="col col-sm-4">
          <%= f.input :period, as: :select2, elements: Periods.to_select_specific_values(false, %w[1 2 3]).to_json,
                label: "Período", readonly: @period != Periods::FULL %>
        </div>
      </div>

      <div class="row hide-when-global-absence">
        <%= f.input :current_teacher_id, as: :hidden, input_html: { value: current_teacher.try(:id) } %>

        <div class="col col-sm-4">
          <%= f.input :discipline_id, as: :select2, elements: @disciplines, user: current_user,
                classroom_id: @attendance_record_report_form.classroom_id,
                required: true, input_html: { value: @attendance_record_report_form.discipline_id } %>
        </div>

        <div class="col col-sm-4">
          <div style="float:right;">
            <a href="#" style="text-decoration:none;" id="select-all-classes"><%= t('.select_all') %></a>
            <a href="#" style="display: none;text-decoration:none;" id="deselect-all-classes"><%= t('.deselect_all') %></a>
          </div>
          <%= f.input :class_numbers, as: :select2, multiple: true, elements: number_of_classes_elements(@number_of_classes),
                label_html: { class: 'required' },
                input_html: { value: @attendance_record_report_form.class_numbers, data: { without_json_parser: true } } %>
        </div>
      </div>

      <div class="row">
        <%= f.input :school_calendar_year, as: :hidden %>

        <div class="col col-sm-4">
          <%= f.input :start_at, as: :date %>
        </div>

        <div class="col col-sm-4">
          <%= f.input :end_at, as: :date %>
        </div>

        <div class="col col-sm-4">
          <%= f.input :second_teacher_signature, as: :boolean %>
        </div>
      </div>
    </fieldset>

    <footer>
      <div class="pull-right">
        <%= f.submit 'Imprimir', class: 'btn btn-primary pull-right', id: 'send-form' %>
      </div>
    </footer>
  <% end %>
</div>
