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. {% block before_navbar %}
  8.     {% include 'Front/Scholar/Partial/_preview_manager_heager.html.twig' with {
  9.         'channel': channel,
  10.         'currentRoute': currentRoute,
  11.     } %}
  12. {% endblock before_navbar %}
  13. {% block body_markup %}
  14. <body class="progression chapter-view {% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}logged-in{% endif %}"
  15.       style="font-family: 'Poppins';"
  16.       id="page-training-lesson"
  17.         {% if currentRoute == 'front_channel_chapter_show' %}
  18.             data-training_id={{ training.id }}
  19.             data-module_id={{ module.id }}
  20.             data-lesson_id={{ lesson.id }}
  21.             data-chapter_id="{{ chapter.id }}"
  22.         {% endif %}
  23. >
  24. {% endblock body_markup %}
  25. {% block content %}
  26.     {% if currentRoute in ['front_channel_chapter_show', 'manager_channel_module_chapter_show', 'manager_channel_training_module_chapter_show'] %}
  27.         {% set trainingModuleLessons = module | get_lessons %}
  28.     {% elseif currentRoute in ['manager_channel_chapter_show_message', 'manager_channel_chapter_show'] %}
  29.         {% set trainingModuleLessons = [lesson] %}
  30.     {% endif %}
  31.     {% include 'Front/Scholar/Partial/_menu_lessons_mobile.html.twig' with {
  32.         'current_chapter': chapter
  33.     } %}
  34.     <div class="container pt-md-5 pb-md-5 pt-3 pb-3 summary-lesson font-size-14">
  35.         <div class="row">
  36.             <div class="col-md-9 col-12">
  37.                 <h2 class="font-weight-bold font-size-16px">{{- 'front.scholar.lesson.show.title.label'|trans({'%name%': chapter.lesson.name}) -}}</h2>
  38.                 <h1 class="v2-title-big">{{- chapter.name -}}</h1>
  39.                 <div class="col-12 col-lg-6 d-flex justify-content-between p-0"> {# align-items-baseline #}
  40.                     <div class="d-flex align-items-center"> {# align-items-baseline #}
  41.                         <img class="star-space chapter-comment-logo"
  42.                              src="{{- asset('build/common/icon-chat.svg', 'common') -}}" alt="Count comments"/>
  43.                         <div class="marks d-flex justify-content-center align-items-center">{{ chapter | getMessageCount }}</div>
  44.                     </div>
  45.                     <div class="dot-div">
  46.                         <div class="w-100 h-100">
  47.                             <i class="fas fa-circle circle-size"></i>
  48.                         </div>
  49.                     </div>
  50.                     <div class="d-flex justify-content-center align-items-center">
  51.                         {%- if lesson.updatedAt is not null -%}
  52.                             {{- 'front.scholar.training.show.createdAt.label'|trans({
  53.                                 '%date%': lesson.updatedAt|format_date('long', locale=app.request.locale),
  54.                             })|raw -}}
  55.                         {%- else -%}
  56.                             {{- 'front.scholar.training.show.createdAt.label'|trans({
  57.                                 '%date%': lesson.createdAt|format_date('long', locale=app.request.locale),
  58.                             })|raw -}}
  59.                         {%- endif -%}
  60.                     </div>
  61.                 </div>
  62.                 {% if chapter.description is not null %}
  63.                     <div class="description-lesson mt-4">
  64.                         <p class="text-subcateg description-style">{{- chapter.description -}}</p>
  65.                     </div>
  66.                 {% endif %}
  67.                 <div class="mt-4 lesson-content">{{- chapter.body|raw -}}</div>
  68.                 {% if currentRoute == 'front_channel_chapter_show' %}
  69.                     {% include 'Front/Scholar/Partial/_scholar_navigation_previous_after.html.twig' with {
  70.                         next_informations: get_next_informations_chapter(training, module, lesson, chapter),
  71.                         previous_informations: get_previous_informations_chapter(training, module, lesson, chapter),
  72.                     } %}
  73.                 {% endif %}
  74.                 {% if canSeeMessages is same as true %}
  75.                     <div class="mt-5 chapter-questions-separator"></div>
  76.                     <div class="mt-5">
  77.                         <div class="font-weight-bold font-size-16px mb-4">{{- 'front.scholar.lesson.show.message.title.label'|trans({'%count%': chapter|getMessageCount}) -}}</div>
  78.                         {% if messages|length == 0 %}
  79.                             <div>{{- 'front.scholar.lesson.show.message.no_message.label'|trans -}}</div>
  80.                         {% endif %}
  81.                         {% for message in messages %}
  82.                             {% if loop.index0 != 0 %}
  83.                                 <div class="mt-3 mb-3 ml-5 mr-5 chapter-questions-separator"></div>
  84.                             {% endif %}
  85.                             {% set lastMessage = message %}
  86.                             {% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
  87.                                 'message': message,
  88.                             } %}
  89.                             {% set children = message|getMessageChildren %}
  90.                             {% for child in children %}
  91.                                 {% include 'Front/Scholar/Chapter/show_forum_message.html.twig' with {
  92.                                     'message': child,
  93.                                 } %}
  94.                                 {% set lastMessage = child %}
  95.                             {% endfor %}
  96.                             {% if lastMessage.children|length == 0 %}
  97.                                 {% if lastMessage.parent is not null %}
  98.                                     {% set messageToAnswer = lastMessage.parent %}
  99.                                 {% else %}
  100.                                     {% set messageToAnswer = lastMessage %}
  101.                                 {% endif %}
  102.                                 {% set permComment = false %}
  103.                                 {% if app.user is not null and app.user.id == lastMessage.user.id or is_granted_comment %}
  104.                                     {% set permComment = true %}
  105.                                 {% endif %}
  106.                                 <div class="mt-2"{% if lastMessage.parent %} style="margin-left: 50px;"{% endif %}>
  107.                                     <button type="button"
  108.                                             class="answer-message-forum"
  109.                                             data-toggle="modal"
  110.                                             data-target="#modalMessage"
  111.                                             id="btn-response"
  112.                                             data-message-id="{{ messageToAnswer.id }}"
  113.                                             data-message-content="{{ messageToAnswer.content }}"
  114.                                             data-message-user="{{ messageToAnswer.user is not null ? messageToAnswer.user.email : '' }}"
  115.                                             data-message-user-name="{{ messageToAnswer.user is not null ? messageToAnswer.user.firstName : '' }} {{ messageToAnswer.user is not null ? messageToAnswer.user.lastName : '' }}"
  116.                                     >
  117.                                         Répondre
  118.                                     </button>
  119.                                     {% if permComment %}
  120.                                         <button type="button"
  121.                                                 class="delete-message-forum"
  122.                                                 data-toggle="modal"
  123.                                                 data-target="#modalMessageDelete{{- lastMessage.id -}}"
  124.                                         >
  125.                                             Supprimer
  126.                                         </button>
  127.                                     {% endif %}
  128.                                 </div>
  129.                                 {% if permComment %}
  130.                                     <div class="modal fade" id="modalMessageDelete{{- lastMessage.id -}}" tabindex="-1"
  131.                                          role="dialog" aria-hidden="true" style="font-family: 'Poppins'">
  132.                                         <div class="modal-dialog modal-dialog-centered forum-message-modal modal-lg"
  133.                                              role="document">
  134.                                             <div class="modal-content border-8">
  135.                                                 <div class="modal-header" style="padding: 1rem;">
  136.                                                     <button type="button" class="close" data-dismiss="modal"
  137.                                                             aria-label="Close">
  138.                                                         <span aria-hidden="true">&times;</span>
  139.                                                     </button>
  140.                                                 </div>
  141.                                                 <div class="modal-body" style="padding: 0px;text-align: center">
  142.                                                     <div class="modal-body-title">Êtes-vous sûr(e) de vouloir supprimer
  143.                                                         ce
  144.                                                         commentaire ?
  145.                                                     </div>
  146.                                                     <br/>
  147.                                                     <div>Vous vous apprêtez à supprimer un commentaire. Cette action est
  148.                                                         irréversible.
  149.                                                     </div>
  150.                                                     <div>Êtes-vous sûr(e) de vouloir réaliser cette action ?</div>
  151.                                                     <br/>
  152.                                                 </div>
  153.                                                 <div class="modal-footer modal-footer-delete-message">
  154.                                                     <button type="button"
  155.                                                             class="btn btn-secondary cancel-delete-message"
  156.                                                             data-dismiss="modal">Annuler
  157.                                                     </button>
  158.                                                     {% set deleteMessagePath = null %}
  159.                                                     {% if currentRoute == 'front_channel_chapter_show' %}
  160.                                                         {% set deleteMessagePath = path('front_channel_chapter_message_delete', {'messageId': lastMessage.id,'trainingId': training.id,'moduleId': module.id,'lessonId': lesson.id,'chapterId': chapter.id,}) %}
  161.                                                     {% elseif currentRoute in ['manager_channel_chapter_show_message', 'manager_channel_chapter_show'] %}
  162.                                                         {% set deleteMessagePath = path('manager_channel_chapter_message_delete', {'channelId': channel.id, 'lessonId': lesson.id, 'chapterId':  chapter.id, 'messageId': lastMessage.id}) %}
  163.                                                     {% elseif currentRoute == 'manager_channel_module_chapter_show' %}
  164.                                                         {# TODO #}
  165.                                                         {% set deleteMessagePath = null %}
  166.                                                     {% elseif currentRoute == 'manager_channel_training_module_chapter_show' %}
  167.                                                         {# TODO #}
  168.                                                         {% set deleteMessagePath = null %}
  169.                                                     {% endif %}
  170.                                                     <a href="{{- deleteMessagePath -}}" type="submit"
  171.                                                        class="btn-valid-modale submit-delete-message">{{ 'front.scholar.lesson.show.message.delete.button.label'|trans }}</a>
  172.                                                 </div>
  173.                                             </div>
  174.                                         </div>
  175.                                     </div>
  176.                                 {% endif %}
  177.                             {% endif %}
  178.                         {% endfor %}
  179.                         {% if form is defined %}
  180.                             <div class="row{% if not app.user %} justify-content-center align-items-center{% endif %} mt-5">
  181.                                 {% if app.user %}
  182.                                     <div class="col-1 d-none d-md-block">
  183.                                         {% if app.user.avatarPath is null %}
  184.                                             <span class="user-account">
  185.                                             <i class="fas fa-user"></i>
  186.                                         </span>
  187.                                         {% else %}
  188.                                             <img class="user-account" src="{{ get_user_avatar_thumbnail(app.user) }}"
  189.                                                  alt="User avatar">
  190.                                         {% endif %}
  191.                                     </div>
  192.                                     <div class="col-md-11 col-12 pr-0 pl-0">
  193.                                         {{ form_start(form, {'attr': {'class': 'm-0 d-flex flex-column flex-md-row'}}) }}
  194.                                         <div class="col-md-10 col-12">
  195.                                             <div>{{ form_row(form.content) }}</div>
  196.                                             <div>{{ form_errors(form) }}</div>
  197.                                         </div>
  198.                                         <div class="col-md-2 col-12 mt-send-mobile">
  199.                                             <button type="submit" class="btn-nellapp-v2"
  200.                                                     style="width: 100%;display: flex;justify-content: space-between;align-items: center;padding: 10px 15px;">
  201.                                                 <div>{{- 'Envoyer' -}}</div>
  202.                                                 <img src="{{ asset('build/common/icon-send--illed.svg', 'common') }}"
  203.                                                      alt="Send icon"/>
  204.                                             </button>
  205.                                         </div>
  206.                                         {{ form_end(form) }}
  207.                                     </div>
  208.                                 {% else %}
  209.                                     <div class="col-1">
  210.                                     <span class="user-account" style="border: 1px solid #dee2e6;">
  211.                                         <i class="fas fa-user"></i>
  212.                                     </span>
  213.                                     </div>
  214.                                     <div class="col-9">
  215.                                         {{- 'front.scholar.lesson.show.message.modal.please_connect.label'|trans -}}
  216.                                     </div>
  217.                                     <div class="col-2">
  218.                                         <a href="{{ path('nellapp_sdk_connect_nellapp') }}" class="btn-nellapp-v2">
  219.                                             {{- 'front.scholar.lesson.show.message.modal.login.label'|trans -}}
  220.                                         </a>
  221.                                     </div>
  222.                                 {% endif %}
  223.                             </div>
  224.                         {% endif %}
  225.                     </div>
  226.                 {% endif %}
  227.             </div>
  228.             <div class="col-3 p-0 d-none d-md-block">
  229.                 {% include 'Front/Scholar/Partial/menu_lessons.html.twig' with {
  230.                     'current_chapter': chapter
  231.                 } %}
  232.             </div>
  233.         </div>
  234.     </div>
  235.     {{ parent() }}
  236. {% endblock content %}
  237. {% block body %}
  238.     {{ parent() }}
  239.     {% if app.user %}
  240.         <!-- Modal -->
  241.         <div class="modal fade" id="modalMessage" tabindex="-1" role="dialog" aria-hidden="true"
  242.              style="font-family: 'Poppins'">
  243.             <div class="modal-dialog modal-dialog-centered forum-message-modal" role="document">
  244.                 <div class="modal-content border-8">
  245.                     <div class="modal-header">
  246.                         <h5 class="modal-title title-main-modal-message question-title"
  247.                             style="font-size: 0.875rem;font-weight: bold;">
  248.                             {{ 'front.scholar.lesson.show.message.modal.title.label'|trans }}
  249.                         </h5>
  250.                         <h5 class="modal-title title-main-modal-message response-title"
  251.                             style="display:none; font-size: 0.875rem; font-weight: bold">
  252.                             {{ 'front.scholar.lesson.show.message.modal.title_response.label'|trans }}
  253.                             <span class="span-response-title"></span>
  254.                         </h5>
  255.                         <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  256.                             <span aria-hidden="true">&times;</span>
  257.                         </button>
  258.                     </div>
  259.                     <div class="modal-body" style="padding: 20px 24px 0px 24px;">
  260.                         <div id="modal-response-message"></div>
  261.                         {{ form_start(formAnswer) }}
  262.                         {{ form_row(formAnswer.content) }}
  263.                     </div>
  264.                     <div class="modal-footer" style="padding:8px 24px 16px 24px;">
  265.                         <button type="button" class="btn-close-modale"
  266.                                 data-dismiss="modal">{{ 'front.scholar.lesson.show.message.modal.close.label'|trans }}</button>
  267.                         <button type="submit"
  268.                                 class="btn-valid-modale">{{ button_label|default('message.entity.save.label'|trans) }}</button>
  269.                     </div>
  270.                     {{ form_end(formAnswer) }}
  271.                 </div>
  272.             </div>
  273.         </div>
  274.     {% endif %}
  275.     {% if currentRoute == 'front_channel_chapter_show' and app.user is not null %}
  276.         {% set granted_edit = is_granted('CHANNEL_USER_PERM_LESSON_UPDATE', lesson) %}
  277.         {% set granted_delete = is_granted('CHANNEL_USER_PERM_LESSON_DELETE', lesson) %}
  278.         {% if granted_edit or granted_delete %}
  279.             <div class="dropdown btn-floating">
  280.                 <a href="{{- path('front_channel_lesson_edit', {'channelId': channel.id, 'lessonId': lesson.id}) -}}"
  281.                    target="_blank" class="btn btn-secondary bmd-btn-fab dropdown-toggle">
  282.                     <img src="{{ asset('build/common/icon-edit.svg', 'common') }}"/>
  283.                 </a>
  284.             </div>
  285.         {% endif %}
  286.     {% endif %}
  287. {% endblock %}
  288. {% block javascripts %}
  289.     {% if app.user and currentRoute == 'front_channel_chapter_show' %}
  290.         <script>
  291.             var attendanceUrl = '{{ url('async_channel_scholar_attendance_chapter', {
  292.                 'channelId': channel.id
  293.             }) }}';
  294.         </script>
  295.     {% endif %}
  296.     {{ parent() }}
  297. {% endblock %}