{% set contacts = pimcore_relations('contacts', {
classes: ['ContactPerson'],
title: 'Contactpersonen'
}) %}
{% embed 'app/area-brick-layout.html.twig' %}
{% block content %}
<!-- Contact Colleagues -->
<section class="container py-10">
{% if editmode or not pimcore_input('contact-people-title').isEmpty() %}
<h2 class="my-10 text-4xl">{{ pimcore_input('contact-people-title', { placeholder: 'Titel' }) }}</h2>
{% endif %}
<div class="relative z-20 block p-10 text-white bg-blue-300 rounded-md">
{% if editmode or not pimcore_input('title').isEmpty() %}
<h3 class="text-2xl leading-7">{{ pimcore_input('title', { placeholder: 'Titel' }) }}</h3>
{% endif %}
{% if editmode %}
{{ contacts|raw }}
{% else %}
{# Don't do `contacts|length` within the loop, that resets the pointer. #}
{% set length = contacts|length %}
{% for i, contact in contacts %}
<div class="
flex
items-center
justify-between
{% if not pimcore_input('title').isEmpty() || length > 1 %}
{{ loop.index == length ? 'pt-6' : 'py-6 border-b border-white border-opacity-20' }}
{% endif %}
">
{% if contact.image %}
<div class="block mr-4">
{{ contact.image.getThumbnail('contact-people-image').html({
imgAttributes: {class: 'rounded-full'}
})|raw }}
</div>
{% endif %}
<div class="flex flex-col flex-grow">
<span class="text-xl font-bold">{{ contact.name }}</span>
<span>{{ contact.function }}</span>
</div>
<div class="flex">
{% if contact.phone %}
<a href="tel:{{ contact.phone | phone }}" class="flex items-center justify-center w-10 h-10 mr-6 bg-white rounded-full">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path fill="#0072BB" fill-rule="evenodd" d="m19.243 13.03-4-1a1.004 1.004 0 0 0-1.075.416l-2.56 3.84a17.084 17.084 0 0 1-7.894-7.894l3.84-2.56a1 1 0 0 0 .416-1.074l-1-4A1 1 0 0 0 6 0H1a1 1 0 0 0-1 1c.012 10.489 8.511 18.988 19 19a1 1 0 0 0 1-1v-5a1 1 0 0 0-.757-.97Z"/></svg>
</a>
{% endif %}
{% if document.hasProperty('contactPage') and data.request.url != document.getProperty('contactPage').getUrl() %}
<a href="{{ document.getProperty('contactPage').getUrl() | trimUrl }}" target="_blank" class="flex items-center justify-center w-10 h-10 bg-white rounded-full">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="17"><path fill="#0072BB" fill-rule="evenodd" d="M2 14.5V6.04l7.594 3.375a.999.999 0 0 0 .812 0L18 6.039V14.5H2Zm16-12v1.35l-8 3.555-8-3.554V2.5h16Zm2 1.98V1.5a1 1 0 0 0-1-1H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1V4.48Z"/></svg>
</a>
{% endif %}
{# Temporarily disabled in favor of ↑ (COOL-186) #}
{#<a href="mailto:{{ contact.email }}" target="_blank" class="flex items-center justify-center w-10 h-10 bg-white rounded-full">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="17"><path fill="#0072BB" fill-rule="evenodd" d="M2 14.5V6.04l7.594 3.375a.999.999 0 0 0 .812 0L18 6.039V14.5H2Zm16-12v1.35l-8 3.555-8-3.554V2.5h16Zm2 1.98V1.5a1 1 0 0 0-1-1H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1V4.48Z"/></svg>
</a>#}
</div>
</div>
{% endfor %}
{% endif %}
</div>
</section>
{% endblock %}
{% endembed %}