{% import "@SyliusShop/Common/Macro/icons.html.twig" as icons %}
{% if app.session is not null and app.session.started %}
{% for type in ['success', 'error', 'info', 'warning'] %}
{% for flash in app.session.flashbag.get(type) %}
{% if 'error' == type %}
{% set result = 'danger' %}
{% set icon = icons.danger() %}
{% endif %}
{% if 'info' == type %}
{% set result = 'info' %}
{% set icon = icons.info() %}
{% endif %}
<div class="alert alert-{{ result|default('success') }} alert-dismissible fade show">
<div class="d-flex align-items-center">
<span class="pr-3 fa-2x">
{{ icon|default(icons.success()) }}
</span>
<strong>
{% set header = 'sylius.ui.'~type %}
{{ header|trans }}
</strong>
{% if flash is iterable %}
{{ flash.message|trans(flash.parameters, 'flashes') }}
{% else %}
{{ flash|trans({}, 'flashes') }}
{% endif %}
</div>
<button type="button" class="close" data-dismiss="alert">
<span>×</span>
</button>
</div>
{% endfor %}
{% endfor %}
{% for flash_message in app.session.flashBag.get('vignette-init-error') %}
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div class="header text-center">
<h2>{{ 'sylius.ui.warning'|trans }}</h2>
</div>
<a class="text-center">
{{ flash_message }}
</a>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
{% endfor %}
{% for flash_message in app.session.flashBag.get('already_logged_in') %}
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div class="header text-center">
<h2>{{ 'sylius.ui.warning'|trans }}</h2>
</div>
<a class="text-center">
{{ 'app.ui.already_signed_in'|trans }}
</a>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
{% endfor %}
{% for flash_message in app.session.flashBag.get('unsubscribe') %}
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div class="header text-center">
<h2>{{ 'app.ui.success_action'|trans }}</h2>
</div>
<a class="text-center">
{{ 'app.ui.successfully_unsubscribed'|trans }}
</a>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
{% endfor %}
{% for flash_message in app.session.flashBag.get('productRemoved') %}
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<div class="header text-center">
<h2>{{ 'sylius.ui.warning'|trans }}</h2>
</div>
<a class="text-center">
{{ 'app.hu_vignette.product_removed_from_cart'|trans }}
</a>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
{% endfor %}
{% endif %}