templates/Front/Scholar/Chapter/show.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% if canSeeMessages is not defined %}
  3.     {% set canSeeMessages = true %}
  4. {% endif %}
  5. {% block title %}{{ chapter.lesson.name }} - {{ parent() }}{% endblock %}
  6. {% set currentRoute = app.request.attributes.get('_route') %}
  7. {% set enableChatBot = chapter is chat_bot_enabled and currentRoute == 'front_channel_chapter_show' %}
  8. {% block before_navbar %}
  9.     {% include 'Front/Scholar/Partial/_preview_manager_heager.html.twig' with {
  10.         'channel': channel,
  11.         'currentRoute': currentRoute,
  12.     } %}
  13. {% endblock before_navbar %}
  14. {% block body_markup %}
  15. <body class="progression chapter-view {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}logged-in{% endif %}"
  16.       style="font-family: 'Poppins';"
  17.       id="page-training-lesson"
  18.         {% if currentRoute == 'front_channel_chapter_show' %}
  19.             data-training_id={{ training.id }}
  20.             data-module_id={{ module.id }}
  21.             data-lesson_id={{ lesson.id }}
  22.             data-chapter_id="{{ chapter.id }}"
  23.         {% endif %}
  24. >
  25. {% endblock body_markup %}
  26. {% block content %}
  27.     {% if currentRoute in ['front_channel_chapter_show', 'manager_channel_module_chapter_show', 'manager_channel_training_module_chapter_show'] %}
  28.         {% set trainingModuleLessons = module | get_lessons %}
  29.     {% elseif currentRoute in ['manager_channel_chapter_show_message', 'manager_channel_chapter_show'] %}
  30.         {% set trainingModuleLessons = [lesson] %}
  31.     {% endif %}
  32.     {% include 'Front/Scholar/Partial/_menu_lessons_mobile.html.twig' with {
  33.         'current_chapter': chapter
  34.     } %}
  35.     <div class="container pt-md-5 pb-md-5 pt-3 pb-3 summary-lesson font-size-14">
  36.         <div class="row">
  37.             <div class="col-md-9 col-12">
  38.                 <div>
  39.                     {% for key, messageType in app.flashes() %}
  40.                         <div>
  41.                             {% for message in messageType %}
  42.                                 <div class="alert alert-{{ key|replace({'error': 'danger'}) }}">
  43.                                     {{ message | trans }}
  44.                                 </div>
  45.                             {% endfor %}
  46.                         </div>
  47.                     {% endfor %}
  48.                 </div>
  49.                 <h2 class="font-weight-bold font-size-16px">{{- 'front.scholar.lesson.show.title.label'|trans({'%name%': chapter.lesson.name}) -}}</h2>
  50.                 <h1 class="v2-title-big">{{- chapter.name -}}</h1>
  51.                 <div class="col-12 col-lg-6 d-flex justify-content-between p-0"> {# align-items-baseline #}
  52.                     <div class="d-flex align-items-center"> {# align-items-baseline #}
  53.                         <img class="star-space chapter-comment-logo"
  54.                              src="{{- asset('build/common/icon-chat.svg', 'common') -}}" alt="Count comments"/>
  55.                         <div class="marks d-flex justify-content-center align-items-center">{{ chapter | getMessageCount }}</div>
  56.                     </div>
  57.                     <div class="d-flex justify-content-center align-items-center">
  58.                         {%- if lesson.updatedAt is not null -%}
  59.                             {{- 'front.scholar.training.show.createdAt.label'|trans({
  60.                                 '%date%': lesson.updatedAt|format_date('long', locale=app.request.locale),
  61.                             })|raw -}}
  62.                         {%- else -%}
  63.                             {{- 'front.scholar.training.show.createdAt.label'|trans({
  64.                                 '%date%': lesson.createdAt|format_date('long', locale=app.request.locale),
  65.                             })|raw -}}
  66.                         {%- endif -%}
  67.                     </div>
  68.                 </div>
  69.                 {% if chapter.description is not null %}
  70.                     <div class="description-lesson mt-4">
  71.                         <p class="text-subcateg description-style">{{- chapter.description -}}</p>
  72.                     </div>
  73.                 {% endif %}
  74.                 <div class="mt-4 lesson-content">{{- chapter.body|raw -}}</div>
  75.                 {% if currentRoute == 'front_channel_chapter_show' %}
  76.                     {% include 'Front/Scholar/Partial/_scholar_navigation_previous_after.html.twig' with {
  77.                         next_informations: get_next_informations_chapter(training, module, lesson, chapter),
  78.                         previous_informations: get_previous_informations_chapter(training, module, lesson, chapter),
  79.                     } %}
  80.                 {% endif %}
  81.                 {% if canSeeMessages is same as true %}
  82.                     <div class="mt-5 chapter-questions-separator"></div>
  83.                     <div class="mt-5" id="forum-messages">
  84.                         <div class="font-weight-bold font-size-16px mb-4">{{- 'front.scholar.lesson.show.message.title.label'|trans({'%count%': chapter|getMessageCount}) -}}</div>
  85.                         {% if messages|length == 0 %}
  86.                             <div>{{- 'front.scholar.lesson.show.message.no_message.label'|trans -}}</div>
  87.                         {% endif %}
  88.                         {% for message in messages %}
  89.                             {% if loop.index0 != 0 %}
  90.                                 <div class="mt-3 mb-3 ml-5 mr-5 chapter-questions-separator"></div>
  91.                             {% endif %}
  92.                             {% set messageToAnswer = null %}
  93.                             {% set children = message|getMessageChildren %}
  94.                             {% if  children|length is same as 0 %}
  95.                                 {% set messageToAnswer = message %}
  96.                             {% endif %}
  97.                             {% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
  98.                                 'message': message,
  99.                                 'canDelete': is_granted_comment or app.user is not null and app.user is owner_of(message),
  100.                                 'messageToAnswer': messageToAnswer
  101.                             } %}
  102.                             {% set messageToAnswer = null %}
  103.                             {% for child in children %}
  104.                                 {% if loop.last is same as true %}
  105.                                     {% set messageToAnswer = message %}
  106.                                 {% endif %}
  107.                                 {% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
  108.                                     'message': child,
  109.                                     'canDelete': is_granted_comment or app.user is not null and app.user is owner_of(child),
  110.                                     'messageToAnswer': messageToAnswer
  111.                                 } %}
  112.                             {% endfor %}
  113.                         {% endfor %}
  114.                         {% if form is defined %}
  115.                             <div id="form-message-anchor" class="row{% if not app.user %} justify-content-center align-items-center{% endif %} mt-5">
  116.                                 {% if app.user %}
  117.                                     <div class="col-1 d-none d-md-block">
  118.                                         {% if app.user.avatarPath is null %}
  119.                                             <span class="user-account">
  120.                                             <i class="fas fa-user"></i>
  121.                                         </span>
  122.                                         {% else %}
  123.                                             <img class="user-account" src="{{ get_user_avatar_thumbnail(app.user) }}"
  124.                                                  alt="User avatar">
  125.                                         {% endif %}
  126.                                     </div>
  127.                                     <div class="col-md-11 col-12 pr-0 pl-0">
  128.                                         {% if enableChatBot is same as false %}
  129.                                             {{ form_start(form, {'attr': {'class': 'm-0 d-flex flex-column flex-md-row'}}) }}
  130.                                             <div class="col-md-10 col-12">
  131.                                                 <div>{{ form_row(form.content) }}</div>
  132.                                                 <div>{{ form_errors(form) }}</div>
  133.                                             </div>
  134.                                             <div class="col-md-2 col-12 mt-send-mobile">
  135.                                                 <button
  136.                                                         class="btn-nellapp-v2"
  137.                                                         style="display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;"
  138.                                                         type="submit"
  139.                                                 >
  140.                                                     <span>{{ "Envoyer" }}</span>
  141.                                                     <i class="ml-2 fas fa-paper-plane"></i>
  142.                                                 </button>
  143.                                             </div>
  144.                                             {{ form_end(form) }}
  145.                                         {% else %}
  146.                                             <button
  147.                                                     class="btn-nellapp-v2"
  148.                                                     style="display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;"
  149.                                                     type="button"
  150.                                                     data-toggle="modal"
  151.                                                     data-target="#chat-bot-modal"
  152.                                                     id="chat-bot-modal-label"
  153.                                             >
  154.                                                 <span>Posez votre question</span>
  155.                                                 <i class="ml-2 fas fa-paper-plane"></i>
  156.                                             </button>
  157.                                         {% endif %}
  158.                                     </div>
  159.                                 {% else %}
  160.                                     <div class="col-1">
  161.                                     <span class="user-account" style="border: 1px solid #dee2e6;">
  162.                                         <i class="fas fa-user"></i>
  163.                                     </span>
  164.                                     </div>
  165.                                     <div class="col-9">
  166.                                         {{- 'front.scholar.lesson.show.message.modal.please_connect.label'|trans -}}
  167.                                     </div>
  168.                                     <div class="col-2">
  169.                                         <a href="{{ path('nellapp_sdk_connect_nellapp') }}" class="btn-nellapp-v2">
  170.                                             {{- 'front.scholar.lesson.show.message.modal.login.label'|trans -}}
  171.                                         </a>
  172.                                     </div>
  173.                                 {% endif %}
  174.                             </div>
  175.                         {% endif %}
  176.                     </div>
  177.                 {% endif %}
  178.             </div>
  179.             <div class="col-3 p-0 d-none d-md-block">
  180.                 {% include 'Front/Scholar/Partial/menu_lessons.html.twig' with {
  181.                     'current_chapter': chapter
  182.                 } %}
  183.             </div>
  184.         </div>
  185.     </div>
  186.     {{ parent() }}
  187. {% endblock content %}
  188. {% block body %}
  189.     {{ parent() }}
  190.     {% if app.user %}
  191.         <!-- Modal -->
  192.         <div class="modal fade" id="modalMessage" tabindex="-1" role="dialog" aria-hidden="true"
  193.              style="font-family: 'Poppins'">
  194.             <div class="modal-dialog modal-dialog-centered forum-message-modal" role="document">
  195.                 <div class="modal-content border-8">
  196.                     <div class="modal-header">
  197.                         <h5 class="modal-title title-main-modal-message question-title"
  198.                             style="font-size: 0.875rem;font-weight: bold;">
  199.                             {{ 'front.scholar.lesson.show.message.modal.title.label'|trans }}
  200.                         </h5>
  201.                         <h5 class="modal-title title-main-modal-message response-title"
  202.                             style="display:none; font-size: 0.875rem; font-weight: bold">
  203.                             {{ 'front.scholar.lesson.show.message.modal.title_response.label'|trans }}
  204.                             <span class="span-response-title"></span>
  205.                         </h5>
  206.                         <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  207.                             <span aria-hidden="true">&times;</span>
  208.                         </button>
  209.                     </div>
  210.                     <div class="modal-body" style="padding: 20px 24px 0px 24px;">
  211.                         <div id="modal-response-message"></div>
  212.                         {{ form_start(formAnswer) }}
  213.                         {{ form_row(formAnswer.content) }}
  214.                     </div>
  215.                     <div class="modal-footer" style="padding:8px 24px 16px 24px;">
  216.                         <button type="button" class="btn-close-modale"
  217.                                 data-dismiss="modal">{{ 'front.scholar.lesson.show.message.modal.close.label'|trans }}</button>
  218.                         <button type="submit"
  219.                                 class="btn-valid-modale">{{ button_label|default('message.entity.save.label'|trans) }}</button>
  220.                     </div>
  221.                     {{ form_end(formAnswer) }}
  222.                 </div>
  223.             </div>
  224.         </div>
  225.         {% if enableChatBot is same as true %}
  226.             {% include 'Front/Scholar/Chapter/_chat_bot_modal.html.twig' %}
  227.         {% endif %}
  228.     {% endif %}
  229. {% endblock %}
  230. {% block javascripts %}
  231.     {% if app.user and currentRoute == 'front_channel_chapter_show' %}
  232.         <script>
  233.             var attendanceUrl = '{{ url('async_channel_scholar_attendance_chapter', {
  234.                 'channelId': channel.id
  235.             }) }}';
  236.         </script>
  237.     {% endif %}
  238.     {{ parent() }}
  239. {% endblock %}