{#**
 * 2007-2018 PrestaShop
 *
 * 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 http://www.prestashop.com for more information.
 *
 * @author    PrestaShop SA <contact@prestashop.com>
 * @copyright 2007-2018 PrestaShop SA
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 * International Registered Trademark & Property of PrestaShop SA
 *#}
{% if warehouses|length > 0 %}
    <h4>{{ 'Product location in warehouses'|trans({}, 'Admin.Catalog.Feature') }}</h4>

    <div class="alert alert-info" style="display:block; position: 'auto';" role="alert">
        <div class="alert-text">
            <p>{{ 'This interface allows you to specify the warehouse in which the product is stocked.'|trans({}, 'Admin.Catalog.Help') }}</p>
            <p>{{ 'It is also possible to specify the location within the warehouse for each product or combination.'|trans({}, 'Admin.Catalog.Help') }}</p>
        </div>
    </div>
    <p>{{ 'Please choose the warehouses associated with this product.'|trans({}, 'Admin.Catalog.Feature') }}</p>

    {% for warehouse in warehouses %}
        <div class="panel panel-default">
            {% set collectionName = 'warehouse_combination_' ~ warehouse.id_warehouse %}
            <div class="form-group" id="warehouse_combination_{{ warehouse.id_warehouse }}">
                <label class="col-sm-2 control-label">
                    <h4>{{ form[collectionName].vars.label }}</h4><br/>
                    {% if form[collectionName]|length() > 1 %}
                        <button type="button" class="btn btn-default check_all_warehouse">
                            <i class="icon-check-sign"></i> {{ 'Check / Uncheck all'|trans({}, 'Admin.Actions') }}
                        </button>
                    {% endif %}
                </label>
                <div class="col-sm-10">
                    {{ form_errors(form[collectionName]) }}
                    {% for warehouse_combination in form[collectionName] %}
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{{ warehouse_combination.vars.value.label }}</label>
                            <div class="col-sm-10">
                                <div class="float-left col-lg-1">{{ form_widget(warehouse_combination.activated) }}</div>
                                {{ form_label(warehouse_combination.location) }}
                                <div class="float-left col-lg-3">{{ form_widget(warehouse_combination.location) }}</div>
                                {{ form_widget(warehouse_combination.id_product_attribute) }}
                                {{ form_widget(warehouse_combination.warehouse_id) }}
                                {{ form_widget(warehouse_combination.product_id) }}
                            </div>
                        </div>
                    {% endfor %}
                </div>
            </div>
        </div>
    {% endfor %}
{% endif %}
