<a href="{{ path('shop_product', {'slug': product.slug}) }}" class="product-card {{ category is defined and category.id == 72 ? 'product-card--sticker-big' : '' }}">
<header class="product-card-header">
{# set thumbnail #}
{% set thumbnail = product.upload %}
{% if thumbnail %}
{% set thumbnailPath = get_upload_background(thumbnail) %}
{# {% set thumbnailPath = thumbnail.path%}#}
{% else %}
{% set thumbnailPath = 'build/animation/01.png' %}
{% endif %}
{# set on hover picture #}
{% set onHover = get_product_uploads(product, 0, constant('App\\Enum\\UploadType::OnHover').value) %}
{% if onHover and onHover|length > 0 %}
{% set onHoverPath = get_upload_background(onHover[0]) %}
{% else %}
{# {% set onHoverPath = 'build/animation/01.webp' %} #}
{% set onHoverPath = null %}
{% endif %}
<div class="product-card-header__image-wrapper" {% if onHoverPath is null %}data-no-hover{% endif %}>
<img src="{{ asset(thumbnailPath) }}" alt="{{ product.name }}" class="product-card-header__image product-card-header__image--original">
{% if onHoverPath is not null %}
<img src="{{ asset(onHoverPath) }}" alt="{{ product.name }}" class="product-card-header__image product-card-header__image--hover">
{% endif %}
</div>
{% set sticker = null %}
{% set customSticker = get_product_uploads(product, 0, constant('App\\Enum\\UploadType::ProductSticker').value) %}
{% if customSticker %}
{% set sticker = customSticker[0] %}
{% elseif find_product_categories_with_type(product.id, 10)|length > 0 and find_product_categories_with_type(product.id, 10)[0].upload %}
{% set sticker = find_product_categories_with_type(product.id, 10)[0].upload %}
{% endif %}
{% if sticker %}
<div class="product-card-constructs">
<div class="product-card-constructs__item product-card-constructs__item--producer">
<img src="{{ get_upload_small(sticker) }}" alt="">
</div>
</div>
{% endif %}
{# temporary solution #}
{% if product.id == 4 %}
<div class="product-card__label product-card__label--1">
{% trans %}prémiové{% endtrans %}
</div>
{% elseif product.id == 1 %}
<div class="product-card__label product-card__label--2">
{% trans %}nejprodávanější{% endtrans %}
</div>
{% endif %}
{# END - temporary solution #}
</header>
<div class="product-card-body">
<strong class="product-card__heading">{{ product.menuName ?: product.name }}</strong>
{% set description = find_product_parameters_by_group_id(product, 3) %}
{% if description %}
<div class="product-card__description mt-3">{{ description[0].data|raw }}</div>
{% endif %}
{# {% set rating = find_product_parameters_by_group_id(product, 4) %}
{% if rating and rating[0].data|number_format matches '/^\\d+$/' %}
{% set rating = rating[0].data|number_format(1) %}
<div class="solution-property-inner mt-4">
<strong class="solution-property__title">{% trans %}Míra ochrany před sluncem{% endtrans %}</strong>
<div class="solution-property-meter">
<div class="visually-hidden">{{ rating }}/5</div>
{% set fullBars = rating|round(0, 'floor') %}
{% set halfBar = rating - fullBars >= 0.5 %}
{% for x in range(1,5) %}
{% if fullBars >= x %}
<div class="solution-property-meter__bar full"></div>
{% elseif x == fullBars+1 and halfBar %}
<div class="solution-property-meter__bar half"></div>
{% else %}
<div class="solution-property-meter__bar"></div>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %} #}
{% set pricing = find_product_parameters_by_group_id(product, 2) %}
{% if pricing and pricing[0].data|number_format matches '/^\\d+$/' %}
{% set pricing = pricing[0].data|number_format(1) %}
<div class="solution-property-inner mt-3">
<strong class="solution-property__title">{% trans %}Cenová hladina{% endtrans %}</strong>
<div class="solution-property-meter">
<div class="visually-hidden">{{ pricing }}/5</div>
{% set fullBars = pricing|round(0, 'floor') %}
{% set halfBar = pricing - fullBars >= 0.5 %}
{% for x in range(1,5) %}
{% if fullBars >= x %}
<div class="solution-property-meter__bar full"></div>
{% elseif x == fullBars+1 and halfBar %}
<div class="solution-property-meter__bar half"></div>
{% else %}
<div class="solution-property-meter__bar"></div>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
</div>
</a>