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

<div id="combination-list-actions">
  <div class="btn-group">
    {# button disabled by default, because js toggles its availability based on selected combinations #}
    <button class="btn btn-outline-secondary dropdown-toggle"
      id="combination-bulk-actions-btn"
      data-toggle="dropdown"
      aria-expanded="false"
      disabled
    >
      {{ 'Bulk actions'|trans({}, 'Admin.Global') }}
      <i class="icon-caret-up"></i>
    </button>
    <div class="dropdown-menu" style="">
      <button
        id="combination-bulk-form-btn" class="dropdown-item bulk-action-btn" type="button"
        data-btn-label="{{ 'Edit %combinations_number% combinations'|trans({}, 'Admin.Catalog.Feature') }}"
        data-form-url="{{ url('admin_products_combinations_bulk_combination_form', {productId: productId}) }}"
        data-modal-confirm-label="{{ 'Apply to %combinations_number% combinations'|trans({}, 'Admin.Catalog.Feature') }}"
        data-modal-cancel-label="{{ 'Cancel'|trans({}, 'Admin.Actions') }}"
      >
        {{ 'Edit %combinations_number% combinations'|trans({'%s': ''}, 'Admin.Catalog.Feature') }}
      </button>
      {% if isMultistoreActive %}
        {% set deleteLabel = 'Delete %combinations_number% combinations from store "%store_name%"'|trans({'%store_name%': shopName}, 'Admin.Catalog.Feature') %}
        {% set modalMessage = 'Are you sure you want to delete selected combinations from store "%store_name%"?'|trans({'%store_name%': shopName}, 'Admin.Catalog.Notification') %}
      {% else %}
        {% set deleteLabel = 'Delete %combinations_number% combinations'|trans({}, 'Admin.Catalog.Feature') %}
        {% set modalMessage = 'Are you sure you want to delete selected combinations?'|trans({}, 'Admin.Catalog.Notification') %}
      {% endif %}
      <button
        id="combination-bulk-delete-btn" class="dropdown-item bulk-action-btn bulk-delete-btn" type="button"
        data-btn-label="{{ deleteLabel }}"
        data-form-url="{{ url('admin_products_combinations_bulk_delete', {productId: productId}) }}"
        data-modal-message="{{ modalMessage }}"
        data-modal-confirm-label="{{ 'Delete %combinations_number% combinations'|trans({}, 'Admin.Catalog.Feature') }}"
        data-modal-cancel-label="{{ 'Cancel'|trans({}, 'Admin.Actions') }}"
        data-bulk-chunk-size="10"
        data-progress-title="{{ 'Deleting %total% combinations'|trans({}, 'Admin.Catalog.Feature') }}"
        data-progress-message="{{ 'Deleting %done%/%total% combinations'|trans({}, 'Admin.Catalog.Feature') }}"
        data-close-label="{{ 'Close'|trans({}, 'Admin.Catalog.Feature') }}"
        data-stop-processing="{{ 'Stop processing'|trans({}, 'Admin.Catalog.Feature') }}"
        data-errors-message="{{ '%error_count% errors occurred. You can download the logs for future reference.'|trans({}, 'Admin.Catalog.Feature') }}"
        data-back-to-processing="{{ 'Back to processing'|trans({}, 'Admin.Catalog.Feature') }}"
        data-download-error-log="{{ 'Download error log'|trans({}, 'Admin.Catalog.Feature') }}"
        data-view-error-log="{{ 'View %error_count% error logs'|trans({}, 'Admin.Catalog.Feature') }}"
        data-view-error-title="{{ 'Error log'|trans({}, 'Admin.Catalog.Feature') }}"
        data-shop-id="{{ shopId }}"
      >
        {{ deleteLabel }}
      </button>
      {% if isMultistoreActive %}
        <button
          id="combination-bulk-delete-btn-all-shops" class="dropdown-item bulk-action-btn bulk-delete-btn" type="button"
          data-btn-label="{{ 'Delete %combinations_number% combinations from all stores'|trans({}, 'Admin.Catalog.Feature') }}"
          data-form-url="{{ url('admin_products_combinations_bulk_delete', {productId: productId}) }}"
          data-modal-message="{{ 'Are you sure you want to delete selected combinations from all stores?'|trans({}, 'Admin.Catalog.Notification') }}"
          data-modal-confirm-label="{{ 'Delete %combinations_number% combinations'|trans({}, 'Admin.Catalog.Feature') }}"
          data-modal-cancel-label="{{ 'Cancel'|trans({}, 'Admin.Actions') }}"
          data-bulk-chunk-size="10"
          data-progress-title="{{ 'Deleting %total% combinations'|trans({}, 'Admin.Catalog.Feature') }}"
          data-progress-message="{{ 'Deleting %done%/%total% combinations'|trans({}, 'Admin.Catalog.Feature') }}"
          data-close-label="{{ 'Close'|trans({}, 'Admin.Catalog.Feature') }}"
          data-stop-processing="{{ 'Stop processing'|trans({}, 'Admin.Catalog.Feature') }}"
          data-errors-message="{{ '%error_count% errors occurred. You can download the logs for future reference.'|trans({}, 'Admin.Catalog.Feature') }}"
          data-back-to-processing="{{ 'Back to processing'|trans({}, 'Admin.Catalog.Feature') }}"
          data-download-error-log="{{ 'Download error log'|trans({}, 'Admin.Catalog.Feature') }}"
          data-view-error-log="{{ 'View %error_count% error logs'|trans({}, 'Admin.Catalog.Feature') }}"
          data-view-error-title="{{ 'Error log'|trans({}, 'Admin.Catalog.Feature') }}"
        >
          {{ 'Delete %combinations_number% combinations from all stores'|trans({'%s': ''}, 'Admin.Catalog.Feature') }}
        </button>
      {% endif %}
    </div>
  </div>

  <button type="button" class="btn btn-primary generate-combinations-button" disabled="disabled">
    {{ 'Generate combinations'|trans({}, 'Admin.Catalog.Feature') }}
  </button>
</div>

{# Combination filters for paginated list #}
<div id="combinations_filters"
  data-translations="{{ {
   'filters.label': 'Filter by:'|trans({}, 'Admin.Actions'),
   'filters.clear': 'Clear filter|Clear {filtersNb} filters'|trans({}, 'Admin.Actions'),
  }|json_encode }}"
