{# LIBRARIES #}
{{ attach_library('ui_patterns/tl_event_content.tl_event_content_lib') }}

{# TEMPLATE #}
{% include "@organisms/tm-event/tl-event-content/partials/tl-top-section.twig" %}

{% if schedules %}
  {% if schedules|length > 1 %}
    {% set accordion_items = [] %}
    {% for schedule in schedules %}
      {% set item = {
        'pid': 'tl_event_schedules_accordion',
        'aiid': schedule.place_id,
        'label': schedule.place_name,
        'content': schedule.content,
      } %}
      {% set accordion_items = accordion_items|merge([item]) %}
    {% endfor %}
    {% set schedules_accordion = {
      'pid': 'tl_event_schedules_accordion',
      'wrapper_class': 'acw-a mb-3',
      'items': accordion_items,
    } %}

    <h2><i class="fas fa-map-marker-alt event-icon"></i> Event Locations</h2>
    {{ pattern('bs-accordion-items', schedules_accordion, 'aci_a') }}
  {% else %}
    <h2><i class="fas fa-map-marker-alt event-icon"></i> Event Location</h2>
    {{ schedules[0] }}
  {% endif %}
{% endif %}