templates/front/ssr35f.html.twig line 1

Open in your IDE?
  1. {% extends 'base_front.html.twig' %}
  2. {% block title %}{{ parent() }} | {{ r.nom }} | {{ ssr.nom }} | {{ post.titre }}{% endblock %}
  3. {% block h1 %}{{ post.titre }}{% endblock %}
  4. {% block ariane %}
  5.     <nav class="navigateur" aria-label="breadcrumb">
  6.         <ol class="breadcrumb">
  7.             <li class="breadcrumb-item"><a href="{{ path("home") }}">{{ config.titreAccueil }}</a></li>
  8.             <li class="breadcrumb-item"><a href="{{ path('rubriques', {slug:r.slug })}}">{{ r.nom }}</a></li>
  9.             <li class="breadcrumb-item"><a href="{{ path('ssrubriques', {slug: r.slug, slug2 : ssr.slug })}}">{{ ssr.nom }}</a></li>
  10.             <li class="breadcrumb-item"><a href="{{ path('agora_categorie', {slug: r.slug, slug2 : ssr.slug, slug3: post.categorie.slug })}}">{{ post.categorie.nom }}</a></li>
  11.             <li class="breadcrumb-item active" aria-current="page">{{ post.titre }}</li>
  12.         </ol>
  13.     </nav>
  14. {% endblock %}
  15. {% block body %}
  16.     <div class="row mx-0">
  17.             
  18.         <div class="col-md-12  ">
  19.             
  20.                 <div class="p-4 bg-white rounded">
  21.                     <div class="text-end">
  22.                         <p class="fst-italic mb-1">{{ post.createdAt|date('d/m/Y') }}</p>
  23.                     </div>
  24.                     {% if post.description %}
  25.                         <div class="ck">
  26.                             {{ post.description|raw }}
  27.                         </div>   
  28.                     {% endif %}
  29.                     {% if post.fichier %}
  30.                         
  31.                     
  32.                     <a target="_blank" href="{{ path('post_pdf', {uuid: post.uuid}) }}" >
  33.                         <i class="text-danger" data-feather="file"></i>
  34.                     </a>
  35.                     {% endif %}
  36.                     {# {% if post.user %}
  37.                         <h5 class="titreH3 ">
  38.                                 {% if app.user %}
  39.                                     {% if post.user %}
  40.                                         {{ post.user.prenom }} {{ post.user.nom }}
  41.                                     {% endif %}
  42.                                 {% else %}
  43.                                     {% if post.user %}
  44.                                         {{ post.user.prenom }} {{ post.user.nom|slice(0, 1)|upper }}
  45.                                     {% endif %}
  46.                                 {% endif %}
  47.                         </h5>
  48.                     {% endif %} #}
  49.                     {% if post.categorie %}
  50.                         <h5 class="titreH3">
  51.                             #{{ post.categorie.nom }}
  52.                         </h5>
  53.                     {% endif %}
  54.                     {% if post.souscategorie %}
  55.                         <h5 class="titreH3">
  56.                             #{{ post.souscategorie.nom }}
  57.                         </h5>
  58.                     {% endif %}
  59.                     {% if post.user != app.user %}
  60.                         {% if app.user %}
  61.                             
  62.                         
  63.                             <div class="text-end">
  64.                                 {% if getVerifConversation(post.user, app.user, post, 'agora') %}
  65.                                     {% set slug = getVerifConversation(post.user, app.user, post, 'agora') %}
  66.                                     <a class="btn btn-primary rounded" href="{{ path('app_messagerie_show',{'slug' : slug })}}">Retourner à la conversation</a>
  67.                                 {% else %}
  68.                                     <button type="button" class="btn btn-primary rounded" data-bs-toggle="modal" data-bs-target="#exampleModal">
  69.                                         Contacter 
  70.                                         {# {{ post.user.prenom }} #}
  71.                                     </button>
  72.                                 {% endif %}
  73.                                 
  74.                             </div>
  75.                         {% endif %}
  76.                     {% endif %}
  77.                 </div>
  78.             
  79.         </div>
  80.     </div>
  81.     
  82.     <div class="modal modal-lg fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
  83.         <div class="modal-dialog">
  84.             <div class="modal-content">
  85.             <div class="modal-header">
  86.                 <h1 class="modal-title fs-5" id="exampleModalLabel">Contacter</h1>
  87.                 <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  88.             </div>
  89.             <div class="modal-body">
  90.                 <div class="input-box">
  91.                     <textarea id="messageInput" placeholder="Tapez votre message ici..." rows="8"></textarea>
  92.                     
  93.                 </div>
  94.             </div>
  95.             <div class="modal-footer">
  96.                 <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Annuler</button>
  97.                 <button class="btn btn-primary" onclick="sendMessage()">Envoyer</button>
  98.                 <div id="displayMessage"></div>
  99.             </div>
  100.             </div>
  101.         </div>
  102.     </div>
  103. {% endblock %}
  104. {% block stylesheets %}
  105.     <style>
  106.         .input-box {
  107.             display: flex;
  108.             align-items: center;
  109.             padding-top: 10px;
  110.         }
  111.         textarea {
  112.             flex: 1;
  113.             padding: 5px;
  114.             resize: none;
  115.             border: 1px solid #ccc;
  116.             border-radius: 5px;
  117.             /*overflow-y: hidden;*/ 
  118.         }
  119.         button {
  120.             padding: 8px 15px;
  121.             margin-left: 10px;
  122.         }
  123.     </style>
  124. {% endblock %}
  125. {% block javascripts %}
  126.     <script>
  127.         document.addEventListener('DOMContentLoaded', function() {
  128.             // Récupérer la div conversationBox
  129.             const conversationBox = document.getElementById('contentContainer');
  130.             // Fonction pour déplacer la div tout en bas
  131.             function scrollToBottom() {
  132.                 conversationBox.scrollTop = conversationBox.scrollHeight;
  133.                 console.log(conversationBox.scrollTop);
  134.             }
  135.             // Écouter l'événement 'load' pour s'assurer que le contenu est chargé
  136.             
  137.             // Appeler la fonction pour faire défiler vers le bas une fois le contenu chargé
  138.             scrollToBottom();
  139.         });
  140.         function sendMessage() {
  141.             const textarea = document.getElementById('messageInput');
  142.             const textValue = textarea.value;
  143.             const lines = textValue.split('\n');
  144.             let contentWithParagraphs = '';
  145.             lines.forEach((line) => {
  146.                 contentWithParagraphs += `<p>${line}</p>`;
  147.             });
  148.             console.log(contentWithParagraphs);
  149.             if (contentWithParagraphs !== '') {
  150.                 sendDatabase(contentWithParagraphs);
  151.             }
  152.         }
  153.         function sendDatabase(contentWithParagraphs) {
  154.             let url = "{{ path('create_conversation') }}";
  155.             let data = {
  156.                 "uuid" : "{{ post.user.uuid }}",
  157.                 'message': contentWithParagraphs,
  158.                 'genre' : 'agora',
  159.                 "relation" : "{{ post.uuid }}",
  160.             }
  161.             $.ajax({
  162.                 method: 'post',
  163.                 dataType: 'json',
  164.                 url : url,
  165.                 data : data,
  166.                 success: function (response)
  167.                 {
  168.                     $('#exampleModal').modal('hide');
  169.                     $('#exampleModal').remove();
  170.                       const alerteHTML = `
  171.                         <div class="alert alert-success text-center disparition col-md-4 mx-auto shadow mt-4">
  172.                         Votre message a bien été envoyé
  173.                         </div>
  174.                     `;
  175.                     // Sélectionnez l'élément container dans lequel vous souhaitez insérer l'alerte
  176.                     const container = document.getElementById('bodyContainer');
  177.                     // Insérez l'alerte à la fin de l'élément container en utilisant insertAdjacentHTML
  178.                     container.insertAdjacentHTML('beforeend', alerteHTML);
  179.                     // Temps en millisecondes avant de faire disparaître le message (par exemple, 3000 ms = 3 secondes)
  180.                     const tempsDisparition = 3000;
  181.                     // Programme la disparition du message après le délai spécifié
  182.                     setTimeout(function () {
  183.                         const alerte = container.lastElementChild;
  184.                         alerte.remove();
  185.                     }, tempsDisparition);
  186.                 },
  187.                 error: function()
  188.                 {
  189.                     alert('error');
  190.                 }
  191.             });
  192.             
  193.         }
  194.         
  195.     </script>
  196. {% endblock %}