{#**
 * 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="catalog-actions">
      {% block product_catalog_filter_by_categories %}
        <div id="product_catalog_category_tree_filter" class="d-inline-block dropdown dropdown-clickable mr-2 mb-2">
          <button
                  class="btn btn-outline-secondary dropdown-toggle"
                  type="button"
                  data-toggle="dropdown"
                  aria-haspopup="true"
                  aria-expanded="false"
          >
              {{ 'Filter by categories'|trans({}, 'Admin.Actions') }}
              {% if selected_category is defined and selected_category is not null %}
                  ({{ selected_category.getName() }})
              {% endif %}
          </button>
          <div id="tree-categories" class="dropdown-menu">
            <div class="categories-tree-actions">
              <a
                href="#"
                name="product_catalog_category_tree_filter_expand"
                onclick="productCategoryFilterExpand($('div#product_catalog_category_tree_filter'), this);"
                id="product_catalog_category_tree_filter_expand"
              >
                <i class="material-icons">expand_more</i>
                  {{ 'Expand'|trans({}, 'Admin.Actions') }}
              </a>
              <a
                href="#"
                name="product_catalog_category_tree_filter_collapse"
                onclick="productCategoryFilterCollapse($('div#product_catalog_category_tree_filter'), this);"
                id="product_catalog_category_tree_filter_collapse"
              >
                <i class="material-icons">expand_less</i>
                  {{ 'Collapse'|trans({}, 'Admin.Actions') }}
              </a>
              <a
                href="#"
                name="product_catalog_category_tree_filter_reset"
                onclick="productCategoryFilterReset($('div#product_catalog_category_tree_filter'));"
                id="product_catalog_category_tree_filter_reset"
              >
                <i class="material-icons">radio_button_unchecked</i>
                  {{ 'Unselect'|trans({}, 'Admin.Actions') }}
              </a>
            </div>
              {{ form_widget(categories) }}
          </div>
          {% if selected_category is defined and selected_category is not null %}
            <button
              class="btn btn-link"
              type="reset"
              name="categories_filter_reset"
              onclick="productCategoryFilterReset($('div#product_catalog_category_tree_filter'));">
              <i class="material-icons">clear</i> {{ 'Clear filter'|trans({}, 'Admin.Actions') }}
            </button>
          {% endif %}
        </div>
      {% endblock %}

      {% block product_catalog_filter_bulk_actions %}
        <div
            class="d-inline-block mb-2"
            bulkurl="{{ path('admin_product_bulk_action', {'action': 'activate_all'}) }}"
            massediturl="{{ path('admin_product_mass_edit_action', {'action': 'sort'}) }}"
            redirecturl="{{ path('admin_product_catalog', {'limit': limit, 'offset': offset, 'orderBy': orderBy, 'sortOrder': sortOrder}) }}"
            redirecturlnextpage="{{ path('admin_product_catalog', {'limit': limit, 'offset': offset+limit, 'orderBy': orderBy, 'sortOrder': sortOrder}) }}"
        >
          {% set buttons_action = [
            {
              "onclick": "bulkProductAction(this, 'activate_all');",
              "icon": "radio_button_checked",
              "label": "Activate selection"|trans({}, 'Admin.Actions')
            }, {
              "onclick": "bulkProductAction(this, 'deactivate_all');",
              "icon": "radio_button_unchecked",
              "label": "Deactivate selection"|trans({}, 'Admin.Actions')
            }
          ] %}

          {% set buttons_action = buttons_action|merge([
            {
              "divider": true
            }, {
              "onclick": "bulkProductAction(this, 'duplicate_all');",
              "icon": "content_copy",
              "label": "Duplicate selection"|trans({}, 'Admin.Actions')
            }
          ]) %}


          {% set buttons_action = buttons_action|merge([
            {
              "divider": true
            }, {
              "onclick": "bulkProductAction(this, 'delete_all');",
              "icon": "delete",
              "label": "Delete selection"|trans({}, 'Admin.Actions')
            }
          ]) %}

          {% include '@PrestaShop/Admin/Helpers/dropdown_menu.html.twig' with {
            'div_style': "btn-group dropdown bulk-catalog",
            'button_id': "product_bulk_menu",
            'disabled': true,
            'menu_label': "Bulk actions"|trans({}, 'Admin.Global'),
            'buttonType': "outline-secondary",
            'menu_icon': "icon-caret-up",
            'items': buttons_action
          } %}
        </div>
      {% endblock %}
</div>
