{#**
 * 2007-2019 PrestaShop and Contributors
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@prestashop.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2019 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *#}
{% if is_modal is not defined %}
  {% set is_modal = false %}
{% endif %}

{% if is_modal == false %}
  {% set column_default_md_3 = 'col-md-3' %}
  {% set column_default_md_2 = 'col-md-2' %}
  {% set column_default_xl_2 = 'col-xl-2' %}
{% else %}
  {% set column_default_md_3 = 'col-md-9' %}
  {% set column_default_md_2 = 'col-md-4' %}
  {% set column_default_xl_2 = 'col-xl-4' %}
{% endif %}

<div class="card card-block">
  <h4><b>{{ 'Specific price conditions'|trans({}, 'Admin.Catalog.Feature') }}</b></h4>
  {{ form_errors(form) }}

  {% if form.sp_id_shop.vars.choices is defined %}
  <div class="row">
    <div class="col-md-4">
      <fieldset class="form-group">
        <label>{{ 'Shop'|trans({}, 'Admin.Global') }}</label>
        {{ form_errors(form.sp_id_shop) }}
        {{ form_widget(form.sp_id_shop) }}
      </fieldset>
    </div>
  </div>
  {% else %}
      {{ form_widget(form.sp_id_shop) }}
  {% endif %}

  <div class="row">
    <div class="{{ column_default_md_3 }}">
      <fieldset class="form-group">
        <label>{{ 'For'|trans({}, 'Admin.Global') }}</label>
        {{ form_errors(form.sp_id_currency) }}
        {{ form_widget(form.sp_id_currency) }}
      </fieldset>
    </div>
    <div class="{{ column_default_md_3 }}">
      <fieldset class="form-group">
        <label>&nbsp;</label>
        {{ form_errors(form.sp_id_country) }}
        {{ form_widget(form.sp_id_country) }}
      </fieldset>
    </div>
    <div class="{{ column_default_md_3 }}">
      <fieldset class="form-group">
        <label>&nbsp;</label>
        {{ form_errors(form.sp_id_group) }}
        {{ form_widget(form.sp_id_group) }}
      </fieldset>
    </div>
    <div class="col-md-6">
      <fieldset class="form-group">
        <label>{{ 'Customer'|trans({}, 'Admin.Global') }}</label>
        {{ form_errors(form.sp_id_customer) }}
        {{ form_widget(form.sp_id_customer) }}
      </fieldset>
    </div>
  </div>
  <div class="row">
    <div id="specific-price-combination-selector" class="col-md-6 {{ has_combinations ? '' : 'hide' }}">
      <fieldset class="form-group">
        <label>{{ form.sp_id_product_attribute.vars.label }}</label>
        {{ form_errors(form.sp_id_product_attribute) }}
        {{ form_widget(form.sp_id_product_attribute) }}
      </fieldset>
    </div>
    <div class="clearfix"></div>
    <div class="{{ column_default_md_3 }}">
      <fieldset class="form-group">
        <label>{{ form.sp_from.vars.label }}</label>
        {{ form_errors(form.sp_from) }}
        {{ form_widget(form.sp_from) }}
      </fieldset>
    </div>
    <div class="{{ column_default_md_3 }}">
      <fieldset class="form-group">
        <label>{{ 'to'|trans({}, 'Admin.Global')|raw }}</label>
        {{ form_errors(form.sp_to) }}
        {{ form_widget(form.sp_to) }}
      </fieldset>
    </div>
  {% if is_modal == true %}
  </div>
  <div class="row">
  {% endif %}
    <div class="{{ column_default_md_2 }}">
      <fieldset class="form-group">
        <label>{{ form.sp_from_quantity.vars.label }}</label>
        {{ form_errors(form.sp_from_quantity) }}
        <div class="input-group">
          {{ form_widget(form.sp_from_quantity) }}
          <div class="input-group-append">
            <span class="input-group-text">{{ 'Unit(s)'|trans({}, 'Admin.Catalog.Feature') }}</span>
          </div>
        </div>
      </fieldset>
    </div>
  </div>
  <br>

  <h4><b>{{ 'Impact on price'|trans({}, 'Admin.Catalog.Feature') }}</b></h4>
  <div class="row">
    <div class="{{ column_default_md_3 }}">
      <fieldset class="form-group">
        <label>{{ form.sp_price.vars.label }}</label>
        {{ form_errors(form.sp_price) }}
        {{ form_widget(form.sp_price) }}
      </fieldset>
    </div>
    <div class="{{ column_default_md_3 }}">
      <fieldset class="form-group">
        <label>&nbsp;</label>
        {{ form_errors(form.leave_bprice) }}
        {{ form_widget(form.leave_bprice) }}
      </fieldset>
    </div>
  </div>
  <div class="row">
    <div class="{{ column_default_xl_2 }} col-lg-3">
      <fieldset class="form-group">
        <label>{{ 'Apply a discount of'|trans({}, 'Admin.Catalog.Feature') }}</label>
        {{ form_errors(form.sp_reduction) }}
        {{ form_widget(form.sp_reduction) }}
      </fieldset>
    </div>
    <div class="{{ column_default_xl_2 }} col-lg-3">
      <fieldset class="form-group">
        <label>&nbsp;</label>
        {{ form_errors(form.sp_reduction_type) }}
        {{ form_widget(form.sp_reduction_type) }}
      </fieldset>
    </div>
    <div class="{{ column_default_xl_2 }} col-lg-3">
      <fieldset class="form-group">
        <label>&nbsp;</label>
        {{ form_errors(form.sp_reduction_tax) }}
        {{ form_widget(form.sp_reduction_tax) }}
      </fieldset>
    </div>
  </div>
  <div class="col-md-12 text-sm-right">
    {{ form_widget(form.cancel) }}
    {{ form_widget(form.save) }}
  </div>
  <div class="clearfix"></div>
</div>
