{# Defined as EditbleDialog field #}
{% set sectors = sectors ?? pimcore_relations('sectors').getElements() %}
{% embed 'app/area-brick-layout.html.twig' %}
{% block content %}
<section>
<div class="container py-10 md:py-14">
{% if editmode or not pimcore_input('title').isEmpty() %}
<h2 class="mb-10 text-2xl text-center md:text-4xl md:mb-20 max-w-[200px] md:max-w-none mx-auto">
{{ pimcore_input('title', { placeholder: 'Titel' }) }}
</h2>
{% endif %}
{% if editmode %}
<div>
{% if pimcore_relations('sectors') is empty %}
<div class="alert alert-danger">
(Nog) geen sectoren gekoppeld.
</div>
{% endif %}
</div>
{% endif %}
<div class="grid grid-cols-2 gap-3 font-bold md:gap-8 md:justify-center md:flex-wrap md:flex ">
{% for sector in sectors %}
<a
href="{{ (sector.page.url ?? null) | trimUrl }}"
class="flex flex-col items-center justify-center grid-cols-1 gap-2 transition-transform bg-white rounded-md md:w-1/3 lg:w-1/6 hover:drop-shadow-xl hover:text-blue aspect-square max-w-[186px] px-4"
>
{% if editmode %}
<div class="alert alert-danger">Geen gekoppelde pagina in huidige taal. Kaart is niet klikbaar.</div>
{% endif %}
{% if sector.icon %}
{{ sector.icon.thumbnail('sector-card-icon').html({
class: 'w-full',
pictureAttributes: {
class: ''
}
})|raw }}
{% else %}
<div class="flex-grow"></div>
{% endif %}
<span class="leading-tight text-center">{{ sector.branchename ?: sector.key }}</span>
</a>
{% endfor %}
{% if document.getProperty('sectorArchivePage') %}
<a
href="{{ document.getProperty('sectorArchivePage').url | trimUrl }}"
class="flex flex-col items-center justify-center grid-cols-1 gap-5 text-white transition-transform rounded-md md:w-1/3 lg:w-1/6 bg-blue hover:drop-shadow-2xl aspect-square max-w-[186px] px-4"
>
<svg class="w-8 h-8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path fill="#FFF" fill-rule="evenodd" d="M3.5 9a3.5 3.5 0 0 1 .192 6.995L3.5 16a3.5 3.5 0 0 1-.192-6.995L3.5 9Zm9 0a3.5 3.5 0 0 1 .192 6.995L12.5 16a3.5 3.5 0 0 1-.192-6.995L12.5 9Zm-9 1.5a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm9 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4ZM3.5 0a3.5 3.5 0 0 1 .192 6.995L3.5 7A3.5 3.5 0 0 1 3.308.005L3.5 0Zm9 0a3.5 3.5 0 0 1 .192 6.995L12.5 7a3.5 3.5 0 0 1-.192-6.995L12.5 0Zm-9 1.5a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm9 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4Z"/>
</svg>
<span class="leading-tight text-center">{{ "Bekijk alle sectoren"|trans }}</span>
</a>
{% elseif editmode %}
<div class="alert alert-danger">
Geen 'Sector Overzicht Pagina' (sectorArchivePage) property toegevoegd aan huidige taal.
</div>
{% endif %}
</div>
</div>
</div>
</section>
{% endblock %}
{% endembed %}