{# **
 * 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)
 * #}
{% use 'bootstrap_4_layout.html.twig' %}

{% block shop_selector_widget %}
  <div class="shop-selector-content shop-selector" data-multiple="{{ multiple }}">
    <ul class="shop-selector-group-list">
      {% for groupName, groupShops in form.vars.choices %}
        <li class="shop-selector-group-item shop-selector-item">
          {{ 'Group'|trans({}, 'Admin.Global') ~ ' ' ~ groupName }}
        </li>

        {% for shopChoice in groupShops %}
          {% set shop = shopChoice.data %}

          <li class="shop-selector-shop-item shop-selector-item{% if shop.id == contextShopId %} selected-shop current-shop disabled{% endif %}" data-shop-id="{{ shop.id }}">
            {% if multiple %}
              {{ block('shop_option_checkbox_widget') }}
            {% else %}
              {{ block('shop_option_radio_widget') }}
            {% endif %}
          </li>
        {% endfor %}
      {% endfor %}
    </ul>

    {% set attr = attr|merge({class: 'd-none shop-selector-input'}) %}
    {{ block('choice_widget') }}
  </div>
{% endblock %}

{% block shop_option_checkbox_widget %}
  <div class="md-checkbox md-checkbox-inline">
    <label class="shop-selector-item-label">
      <input
        type="checkbox" data-value-type="boolean" class="form-check-input" value="{{ shop.id }}"
        {% if shopChoice is selectedchoice(value) %}checked{% endif %}
        {% if shop.id == contextShopId %}disabled="disabled"{% endif %}
      />
      <i class="md-checkbox-control"></i>
      {{ block('shop_selector_item_name') }}
    </label>
  </div>
{% endblock %}

{% block shop_option_radio_widget %}
  {{ block('shop_selector_item_name') }}
{% endblock %}

{% block shop_selector_item_name %}
  <div class="shop-selector-item-name">
    <span class="shop-selector-color-container">
      <span class="shop-selector-color"{% if shop.color is not empty %} style="background-color: {{ shop.color }};"{% endif %}></span>
    </span>
    {{ shop.name }}
    {% if not multiple %}
      <i class="material-icons">arrow_forward</i>
    {% else %}
      <span class="shop-selector-status" data-added-label="{{ 'Added'|trans({}, 'Admin.Global') }}" data-removed-label="{{ 'Removed'|trans({}, 'Admin.Global') }}">
        {% if shop.id == contextShopId %}
          {{ 'Current store'|trans({}, 'Admin.Global') }}
        {% endif %}
      </span>
    {% endif %}
  </div>
{% endblock %}
