{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% trans_default_domain 'EasyAdminBundle' %}

{% if ea.crud.currentAction == 'detail' or not field.customOptions.get('renderAsSwitch') %}
    <span class="badge {{ field.value == true ? 'badge-boolean-true' : 'badge-boolean-false' }}">
        {{ (field.value == true ? 'label.true' : 'label.false')|trans }}
    </span>
{% else %}
    <div class="form-check form-switch">
        <input type="checkbox" class="form-check-input" id="{{ field.uniqueId }}" {{ field.value == true ? 'checked' }}
            data-toggle-url="{{ field.customOptions.get('toggleUrl') }}"
            {{ field.formTypeOption('disabled') == true ? 'disabled' }} autocomplete="off">
        <label class="form-check-label" for="{{ field.uniqueId }}"></label>
    </div>
{% endif %}
