1{#**
2 * Copyright since 2007 PrestaShop SA and Contributors
3 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
4 *
5 * NOTICE OF LICENSE
6 *
7 * This source file is subject to the Open Software License (OSL 3.0)
8 * that is bundled with this package in the file LICENSE.md.
9 * It is also available through the world-wide-web at this URL:
10 * https://opensource.org/licenses/OSL-3.0
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@prestashop.com so we can send you a copy immediately.
14 *
15 * DISCLAIMER
16 *
17 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18 * versions in the future. If you wish to customize PrestaShop for your
19 * needs please refer to https://devdocs.prestashop.com/ for more information.
20 *
21 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
22 * @copyright Since 2007 PrestaShop SA and Contributors
23 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
24 *#}
25
26{% set actions = column.options.actions %}
27
28{% if actions is not empty %}
29    {% set inlineActions = [] %}
30    {% set regularActions = [] %}
31
32    {% for action in actions %}
33      {% if action.options['use_inline_display'] == true %}
34          {% set inlineActions = inlineActions|merge([action]) %}
35        {% else %}
36          {% set regularActions = regularActions|merge([action]) %}
37      {% endif %}
38    {% endfor %}
39
40    <div class="btn-group-action text-right">
41      {% if inlineActions is not empty %}
42        <div class="btn-group d-flex justify-content-between text-right">
43          {% for inlineAction in inlineActions -%}
44            {% if inlineAction.isApplicable(record) %}
45
46              {% set class = 'dropdown-item inline-dropdown-item' %}
47
48              {{ include('@PrestaShop/Admin/Common/Grid/Actions/Row/'~inlineAction.type~'.html.twig', {
49                'grid': grid,
50                'column': column,
51                'attributes': {'class': class, 'tooltip_name': true},
52                'record': record,
53                'action': inlineAction
54              }) }}
55            {% endif %}
56          {% endfor %}
57        </div>
58      {% endif %}
59
60      {% if regularActions is not empty %}
61        <div class="btn-group">
62          {% set skippedActions, isFirstRendered = 0, false %}
63
64          {# Render first item that is not in dropwdown #}
65          {% for action in regularActions  %}
66            {% if not isFirstRendered %}
67              {% set skippedActions = skippedActions + 1 %}
68            {% endif %}
69
70            {% if action.isApplicable(record) and not isFirstRendered %}
71              {{ include('@PrestaShop/Admin/Common/Grid/Actions/Row/'~action.type~'.html.twig', {
72                'grid': grid,
73                'column': column,
74                'attributes': {'class': 'dropdown-item', 'tooltip_name': true},
75                'record': record,
76                'action': action
77              }) }}
78
79              {% set isFirstRendered = true %}
80            {% endif %}
81          {% endfor %}
82
83          {# Render remaining items in dropdown #}
84          {% if regularActions|length > skippedActions %}
85            <a class="btn btn-link dropdown-toggle dropdown-toggle-dots dropdown-toggle-split no-rotate"
86               data-toggle="dropdown"
87               aria-haspopup="true"
88               aria-expanded="false"
89            >
90            </a>
91
92            <div class="dropdown-menu dropdown-menu-right">
93              {% for action in regularActions|slice(skippedActions) if action.isApplicable(record) %}
94                {{ include('@PrestaShop/Admin/Common/Grid/Actions/Row/'~action.type~'.html.twig', {
95                  'grid': grid,
96                  'column': column,
97                  'attributes': {'class': 'dropdown-item', 'tooltip_name': false},
98                  'record': record,
99                  'action': action
100                }) }}
101              {% endfor %}
102            </div>
103          {% endif %}
104        </div>
105      {% endif %}
106    </div>
107{% endif %}
108