{% set logentries = admin.getLogEntries(object) %}
<td>
{% block field %}
    {% if logentries|length > 0 %}
        <table class="table table-bordered table-striped">
            <thead>
            <tr>
                {# <th>Id objet</th> #}
                {# <th>Sujet</th> #}
                <th>Date</th>
                <th>Utilisateur</th>
                <th>Champ(s) modifié(s)</th>
            </tr>
            </thead>
            <tbody>
            {% for log in logentries %}
                {% set user = getLogUser(log.username) %}
                <tr>
                    {# <td>{{ log.objectId }}</td> #}
                    {# <td>{{ admin.getLogEntryMappingClassName(log.objectClass) }}</td> #}
                    <td>{{ log.loggedAt|date('d/m/Y H:i') }}</td>
                    <td>
                        {% if user is not null %}
                            {# <a href="{{ path('admin_sonata_user_user_edit', {'id': user.id}) }}">{{ user.fullname }}</a> #}
                            {{ user.fullname }}
                        {% else %}
                            {{ log.username }}
                        {% endif %}
                    </td>
                    <td {% if log.action == 'create'%}class='bg-green'{% endif %}>
                        {% if log.action == 'create'%}
                            CREATION
                        {% else %}
                            <table class="table">
                            {% for field, value in log.data %}
                                <tr>
                                    <th>{{ field }}</th>
                                    <td>
                                        {% if is_object(value) %}
                                            {% if 'DateTime' == get_class(value) %}
                                                {{ value|date(options.format|default(null), options.timezone|default(null)) }}
                                            {% else %}
                                                {{ value|serialize }}
                                            {% endif %}
                                        {% elseif value is iterable%}
                                            {% for key, v in value %}
                                                <p>{{ key }} => {{ v|raw }}</p>
                                            {% endfor %}
                                        {% else %}
                                            {{ value }}
                                        {% endif %}
                                    </td>
                                </tr>
                            {% endfor %}
                            </table>
                        {% endif %}
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p><em>Aucun historique pour le moment !</em></p>
    {% endif %}
{% endblock %}
</td>