{% extends 'frontend.html.twig' %}
{% block content %}
<div class="rts-events-section section-gap" id="sponsor-list">
<div class="container">
<div class="row">
<div class="col mb-5">
<span class="h1 primary">Sponsorenliste</span>
</div>
</div>
<div class="row">
{% for sponsor in sponsors %}
{% set sponsorName = sponsor.address.company is not empty
? sponsor.address.company
: sponsor.person.firstname~' '~sponsor.person.lastname
%}
<div class="col-xl-4 col-md-6">
<div class="event-single">
<div class="event-picture">
{% if sponsor.image.id is defined %}
<img src="{{ sponsor.image.src }}" alt="{{ sponsorName }}" class="p-3">
{% else %}
<img src="{{ asset('/assets/frontend/images/Sponsor-Default.png') }}" alt="{{ sponsorName }}" class="p-3">
{% endif %}
</div>
<div class="contents">
<div class="area-count">
{% set areaCount = 0 %}
{% for area in sponsor.areas %}
{% if area.contract.state == 'active' or area.contract.state == 'cancelled' %}
{% set areaCount = areaCount + 1 %}
{% endif %}
{% endfor %}
{{ "%02d"|format(areaCount) }} Banden</div>
<div class="event-title">{{ sponsorName }}</div>
{% if sponsor.contact.url != '' %}
<div class="sponsor-url">
<i class="fa fa-link pr-2"></i>
<a href="{{ sponsor.contact.url }}" target="_blank">
{{ sponsor.contact.url }}
</a>
</div>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
</div>
{% endblock %}