{#
journey‐check‐link.html.twig

Renders a single “update” as a clickable link instead of a dropdown.
Expects to be passed:
  - item           : the ItemDTO (with fields like item.name, item.id, item.statusText, etc.)
  - cols           : CSS classes for the wrapper (e.g. 'col-lg-6', 'col-md-12', etc.)
  - status_class   : optional extra class for hiding/showing status spans (e.g. 'd-none d-lg-inline')
  - pid            : prefix used to build a unique uid (same as your original template)
  - nav_link_url   : the URL to navigate to when clicked (e.g. the “service updates” page)
#}

{# LIBRARIES (keep these if needed; remove any you don’t actually use) #}
{{ 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') }}

{# VARIABLES / UID CONSTRUCTION (same logic you already had) #}
{% set parent       = parent|default('') %}
{% set uid          = uid|default('') %}
{% set machine_name = item.machineName|replace({'&': ''}) %}
{% set status_class = status_class|default('') %}
{% set cols         = cols|default('col-md-12') %}
{% set nav_link_url = nav_link_url|default('#') %}

{# Build a unique ID string for this item #}
{% if uid %}
  {% set uid = "#{uid}-#{machine_name}-#{item.id}" %}
{% else %}
  {% set uid = "#{machine_name}" %}
{% endif %}
{% if pid %}
  {% set uid = "#{pid}-#{uid}" %}
{% endif %}

{# TEMPLATE #}
<div class="jc-modal-item status-{{ item.status }} {{ cols }} jc-link-item">
  {% set text %}
    {% set statusMessage = '' %}
    {% if item.statusText %}
      {% set statusMessage %}
        <span class="status {{ status_class }}">{{ item.statusText }}</span>
      {% endset %}
    {% endif %}
    {% if item.statusDescription %}
      {% set statusMessage %}
        <span class="jcs-affected {{ status_class }}"> - {{ item.statusDescription|raw }}</span>
      {% endset %}
    {% endif %}
    {{ item.name }} {{ statusMessage|raw }}
  {% endset %}

  <a href="{{ nav_link_url }}"
     class="{{ item.status }} service-update-anchor beliag belirf aat-cancel collapsed toggle d-flex justify-content-between align-items-center"
     role="button">
    {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
      "text": text|raw,
      "status": item.status,
      "class": item.status ~ ' service-update-anchor beliag belirf aat-cancel jc-link',
      "attr": [],
      "url": null,
      "toggle": null,
    } %}
    <i class="fas fa-chevron-right"></i>
  </a>
</div>
