{% 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') %}
{% 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">
<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="dot-div">
<div class="w-100 h-100">
<i class="fas fa-circle circle-size"></i>
</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">
<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 lastMessage = message %}
{% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
'message': message,
} %}
{% set children = message|getMessageChildren %}
{% for child in children %}
{% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
'message': child,
} %}
{% set lastMessage = child %}
{% endfor %}
{% if lastMessage.children|length == 0 %}
{% if lastMessage.parent is not null %}
{% set messageToAnswer = lastMessage.parent %}
{% else %}
{% set messageToAnswer = lastMessage %}
{% endif %}
{% set permComment = false %}
{% if app.user is not null and app.user.id == lastMessage.user.id or is_granted_comment %}
{% set permComment = true %}
{% endif %}
<div class="mt-2"{% if lastMessage.parent %} style="margin-left: 50px;"{% endif %}>
<button type="button"
class="answer-message-forum"
data-toggle="modal"
data-target="#modalMessage"
id="btn-response"
data-message-id="{{ messageToAnswer.id }}"
data-message-content="{{ messageToAnswer.content }}"
data-message-user="{{ messageToAnswer.user is not null ? messageToAnswer.user.email : '' }}"
data-message-user-name="{{ messageToAnswer.user is not null ? messageToAnswer.user.firstName : '' }} {{ messageToAnswer.user is not null ? messageToAnswer.user.lastName : '' }}"
>
Répondre
</button>
{% if permComment %}
<button type="button"
class="delete-message-forum"
data-toggle="modal"
data-target="#modalMessageDelete{{- lastMessage.id -}}"
>
Supprimer
</button>
{% endif %}
</div>
{% if permComment %}
<div class="modal fade" id="modalMessageDelete{{- lastMessage.id -}}" tabindex="-1"
role="dialog" aria-hidden="true" style="font-family: 'Poppins'">
<div class="modal-dialog modal-dialog-centered forum-message-modal modal-lg"
role="document">
<div class="modal-content border-8">
<div class="modal-header" style="padding: 1rem;">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" style="padding: 0px;text-align: center">
<div class="modal-body-title">Êtes-vous sûr(e) de vouloir supprimer
ce
commentaire ?
</div>
<br/>
<div>Vous vous apprêtez à supprimer un commentaire. Cette action est
irréversible.
</div>
<div>Êtes-vous sûr(e) de vouloir réaliser cette action ?</div>
<br/>
</div>
<div class="modal-footer modal-footer-delete-message">
<button type="button"
class="btn btn-secondary cancel-delete-message"
data-dismiss="modal">Annuler
</button>
{% set deleteMessagePath = null %}
{% if currentRoute == 'front_channel_chapter_show' %}
{% set deleteMessagePath = path('front_channel_chapter_message_delete', {'messageId': lastMessage.id,'trainingId': training.id,'moduleId': module.id,'lessonId': lesson.id,'chapterId': chapter.id,}) %}
{% elseif currentRoute in ['manager_channel_chapter_show_message', 'manager_channel_chapter_show'] %}
{% set deleteMessagePath = path('manager_channel_chapter_message_delete', {'channelId': channel.id, 'lessonId': lesson.id, 'chapterId': chapter.id, 'messageId': lastMessage.id}) %}
{% elseif currentRoute == 'manager_channel_module_chapter_show' %}
{# TODO #}
{% set deleteMessagePath = null %}
{% elseif currentRoute == 'manager_channel_training_module_chapter_show' %}
{# TODO #}
{% set deleteMessagePath = null %}
{% endif %}
<a href="{{- deleteMessagePath -}}" type="submit"
class="btn-valid-modale submit-delete-message">{{ 'front.scholar.lesson.show.message.delete.button.label'|trans }}</a>
</div>
</div>
</div>
</div>
{% endif %}
{% endif %}
{% endfor %}
{% if form is defined %}
<div 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">
{{ 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 type="submit" class="btn-nellapp-v2"
style="width: 100%;display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;">
<div>{{- 'Envoyer' -}}</div>
<img src="{{ asset('build/common/icon-send--illed.svg', 'common') }}"
alt="Send icon"/>
</button>
</div>
{{ form_end(form) }}
</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>
{% endif %}
{% if currentRoute == 'front_channel_chapter_show' and app.user is not null %}
{% set granted_edit = is_granted('CHANNEL_USER_PERM_LESSON_UPDATE', lesson) %}
{% set granted_delete = is_granted('CHANNEL_USER_PERM_LESSON_DELETE', lesson) %}
{% if granted_edit or granted_delete %}
<div class="dropdown btn-floating">
<a href="{{- path('front_channel_lesson_edit', {'channelId': channel.id, 'lessonId': lesson.id}) -}}"
target="_blank" class="btn btn-secondary bmd-btn-fab dropdown-toggle">
<img src="{{ asset('build/common/icon-edit.svg', 'common') }}"/>
</a>
</div>
{% 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 %}