{% import "@SyliusShop/Common/Macro/money.html.twig" as money %}

<div class="product-box-container" {{ sylius_test_html_attribute('product') }}>
    {# TODO BACK : A dynamiser selon prix promo #}
    <div class="product-box-tag">
        <span class="badge badge-secondary">Promo</span>
    </div>

    <a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}" class="product-box-image-wrapper">
        {% include '@SyliusShop/Product/_mainImage.html.twig' with {'product': product} %}
    </a>

    <div class="product-box-text-wrapper">
        <a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}" class="product-box-name" {{ sylius_test_html_attribute('product-name', product.name) }}>
            <h2 class="product-box-title">{{ product.name }}</h2>

            {# TODO BACK : A dynamiser #}
            <h3 class="product-box-brand">Marque</h3>
        </a>

        {% if product.acceptedReviews|length > 0 %}

            <a href="{{ path('sylius_shop_product_show', {'slug': product.slug, '_locale': product.translation.locale}) }}#product-reviews" class="product-box-review review-rating">
                {% include '@SyliusShop/Product/_starRating.html.twig' %}
                <span class="product-box-review-nb">({{ product.acceptedReviews|length }})</span>
            </a>
        {% endif %}

        {% if not product.variants.empty() %}
            <div class="product-box-price-wrapper" {{ sylius_test_html_attribute('product-price') }}>
                {# TODO BACK : A dynamiser selon prix promo #}
                {% if 0 %}
                    <span class="product-box-price">{{ money.calculatePrice(product|sylius_resolve_variant) }}</span>
                {% else %}
                    <span class="product-box-price product-box-price-promo">{{ money.calculatePrice(product|sylius_resolve_variant) }}</span>
                    <span class="product-box-price-old">{{ money.calculatePrice(product|sylius_resolve_variant) }}</span>
                {% endif %}
            </div>
        {% endif %}
    </div>
</div>
