{% if tasks is not defined or adminlte_direct_include is defined %}
{% set tasks = null %}
{% set adminlte_tasks = adminlte_tasks() %}
{% if adminlte_tasks is not null %}
{% set tasks = adminlte_tasks.tasks %}
{% set total = adminlte_tasks.total %}
{% endif %}
{% endif %}
{% if tasks is defined and tasks is not null %}
<li class="dropdown tasks-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="far fa-flag"></i>
<span class="label label-danger">{{ total }}</span>
</a>
<ul class="dropdown-menu">
<li class="header">{{ 'You have %count% tasks' |trans({'%count%': total}, 'AdminLTEBundle') }}</li>
<li>
<ul class="menu">
{% for task in tasks %}
<li>
<a href="{{ path('adminlte_task'|route_alias, {'id': task.identifier}) }}">
<h3>
{{ task.title }}
<small class="pull-right">{{ task.progress }}%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-{{ task.color }}"
style="width: {{ task.progress }}%"
role="progressbar"
aria-valuenow="{{ task.progress }}"
aria-valuemin="0"
aria-valuemax="100">
<span class="sr-only">{{ '%progress%% Complete'|trans({'%progress%':task.progress}, 'AdminLTEBundle') }}</span>
</div>
</div>
</a>
</li>
{% endfor %}
</ul>
<li class="footer">
<a href="{{ path('adminlte_tasks'|route_alias) }}">{{'View all'|trans({}, 'AdminLTEBundle')}}</a>
</li>
</ul>
</li>
{% endif %}