<span class="ftr-text--l">{{ text_checkout_shipping_method }}</span>
{% if error_warning %}
  <div class="warning">{{ error_warning }}</div>
{% endif %}
{% if shipping_methods %}
  <p class="ftr-text--grey ftr-out-space--v-m">{{ text_shipping_method }}</p>
  {% for shipping_method in shipping_methods %}
    <p>
      <b class="ftr-text--grey">{{ shipping_method.title }}</b>
    </p>
    {% if not shipping_method.error %}
      {% for quote in shipping_method.quote %}
        {% if ((quote.code == code or code == false) or (quote.code == shipping_cart_chk)) %}
          {% set code = quote.code %}
          <input class="ftr-radio" id="{{ quote.code }}" type="radio" name="shipping_method" value="{{ quote.code }}"
                 checked>
        {% else %}
          <input class="ftr-radio" id="{{ quote.code }}" type="radio" name="shipping_method" value="{{ quote.code }}">
        {% endif %}

        <label class="ftr-radio-label ftr-out-space--t-n ftr-block {{ (error_shipping_method) ? 'error' : '' }}"
               for="{{ quote.code }}">
          <span class="ftr-radio-label__text">{{ quote.title }} {{ quote.text }}</span>
          {% if quote.pickup_address %}
            <span
              class="text-small text-gray top-margin-medium left-margin-large visible-block">{{ quote.pickup_address }}</span>
          {% endif %}
          {% if quote.message %}
            <span
              class="text-small text-gray top-margin-medium left-margin-large visible-block">{{ quote.message }}</span>
          {% endif %}
          {% if error_shipping_method %}
            <span class="ftr-radio-label__error">{{ error_shipping_method }}</span>
          {% endif %}
        </label>
      {% endfor %}
    {% else %}
      <div class="error">{{ shipping_method.error }}</div>
    {% endif %}
  {% endfor %}
{% endif %}

{% if not futura_frete_conta_cliente_status %}
  <label class="ftr-field  {{ (error_comment) ? 'error' : '' }}">
    <textarea id="comment" name="comment" rows="4" class="ftr-field__entry ftr-js-field__entry"
              data-value="{{ comment }}">{{ comment }}</textarea>
    <span class="ftr-field__text">{{ text_comments }}</span>
    {% if error_comment %}
      <span class="ftr-field__error">{{ error_comment }}</span>
    {% endif %}
  </label>
{% else %}
  <script>
    $(document).ready(function () {

      if ($("input[name='shipping_method']:checked").val() == 'futura_frete_conta_cliente.futura_frete_conta_cliente') {
        $('#comment-exibe').removeClass('ftr-hidden');
      }

      $('input[type="radio"]').change(function () {
        if ($(this).attr("id") == 'futura_frete_conta_cliente.futura_frete_conta_cliente') {
          $('#comment-exibe').removeClass('ftr-hidden');
        } else {
          $('#comment-exibe').addClass('ftr-hidden');
        }
      });
    })
  </script>
  <div id="comment-exibe" class="ftr-hidden">
    <label class="ftr-field">
      <input type="text" id="comment" name="comment" class="ftr-field__entry ftr-js-field__entry" value="">
      <span class="ftr-field__text">{{ text_carrier }}</span>
    </label>
    <span>{{ text_message_carrier }}</span>
  </div>
{% endif %}
