{% from 'utils.html.twig' import ico %}
{% set items = pageSectionItems(section) %}
{% set itemTemplate = pageSectionTemplateItem(section) %}
{% set background = section.background == enum('PageSectionEnum::YES') ? 'sec-bg-alt' : null %}
{% set format = pageSectionFormat(section.type) %}
{% set positionItem = pageSectionPosition(section.positionItem) %}
{% set positionText = pageSectionPosition(section.positionText) %}
{% set perLine = (section.numberPerline > items|length)? items|length : section.numberPerline %}
{% set ofLines = section.numberOfline %}
{% set slider = section.slider == enum('PageSectionEnum::YES') ? true : false %}
{% set showAll = pageSectionShowAll(section) %}
{% set linkAll = pageSectionLinkAll(section) %}
{% set sectionClasses = [
'pag-sec',
"sec-#{format}",
background,
(slider? 'slider slider-destaques':null),
"sec-items-#{positionItem}",
"sec-text-#{positionText}"
]|filter(class=> class is not empty)
%}
{% if items|length > 0 %}
<section class="{{ sectionClasses|join(' ')|trim }}" id="sec-content-{{ section.id }}">
<div id="container-{{ section.id }}" class="{{ format is not same as('expand')? 'container-boxes' : 'container' }}">
<header class="tit-sec">
<h2>{{ section.title }}</h2>
<span class="sub">{{ section.subtitle }}</span>
</header>
{# BOXES | SLIDER #}
<div class="items-section items-{{ format }}{{ format is not same as('expand')? " items-line-#{perLine}" }}">
{% if slider %}
{# SLIDER ARROWS #}
<div id="arrows-slider-{{ section.id }}" class="tns-arrows">
<button class="slider-seta slider-seta-prev">{{ ico('arrow-left') }}</button>
<button class="slider-seta slider-seta-next">{{ ico('arrow-right') }}</button>
</div>
{% endif %}
{# SLIDER ITEMS #}
<div
{% if slider %}
id="slider-{{ section.id }}" class="js--slider" data-slider-items="{{ perLine }}"
data-slider-options-label="slider-{{ format }}"
{% else %}
class="products-list-{{ format }}"
{% endif %}>
{% for ind, item in items %}
{% include itemTemplate with { item: item, format: format, ind: ind+1 }%}
{% endfor %}
{# SHOW MORE #}
{% if showAll and slider %}
<div class="sec--{{ format }}">
<div class="{{ format is not same as('default')? "item":"item-curso" }}">
<a class="link-all" href="{{ linkAll }}">
{{
getLanguage('see_all', 'product') }} {{ ico('arrow-right')
}}
</a>
</div>
</div>
{% endif %}
</div>
</div>
{# SHOW MORE #}
{% if showAll and not slider %}
<div class="btn-box btn-box-home">
<a id="btn-product-section" class="btn-ver" href="{{ linkAll }}">{{ getLanguage('see_all', 'product') }}</a>
</div>
{% endif %}
</div>
</section>
{% endif %}