{% import "@AdminLTE/Macros/default.html.twig" as macro %}
{% if messages is not defined or adminlte_direct_include is defined %}
{% set messages = null %}
{% set adminlte_messages = adminlte_messages() %}
{% if adminlte_messages is not null %}
{% set messages = adminlte_messages.messages %}
{% set total = adminlte_messages.total %}
{% endif %}
{% endif %}
{% if messages is defined and messages is not null %}
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="far fa-envelope"></i>
<span class="label label-success">{{ total }}</span>
</a>
<ul class="dropdown-menu">
<li class="header">{{ 'You have %count% messages'|trans({'%count%': total}, 'AdminLTEBundle') }}</li>
<li>
<ul class="menu">
{% for msg in messages %}
<li>
<a href="{{ path('adminlte_message'|route_alias, {'id': msg.identifier}) }}">
<div class="pull-left">
{{ macro.avatar(msg.from.avatar, msg.from.username) }}
</div>
<h4>
{{ msg.from.username }}
<small><i class="far fa-clock"></i> {{ msg.sentAt|date('d.m.Y H:i') }}</small>
</h4>
<p>{{ msg.subject }}</p>
</a>
</li>
{% endfor %}
</ul>
</li>
<li class="footer"><a href="{{ path('adminlte_messages'|route_alias) }}">{{'View all'|trans({}, 'AdminLTEBundle')}}</a></li>
</ul>
</li>
{% endif %}