| <%= index + 1 %> |
<% student_data = custom_student_name(student, params[:dates]) %>
<%= student_data[:name] %>
|
<% absences_on_the_period = 0 %>
<% if @general_configuration.type_of_teaching == true %>
<%= form.input :type_of_teaching, as: :select2, elements: TypesOfTeaching.to_select_specific_values(false, @general_configuration.types_of_teaching).to_json,
label: false, required: false,
input_html: { value: student[:type_of_teaching], data: { without_json_parser: true, id: :type_of_teaching } } %>
|
<% end %>
<% params[:dates].each do |date| %>
<% response_data = data_additional(date, student) %>
 
<% date[:daily_frequencies].each do |daily_frequency| %>
<% date = daily_frequency.frequency_date %>
<% class_number = daily_frequency.class_number || nil %>
<% student_id = student[:student][:id] %>
<% frequency_id = "#{date.to_s.tr('-', '').rjust(10, '0')}#{class_number.to_s.rjust(10, '0')}" %>
<% daily_frequency_path = "[daily_frequency][daily_frequencies][#{frequency_id}]" %>
<% absence_justification = @absence_justifications[student_id] || {} %>
<% absence_justifications = absence_justification[date] || {} %>
<% absence_justification_student_id = absence_justifications[0] || absence_justifications[class_number] %>
<% daily_frequency_student_path = "#{daily_frequency_path}[students_attributes]" %>
<% presenter = DailyFrequencyPresenter.new(student: student, date: date, daily_frequency: daily_frequency, response_data: response_data, physical_frequencies: @physical_frequencies) %>
<% unique_id = "#{class_number.to_s.rjust(10, '0')}#{student[:student][:id].to_s.rjust(10, '0')}" %>
<%= simple_fields_for "#{daily_frequency_student_path}[#{unique_id}]",
daily_frequency_student = daily_frequency.build_or_find_by_student(student[:student][:id], default_presence: presenter.default_presence) do |f| %>
  <%= class_number %>
<%= f.hidden_field :id, value: daily_frequency_student.id %>
<%= f.hidden_field :daily_frequency_id, value: daily_frequency.id %>
<%= f.hidden_field :student_id, value: student[:student][:id] %>
<%= f.hidden_field :dependence, value: response_data[:response_tooltip] == 'Dependência' ? true : false %>
<%= f.hidden_field :active, value: response_data[:response_class] != 'inactive' ? true : false %>
<%= f.hidden_field :type_of_teaching, value: student[:type_of_teaching] %>
<%= f.hidden_field :absence_justification_student_id, class: 'hidden-justified', value: absence_justification_student_id %>
<% if absence_justification_student_id %>
<% else %>
<% if presenter.ignored? %>
<% else %>
<% end %>
<% end %>
<% if daily_frequency_student.persisted? %>
<% if response_data[:response_class] != 'inactive' %>
<% absences_on_the_period += daily_frequency_student.present ? 0 : 1 %>
<% end %>
<% end %>
<% if @general_configuration.type_of_teaching == true %>
<%= f.input :type_of_teaching, as: :select2, elements: TypesOfTeaching.to_select_specific_values(false, @general_configuration.types_of_teaching).to_json,
label: false, required: false,
input_html: { value: f.object.type_of_teaching, data: { without_json_parser: true, id: 'type_of_teaching_input' } } %>
<% end %>
<% end %>
<% end %>
|
<% end %>
<%= absences_on_the_period %>
|