{% extends 'base.html.twig' %}
{% block page_title %}
{{ 'storefront.title'|resolve|striptags }} | Produkte
{% endblock %}
{% block head_custom_stylesheets %}
{{ encore_entry_link_tags('hero-header') }}
{{ encore_entry_link_tags('product-card') }}
{% endblock head_custom_stylesheets %}
{% block content %}
{% if category and category.headerImage %}
<div class="hero-header" style="background-image: url(/images/{{ category.headerImage }});">
<div class="hero-header-inner">
<div class="container-3xl">
<div class="row">
<div class="col-12">
<h1 class="hero-headline mb-5 text-white">{{ 'product.list.page.headline'|resolve }}</h1>
</div>
</div>
</div>
</div>
</div>
{% else %}
<div class="container-3xl mb-0 mt-5 mt-sm-5">
<div class="row">
<div class="col-12">
<h1 class="ornament-with-child">{{ 'product.list.page.headline'|resolve }}</h1>
</div>
</div>
</div>
{% endif %}
<div class="container-3xl my-5">
<div class="row">
<div class="col-12">
{{ 'product.list.page.description'|resolve }}
</div>
</div>
</div>
<div class="product-cards container-3xl my-3 mb-sm-6">
<div class="row g-4 match-height-product" data-match-height-group="product-group">
{% if tenant.categories|length > 0 %}
{% for product in tenant.products|filter(product => category in product.categories) %}
{% set productConfig = product.config|json_decode %}
<div class="col-12 col-md-6">
<div data-match-height="product" class="product position-relative d-flex flex-column justify-content-between h-100 p-3 p-sm-5 bg-lightgrey">
<div class="row">
<div class="col-12 col-sm-{{ product.listImage ? '8' : '12' }} order-2 order-sm-1">
<h4 class="mb-4">{{ product.name }}</h4>
<div>
<p class="line-clamp clamp-4">{{ product.shortDescription }}</p>
<ul id="product-config">
{% if productConfig.kim_addresses_included %}
<li>
{{ productConfig.kim_addresses.quantity }}x KIM Adressen
</li>
{% endif %}
{% if productConfig.hardware_included %}
{% for hardware in productConfig.hardware %}
{% if hardware.quantity > 0 %}
<li>
{{ hardware.quantity }}x {{ hardware.hardware|resolve }}
</li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
</div>
</div>
{% if product.listImage %}
<div class="col-12 col-sm-4 order-1 order-sm-2 mb-4">
<img class="w-100" src="/images/{{ product.listImage }}" alt="{{ product.name }}">
</div>
{% endif %}
</div>
<a href="{{ path('product_details', {productId: product.id}) }}" class="d-flex justify-content-end align-items-center text-decoration-none fw-bold my-3 mt-sm-0"><span class="me-2">Mehr erfahren </span><i class="fas fa-arrow-right"></i></a>
</div>
</div>
{% endfor %}
{% else %}
{% for product in tenant.products %}
{% set productConfig = product.config|json_decode %}
<div class="col-xs-12 col-md-6 mb-3">
<div class="product position-relative d-flex flex-column justify-content-between h-100 p-3 p-sm-5 bg-lightgrey">
<div class="row">
<div class="col-xs-12 col-sm-{{ product.listImage ? '8' : '12' }} order-2 order-sm-1">
<h4 class="mb-4">{{ product.name }}</h4>
<div>
<p>{{ product.shortDescription }}</p>
<ul>
{% if productConfig.kim_addresses_included %}
<li>
{{ productConfig.kim_addresses.quantity }} KIM Adressen
</li>
{% endif %}
{% if productConfig.hardware_included %}
{% for hardware in productConfig.hardware %}
<li>
{{ hardware.quantity }} {{ hardware.hardware }}
</li>
{% endfor %}
{% endif %}
</ul>
</div>
</div>
{% if product.listImage %}
<div class="col-xs-12 col-sm-4 order-1 order-sm-2 mb-4">
<img class="w-100" src="/images/{{ product.listImage }}" alt="{{ product.name }}">
</div>
{% endif %}
</div>
<a href="{{ path('product_details', {productId: product.id}) }}" class="d-flex justify-content-end align-items-center text-decoration-none fw-bold"><span class="me-2">Mehr erfahren </span><i class="fas fa-arrow-right"></i></a>
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>
{% endblock %}