<% content_for :js do %>
  <%= javascript_include_tag 'views/absence_justification_report/form' %>
<% end %>

<%= simple_form_for @absence_justification_report_form, url: absence_justification_report_path, method: :post, html: { class: "smart-form", target: '_blank' } do |f| %>
  <%= f.error_notification unless @absence_justification_report_form.errors[:base].any? %>
  <div class="alert alert-danger <%= 'hidden' unless @absence_justification_report_form.errors[:base].any? %>">
    <i class="fa fa-exclamation-circle fa-fw"></i>
    <%= @absence_justification_report_form.errors[:base].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: @absence_justification_report_form.classroom_id } %>
      </div>
    </div>

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

    <div class="col col-sm-4">
      <%= f.input :author, as: :select2, elements: AbsenceJustificationAuthors.to_select.to_json %>
    </div>

    <%= hidden_field_tag :teacher_id, current_teacher %>
  </fieldset>

  <footer>
    <%= f.submit 'Imprimir', class: 'btn btn-primary' %>
  </footer>
<% end %>
