{% extends 'base.html.twig' %}
{% if canSeeMessages is not defined %}
{% set canSeeMessages = true %}
{% endif %}
{% block title %}{{ chapter.lesson.name }} - {{ parent() }}{% endblock %}
{% set currentRoute = app.request.attributes.get('_route') %}
{% set enableChatBot = chapter is chat_bot_enabled and currentRoute == 'front_channel_chapter_show' %}
{% block before_navbar %}
{% include 'Front/Scholar/Partial/_preview_manager_heager.html.twig' with {
'channel': channel,
'currentRoute': currentRoute,
} %}
{% endblock before_navbar %}
{% block body_markup %}
<body class="progression chapter-view {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}logged-in{% endif %}"
style="font-family: 'Poppins';"
id="page-training-lesson"
{% if currentRoute == 'front_channel_chapter_show' %}
data-training_id={{ training.id }}
data-module_id={{ module.id }}
data-lesson_id={{ lesson.id }}
data-chapter_id="{{ chapter.id }}"
{% endif %}
>
{% endblock body_markup %}
{% block content %}
{% if currentRoute in ['front_channel_chapter_show', 'manager_channel_module_chapter_show', 'manager_channel_training_module_chapter_show'] %}
{% set trainingModuleLessons = module | get_lessons %}
{% elseif currentRoute in ['manager_channel_chapter_show_message', 'manager_channel_chapter_show'] %}
{% set trainingModuleLessons = [lesson] %}
{% endif %}
{% include 'Front/Scholar/Partial/_menu_lessons_mobile.html.twig' with {
'current_chapter': chapter
} %}
<div class="container pt-md-5 pb-md-5 pt-3 pb-3 summary-lesson font-size-14">
<div class="row">
<div class="col-md-9 col-12">
<div>
{% for key, messageType in app.flashes() %}
<div>
{% for message in messageType %}
<div class="alert alert-{{ key|replace({'error': 'danger'}) }}">
{{ message | trans }}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
<h2 class="font-weight-bold font-size-16px">{{- 'front.scholar.lesson.show.title.label'|trans({'%name%': chapter.lesson.name}) -}}</h2>
<h1 class="v2-title-big">{{- chapter.name -}}</h1>
<div class="col-12 col-lg-6 d-flex justify-content-between p-0"> {# align-items-baseline #}
<div class="d-flex align-items-center"> {# align-items-baseline #}
<img class="star-space chapter-comment-logo"
src="{{- asset('build/common/icon-chat.svg', 'common') -}}" alt="Count comments"/>
<div class="marks d-flex justify-content-center align-items-center">{{ chapter | getMessageCount }}</div>
</div>
<div class="d-flex justify-content-center align-items-center">
{%- if lesson.updatedAt is not null -%}
{{- 'front.scholar.training.show.createdAt.label'|trans({
'%date%': lesson.updatedAt|format_date('long', locale=app.request.locale),
})|raw -}}
{%- else -%}
{{- 'front.scholar.training.show.createdAt.label'|trans({
'%date%': lesson.createdAt|format_date('long', locale=app.request.locale),
})|raw -}}
{%- endif -%}
</div>
</div>
{% if chapter.description is not null %}
<div class="description-lesson mt-4">
<p class="text-subcateg description-style">{{- chapter.description -}}</p>
</div>
{% endif %}
<div class="mt-4 lesson-content">{{- chapter.body|raw -}}</div>
{% if currentRoute == 'front_channel_chapter_show' %}
{% include 'Front/Scholar/Partial/_scholar_navigation_previous_after.html.twig' with {
next_informations: get_next_informations_chapter(training, module, lesson, chapter),
previous_informations: get_previous_informations_chapter(training, module, lesson, chapter),
} %}
{% endif %}
{% if canSeeMessages is same as true %}
<div class="mt-5 chapter-questions-separator"></div>
<div class="mt-5" id="forum-messages">
<div class="font-weight-bold font-size-16px mb-4">{{- 'front.scholar.lesson.show.message.title.label'|trans({'%count%': chapter|getMessageCount}) -}}</div>
{% if messages|length == 0 %}
<div>{{- 'front.scholar.lesson.show.message.no_message.label'|trans -}}</div>
{% endif %}
{% for message in messages %}
{% if loop.index0 != 0 %}
<div class="mt-3 mb-3 ml-5 mr-5 chapter-questions-separator"></div>
{% endif %}
{% set messageToAnswer = null %}
{% set children = message|getMessageChildren %}
{% if children|length is same as 0 %}
{% set messageToAnswer = message %}
{% endif %}
{% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
'message': message,
'canDelete': is_granted_comment or app.user is not null and app.user is owner_of(message),
'messageToAnswer': messageToAnswer
} %}
{% set messageToAnswer = null %}
{% for child in children %}
{% if loop.last is same as true %}
{% set messageToAnswer = message %}
{% endif %}
{% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
'message': child,
'canDelete': is_granted_comment or app.user is not null and app.user is owner_of(child),
'messageToAnswer': messageToAnswer
} %}
{% endfor %}
{% endfor %}
{% if form is defined %}
<div id="form-message-anchor" class="row{% if not app.user %} justify-content-center align-items-center{% endif %} mt-5">
{% if app.user %}
<div class="col-1 d-none d-md-block">
{% if app.user.avatarPath is null %}
<span class="user-account">
<i class="fas fa-user"></i>
</span>
{% else %}
<img class="user-account" src="{{ get_user_avatar_thumbnail(app.user) }}"
alt="User avatar">
{% endif %}
</div>
<div class="col-md-11 col-12 pr-0 pl-0">
{% if enableChatBot is same as false %}
{{ form_start(form, {'attr': {'class': 'm-0 d-flex flex-column flex-md-row'}}) }}
<div class="col-md-10 col-12">
<div>{{ form_row(form.content) }}</div>
<div>{{ form_errors(form) }}</div>
</div>
<div class="col-md-2 col-12 mt-send-mobile">
<button
class="btn-nellapp-v2"
style="display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;"
type="submit"
>
<span>{{ "Envoyer" }}</span>
<i class="ml-2 fas fa-paper-plane"></i>
</button>
</div>
{{ form_end(form) }}
{% else %}
<button
class="btn-nellapp-v2"
style="display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;"
type="button"
data-toggle="modal"
data-target="#chat-bot-modal"
id="chat-bot-modal-label"
>
<span>Posez votre question</span>
<i class="ml-2 fas fa-paper-plane"></i>
</button>
{% endif %}
</div>
{% else %}
<div class="col-1">
<span class="user-account" style="border: 1px solid #dee2e6;">
<i class="fas fa-user"></i>
</span>
</div>
<div class="col-9">
{{- 'front.scholar.lesson.show.message.modal.please_connect.label'|trans -}}
</div>
<div class="col-2">
<a href="{{ path('nellapp_sdk_connect_nellapp') }}" class="btn-nellapp-v2">
{{- 'front.scholar.lesson.show.message.modal.login.label'|trans -}}
</a>
</div>
{% endif %}
</div>
{% endif %}
</div>
{% endif %}
</div>
<div class="col-3 p-0 d-none d-md-block">
{% include 'Front/Scholar/Partial/menu_lessons.html.twig' with {
'current_chapter': chapter
} %}
</div>
</div>
</div>
{{ parent() }}
{% endblock content %}
{% block body %}
{{ parent() }}
{% if app.user %}
<!-- Modal -->
<div class="modal fade" id="modalMessage" tabindex="-1" role="dialog" aria-hidden="true"
style="font-family: 'Poppins'">
<div class="modal-dialog modal-dialog-centered forum-message-modal" role="document">
<div class="modal-content border-8">
<div class="modal-header">
<h5 class="modal-title title-main-modal-message question-title"
style="font-size: 0.875rem;font-weight: bold;">
{{ 'front.scholar.lesson.show.message.modal.title.label'|trans }}
</h5>
<h5 class="modal-title title-main-modal-message response-title"
style="display:none; font-size: 0.875rem; font-weight: bold">
{{ 'front.scholar.lesson.show.message.modal.title_response.label'|trans }}
<span class="span-response-title"></span>
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" style="padding: 20px 24px 0px 24px;">
<div id="modal-response-message"></div>
{{ form_start(formAnswer) }}
{{ form_row(formAnswer.content) }}
</div>
<div class="modal-footer" style="padding:8px 24px 16px 24px;">
<button type="button" class="btn-close-modale"
data-dismiss="modal">{{ 'front.scholar.lesson.show.message.modal.close.label'|trans }}</button>
<button type="submit"
class="btn-valid-modale">{{ button_label|default('message.entity.save.label'|trans) }}</button>
</div>
{{ form_end(formAnswer) }}
</div>
</div>
</div>
{% if enableChatBot is same as true %}
{% include 'Front/Scholar/Chapter/_chat_bot_modal.html.twig' %}
{% endif %}
{% endif %}
{% endblock %}
{% block javascripts %}
{% if app.user and currentRoute == 'front_channel_chapter_show' %}
<script>
var attendanceUrl = '{{ url('async_channel_scholar_attendance_chapter', {
'channelId': channel.id
}) }}';
</script>
{% endif %}
{{ parent() }}
{% endblock %}