{#**
 * 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)
 *#}

{%- block features_row -%}
  <h3>{{ 'Features'|trans({}, 'Admin.Catalog.Feature') }}</h3>

  {{ form_errors(form) }}
  {{- block('form_rows') -}}
{%- endblock -%}

{%- block feature_value_row -%}
  <div class="form-group row product-feature">
    <div class="col-12 col-lg-3">
      <fieldset class="form-group mb-0">
        <label class="form-control-label">{{ form.feature_id.vars.label }}</label>
        {{ form_widget(form.feature_id) }}
        {{ form_errors(form.feature_id) }}
      </fieldset>
    </div>
    <div class="col-12 col-lg-3">
      <fieldset class="form-group mb-0">
        <label class="form-control-label">{{ form.feature_value_id.vars.label }}</label>
        {{ form_widget(form.feature_value_id) }}
        {{ form_errors(form.feature_value_id) }}
      </fieldset>
    </div>
    <div class="col-12 col-lg-3">
      <fieldset class="form-group mb-0">
        <label class="form-control-label">{{ form.custom_value.vars.label }}</label>
        {{ form_widget(form.custom_value_id) }}
        {{ form_widget(form.custom_value) }}
        {{ form_errors(form.custom_value) }}
      </fieldset>
    </div>
    <div class="col-12 col-lg-1">
      {{ form_widget(form.delete) }}
    </div>
  </div>
{%- endblock -%}

{# Override features collection template to remove the label and init the table #}
{%- block collection_row -%}
  {# We put prototype name in a data attribute, so the JS code can get it dynamically #}
  {%- set attr = attr|merge({'data-prototype': form_row(prototype), 'data-prototype-name': prototype.vars.name }) -%}
  {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' form-group row feature-values-collection')|trim }) -%}

  <div {{ block('widget_attributes') }}>
    <div class="col-sm">
      {{- block('form_rows') -}}
    </div>
  </div>
{%- endblock -%}
