{# LIBRARIES #}
{{ attach_library('ui_patterns/jc_dropdown.jc_base') }}
{{ attach_library('ui_patterns/jc_modal.jc_modal_lib') }}

{% set uid = uid|default('') %}
{% set pid = pid|default('') %}
{% set route_links = route_links|default([]) %}

<div class="disruptions">

  {% if route_links|length %}
    <ul class="route-links">
      {% for route_link in route_links %}
        <li>
          {% include '@atoms/tm-links/icon-bookended/icon-bookended.twig' with {
            'text': route_link.text,
            'icon_left': route_link.icon_left,
            'icon_right': route_link.icon_right,
            'url': route_link.url,
            'class': 'belinline btn btn-default'
          } %}
        </li>
      {% endfor %}
    </ul>
  {% endif %}

  {% if element.descriptions|length %}
    {% for item in element.descriptions %}
      {% include '@organisms/tm-jc/jc-modal/jc-modal-route/journey-check-description.html.twig' with {
        'description': item,
        'route': element,
        'uid': uid,
        'pid': pid,
      } only %}
    {% endfor %}
  {% endif %}

  {% if element.descriptions|length and element.incidentLists|length %}
    <hr class="rd-divider">
  {% endif %}

  {% if element.incidentLists|length %}
    {% for item in element.incidentLists %}
      {% include '@organisms/tm-jc/jc-modal/jc-modal-incident/journey-check-incident-list.html.twig' with {
        'incidentList': item,
        'route': element,
        'uid': uid,
        'pid': pid,
      } only %}
    {% endfor %}
  {% endif %}

  {% if element.incidentLists|length and element.moreInfoText %}
    <hr class="rd-divider">
  {% endif %}

  {% if element.moreInfoText %}
    {{ element.moreInfoText|jc_header_level(3)|raw }}
  {% endif %}

</div>
