{% from 'utils.html.twig' import percentValue, discountValue, discountPrices, imgUpload, getProductLink, ico %}
<div class="sec--{{ format }}">
<a class="link-detail" href="{{ getProductLink(item, productCoupon ?? null) }}">
<div class="item item-product">
<div class="foto">
{% if not userHasProduct(item.product) and user %}
{# WISHLIST #}
{% include 'website/controls/btn-wishlist.html.twig' with {
'wish_id': item.product.id,
'wish_offer_id': item.id,
'wish_title': item.product.title,
'wish_currency': item.currencyCode,
'wish_price': item.getPriceRealCopy(),
}%}
{% endif %}
{# PHOTO EXPAND #}
{% if item.productPage.photoExpand is not null %}
{{ imgUpload(item.productPage.photoExpand, enum('AbstractEnum::PATH_PRODUCT_PHOTO'), 'product-box-expand', item.product.title) }}
{% elseif item.productPage.photo is not null %}
{{ imgUpload(item.productPage.photo, enum('AbstractEnum::PATH_PRODUCT_PHOTO'), 'product-box-expand', item.product.title) }}
{% endif %}
</div>
<div class="info">
<div class="wrap-tags">
{# DISCOUNT #}
{% if item.notForSale == enum('ProductOfferEnum::NO')
and item.getSaleIsOpen()
and item.priceDisplay > item.getPriceRealCopy() %}
<span class="tag desconto">
{{ getLanguage('off_discount', 'product') }} {{ discountValue(item.priceDisplay, item.priceReal) }}
</span>
{% endif %}
{# TAGS #}
{% include 'website/includes/subscription-tags.html.twig' %}
</div>
{# TITLE #}
<h3>{{ item.product.title }}</h3>
{# WORKLOAD #}
{% set timeTotal = getTimeTotalProduct(item.product) %}
{% if timeTotal > 0 %}
<p class="workload">
{{ ico('clock') }}{{ timeTotal }}
{{ plural(timeTotal,
getLanguage('workload_home_hour', 'product'),
getLanguage('workload_home_hours', 'product')
)}}
</p>
{% endif %}
{# DESCRIPTION #}
{% if item.productPage.description is not empty %}
<p class="desc">{{ item.productPage.description|raw }}</p>
{% endif %}
{# SCORE #}
{% set scoreProduct = getScoreProduct(item.product) %}
{% if (scoreProduct.scoreTotal > 9) and item.productPage.showModuleTestimonials and getConfig('allow_testimonial') == enum('CourseEnum::YES') %}
<span class="avaliacao">
<span class="nota">{{ scoreProduct.score }}</span> 
{% include 'website/includes/stars.html.twig' with { score: scoreProduct.score } %}
</span>
{% endif %}
{% if item.notForSale == enum('ProductOfferEnum::NO') %}
<div class="pricing-box">
{# HAS PRODUCT #}
{% if userHasProduct(item.product) %}
<p class="preco-original">{{ getLanguage('acquired', 'product')|upper }}</p>
<p class="preco-gratis">{{ getLanguage('access2', 'product')|upper }}</p>
{# FREE #}
{% elseif item.saleOption == enum('ProductOfferEnum::FREE') %}
<p class="preco-original">{{ getLanguage('free2', 'product')|upper }}</p>
<p class="preco-gratis">{{ getLanguage('access2', 'product')|upper }}</p>
{# PRICE #}
{% elseif checkProductOfferIsOnSale(item) %}
{{ discountPrices(item) }}
{# WAITLIST #}
{% else %}
{% if
item.nextProductOffer and
item.nextProductOffer.status == enum('ProductOfferEnum::PUBLISHED') and
item.nextProductOffer.isNotDeleted()
%}
{{ discountPrices(item) }}
{% else %}
{% set messageItemBox = item.getDiffDuration().start == true ?
getLanguage('coming_soon_access', 'product')|upper :
getLanguage('closed_access', 'product')|upper
%}
<p class="preco-original">{{ messageItemBox }}</p>
<p class="lista-espera">{{ getLanguage('waitlist', 'product') }}</p>
{% endif %}
{% endif %}
</div>
{% endif %}
</div>
</div>
</a>
</div>