{% extends 'datatable.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}

{% set manageAllowed = is_granted('manage_tag') %}

{% block datatable_row_attr %}{% if manageAllowed %} class="modal-ajax-form open-edit {{ widgets.class_tag_row(entry) }}" data-href="{{ path('tags_edit', {'id': entry.id}) }}" {% endif %}{% endblock %}

{% block datatable_column_value %}
    {% if column == 'name' %}
        {{ widgets.label_name(entry.name, entry.color|colorize(entry.name)) }}
    {% elseif column == 'amount' %}
        {{ widgets.badge_counter(entry.amount, null, (entry.amount == 0 ? 'yellow' : '')) }}
    {% elseif column == 'visible' %}
        {{ widgets.label_visible(entry.visible) }}
    {% elseif column == 'actions' %}
        {% set event = actions(app.user, 'tag', 'index', {'tag': entry}) %}
        {{ widgets.table_actions(event.actions) }}
    {% elseif column == 'id' %}
        {% if dataTable.hasBatchForm() %}
            {{ tables.datatable_multiupdate_row(entry.id) }}
        {% endif %}
    {% endif %}
{% endblock %}
