{# VARIABLES #}
{% set spinner %}
  {% include "@molecules/tm-bs/spinner/spinner.twig" with {
    'ajax': true
  } only %}
{% endset %}

{% set submit_text = submit_text|default("Submit") %}
{% set alert_text = alert_text|default("Use the search") %}
{% set result = result|default(false) %}
{% set icon = 'fas fa-check-circle' %}
{% if result == 'failure'%}
  {% set icon ='fas fa-exclamation-triangle' %}
{% endif %}


{# TEMPLATE #}
<div class="flexipass-check-result" id="flexipass-check-result">

  <div class="row message-container">

    {% if alert_text %}
      <div class="col-sm-12 col-md-8">
        {% if result %}
          <h2 class="h3"><i class="{{ icon }}"></i> {{ alert_text|raw }}</h2>
        {% else %}
          {{ alert_text|raw }}
        {% endif %}
      </div>
    {% endif %}

    <div class="col-sm-12 col-md-4 text-md-end">
      {{ altcom_ajax_button(
        submit_text ~ ' ' ~ spinner,
        'flexipass_check_results',
        'flexipass-check-result',
        {
          'form_id': 'this',
          'block_id': 'embedded_flexipasscheckformblock',
          'cache_tag': 'config:flexipass_check.settings',
          'label': submit_text,
          'callback': 'flexipass_check_results',
          'ajax_id': 'flexipass-check-result'
        })
      }}
    </div>
  </div>
</div>
