{# VARIABLES #}
{% set buy_tickets_button = false %}
{% set tickets_button_class = tickets_button_class|default('btn-default btn-md mt-3') %}
{% set standalone = standalone|default(false) %}

{% set link_title = 'Buy train tickets' %}
{% if nearest_station['title'] %}
  {% set link_title = 'Buy tickets to ' ~ nearest_station['title'] %}
{% endif %}

{% if not hide_tickets_button and nearest_station %}
  {% set buy_tickets_button_attrs = create_attribute()
    .setAttribute('data-to-station', nearest_station['crs'])
  %}
  {% set buy_tickets_button %}
    {% include "@atoms/tm-links/standard/standard.twig" with {
      "text": link_title,
      "url": '#',
      "class": "buy-tickets-btn btn #{tickets_button_class}",
      "attributes": buy_tickets_button_attrs,
    } only %}
  {% endset %}
{% endif %}

{# TEMPLATE #}
{% if not standalone %}
  {% include "@organisms/tm-off/offer-content/partials/offer-blk.twig" with {
    'text': buy_tickets_button,
    'block_style': block_style,
  } only %}
{% else %}
  {{ buy_tickets_button }}
{% endif %}
