{% from 'utils.html.twig' import ico, libraryDuration %}
{% set icosLibrary = {
1: 'globe',
2: 'file-text',
3: 'sound',
4: 'file-text',
5: 'video',
6: 'video',
7: 'video',
8: 'video',
9: 'video'
} %}
{% set libEnum = {
1: 'CONTENT_EMBED',
2: 'CONTENT_FILES',
3: 'CONTENT_AUDIO',
4: 'CONTENT_TEXT',
5: 'CONTENT_VIDEO',
6: 'CONTENT_LIVE',
7: 'CONTENT_CONFERENCE',
8: 'CONTENT_VIDEO_FILE',
9: 'CONTENT_EXTERNAL_LIVE',
10: 'CONTENT_NEW_LIVE'
} %}
{% if lessonModules|length > 0 %}
{% set total = lessonModules|length %}
{% set resta = total-show %}
<h3 class="tit-sec">{{ getLanguage('content', 'product') }}</h3>
<div id="contem-modulos" class="perguntas">
{% for i, lessonModule in lessonModules %}
{% set n = i+1 %}
{% if (n == show + 1) %}<div class="js--hidden">{% endif %}
<div class="questao{{ n <= open ? ' status--aberto' }}">
<div class="pergunta js--abre">
<p>
<span class="question-number">{{ n }}</span>{{ lessonModule.title }}
{% for k, workload in lessonModule.workload %}
{% if workload > 0 %}
<span class="workload">
<span class="ico-clock">{{ ico('clock') }}</span>{{ workload }}
{{ plural(workload,
getLanguage('workload_hour', 'product'),
getLanguage('workload_hours', 'product')
)}}
</span>
{% endif %}
{% endfor %}
</p>
<span class="ico seta">{{ ico('chevron-down') }}</span>
</div>
<div class="resposta product-content js--sub">
{% if lessonModule.description is not empty %}
{% if lessonModule.description != "null" %}
<div class="desc">{{ lessonModule.description }}</div>
{% endif %}
{% endif %}
<ul class="lessons">
{% set paged = [enum('LibraryEnum::CONTENT_FILES'), enum('LibraryEnum::CONTENT_TEXT')] %}
{% set isPaged = false %}
{% for j, lesson in lessonModule.lessons %}
{% if lesson.library %}
<li class="lesson">
{% if lesson.library.type is defined %}
{% if lesson.library.type > 0 and lesson.library.type < 10 %}
<i class="ico">{{ ico(icosLibrary[lesson.library.type]) }}</i>
{% endif %}
{% endif %}
<p class="title">{{ lesson.title }}</p>
{% if lesson.library.type is defined %}
{% set isPaged = (lesson.library.type in paged ? true : false) %}
{% endif %}
{% if not isPaged %}
<span class="ico">{{ ico('clock') }}</span>
{% endif %}
<p class="size">
{{ libraryDuration(lesson) }}
</p>
{% if lesson.demonstration == enum('LessonEnum::YES') %}
<p class="acao">
<a class="btn-watch" href="{{ path('lessonDemoPage', { lessonId: lesson.id, productOfferId: productOffer.id }) }}">{{ getLanguage('watch', 'product') }}</a>
</p>
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
{% if (n == total) %}</div>{% endif %}
{# -/ .js--hidden #}
{% endfor %}
{# MOSTRAR MAIS #}
{% if resta > 0 %}
{% set label = (resta == 1)?'module':'modules' %}
<div class="modulos-mais">
<a id="btn-modulos-mostrar" class="btn-mais">
<span class="js--shown">{{ getLanguage('more', 'product') }} {{ resta }} {{ getLanguage(label, 'product') }}</span>
<span class="js--hidden">{{ getLanguage('hide', 'product') }} {{ resta }} {{ getLanguage(label, 'product') }}</span>
</a>
</div>
{% endif %}
</div>
{% endif %}