{#**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * 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.md.
 * 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://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 *#}
<tr class="combination loaded" id="attribute_{{ form.vars.value.id_product_attribute }}" data="{{ form.vars.value.id_product_attribute }}" data-index="{{ form.vars.value.id_product_attribute }}">
  <td width="1%"><input class="js-combination" type="checkbox" data-id="{{ form.vars.value.id_product_attribute }}" data-index="{{ form.vars.value.id_product_attribute }}"></td>
  <td class="img"><div class="fake-img"></div></td>
    <td>{{ form.vars.value.name }}</td>
    <td class="attribute-price">
        <div class="input-group">
            <div class="input-group-prepend">
                <span class="input-group-text">{{ default_currency_symbol }}</span>
            </div>
            <input type="text" class="attribute_priceTE form-control text-sm-right" value="{{ form.vars.value.attribute_price }}">
        </div>
    </td>
    <td class="attribute-finalprice text-sm-right">
      <div>
        <span class="final-price" data-price="{{ form.vars.value.final_price }}" data-uniqid="{{ form.vars.value.id_product_attribute }}">{{ form.vars.value.final_price }}</span> {{ default_currency_symbol }}
      </div>
      {% if 'PS_USE_ECOTAX'|configuration != 0 %}
        {% set attributeEcotax = form.vars.value.attribute_ecotax %}
        {% if attributeEcotax == 0 %}
          {% set attributeEcotax = form.vars.value.product_ecotax %}
        {% endif %}
        <div class="attribute-ecotax-preview{% if attributeEcotax == 0 %} d-none{% endif %}">
          {{ 'Ecotax'|trans({}, 'Admin.Catalog.Feature') }}
          <span class="attribute-ecotax">{{ attributeEcotax|round(2) }}</span> {{ default_currency_symbol }}
        </div>
      {% endif %}
    </td>
    {% if configuration('PS_STOCK_MANAGEMENT') %}
      <td class="attribute-quantity">
          <div>
              <input type="text" value="{{ form.vars.value.attribute_quantity }}" class="form-control text-sm-right">
          </div>
      </td>
    {% endif %}

    <td class="attribute-actions">
        <div class="btn-group btn-group-sm" role="group">
            <a href="#combination_form_{{ form.vars.value.id_product_attribute }}" class="btn btn-open tooltip-link btn-sm"><i class="material-icons">mode_edit</i></a>
        </div>
        <div id="combination_form_{{ form.vars.value.id_product_attribute }}" data="{{ form.vars.value.id_product_attribute }}" class="combination-form hide row">
            <div class="col-sm-12 nav">
                {# "Prev." is short for "Previous" #}
                <a class="btn-sensitive prev"><i class="material-icons">keyboard_arrow_left</i> {{ 'Prev. combination'|trans({}, 'Admin.Catalog.Feature') }}</a>
                <a class="next btn-sensitive">{{ 'Next combination'|trans({}, 'Admin.Catalog.Feature') }} <i class="material-icons">keyboard_arrow_right</i></a>
            </div>
            <div class="panel col-md-12 p-2">
                <div class="float-left">
                    <button type="button" class="back-to-product btn btn-outline-secondary btn-back"><i class="material-icons">arrow_back</i> {{ 'Back to product'|trans({}, 'Admin.Catalog.Feature') }}</button>
                </div>
                <h2 class="title pt-2">
                  {{ "Combination details"|trans({}, 'Admin.Catalog.Feature') }} -
                  {{ form.vars.value.name }}
                </h2>
                {{ form_widget(form.attribute_default) }}
                <div class="row">
                  {% if configuration('PS_STOCK_MANAGEMENT') %}
                    <div class="col-md-2">
                      <fieldset class="form-group">
                          <label class="form-control-label">
                            {{ form.attribute_quantity.vars.label }}
                          </label>
                          {{ form_errors(form.attribute_quantity) }}
                          {{ form_widget(form.attribute_quantity) }}
                      </fieldset>
                    </div>
                  {% endif %}
                    <div class="col-md-3">
                      <fieldset class="form-group">
                          <label class="form-control-label">{{ form.available_date_attribute.vars.label }}</label>
                          {{ form_errors(form.available_date_attribute) }}
                          {{ form_widget(form.available_date_attribute) }}
                      </fieldset>
                    </div>
                    <div class="col-md-2">
                      <fieldset class="form-group">
                          <label class="form-control-label">
                            {{ form.attribute_minimal_quantity.vars.label }}
                            <span class="help-box" data-toggle="popover"
                              data-content="{{ "The minimum quantity required to buy this product (set to 1 to disable this feature). E.g.: if set to 3, customers will be able to purchase the product only if they take at least 3 in quantity."|trans({}, 'Admin.Catalog.Help') }}" ></span>
                          </label>
                          {{ form_errors(form.attribute_minimal_quantity) }}
                          {{ form_widget(form.attribute_minimal_quantity) }}
                      </fieldset>
                    </div>
                    <div class="col-md-4">
                      <fieldset class="form-group">
                          <label class="form-control-label">{{ form.attribute_reference.vars.label }}</label>
                          {{ form_errors(form.attribute_reference) }}
                          {{ form_widget(form.attribute_reference) }}
                      </fieldset>
                    </div>
                </div>
                <h2 class="title">
                  {{ 'Stock'|trans({}, 'Admin.Catalog.Feature') }}
                </h2>
                <div class="row">
                  <div class="col-md-3">
                    <fieldset class="form-group">
                      <label class="form-control-label">{{ form.attribute_location.vars.label }}</label>
                      {{ form_errors(form.attribute_location) }}
                      {{ form_widget(form.attribute_location) }}
                    </fieldset>
                  </div>
                  <div class="col-md-3">
                    <fieldset class="form-group">
                      <label class="form-control-label">{{ form.attribute_low_stock_threshold.vars.label }}</label>
                      {{ form_errors(form.attribute_low_stock_threshold) }}
                      {{ form_widget(form.attribute_low_stock_threshold) }}
                    </fieldset>
                  </div>
                  <div class="col-md-9">
                    <fieldset class="form-group widget-checkbox-inline">
                      <label class="form-control-label">&nbsp;</label>
                      <div class="widget-checkbox-inline">
                        {{ form_errors(form.attribute_low_stock_alert) }}
                        {{ form_widget(form.attribute_low_stock_alert) }}
                        <span class="help-box" data-toggle="popover" data-html="true" data-content="{{ "The email will be sent to all the users who have the right to run the stock page. To modify the permissions, go to [1]Advanced Parameters > Team[/1]"|trans({'[1]':'<a href=&quot;'~getAdminLink("AdminEmployees")~'&quot;>','[/1]':'</a>'}, 'Admin.Catalog.Help')|raw }}" ></span>
                      </div>
                    </fieldset>
                  </div>
                </div>
                <h2 class="title">
                  {{ "Price and impact"|trans({}, 'Admin.Catalog.Feature') }}
                </h2>
                <div class="row">
                    <div class="col-md-3">
                        <fieldset class="form-group">
                            <label class="form-control-label">{{ form.attribute_wholesale_price.vars.label }}</label>
                            {{ form_errors(form.attribute_wholesale_price) }}
                            {{ form_widget(form.attribute_wholesale_price) }}
                        </fieldset>
                    </div>
                    <div class="col-md-3">
                        <fieldset class="form-group">
                            <label class="form-control-label">
                              {{ form.attribute_price.vars.label }}
                              <span class="help-box" data-toggle="popover"
                                data-content="{{ "Does this combination have a different price? Is it cheaper or more expensive than the default retail price?"|trans({}, 'Admin.Catalog.Help') }}" ></span>
                            </label>
                            {{ form_errors(form.attribute_price) }}
                            {{ form_widget(form.attribute_price) }}
                        </fieldset>
                    </div>
                    <div class="col-md-3">
                        <fieldset class="form-group">
                            <label class="form-control-label">{{ form.attribute_priceTI.vars.label }}</label>
                            {{ form_errors(form.attribute_priceTI) }}
                            {{ form_widget(form.attribute_priceTI) }}
                        </fieldset>
                    </div>
                    <div class="col-md-3">
                      <div class="form-control-label vcenter">{{ "Final retail price (tax excl.) will be"|trans({}, 'Admin.Catalog.Feature') }} <span class="final-price" data-price="{{ form.vars.value.final_price }}" data-uniqid="{{ form.vars.value.id_product_attribute }}">{{ form.vars.value.final_price }}</span> {{ default_currency_symbol }}</div>
                      <div class="form-control-label vcenter">{{ "Final retail price (tax incl.) will be"|trans({}, 'Admin.Catalog.Feature') }} <span class="final-price-tax-included" data-price="{{ form.vars.value.final_price_tax_included }}" data-uniqid="{{ form.vars.value.id_product_attribute }}">{{ form.vars.value.final_price_tax_included }}</span> {{ default_currency_symbol }}</div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-3 {% if configuration('PS_USE_ECOTAX') != 1 %}hide{% endif %}">
                        <fieldset class="form-group">
                            <label class="form-control-label">{{ form.attribute_ecotax.vars.label }}</label>
                            {{ form_errors(form.attribute_ecotax) }}
                            {{ form_widget(form.attribute_ecotax) }}
                        </fieldset>
                    </div>
                    <div class="col-md-3">
                        <fieldset class="form-group">
                            <label class="form-control-label">
                              {{ form.attribute_unity.vars.label }}
                              <span class="help-box" data-toggle="popover"
                                data-content="{{ "Does this combination have a different price per unit?"|trans({}, 'Admin.Catalog.Feature') }}" ></span>
                            </label>
                            {{ form_errors(form.attribute_unity) }}
                            {{ form_widget(form.attribute_unity) }}
                        </fieldset>
                    </div>
                    <div class="col-md-3">
                        <fieldset class="form-group">
                            <label class="form-control-label">{{ form.attribute_weight.vars.label }}</label>
                            <div class="input-group">
                                <div class="input-group-prepend">
                                    <span class="input-group-text">{{ configuration('PS_WEIGHT_UNIT') }}</span>
                                </div>
                                {{ form_errors(form.attribute_weight) }}
                                {{ form_widget(form.attribute_weight) }}
                            </div>
                        </fieldset>
                    </div>
                </div>
                <h2 class="title">
                  {{ "Specific references"|trans({}, 'Admin.Catalog.Feature') }}
                </h2>
                <div class="row">
                    <div class="col-md-4">
                        <fieldset class="form-group">
                            <label class="form-control-label">{{ form.attribute_isbn.vars.label }}</label>
                            {{ form_errors(form.attribute_isbn) }}
                            {{ form_widget(form.attribute_isbn) }}
                        </fieldset>
                    </div>
                    <div class="col-md-4">
                        <fieldset class="form-group">
                            <label class="form-control-label">
                              {{ form.attribute_ean13.vars.label }}
                              <span class="help-box" data-toggle="popover"
                                data-content="{{ "This type of product code is specific to Europe and Japan, but is widely used internationally. It is a superset of the UPC code: all products marked with an EAN will be accepted in North America."|trans({}, 'Admin.Catalog.Help') }}" ></span>
                            </label>
                            {{ form_errors(form.attribute_ean13) }}
                            {{ form_widget(form.attribute_ean13) }}
                        </fieldset>
                    </div>
                    <div class="col-md-4">
                        <fieldset class="form-group">
                            <label class="form-control-label">{{ form.attribute_upc.vars.label }}</label>
                            {{ form_errors(form.attribute_upc) }}
                            {{ form_widget(form.attribute_upc) }}
                        </fieldset>
                    </div>
                    <div class="col-md-4">
                        <fieldset class="form-group">
                            <label class="form-control-label">{{ form.attribute_mpn.vars.label }}</label>
                            {{ form_errors(form.attribute_mpn) }}
                            {{ form_widget(form.attribute_mpn) }}
                        </fieldset>
                    </div>
                </div>
                <h2 class="title">
                  {{ "Images"|trans({}, 'Admin.Catalog.Feature') }}
                </h2>
                <div class="row">
                    <div class="col-md-12">
                        <fieldset class="form-group js-combination-images">
                            <label>
                                <small class="form-control-label">{{ form.id_image_attr.vars.label }}</small>
                                <small class="form-control-label number-of-images"></small>
                            </label>
                            {{ form_errors(form.id_image_attr) }}
                            {{ form_widget(form.id_image_attr) }}
                        </fieldset>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-12">
                        {{ renderhook('displayAdminProductsCombinationBottom', { 'id_product': form.vars.value.id_product, 'id_product_attribute': form.vars.value.id_product_attribute }) }}
                    </div>
                </div>

                {{ form_widget(form.id_product_attribute) }}
            </div>
        </div>
    </td>
    <td width="5%">
      <a href="{{ path('admin_delete_attribute', {'idProduct': form.vars.value.id_product}) }}" class="btn tooltip-link btn-sm delete" data="{{ form.vars.value.id_product_attribute }}"><i class="material-icons">delete</i></a>
    </td>
    <td>
      {% set checked = form.vars.value.attribute_default == 1 ? 'checked' : '' %}
      <input class="attribute-default" type="radio" {{ checked }} data-id="{{ form.vars.value.id_product_attribute }}">
    </td>
</tr>
