{% set accountLinksBlock = pimcore_block('accountLinksBlock') %}
{% set LoginLink = pimcore_link('LoginLink') %}
{% set LogoutLink = pimcore_link('LogoutLink') %}
{% if editmode %}
<link rel="stylesheet" href="{{ get_frontend_file('backend', 'css') }}" type="text/css">
<div class="container">
<div class="row mb-5">
<div class="col-3">
<b>Login Link</b>
</div>
<div class="col">
{{ LoginLink | raw }}
</div>
</div>
<div class="row mb-5">
<div class="col-3">
<b>Logout Link</b>
</div>
<div class="col">
{{ LogoutLink | raw }}
</div>
</div>
<div class="row">
<div class="col">
<h3>Account Links</h3>
</div>
</div>
</div>
{% endif %}
<section class="l-account">
<div class="container">
<div class="row">
<div class="col-sm-12">
{% if not editmode %}
{% set user = get_full_name() %}
{% set agentNr = get_agent_number() %}
{% if document.getProperty('isBms') is defined and document.getProperty('isBms') == true %}
{% set agentNr = '' %}
{% endif %}
{% if user == false %}
<div class="l-account__link l-account__link--login">
<a href="" class="open"><b>Login</b><span></span></a>
<a href="" class="close"><b>Login</b><span></span></a>
</div>
{% else %}
<div class="l-account__link l-account__link--user">
<a href="" class="open"><b>Hallo</b><span></span><i>{{ user }}{{ agentNr }}</i></a>
<a href="" class="close"><b>Hallo</b><span></span><i>{{ user }}{{ agentNr }}</i></a>
</div>
{% endif %}
{% endif %}
<div class="l-account__nav background-primary e-rte">
{% if not editmode and user == false %}
{% if LoginLink != null %}
<span><a href="{{ LoginLink.getHref() }}" class="e-button w-100">{{ LoginLink.text | raw }}</a></span>
{% endif %}
{% endif %}
{% if not editmode and user == true %}
{% if LogoutLink != null %}
<span class="d-md-none"><b>{{user}}</b></span>
{% endif %}
{% endif %}
{% if user == true %}
{% for i in accountLinksBlock.iterator %}
{% set accountLinkImage = pimcore_image('accountLinkImage',{'width': 100, 'height': 100}) %}
{% set accountLink = pimcore_link('link') %}
{% set permission = null %}
{% if pimcore_document(accountLink.data.internalId) is not null %}
{% set permission = pimcore_document(accountLink.data.internalId).getProperty('pagePermissions') %}
{% endif %}
{% set hasAccessForUsers = true %}
{% set hasAccesForGDV = true %}
{% set hasAccesForSettlement = true %}
{% set hasAccesForCustomer = true %}
{% if permission == "viewMyUsers" %}
{% set hasAccessForUsers = has_access_for('Users') %}
{% endif %}
{% if permission == 'viewGdvDownload' %}
{% set hasAccesForGDV = has_access_for('GDV') %}
{% endif %}
{% if permission == 'viewSettlements' %}
{% set hasAccesForSettlement = has_access_for('Settlement') %}
{% endif %}
{% if permission == 'viewCustomerList' %}
{% set hasAccesForCustomer = has_access_for('Customer') %}
{% endif %}
{% if editmode %}
<div class="row mb-5">
<div class="col-3">
<b>Icon:</b><br>
{{ accountLinkImage | raw }}
</div>
<div class="col">
<b>Link:</b><br>
{{ accountLink | raw }}
</div>
</div>
{% else %}
{% if accountLink.getHref() != '' and accountLinkImage != null and hasAccesForCustomer == true and hasAccessForUsers == true and hasAccesForGDV == true and hasAccesForSettlement == true %}
<span><a href="{{ accountLink.getHref() }}" target="{{ accountLink.getTarget() }}" class="l-account__nav--link">{{ convert_svg_to_code(app.request.getSchemeAndHttpHost(), accountLinkImage.getImage()) | raw }} {{ accountLink.text | raw }}</a></span>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% if not editmode and user == true %}
{% if LogoutLink != null %}
<span><a href="{{ LogoutLink.getHref() }}" class="e-button--light w-100">{{ LogoutLink.text | raw }}</a></span>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
</section>