<h1>Quadro de Aulas</h1>

<table class="info-table">
  <thead>
    <tr class="info-header">
      <th><strong><%= t('lessons_boards.index.unity') %></strong></th>
      <th><strong><%= t('lessons_boards.index.grade') %></strong></th>
      <th><strong><%= t('lessons_boards.index.classroom') %></strong></th>
      <th><strong><%= t('lessons_boards.form.period') %></strong></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><%= @lesson_board.classrooms_grade.classroom.unity.name %></td>
      <td><%= @lesson_board.classrooms_grade.grade.description %></td>
      <td><%= @lesson_board.classrooms_grade.classroom.description %></td>
      <td><%= Periods.translate(Periods.key_for(@lesson_board.period.to_s)) %></td>
    </tr>
  </tbody>
</table>

<table class="lessons-table">
  <thead>
    <tr>
      <th style="width: 10%;">Nº Aula</th>
      <% Workdays.translations.each do |weekday| %>
        <th><%= weekday %></th>
      <% end %>
    </tr>
  </thead>
  <tbody>
    <% @lesson_board.lessons_board_lessons.each do |lesson| %>
      <tr>
        <td><%= lesson.lesson_number %></td>
        <% Workdays.list.each do |weekday| %>
          <td>
            <% lesson_weekday = lesson.lessons_board_lesson_weekdays.find { |lwl| lwl.weekday == weekday } %>
            <% if lesson_weekday&.teacher_discipline_classroom.present? %>
              <%= lesson_weekday.teacher_discipline_classroom.teacher.name %> -
              <%= lesson_weekday.teacher_discipline_classroom.discipline.description %>
            <% else %>
              -
            <% end %>
          </td>
        <% end %>
      </tr>
    <% end %>
  </tbody>
</table>
