{# EXTENDS #}
{% set items = element.items %}
{% set status = element.status %}
{% set status_text = element.statusText %}
{% set footer_text = element.footerText %}

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

{# TEMPLATE #}
<!-- JC Block - Dropdown -->
<div id="jcd">
  <!-- Collapse trigger -->
  {% set attr = create_attribute()
    .setAttribute('data-bs-toggle', 'collapse')
    .setAttribute('tabindex', '0')
    .setAttribute('data-bs-target', '#journey-check-service-groups')
  %}
  {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
    "text": status_text,
    "status": status,
    "attr": attr,
    "class": 'service-update-button beliag belirf',
    "toggle": 'sign',
  } %}
  <!-- / Collapse trigger -->

  <!-- Collapse area -->
  <div id="journey-check-service-groups" class="collapse clearfix">
    {% for link in items %}
      {% set uid = "#{link.machineName}" %}
      {% set attr = create_attribute()
        .setAttribute('role', 'button')
        .setAttribute('tabindex', '0')
        .setAttribute('data-bs-toggle', 'modal')
        .setAttribute('data-bs-target', "#jcs-modal")
        .setAttribute('data-alt-toggle', "clicker")
        .setAttribute('data-alt-target', "#jcml-#{uid}")
      %}
      {% set show_link = (link.status != 'good') ? true : false  %}
      {% set show_link = link.showDetails ? true : show_link  %}
      {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
        "text": link.name,
        "status": link.status,
        "attr": attr,
        "class": 'service-update-anchor beliag belirf',
        "toggle": show_link ? 'sign' : null,
      } %}
    {% endfor %}
  </div>
  <!-- / Collapse area -->

</div>
<!-- / JC Block -->
