<div id="openbay-info">
  <div class="form-horizontal">
    <div class="alert alert-warning">{{ text_marketplace_shipped }}</div>
    <div class="form-group">
      <label class="col-sm-2 control-label" for="courier-id">{{ entry_courier }}</label>
      <div class="col-sm-10">
        <select name="courier_id" id="courier-id" class="form-control openbay-data">
          {% for courier in couriers %}
            {% if order_info.courier_id == courier %}
              <option selected="selected">{{ courier }}</option>
            {% else %}
              <option>{{ courier }}</option>
            {% endif %}
          {% endfor %}
        </select>
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label" for="courier-other">{{ entry_courier_other }}</label>
      <div class="col-sm-10">
        <input type="text" name="courier_other" value="{% if order_info.courier_other is not empty %}{{ order_info.courier_id }}{% endif %}" placeholder="{{ entry_courier_other }}" id="courier-other" class="form-control openbay-data" />
      </div>
    </div>
    <div class="form-group">
      <label class="col-sm-2 control-label" for="tracking-no">{{ entry_tracking }}</label>
      <div class="col-sm-10">
        <input type="text" name="tracking_no" value="{{ order_info.tracking_no }}" placeholder="{{ entry_tracking }}" id="tracking-no" class="form-control openbay-data" />
      </div>
    </div>
    <input type="hidden" value="Amazon EU" id="order-channel" />
  </div>
</div>

<script type="text/javascript"><!--
  function verifyStatusChange() {
    var courier = '';
    var courier_other = '';
    var tracking = '';

    if ($('#order-channel').val()){
      courier = $('#courier-id').val();
      courier_other = $('#courier-other').val();
      tracking = $('#tracking-no').val();

      if (courier != '' && courier_other != '') {
        alert('{{ error_tracking_custom }}');
        return false;
      }

      if (tracking != '' && courier == '' && courier_other == ''){
        alert('{{ error_tracking_courier }}');
        return false;
      }

      if ((tracking.indexOf('>') != -1) || (tracking.indexOf('<') != -1)) {
        alert('{{ error_tracking_id_format }}');
        return false;
      }
    }
  }
//--></script>
