{# LIBRARIES #}
{% extends "@molecules/tm-cards/news-card/news-card.twig" %}

{# PARENT VARIABLES #}
{% set card_class = "news-card offer-card-alt" %}
{% set link_scope = "header" %}
{% set show_header = true %}
{% set show_footer = true %}
{% set show_itinerary = show_itinerary %}

{# LOCAL VARIABLES #}
{% set offer_text = offer_text|default("missing") %}
{% set admission_price = admission_price|default("missing") %}

{# BLOCKS #}
{% block card_header %}
  {{ attach_library('ui_patterns/offer_card_alt.offer_card_alt_lib') }}

  {% if badge_text_top or badge_text_bottom or badge_graphic_image %}
    {% include "@molecules/tm-bits/tm-bits-badge.twig" with {
      'badge_color': badge_color,
      'badge_text': badge_text_top,
      'badge_text_large': badge_text_bottom,
      'floating': true,
      'badge_img_alt': badge_graphic_image['alt'],
      'badge_img_url': badge_graphic_image['url'],
      'badge_img_attrs': badge_graphic_image['img_attributes'],
    } only%}
  {% endif %}

  {{ parent() }}

{% endblock %}

{# BLOCK BODY #}
{% block card_body %}

  {% if title %}
    {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
      "text": title,
      "icon_right": global_icon_right|default('fas fa-chevron-right'),
      "class": "subtitle h2",
      "url": card_link
    } only %}
  {% endif %}

  {% if tags %}
    {% include "@molecules/tm-cards/card-partials/tags.html.twig" with {
      "visible_limit": "2",
      "no_icon": true
    } %}
  {% endif %}

{% endblock %}

{% block card_footer %}

  {% if show_itinerary and oid %}
    <span data-itinerary-id="{{ oid }}"
          data-itinerary-action="toggle"
          data-itinerary-animate="true"
          class="itinerary icon-toggle"
    >
    </span>
  {% endif %}

  {% if location %}
    <div class="{{ content ? 'wfade' : 'nfade' }}">
      {% include "@atoms/tm-links/icon-bookended/icon-bookended.twig" with {
        "text": '<span class="fst-italic">Closest station</span>: ' ~ location,
        "icon_left": "far fa-map-marker-alt",
        "class": "location"
      } only %}
    </div>
  {% endif %}

{% endblock %}
