<%= simple_form_for @teaching_plan, html: { class: 'smart-form' } do |f| %>
  <%= f.error_notification %>

  <fieldset>
    <div class="row">
      <div class="col col-sm-3">
        <%= f.input :year, disabled: true %>
      </div>
    </div>

    <div class="row">
      <div class="col col-sm-4">
        <%= f.association :unity, as: :select2, elements: @unities, input_html: { value: @teaching_plan.unity_id } %>
      </div>

      <div class="col col-sm-4">
        <%= f.association :classroom, as: :select2, elements: @classrooms %>
      </div>

      <div class="col col-sm-4">
        <%= f.association :discipline, as: :select2, elements: @disciplines %>
      </div>
    </div>

    <div class="row">
      <div class="col col-sm-4">
        <%= f.association :school_term_type, as: :select2,
                          elements: SchoolTermType.to_select2(
                            current_user.current_school_year,
                            current_user.current_unity_id
                          ).to_json %>
      </div>

      <div id="school_term_type" class="col col-sm-4">
        <%= f.association :school_term_type_step, as: :select2, elements: [], required: true %>
      </div>
    </div>

    <div class="row">
      <div class="col col-sm-12">
        <%= f.input :objectives %>
      </div>
    </div>

    <div class="row">
      <div class="col col-sm-12">
        <%= f.input :content %>
      </div>
    </div>

    <% @methodology_translation = Translation.find_by(key: 'navigation.methodology_by_discipline', group: 'teaching_plans').translation %>
    <% @evaluation_translation = Translation.find_by(key: 'navigation.avaliation_by_discipline', group: 'teaching_plans').translation %>
    <% @references_translation = Translation.find_by(key: 'navigation.references_by_discipline', group: 'teaching_plans').translation %>

    <div class="row">
      <div class="col col-sm-12">
        <%= f.input :methodology, label: @methodology_translation%>
      </div>
    </div>

    <div class="row">
      <div class="col col-sm-12">
        <%= f.input :evaluation, label: @evaluation_translation %>
      </div>
    </div>

    <div class="row">
      <div class="col col-sm-12">
        <%= f.input :references, label: @references_translation %>
      </div>
    </div>
  </fieldset>

  <footer>
    <%= link_to 'Voltar', teaching_plans_path, class: 'btn btn-default' %>

    <% if @teaching_plan.persisted? %>
      <%= link_to 'Histórico', history_teaching_plan_path(@teaching_plan), class: 'btn btn-info' %>
    <% end %>

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