forked from Sylius/Stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable.html.twig
More file actions
66 lines (61 loc) · 3.79 KB
/
table.html.twig
File metadata and controls
66 lines (61 loc) · 3.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{% macro headers(grid, definition, request_attributes) %}
{% import '@SyliusBootstrapAdminUi/shared/helper/sorting.html.twig' as sorting %}
{% if definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 %}
<th class="w-1 {{ field.options.vars.th_class|default('') }}">
<input data-check-all="index" type="checkbox" class="form-check-input">
</th>
{% endif %}
{% for field in definition.fields|sylius_sort_by('position') %}
{% if field.enabled %}
{% if field.isSortable %}
{{ sorting.table_header(grid, field, request_attributes) }}
{% else %}
<th class="text-body sylius-table-column-{{ field.name }} {{ field.options.vars.th_class|default('') }}">{{ field.label|trans }}</th>
{% endif %}
{% endif %}
{% endfor %}
{% if definition.actionGroups.item is defined and definition.getEnabledActions('item')|length > 0 %}
<th class="w-1 text-body text-center sylius-table-column-actions {{ field.options.vars.th_class|default('') }}">{{ 'sylius.ui.actions'|trans }}</th>
{% endif %}
{% endmacro %}
{% macro row(grid, definition, row) %}
{% import '@SyliusBootstrapAdminUi/shared/helper/dropdown.html.twig' as dropdown %}
<tr class="item" {{ sylius_test_html_attribute('row') }} {{ sylius_test_html_attribute('resource-id', row.id|default(null)) }}>
{% if definition.actionGroups.bulk is defined and definition.getEnabledActions('bulk')|length > 0 and row.id is defined %}
<td class="text-center"><input data-check-all-group="index" class="form-check-input" type="checkbox" value="{{ row.id }}" /></td>
{% endif %}
{% for field in definition.enabledFields|sylius_sort_by('position') %}
<td{% if field.options.vars.td_class is defined %} class="{{ field.options.vars.td_class }}"{% endif %}>
{% if field.name == 'code' %}
<code>{{ sylius_grid_render_field(grid, field, row) }}</code>
{% else %}
{{ sylius_grid_render_field(grid, field, row) }}
{% endif %}
</td>
{% endfor %}
{% if definition.actionGroups.item is defined and definition.getEnabledActions('item')|length > 0 %}
<td{% if field.options.vars.td_class is defined %} class="{{ field.options.vars.td_class }}"{% endif %} {{ sylius_test_html_attribute('actions') }}>
<div class="d-flex gap-1 justify-content-end">
{% for action in definition.getEnabledActions('item')|sylius_sort_by('position') %}
{{ sylius_grid_render_action(grid, action, row) }}
{% endfor %}
{% if definition.actionGroups.subitem is defined and definition.getEnabledActions('subitem')|length > 0 %}
{% set subactions %}
{% for action in definition.getEnabledActions('subitem')|sylius_sort_by('position') %}
{{ sylius_grid_render_action(grid, action, row) }}
{% endfor %}
{% endset %}
{% set more_button %}
<button class="btn btn-icon dropdown-static" data-bs-toggle="tooltip" data-bs-title="{{ 'sylius.ui.more'|trans }}">
{{ ux_icon('tabler:dots') }}
</button>
{% endset %}
{% if subactions|trim|length > 0 %}
{{ dropdown.default({ customTrigger: more_button, content: subactions, direction: 'down-end' }) }}
{% endif %}
{% endif %}
</div>
</td>
{% endif %}
</tr>
{% endmacro %}