{# LIBRARIES #}
{{ attach_library('ui_patterns/journey_planner_bar.journey_planner_bar_lib') }}

{% set exposed = show_exposed_booking_form_button %}
{% set bt_title = bt_title|default("<i class=\"fas fa-ticket-alt rot-135\"></i> Buy Tickets") %}
{% set ld_title = ld_title|default("<i class=\"fas fa-clock\"></i> Live Departures") %}

{# BUY TICKETS TAB #}
{% set bt = [] %}
{% if booking_form_desktop %}
  {% set bt_content %}
    {% if exposed %}
      <div class="mbo">
    {% endif %}
    {{ booking_form_desktop }}
    {% if booking_form_modal %}
      {{ booking_form_modal }}
    {% endif %}
    {% if exposed %}
      </div>
    {% endif %}
  {% endset %}
  {% if exposed %}
    {% set bt = {
      tbid: "buy-tickets",
      title: bt_title,
      content: bt_content,
      first: false,
      nav_attrs: {
        "data-exposed-booking-form": "true"
      }
    } %}
  {% else %}
    {% set bt = {
      tbid: "buy-tickets",
      title: bt_title,
      content: bt_content,
      first: false
    } %}
  {% endif %}
{% endif %}

{# LIVE DEPARTS TAB #}
{% set ld_content %}
  {% if ld_search %}
    <div class="col" id="ld_search">{{ ld_search }}</div>
  {% endif %}
{% endset %}
{% set ld = {
  tbid: "live-departures",
  title: ld_title,
  content: ld_content,
  first: false
} %}

{# TEMPLATE #}
<div class="col-md-12" id="btjcd-nav">
  {{ pattern('bs-tabs-items', {
    'pid': 'btld',
    'items': [bt, ld],
    'list_suffix' : menu_lower,
    'nav_wrapper': true,
    'nav_only': true,
    'allow_close': true,
  }, 'tbi_b') }}
</div>

<div class="col-md-12 {{ exposed ? 'exp-jpb' }}" id="btjcd-tabs">
  <div class="row">

    <div class="col-lg-{{ exposed ? '12' : '8' }}" id="bt-wrapper">
      {{ pattern('bs-tabs-items', {
        'pid': 'btld',
        'items': [bt, ld],
        'wrapper_class': 'tbw-b',
        'content_only': true,
        'allow_close': true,
      }, 'tbi_b') }}
    </div>

    <div class="col-lg-{{ exposed ? '12' : '4' }}" id="hjcd-wrapper">
      <div id="hjcd">
        {% if emulate_ajax %}<div id="jcdw">{% endif %}
          {{ jc_dropdown }}
          {% if emulate_ajax %}</div>{% endif %}
      </div>
    </div>

  </div>
</div>
