{% if app.session is not null and app.session.started %}
{% set _flash_messages = app.session.flashbag.all %}
{% if _flash_messages|length > 0 %}
<div id="flash-messages">
{% for label, messages in _flash_messages %}
{% for message in messages %}
{% set animation='bounce' %}
{% if label=='danger' %}
{% set animation='shake' %}
{% endif %}
<div class="alert alert-{{ label }} animated {{ animation }}">
<button type="button" class="alert-close" onclick="this.closest('div').style.display='none'">
×
</button>
{% if label=='success' %}
<i class="fa fa-check-circle-o mr-2"></i>
{% elseif label=='danger' or label=='warning' %}
<i class="fa fa-warning mr-2"></i>
{% elseif label=='info' %}
<i class="fa fa-info-circle mr-2"></i>
{% endif %}
{{ message|trans|striptags }}
</div>
{% endfor %}
{% endfor %}
</div>
<script type="text/javascript">
$(document).ready(function() {
setTimeout(function() {
$("#flash-messages .alert").fadeOut(1000);
},3000);
});
</script>
{% endif %}
{% endif %}