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