></div>
<div id="combination-edit-modal"
     data-empty-image="{{ asset('themes/new-theme/img/empty_state/combinations_history.svg') }}"
     data-translations="{{ {
       'modal.save': 'Save'|trans({}, 'Admin.Actions'),
       'modal.close': 'Close'|trans({}, 'Admin.Actions'),
       'modal.previous': 'Previous combination'|trans({}, 'Admin.Catalog.Feature'),
       'modal.next': 'Next combination'|trans({}, 'Admin.Catalog.Feature'),
       'modal.history.editedCombination': 'Edited combinations ({editedNb})'|trans({}, 'Admin.Catalog.Feature'),
       'modal.history.confirmTitle': 'Discard changes?'|trans({}, 'Admin.Catalog.Notification'),
       'modal.history.confirmBody': 'All unsaved modifications made on the combination [1]{combinationName}[/1] will be lost.'|trans({'[1]': '<span class="font-weight-bold">', '[/1]': '</span>'}, 'Admin.Catalog.Notification'),
       'modal.cancel': 'Cancel'|trans({}, 'Admin.Actions'),
       'modal.confirm': 'Discard'|trans({}, 'Admin.Actions'),
       'modal.history.empty': 'Here, you can have a look at the combinations you have edited. The list will reset when you close the editing window.'|trans({}, 'Admin.Catalog.Feature'),
       'modal.history.open': 'Open history'|trans({}, 'Admin.Catalog.Feature'),
       'modal.history.close': 'Close history'|trans({}, 'Admin.Catalog.Feature'),
     }|json_encode }}"
></div>
