{{ header }}{{ column_left }}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <div class="pull-right">
        <button type="submit" form="settings-form" data-toggle="tooltip" title="{{ button_save }}" class="btn btn-primary"><i class="fa fa-save"></i></button>
        <a href="{{ cancel }}" data-toggle="tooltip" title="{{ button_cancel }}" class="btn btn-default"><i class="fa fa-reply"></i></a>
      </div>
      <h1>{{ heading_title }}</h1>
      <ul class="breadcrumb">
        {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
        {% endfor %}
      </ul>
    </div>
  </div>
  <div class="container-fluid">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-amazon"></i> {{ text_edit }}</h3>
      </div>
      <div class="panel-body">
        <form action="" method="post" enctype="multipart/form-data" id="settings-form" class="form-horizontal">
          {% if openbay_amazon_token is empty %}
          <a href="{{ link_signup }}" target="_blank"><div class="alert alert-info"><h5 style="font-size: 14px;"><i class="fa fa-user-plus fa-2x"></i>&nbsp;&nbsp;{{ text_register_banner }}</h5></div></a>
          {% endif %}
          <ul class="nav nav-tabs">
            <li class="active"><a href="#tab-settings" data-toggle="tab">{{ tab_settings }}</a></li>
            <li><a href="#tab-product" data-toggle="tab">{{ tab_listing }}</a></li>
            <li><a href="#tab-orders" data-toggle="tab">{{ tab_orders }}</a></li>
          </ul>
          <div class="tab-content">
            <div class="tab-pane active" id="tab-settings">
              <div class="form-group">
                <label class="col-sm-2 control-label" for="amazon-status">{{ entry_status }}</label>
                <div class="col-sm-10">
                  <select name="openbay_amazon_status" id="amazon-status" class="form-control">
                    {% if openbay_amazon_status %}
                    <option value="1" selected="selected">{{ text_enabled }}</option>
                    <option value="0">{{ text_disabled }}</option>
                    {% else %}
                    <option value="1">{{ text_enabled }}</option>
                    <option value="0" selected="selected">{{ text_disabled }}</option>
                    {% endif %}
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="entry-token">{{ entry_token }}</label>
                <div class="col-sm-10">
                  <input type="text" name="openbay_amazon_token" value="{{ openbay_amazon_token }}" placeholder="{{ entry_token }}" id="entry-token" class="form-control" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="entry-encryption-key">{{ entry_encryption_key }}</label>
                <div class="col-sm-10">
                  <input type="text" name="openbay_amazon_encryption_key" value="{{ openbay_amazon_encryption_key }}" placeholder="{{ entry_encryption_key }}" id="entry-encryption-key" class="form-control" />
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="entry-encryption-iv">{{ entry_encryption_iv }}</label>
                <div class="col-sm-10">
                  <input type="text" name="openbay_amazon_encryption_iv" value="{{ openbay_amazon_encryption_iv }}" placeholder="{{ entry_encryption_iv }}" id="entry-encryption-iv" class="form-control" />
                </div>
              </div>
              {% if api_checked == true %}
              <div class="form-group">
                <label class="col-sm-2 control-label">{{ text_api_status }}</label>
                <div class="col-sm-10">
                  {% if api_status == false %}
                    <h4><span class="label label-danger"><i class="fa fa-minus-square"></i> {{ text_api_error }}</span></h4>
                  {% elseif api_auth == false %}
                    <h4><span class="label label-danger"><i class="fa fa-minus-square"></i> {{ text_api_auth_error }}</span></h4>
                  {% else %}
                    <h4><span class="label label-success"><i class="fa fa-check-square-o"></i> {{ text_api_ok }}</span></h4>
                  {% endif %}
                </div>
              </div>
              {% endif %}
            </div>
            <div class="tab-pane" id="tab-product">
              <div class="form-group">
                <label class="col-sm-2 control-label" for="entry-tax-percentage"><span data-toggle="tooltip" data-container="#tab-product" title="{{ help_tax_percentage }}">{{ entry_tax_percentage }}</span></label>
                <div class="col-sm-10">
                  <div class="input-group col-xs-2">
                    <input type="text" name="openbay_amazon_listing_tax_added" value="{{ openbay_amazon_listing_tax_added }}" placeholder="{{ entry_tax_percentage }}" id="entry-tax-percentage" class="form-control" />
                    <span class="input-group-addon">%</span> </div>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label"><span data-toggle="tooltip" data-container="#tab-product" title="{{ help_entry_marketplace_default }}">{{ entry_marketplace_default }}</span></label>
                <div class="col-sm-10">
                  {% for marketplace in marketplaces %}
                    {% if marketplace.code == openbay_amazon_default_listing_marketplace %}
                      <input id="p_code_{{ marketplace.code }}" type="radio" name="openbay_amazon_default_listing_marketplace" value="{{ marketplace.code }}" checked="checked" />
                    {% else %}
                      <input id="p_code_{{ marketplace.code }}" type="radio" name="openbay_amazon_default_listing_marketplace" value="{{ marketplace.code }}" />
                    {% endif %}
                      <label for="p_code_{{ marketplace.code }}">{{ marketplace.name }}</label>
                    <br />
                  {% endfor %}
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label" for="entry-default-condition">{{ entry_default_condition }}</label>
                <div class="col-sm-10">
                  <select name="openbay_amazon_listing_default_condition" id="entry-default-condition" class="form-control">
                    <option></option>
                    {% for value, condition in conditions %}
                    {% if value == openbay_amazon_listing_default_condition %}
                    <option selected="selected" value="{{ value }}">{{ condition }}</option>
                    {% else %}
                    <option value="{{ value }}">{{ condition }}</option>
                    {% endif %}
                    {% endfor %}
                  </select>
                </div>
              </div>
            </div>
            <div class="tab-pane" id="tab-orders">
              <fieldset>
                <legend>{{ text_order_statuses }}</legend>
                {% for key,amazon_order_status in amazon_order_statuses %}
                <div class="form-group">
                  <label class="col-sm-2 control-label">{{ amazon_order_status.name }}</label>
                  <div class="col-sm-10">
                    <select name="openbay_amazon_order_status_{{ key }}" class="form-control">
                      {% for order_status in order_statuses %}
                        {% if amazon_order_status.order_status_id == order_status.order_status_id %}
                          <option value="{{ order_status.order_status_id }}" selected="selected">{{ order_status.name }}</option>
                        {% else %}
                          <option value="{{ order_status.order_status_id }}">{{ order_status.name }}</option>
                        {% endif %}
                      {% endfor %}
                    </select>
                  </div>
                </div>
                {% endfor %}
              </fieldset>
              <fieldset>
                <legend>{{ text_marketplaces }}</legend>
                {% for marketplace in marketplaces %}
                <div class="form-group">
                  <label class="col-sm-2 control-label" for="code-{{ marketplace.code }}">{{ marketplace.name }}</label>
                  <div class="col-sm-10">
                    {% if marketplace.id in marketplace_ids %}
                      <input id="code-{{ marketplace.code }}" type="checkbox" name="openbay_amazon_orders_marketplace_ids[]" value="{{ marketplace.id }}" checked="checked" />
                    {% else %}
                      <input id="code-{{ marketplace.code }}" type="checkbox" name="openbay_amazon_orders_marketplace_ids[]" value="{{ marketplace.id }}" />
                    {% endif %}
                  </div>
                </div>
                {% endfor %}
              </fieldset>
              <fieldset>
                <legend>{{ text_other }}</legend>
                <div class="form-group">
                  <label class="col-sm-2 control-label" for="entry-import-tax"><span data-toggle="tooltip" data-container="#tab-orders" title="{{ help_import_tax }}">{{ entry_import_tax }}</span></label>
                  <div class="col-sm-10">
                    <div class="input-group col-xs-2">
                      <input type="text" name="openbay_amazon_order_tax" value="{{ openbay_amazon_order_tax }}" id="entry-import-tax" class="form-control" placeholder="{{ entry_import_tax }}" />
                      <span class="input-group-addon">%</span> </div>
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label" for="entry-customer-group"><span data-toggle="tooltip" data-container="#tab-orders" title="{{ help_customer_group }}">{{ entry_customer_group }}</span></label>
                  <div class="col-sm-10">
                    <select name="openbay_amazon_order_customer_group" id="entry-customer-group" class="form-control">
                      {% for customer_group in customer_groups %}
                        {% if openbay_amazon_order_customer_group == customer_group.customer_group_id %}
                          <option value="{{ customer_group.customer_group_id }}" selected="selected">{{ customer_group.name }}</option>
                        {% else %}
                          <option value="{{ customer_group.customer_group_id }}">{{ customer_group.name }}</option>
                        {% endif %}
                      {% endfor %}
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label" for="entry-notify-admin">{{ entry_notify_admin }}</label>
                  <div class="col-sm-10">
                    <select name="openbay_amazon_notify_admin" id="entry-notify-admin" class="form-control">
                      {% if openbay_amazon_notify_admin %}
                      <option value="1" selected="selected">{{ text_yes }}</option>
                      <option value="0">{{ text_no }}</option>
                      {% else %}
                      <option value="1">{{ text_yes }}</option>
                      <option value="0" selected="selected">{{ text_no }}</option>
                      {% endif %}
                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <label class="col-sm-2 control-label" for="entry-default-shipping"><span data-toggle="tooltip" data-container="#tab-orders" title="{{ help_default_shipping }}">{{ entry_default_shipping }}</span></label>
                  <div class="col-sm-10">
                    <select name="openbay_amazon_default_carrier" id="entry-default-shipping" class="form-control">
                      {% for carrier in carriers %}
                        <option{% if carrier == openbay_amazon_default_carrier %} selected{% endif %}>{{ carrier }}</option>
                      {% endfor %}
                    </select>
                  </div>
                </div>
              </fieldset>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>
{{ footer }}
