{% embed 'app/area-brick-layout.html.twig' %}
{% block content %}
<!-- Cards masonry -->
<section class="bg-gray-200">
<div class="md:container mx-auto">
{% if editmode %}
{{ pimcore_relations('references', {
classes: ['Project'],
title: 'References',
}) }}
{% endif %}
{% if editmode and projectObjects is not defined %}
<div>
{{ pimcore_relations('projects', {
classes: ['Project'],
title: 'Projecten',
}) }}
</div>
{% else %}
{% if projectObjects is defined %}
<div class="flex md:items-end justify-between flex-col md:flex-row">
{# Tabs as links #}
{% set projectsPage = document.getProperty('projectsPage') %}
{% set insightsPage = document.getProperty('insightsPage') %}
<div class="flex gap-8 js-tabs filter-tabs pb-6 px-5 md:px-0 md:mb-0">
{% if insightsPage %}
<a href="{{ insightsPage.url }}">{{ 'Insights' | trans }}</a>
{% endif %}
{% if projectsPage is not empty %}
<a href="{{ projectsPage.url }}">{{ 'Projects' | trans }}</a>
{% endif %}
</div>
{# Filters #}
<form
method="get"
class="flex flex-col items-center justify-between md:flex-row">
<div
class="flex flex-col justify-end w-full gap-3 px-5 pt-6 md:py-6 bg-blue-200 md:bg-white md:gap-6 md:flex-row md:bg-opacity-0 md:px-0">
<div data-filter="product_category" class="filter-dropdown js-filter">
<div class="flex flex-row gap-8 items-center justify-between sm:justify-start">
<label data-base-label="{{ 'Products' | trans }}" class="js-filter-label" for="product_category">{{ 'Products' | trans }}</label>
<div class="flex flex-row gap-4 pointer-events-none items-center">
<svg class="pointer-events-none select-open-arrow" xmlns="http://www.w3.org/2000/svg" width="16" height="9.42468697"><path fill="#323E48" fill-rule="evenodd" d="M15.65624442 7.3520215 8.9247854.38881541C8.68558505.14026701 8.3504987-4.8e-7 7.99960082-4.8e-7c-.34971019 0-.68446606.14012915-.92503804.38866442L.3428726 7.352109C.12004 7.5819731 0 7.8825387 0 8.1937897c0 .3429687.1462408.6715199.4108179.9068985l.11367.0902432c.509531.3590258 1.2271427.3021077 1.6687114-.1543865l5.80789478-6.00860086 5.80601078 6.00749926c.47506145.4925072 1.27101644.5211493 1.78259099.0650323.51947241-.4630657.5501348-1.2485897.06654857-1.7484541Z"/></svg>
<button class="js-filter-clear pointer-events-auto">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#323E48" fill-rule="evenodd" d="M1.7859559.30642159 8 6.521 14.2140441.30642159c.4085621-.40856212 1.0709722-.40856212 1.4795343 0 .4085621.40856212.4085621 1.07097219 0 1.47953431L9.479 8l6.2145784 6.2140441c.4085621.4085621.4085621 1.0709722 0 1.4795343-.4085621.4085621-1.0709722.4085621-1.4795343 0L8 9.479l-6.2140441 6.2145784c-.40856212.4085621-1.0709722.4085621-1.47953431 0-.40856212-.4085621-.40856212-1.0709722 0-1.4795343L6.521 8 .30642159 1.7859559c-.40856212-.40856212-.40856212-1.0709722 0-1.47953431.40856212-.40856212 1.07097219-.40856212 1.47953431 0Z"/></svg>
</button>
</div>
</div>
<input
name="product_category"
>
<div class="flex flex-col filter-dropdown__list js-filter-list drop-shadow-xl">
{% for id, name in productCategoryFilter %}
{% set itemName = name ~ '-product-filter' %}
{% set translated = itemName | slug | lower | trans %}
{% if '-filter' in translated %}
{% set showTranslated = false %}
{% else %}
{% set showTranslated = true %}
{% endif %}
<button class="filter-dropdown__option js-filter-option text-left" value="{{ id }}" data-translated-slug="{{ translated }}" {{ app.request.query.get('product_category') == id ? 'selected' : '' }}>
{% if showTranslated %}
{{ translated }}
{% else %}
{{ name }}
{% endif %}
</button>
{% endfor %}
</div>
</div>
<div data-filter="branch" class="filter-dropdown js-filter">
<div class="flex flex-row gap-8 items-center justify-between sm:justify-start">
<label data-base-label="{{ 'Branches' | trans }}" class="js-filter-label" for="branch">{{ 'Branches' | trans }}</label>
<div class="flex flex-row gap-4 pointer-events-none items-center">
<svg class="pointer-events-none select-open-arrow" xmlns="http://www.w3.org/2000/svg" width="16" height="9.42468697"><path fill="#323E48" fill-rule="evenodd" d="M15.65624442 7.3520215 8.9247854.38881541C8.68558505.14026701 8.3504987-4.8e-7 7.99960082-4.8e-7c-.34971019 0-.68446606.14012915-.92503804.38866442L.3428726 7.352109C.12004 7.5819731 0 7.8825387 0 8.1937897c0 .3429687.1462408.6715199.4108179.9068985l.11367.0902432c.509531.3590258 1.2271427.3021077 1.6687114-.1543865l5.80789478-6.00860086 5.80601078 6.00749926c.47506145.4925072 1.27101644.5211493 1.78259099.0650323.51947241-.4630657.5501348-1.2485897.06654857-1.7484541Z"/></svg>
<button class="js-filter-clear pointer-events-auto">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#323E48" fill-rule="evenodd" d="M1.7859559.30642159 8 6.521 14.2140441.30642159c.4085621-.40856212 1.0709722-.40856212 1.4795343 0 .4085621.40856212.4085621 1.07097219 0 1.47953431L9.479 8l6.2145784 6.2140441c.4085621.4085621.4085621 1.0709722 0 1.4795343-.4085621.4085621-1.0709722.4085621-1.4795343 0L8 9.479l-6.2140441 6.2145784c-.40856212.4085621-1.0709722.4085621-1.47953431 0-.40856212-.4085621-.40856212-1.0709722 0-1.4795343L6.521 8 .30642159 1.7859559c-.40856212-.40856212-.40856212-1.0709722 0-1.47953431.40856212-.40856212 1.07097219-.40856212 1.47953431 0Z"/></svg>
</button>
</div>
</div>
<input
name="branch"
>
<div class="flex flex-col filter-dropdown__list js-filter-list drop-shadow-xl">
{% for id, name in branchFilter %}
{% set itemName = name ~ '-branch-filter' %}
{% set translated = itemName | slug | lower | trans %}
{% if '-filter' in translated %}
{% set showTranslated = false %}
{% else %}
{% set showTranslated = true %}
{% endif %}
<button class="filter-dropdown__option js-filter-option text-left" data-translated-slug="{{ translated }}" value="{{ id }}" {{ app.request.query.get('branch') == id ? 'selected' : '' }}>
{% if showTranslated %}
{{ translated }}
{% else %}
{{ name }}
{% endif %}
</button>
{% endfor %}
</div>
</div>
</div>
</form>
</div>
{% endif %}
{% endif %}
</div>
</section>
<section class="bg-blue-200">
{% set projects = projectObjects ?? pimcore_relations('projects') %}
{% set referenceProjects = pimcore_relations('references') %}
{% set pageNumber = pagination.currentPageNumber %}
{% if projects|length > 0 %}
{% set iterationCount = (pageNumber - 1) * 3 %}
<div class="sm:container py-10 mx-auto md:py-20 ">
<div class="grid grid-cols-12 gap-8 mb-20 lg:gap-y-16">
{% for project in projects | slice(0,9) %}
{% if project.title is not empty and project.webdesq_content is not empty %}
{% include 'includes/cards/default.html.twig' with {
project: project,
class: "col-span-12 md:col-span-4 mx-5 sm:mx-0",
} %}
{% if loop.index % 3 == 0 %}
{% if (referenceProjects.getElements() | length - 1) >= iterationCount %}
{% set refProject = referenceProjects.getElements[iterationCount] %}
{% set isMirrored = iterationCount % 2 == 1 %}
<div class="col-span-12">
{% include 'includes/cards/reference.html.twig' with {
project: refProject,
mirrored: isMirrored
} %}
</div>
{% set iterationCount = iterationCount + 1 %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</div>
{% if pagination is defined %}
{% include 'includes/pagination.html.twig' %}
{% endif %}
</div>
{% else %}
<div>
<p>{{ "Binnen de gekozen filters zijn helaas geen projecten gevonden. Probeer het opnieuw."|trans }}</p>
</div>
</section>
{% endif %}
{% endblock %}
{% endembed %}