{#
/**
 * @file
 * Default class sessions template implementation.
 *
 * Available variables:
 * - sessions_short_list: Short list of class sessions.
 * - session_instance_row: Class session items data.
 *   - location: Location name of class item.
 *   - day_of_week: Day name of class item.
 *   - formatted_date: Formatted date of class item.
 *   - time_start: Start time of the class item.
 *   - time_to: End time of the class item.
 *   - ticket_required: Ticket required.
 *   - in_membership: Included in membership.
 *   - age_min: Minimum age.
 *   - age_max: Maximum age.
 *   - registration_link: Link to registration page.
 *
 * @ingroup themeable
 */
#}

<div class="container">
  <div class="class-page-other-sessions row">
    <!-- Schedule -->
    <div class="w-100">
      <h2>{{ 'Class Times'|t }}</h2>
        {% if sessions_short_list is not empty %}
          <div class="class__session-instances-short_list">
            <ul>
              {% for sessions_short_info_list_item in sessions_short_list %}
                <li>{{ sessions_short_info_list_item }}</li>
              {% endfor %}
            </ul>
          </div>
        {% endif %}
      <div class="class__session-instances table table-hover">
        <table class="class__session-instances-list">
          <tbody>
          {% if session_instances_rows is not empty %}
            {% for session_instance_row in session_instances_rows %}
              <tr class="class__session-instance">
                {# Include location if not a current query condition. #}
                {% if conditions_location is empty %}
                  <td class="location">{{ session_instance_row.location }}</td>
                {% endif %}
                <td class="days">
                  <span>{{ session_instance_row.day_of_week }}, {{ session_instance_row.formatted_date }}</span><br/>
                  <span>{{ session_instance_row.time_start }} - {{ session_instance_row.time_to }}</span>
                </td>
                <td class="details">
                  {% if session_instance_row.registration %}
                    <span class="badge badge-success font-weight-light"><i class="fas fa-desktop"></i> {{ "Online registration"|t }}</span>
                    {% if session_instance_row.ticket_required or session_instance_row.in_membership %}
                      </br>
                    {% endif %}
                  {% endif %}
                  {% if session_instance_row.ticket_required %}
                    <span class="badge badge-warning font-weight-light"><i class="fas fa-ticket-alt"></i> {{ "Ticket required"|t }}</span>
                    {% if session_instance_row.in_membership %}
                      </br>
                    {% endif %}
                  {% endif %}
                  {% if session_instance_row.in_membership %}
                    <span
                        class="in-membership">{{ "Included in membership"|t }}</span>
                  {% endif %}
                </td>
                <td class="age_range">
                  {% if session_instance_row.age_min is not empty and session_instance_row.age_max is not empty %}
                    <span
                        class="age-range">{{ "Ages"|t }} {{ session_instance_row.age_min }}
                      - {{ session_instance_row.age_max }}</span>
                  {% elseif session_instance_row.age_min is not empty %}
                    <span
                        class="age-range">{{ "Ages"|t }} {{ session_instance_row.age_min }} {{ "and up"|t }}</span>
                  {% elseif session_instance_row.age_max is not empty %}
                    <span
                        class="age-range">{{ "Ages"|t }} {{ session_instance_row.age_max }} {{ "and under"|t }}</span>
                  {% endif %}
                </td>
                <td class="registration_link">{{ session_instance_row.registration_link }}</td>
              </tr>
            {% endfor %}

          {% else %}
            <tr>
              <td>
                {% if conditions_location is empty %}
                  <span>{{ "No sessions are available at any location."|t }}</span>
                {% else %}
                  <span>{{ "No sessions are available at this branch."|t }}</span>
                {% endif %}
              </td>
            </tr>
          {% endif %}
          </tbody>
        </table>
      </div>
    </div>
  </div>
</div>
