dashboard for org
This commit is contained in:
@@ -12,7 +12,27 @@
|
||||
{# Колонка действий #}
|
||||
{% if actionsConfig is defined and actionsConfig|length > 0 %}
|
||||
<td class="actions-cell text-end">
|
||||
{{ render_actions(item, actionsConfig)|raw }}
|
||||
{# Фильтруем действия на основе прав доступа #}
|
||||
{% set visibleActions = [] %}
|
||||
{% for action in actionsConfig %}
|
||||
{% set showAction = true %}
|
||||
{% if action.type is defined %}
|
||||
{% if action.type == 'edit' and not (can_edit|default(true)) %}
|
||||
{% set showAction = false %}
|
||||
{% elseif action.type == 'delete' and not (can_delete|default(true)) %}
|
||||
{% set showAction = false %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if showAction %}
|
||||
{% set visibleActions = visibleActions|merge([action]) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if visibleActions|length > 0 %}
|
||||
{{ render_actions(item, visibleActions)|raw }}
|
||||
{% else %}
|
||||
<span class="text-muted small">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
{ label: 'Ред.', url: '/clients/edit/{id}', icon: 'bi bi-pencil', class: 'btn-outline-primary' },
|
||||
{ label: 'Удалить', url: '/clients/delete/{id}', icon: 'bi bi-trash', class: 'btn-outline-danger' }
|
||||
]
|
||||
- can_edit: Разрешено ли редактирование (для фильтрации действий)
|
||||
- can_delete: Разрешено ли удаление (для фильтрации действий)
|
||||
- emptyMessage: Сообщение при отсутствии данных
|
||||
- emptyActionUrl: URL для кнопки действия
|
||||
- emptyActionLabel: Текст кнопки
|
||||
@@ -50,7 +52,27 @@
|
||||
{# Колонка действий #}
|
||||
{% if actionsConfig is defined and actionsConfig|length > 0 %}
|
||||
<td class="actions-cell text-end">
|
||||
{{ render_actions(item, actionsConfig)|raw }}
|
||||
{# Фильтруем действия на основе прав доступа #}
|
||||
{% set visibleActions = [] %}
|
||||
{% for action in actionsConfig %}
|
||||
{% set showAction = true %}
|
||||
{% if action.type is defined %}
|
||||
{% if action.type == 'edit' and not (can_edit|default(true)) %}
|
||||
{% set showAction = false %}
|
||||
{% elseif action.type == 'delete' and not (can_delete|default(true)) %}
|
||||
{% set showAction = false %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if showAction %}
|
||||
{% set visibleActions = visibleActions|merge([action]) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if visibleActions|length > 0 %}
|
||||
{{ render_actions(item, visibleActions)|raw }}
|
||||
{% else %}
|
||||
<span class="text-muted small">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user