<% content_for :js do %>
  <%= javascript_include_tag 'views/general_configurations/edit' %>
<% end %>

<div class="widget-body no-padding">
  <%= simple_form_for @general_configuration,
  url: general_configurations_path, method: :patch, html: { class: "smart-form" } do |f| %>
    <%= f.error_notification %>

    <fieldset>
      <div class="row">
        <div class="col col-sm-4">
          <%= f.input :copyright_name %>
        </div>
        <div class="col col-sm-4">
          <%= f.input :support_url %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :security_level do %>
            <%= f.input_field :security_level, collection: SecurityLevels %>
            <i></i>
          <% end %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :allows_after_sales_relationship do %>
            <%= f.input_field :allows_after_sales_relationship, collection: AfterSaleRelationshipOptions %>
            <i></i>
          <% end %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :require_daily_activities_record do %>
            <%= f.input_field :require_daily_activities_record, collection: RequireDailyActivitiesRecordTypes %>
            <i></i>
          <% end %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :display_header_on_all_reports_pages, label: false, inline_label: true %>
        </div>
        <div class="col col-sm-6">
          <%= f.input :show_school_term_recovery_in_exam_record_report, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :show_daily_activities_in_knowledge_area_content_record_report,
                        label: false,
                        inline_label: true %>
        </div>
        <div class="col col-sm-6">
          <%= f.input :display_daily_activies_log, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :max_descriptive_exam_character_count, as: :integer %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :allows_copy_experience_fields_in_lesson_plans, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :allows_copy_lesson_plans_to_other_grades, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :remove_lesson_plan_objectives, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :show_experience_fields, label: false, inline_label: true %>
        </div>
      </div>

      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :show_inactive_enrollments, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :show_percentage_on_attendance_record_report, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :do_not_send_justified_absence, as: :boolean, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row <%= 'hidden' if Rails.application.secrets[:STUDENT_DOMAIN].blank? %>">
        <div class="col col-sm-6">
          <%= f.input :create_users_for_students_when_synchronize, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :notify_consecutive_or_alternate_absences, as: :boolean, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :type_of_teaching, as: :boolean, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :allow_class_number_on_content_records, as: :boolean, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row">
        <div class="col col-sm-6">
          <%= f.input :group_children_education, as: :boolean, label: false, inline_label: true %>
        </div>
      </div>
      <div class="row margin-top-10" id="types_of_teaching_container">
        <div class='col col-xs-12 col-sm-12 col-md-6'>
          <div style="float:right;">
        </div>
        <%= f.input :types_of_teaching, as: :select2, elements: TypesOfTeaching.to_select(false).to_json, multiple: true, required: false,
            input_html: { value: f.object.types_of_teaching.join(','), data: { without_json_parser: true } }  %>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-6">
          <%= f.input :days_to_expire_password do %>
            <%= f.input_field :days_to_expire_password,
              rel: 'popover-hover',
              :'data-placement' => 'bottom',
              :'data-content' => t('activerecord.attributes.general_configuration.days_to_expire_password_label_hint'),
              :'data-toggle'=> 'popover',
              maxlength: "3" %>
          <% end %>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-6">
          <%= f.input :days_to_disable_access do %>
            <%= f.input_field :days_to_disable_access,
              rel: 'popover-hover',
              :'data-placement' => 'bottom',
              :'data-content' => t('activerecord.attributes.general_configuration.days_to_expire_password_label_hint'),
              :'data-toggle'=> 'popover',
              maxlength: "3" %>
          <% end %>
        </div>
      </div>
      <fieldset id="notify_consecutive_or_alternate_absences_fields" class="fieldset">
        <legend><%= t('.infrequency_tracking_configurations') %></legend>
          <div class="row">
            <div class="col col-sm-6">
              <%= f.input :max_consecutive_absence_days, as: :integer %>
            </div>
          </div>
          <div class="row">
            <div class="col col-sm-6">
              <%= f.input :max_alternate_absence_days, as: :integer %>
            </div>
            <div class="col col-sm-6">
              <%= f.input :days_to_consider_alternate_absences, as: :integer %>
            </div>
          </div>
      </fieldset>
      <div class="row">
        <div class="col col-sm-4">
          <%= f.association :employees_default_role, as: :select2, elements: Role.ordered %>
        </div>
      </div>

      <fieldset class="fieldset">
        <legend><%= t('.profile_configurations') %></legend>
        <div class="row">
          <div class="col col-sm-6">
            <%= f.input :grouped_teacher_profile, label: false, inline_label: true %>
          </div>
        </div>
      </fieldset>
    </fieldset>

    <footer>
      <% if @general_configuration.persisted? %>
        <%= link_to 'Histórico', history_general_configurations_path, class: 'btn btn-info' %>
      <% end %>

      <button type="submit" class="btn btn-primary">
        Salvar
      </button>
    </footer>
  <% end %>
</div>
