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