{{ attach_library('ui_patterns/jc_summary.jc_summary_lib') }}

{% set attributes = attributes|default(create_attribute()) %}
{% set time_updated = time_updated|default("now"|date("H:i:s")) %}

{% set icon_left = "fas fa-check-circle" %}
{% if data.status == 'good' %}
  {% set icon_left = "fas fa-check-circle" %}
{% elseif data.status == 'minor' %}
  {% set icon_left = "fas fa-exclamation-triangle" %}
{% elseif data.status == 'major' %}
  {% set icon_left = "fas fa-exclamation-triangle" %}
{% endif %}

<div id="rbs-blk">

  <div class="{{ data.status }} rbs-header">
    <i class="{{ icon_left }}"></i>
    <h2>{{ data.statusText }}</h2>
  </div>

  {% set ajax_attrs = altcom_ajax_attrs_string(
    'journey_check_summary_status',
    'jcssw',
    {}, 1)
  %}

  <div class="rbs-updates bg-{{ data.status }} efx-pulse efx-warning mt-3">
    <span class="rbs-updated">Latest update: <span class="time">{{ time_updated }}</span></span>
    <a href="#" class="rbs-icon" role="button" aria-label="Reload data" {{ ajax_attrs|raw }}>
      <i class="fas fa-sync-alt"></i>
    </a>
  </div>

</div>
