{% extends '@SonataAdmin/CRUD/base_list_field.html.twig' %}

{% if object is instanceof("App\\Entity\\Flux") and (is_granted('ROLE_SUPER_ADMIN') or is_granted('ROLE_TRESORIER')) %}
    {% block field%}
    {%- spaceless %}
        {% if value %}
            {% set text = 'label_type_yes'|trans({}, 'SonataAdminBundle') %}
        {% else %}
            {% set text = 'label_type_no'|trans({}, 'SonataAdminBundle') %}
        {% endif %}

        {% if field_description.options.inverse|default(false) ? not value : value %}
            {% set class = 'label-success' %}
        {% else %}
            {% set class = 'label-danger' %}
        {% endif %}
        <span class="label {{ class }} editableboolean" data-value="{{value ? 'true' : 'false'}}" data-url="{{path('setreconverti', {'id': object.id})}}" style='cursor:pointer;'>{{ text }}</span>
    {% endspaceless -%}
    {% endblock %}
{% endif %}