{# LIBRARIES #}
{{ attach_library('altcom_ajax/altcom_ajax') }}
{{ attach_library('ui_patterns/libraries.bs_collapse') }}
{{ attach_library('ui_patterns/libraries.bs_buttons') }}
{{ attach_library('ui_patterns/jc_dropdown.jc_base') }}
{{ attach_library('ui_patterns/jc_dropdown.jc_dropdown_lib') }}
{{ attach_library('ui_patterns/jc_embed_routes.jc_embed_routes_lib') }}

{# VARIABLES #}
{% set footer_text = element.footerText %}
{% set extra_link = element.link %}
{% set hide_footer = TRUE %}
{% set header_title = header_title|default("<i class='fas fa-info mx-1'></i> Live travel updates") %}
{% set status_message_separator = status_message_separator|default(' - ') %}

{# TEMPLATE #}
<div id="jcs-embed-routes" class="jcs-embed">

  <div class="jcs-embed-routes-header mb-2">
    <h2 class="mb-0">{{ header_title|raw }}</h2>
    <div class="update ms-auto">Last update: {{ "now"|date("H:i", "Europe/London") }}</div>
  </div>

  {% if extra_link %}
    {% set attr = create_attribute() %}
    {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
      "text": extra_link.text,
      "url": extra_link.url,
      "attr": attr,
      "icon_left": extra_link.icon,
      "icon_right": global_icon_right|default('fas fa-chevron-right'),
      "class": 'service-update-anchor beliag belirf e-link ' ~ extra_link.class,
    } %}
  {% endif %}

  {% include "@organisms/tm-jc/jc-modal/jc-modal-items/journey-check-modal-items.html.twig" %}

  <!-- Pseudo footer -->
  <div class="jcmf">
    {% if footer_text %}
      <h2 class="text-normal">

      <span id="sgha" class="{{ (footer_text) ? 'service-update-anchor' }} bel belianu">
        <span class="bell">{{ footer_text }}</span>
      </span>

      </h2>
    {% endif %}
  </div>
  <!-- / Pseudo footer -->

</div>
