{# DOCS #}
{#
element
 - status
 - hasIncidents
 - statusText
 - footerText
 - items
#}
{% set show_collapse_all = false %}
{% set filtered = element.filtered %}

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

{# TEMPLATE #}

{% for item in element.items %}
  {% include '@organisms/tm-jc/jc-modal/jc-modal-items/journey-check-item.html.twig' with {
    'item': item
  } only %}
  {% if item.showDetails == true %}
    {% set show_collapse_all = true %}
  {% endif %}
{% endfor %}

<!-- Pseudo footer -->
{% if not hide_footer %}
  <div class="jcmf">
    <h2 class="text-normal ta-r">
      <a href="#" id="sgsh" class="visually-hidden bel beliag">
        <span class="bell expand">Show filtered routes </span>
        <i class="beli belir fas fa-plus"></i>
      </a>
      {% if show_collapse_all %}
        <a href="#" id="sgha" class="visually-hidden {{ (element.footerText) ? 'service-update-anchor' : 'btn btn-sm btn-outline-default me-0 ffl belinline' }} bel belianu">
          {% if element.footerText %}<span class="bell">{{ element.footerText }}</span>{% endif %}
          <span class="bell expand">Hide all </span>
          <i class="beli belir {{ global_icon_up|default('fas fa-chevron-up') }}"></i>
        </a>
        <a href="#" id="sgsa" class="{{ (element.footerText) ? 'service-update-anchor' : 'btn btn-sm btn-outline-default me-0 ffl belinline' }} bel beliand">
          {% if element.footerText %}<span class="bell">{{ element.footerText }}</span>{% endif %}
          <span class="bell expand">Show all </span>
          <i class="beli belir fas {{ global_icon_down|default('fas fa-chevron-down') }}"></i>
        </a>
      {% endif %}
    </h2>
  </div>
{% endif %}
<!-- / Pseudo footer -->

{% if filtered %}
  {% set ajax_attrs = altcom_ajax_attrs_string(
    'journey_check_modal_items',
    'jcm-items',
    {}, 1, 0, 1)
  %}
  <button id="unfilter-routes-modal" class="d-none service-update-anchor w-100 text-align-left" {{ ajax_attrs }}>View status of other routes</button>
{% endif %}
