templates/front/theme1/page_ref.html.twig line 1

Open in your IDE?
  1. {% extends "front/"~ app.request.server.get('APP_THEME') ~"/base.html.twig" %}
  2. {% block preload %}
  3.     {% if post.image is defined  and post.image is not empty %}
  4.         {% if post.image %}
  5.             <link rel="preload" as="image" href="{{asset_image(post.image)}}" />
  6.         {% endif %}
  7.     {% endif %}
  8.      {% if galleries is defined and galleries is not empty %}
  9.            {% for item in galleries %}
  10.                 {% if item.path is defined %}
  11.                     <link rel="preload" as="image" href="{{asset_image_gallery(item.path)}}" />
  12.                 {% endif %}
  13.            {% endfor %}
  14.     {% endif %}
  15. {% endblock %}
  16. {% block stylesheets %}
  17.     {{parent()}}
  18.     {% if modele_galerie[0].type == 4 %}
  19.         <link rel="stylesheet" type="text/css" href="{{asset('templates/front/theme1/assets/plugins/flexslider/flexslider.css')}}" media="screen" >
  20.     {% endif %}
  21. {% endblock %}
  22. {% block body %}
  23.     <div class="page_cms page_activite pt-5">
  24.         <div class="breadcrumb-style-default">
  25.             <div class="container">
  26.                 <div class="row">
  27.                     <div class="col-lg-12">
  28.                         <div class="inner text-center">
  29.                             {% if breadcrumb is defined and breadcrumb is not empty %}
  30.                                 {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/partials/breadcrumb.html.twig')}}
  31.                                 <h1 class="page-title">{{breadcrumb|last.name}}</h1>
  32.                             {% endif %}
  33.                         </div>
  34.                     </div>
  35.                 </div>
  36.             </div>
  37.         </div>
  38.         <div class="container-fluid wrapper mt-3">
  39.             <div class="row gx-5 py-2">
  40.                 {% if post.summary is not empty and post.summary != "" %}
  41.                     <div class="col-sm-12 text-center">
  42.                         <h2 class="sub-title wow">{{post.summary}}</h2>
  43.                     </div>
  44.                 {% endif %}
  45.                 
  46.                 {% if post.image and post.image is not empty  %}
  47.                     <div class="col-sm-12 text-center my-4">
  48.                         <img class="lazyload img-fluid principal-img" data-srcset="{{asset_image(post.image)}}" src="{{asset_image(post.image)}}" alt="{{post.title}}" />
  49.                     </div>
  50.                 {% endif %}
  51.                 {% if post.content is not empty and post.content != "" %}
  52.                     <div class="col-lg-12 content_post">
  53.                         {{post.content|raw}}
  54.                         {% if post.typelien == null %}
  55.                             {% if categorieTree is defined and categorieTree[0] is defined  %}
  56.                                 <div class="text-center py-2">
  57.                                     <a href="{{path('page',{slug:categorieTree[0].slug})}}" class="btn btn-primary py-3 px-5 mt-3 btn-plus">Retour à la liste {{categorieTree[0].titre}}</a>
  58.                                 </div>
  59.                             {% endif %}
  60.                         {% elseif post.typelien != 1 %}
  61.                                 {% if post.typelien == '4' %}
  62.                                     <div class="text-center py-2">
  63.                                         <a href="javascript:void(0)" onclick="window.location.href = 'tel:{{post.telephone}}';" class="btn btn-primary py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  64.                                     </div>
  65.                                 {% elseif post.typelien == '2' %}
  66.                                     <div class="text-center py-2">
  67.                                         <a href="{{post.lieninterne}}" class="btn btn-primary py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  68.                                     </div>
  69.                                 {% elseif post.typelien == '3' %}
  70.                                     <div class="text-center py-2">
  71.                                         <a href="{{post.lienexterne}}" target="_blank" class="btn btn-primary py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
  72.                                     </div>
  73.                                 {% endif %}
  74.                         {% endif %}
  75.                         {% if docs and docs is not empty %}
  76.                             <div class="col-md-12 bloc-docs d-flex justify-content-center">
  77.                                 {% for doc in docs %}
  78.                                     <a class="btn-back-pulse m-2" href="{{doc.location ~ doc.path ~ '/' ~ doc.fileName}}" title="{{doc.fileName|slice(0, -4)}}" target="_blank"><i class="fa fa-file-pdf-o mr-2"></i>{{doc.fileName|slice(0, -4)}}</a>   
  79.                                 {% endfor %}
  80.                             </div>
  81.                         {% endif %}
  82.                     </div>
  83.                 {% endif %}
  84.             </div>
  85.             {% if next_article is defined and next_article is not empty or prev_article is defined and prev_article is not empty %}
  86.                <div class="row gx-5 py-4">
  87.                     <div class="col-lg-12 d-flex justify-content-between">
  88.                         <div class="">
  89.                             {% if prev_article is defined and prev_article is not empty %}
  90.                               <a href="{{path('page',{'slug':prev_article.slug})}}" title="{{prev_article.title}}"><span class="signe1"><i class="fa fa-arrow-left"></i></span> {{prev_article.title}}</a>
  91.                             {% endif %}
  92.                         </div>
  93.                         <div class="">
  94.                             {% if next_article is defined and next_article is not empty %}
  95.                               <a href="{{path('page',{'slug':next_article.slug})}}"  title="{{next_article.title}}">{{next_article.title}}  <span class="signe1"><i class="fa fa-arrow-right"></i></span></a>
  96.                             {% endif %}
  97.                         </div>
  98.                     </div>
  99.                 </div>
  100.             {% endif %}
  101.         </div>
  102.         {# {% if actualite_ref is defined and actualite_ref is not empty %}
  103.             <div class="container-fluid wrapper mt-3">
  104.                 <div class="row gx-5 py-2">
  105.                     <div class="col-sm-12 text-center">
  106.                         <h2 class="sub-title wow">Nos autres prestations autour de {{secteur.titre}}</h2>
  107.                     </div>
  108.                     <div class="col-sm-12">
  109.                          <div class="list_blocs pos1">
  110.                             <div class="blocs">
  111.                                 <section id="results" class="results dynam-affichage affichage1 type_affiche3">
  112.                                     {% for item in actualite_ref %}
  113.                                         {% set duree = 0.1 %}
  114.                                         {% set image_item = item.image != null? asset_image(item.image):'uploads/images/' ~ parametre.imagevide %}
  115.                                         <a class="article wow zoomIn animated" data-wow-delay="{{duree}}s" href="{{path('page',{slug:item.slug})}}" title="" style="visibility: visible; animation-delay: 0.1s; animation-name: zoomIn;">
  116.                                             <span class="article-image lazyloaded"  style="background-image: url({{image_item}}); background-size: cover; background-position: center center; background-repeat: no-repeat;"> </span>                 
  117.                                             <span class="article-cnt">
  118.                                                 <h3 class="article-titre">{{item.title}}</h3>
  119.                                                 <span class="article-txt">
  120.                                                     {% if item.summary is not empty %}
  121.                                                           {{item.summary|raw}}
  122.                                                     {% else %}
  123.                                                           {{cutText(item.content)|raw}}
  124.                                                     {% endif %}
  125.                                                 </span>
  126.                                                 <span class="article-bts">
  127.                                                     <span class="article-plus btn-fade">En savoir plus</span>
  128.                                                 </span>
  129.                                             </span>
  130.                                         </a>
  131.                                         {% set duree = duree + 0.2 %}
  132.                                     {% endfor %}
  133.                                 </section>
  134.                             </div>
  135.                         </div>
  136.                     </div>
  137.                 </div>
  138.             </div>
  139.         {% endif %} #}
  140.         {% if galleries and galleries is not empty and template_model_gallerie is defined and template_model_gallerie is not empty %}
  141.             {{ include(template_from_string(template_model_gallerie)) }}
  142.         {% endif %}
  143.         {% if post.urlvideo is not empty %}
  144.             <div class="container-fluid wrapper mt-3">
  145.                 <div class="col-md-12 mt-1">
  146.                     <div class="video">
  147.                         {% set id_video_externe = post.urlvideo|split('?v=')[1] %}
  148.                         <a class="video-thumbnail m-0" href="{{post.urlvideo}}" data-fancybox="video">
  149.                             <img src="https://img.youtube.com/vi/{{id_video_externe}}/maxresdefault.jpg" class="img-fluid" alt=""/>
  150.                         </a>
  151.                     </div>
  152.                 </div>
  153.             </div>
  154.         {% endif %}
  155.         {% if blocs is defined  %}
  156.             {% for bloc in blocs.Bloc %}
  157.                 {% if is_mobile() and  bloc.mobile == true   %}
  158.                     {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/bloc.html.twig',{
  159.                         bloc: bloc,
  160.                     }, with_context = false)}}
  161.                 {% endif %}
  162.                 
  163.                 {% if is_full_view() and is_mobile() == false and bloc.desktop == true %}
  164.                     {{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/bloc.html.twig',{
  165.                         bloc: bloc,
  166.                     }, with_context = false)}}
  167.                 {% endif %}
  168.             {% endfor %}
  169.         {% endif %} 
  170.     </div> 
  171. {% endblock %}
  172. {% block javascripts %}
  173.     {{parent()}}
  174.     <script src="{{ asset('assets-admin/plugins/form-builder-io/formio.full.min.js') }}"></script>
  175.     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
  176.     <script>
  177.     
  178.         var current_fs, next_fs, previous_fs;
  179.         var left, opacity, scale; 
  180.         var animating; 
  181.         $(".next").click(function(){
  182.             current_fs = $(this).parent();
  183.             next_fs = $(this).parent().next();
  184.             
  185.             if (!validateForm(current_fs)) {
  186.                 return false;
  187.             }
  188.             if(animating) return false;
  189.             animating = true;
  190.         
  191.             $("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
  192.             next_fs.show(); 
  193.             //hide the current fieldset with style
  194.             current_fs.animate({opacity: 0}, {
  195.                         step: function(now, mx) {
  196.                             //as the opacity of current_fs reduces to 0 - stored in "now"
  197.                             //1. scale current_fs down to 80%
  198.                             scale = 1 - (1 - now) * 0.2;
  199.                             //2. bring next_fs from the right(50%)
  200.                             left = (now * 50)+"%";
  201.                             //3. increase opacity of next_fs to 1 as it moves in
  202.                             opacity = 1 - now;
  203.                             current_fs.css({
  204.                         'transform': 'scale('+scale+')',
  205.                         'position': 'absolute'
  206.                     });
  207.                     next_fs.css({'left': left, 'opacity': opacity});
  208.                 }, 
  209.                 duration: 1000, 
  210.                 complete: function(){
  211.                     current_fs.hide();
  212.                     animating = false;
  213.                 }, 
  214.                 //this comes from the custom easing plugin
  215.                 easing: 'easeInOutBack'
  216.             });
  217.         });
  218.         $(".previous").click(function(){
  219.             current_fs = $(this).parent();
  220.             previous_fs = $(this).parent().prev();
  221.             // if (!validateForm(current_fs)) {
  222.             //     return false;
  223.             // }
  224.             if(animating) return false;
  225.             animating = true;
  226.             
  227.             //de-activate current step on progressbar
  228.             $("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
  229.             
  230.             //show the previous fieldset
  231.             previous_fs.show(); 
  232.             //hide the current fieldset with style
  233.             previous_fs.css({'transform': 'scale(1)', 'opacity': '1','position':'relative'});
  234.             current_fs.hide();
  235.             animating = false;
  236.             // current_fs.animate({opacity: 0}, {
  237.             //     step: function(now, mx) {
  238.             //         //as the opacity of current_fs reduces to 0 - stored in "now"
  239.             //         //1. scale previous_fs from 80% to 100%
  240.             //         scale = 0.8 + (1 - now) * 0.2;
  241.             //         //2. take current_fs to the right(50%) - from 0%
  242.             //         left = ((1-now) * 50)+"%";
  243.             //         //3. increase opacity of previous_fs to 1 as it moves in
  244.             //         opacity = 1 - now;
  245.             //         current_fs.css({'left': left});
  246.             //         previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity,'position':'relative'});
  247.             //     }, 
  248.             //     duration: 800, 
  249.             //     complete: function(){
  250.             //         current_fs.hide();
  251.             //         animating = false;
  252.             //     }, 
  253.             //     //this comes from the custom easing plugin
  254.             //     easing: 'easeInOutBack'
  255.             // });
  256.         });
  257.         // $(".form-wizrd .submit.action-button").click(function(e){
  258.         //      current_fs = $(this).parent();
  259.         //      if (!validateForm(current_fs)) {
  260.         //         return false;
  261.         //      }
  262.         // });
  263.         function validateForm(current_fs) {
  264.             let formTabs, formInputs, i, valid = true;
  265.             formInputs = current_fs[0].querySelectorAll('[data-form-input]');
  266.      
  267.             for (i = 0; i < formInputs.length; i++) {
  268.                 if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') != 'checkbox') {
  269.                     formInputs[i].addEventListener('keyup', (event) => {
  270.                         event.target.classList.remove("has-error");
  271.                         $(event.target.parentElement).find('.invalid-feedback').css('display','none');
  272.                        // event.target.nextElementSibling.style.display = "none";
  273.                     });
  274.                 }
  275.                 if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') == 'checkbox') {
  276.                     formInputs[i].addEventListener('change', (event) => {
  277.                         if($(event.target).is(':checked')){
  278.                             $(event.target).attr('checked', true);
  279.                         }else{
  280.                             $(event.target).attr('checked', false);
  281.                         }
  282.                         event.target.classList.remove("has-error");
  283.                         $(event.target.parentElement).find('.invalid-feedback').css('display','none');
  284.                         //event.target.nextElementSibling.style.display = "none";
  285.                     });
  286.                 }
  287.                 if (formInputs[i].hasAttribute("required") && formInputs[i].nodeName == 'SELECT') {
  288.                     formInputs[i].addEventListener('change', (event) => {
  289.                         console.log('select change');
  290.                         event.target.classList.remove("has-error");
  291.                         $(event.target.parentElement).find('.invalid-feedback').css('display','none');
  292.                         //event.target.nextElementSibling.style.display = "none";
  293.                     });
  294.                 }
  295.                 if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') == 'email') {
  296.                     formInputs[i].addEventListener('keyup', (event) => {
  297.                         console.log(isEmail(event.target.value));
  298.                         if (isEmail(event.target.value) == true) {
  299.                            event.target.classList.remove("has-error");
  300.                            $(event.target.parentElement).find('.invalid-feedback').css('display','none');
  301.                         }else{
  302.                             if (!event.target.classList.contains('has-error')) {
  303.                                 event.target.className += " has-error";
  304.                             }
  305.                             $(event.target.parentElement).find('.invalid-feedback').html('Veuillez choisir un email valide.');
  306.                             $(event.target.parentElement).find('.invalid-feedback').css('display','block');
  307.                         }
  308.                        // event.target.nextElementSibling.style.display = "none";
  309.                     });
  310.                 }
  311.                 if(formInputs[i].hasAttribute("required")){
  312.                     if ($(formInputs[i]).attr('type') == 'checkbox' && $(formInputs[i]).is(':checked') == false) {
  313.                         if (!formInputs[i].classList.contains('has-error')) {
  314.                             formInputs[i].className += " has-error";
  315.                         }
  316.                         $(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
  317.                         valid = false;
  318.                     }else if(formInputs[i].value == "" && ($(formInputs[i]).attr('type') == 'text' || formInputs[i].nodeName == 'SELECT' || formInputs[i].nodeName == 'TEXTAREA')){
  319.                         if (!formInputs[i].classList.contains('has-error')) {
  320.                             formInputs[i].className += " has-error";
  321.                         }
  322.                         $(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
  323.                          valid = false;
  324.                     }else if(!isEmail(formInputs[i].value) && $(formInputs[i]).attr('type') == 'email'){
  325.                         if (!formInputs[i].classList.contains('has-error')) {
  326.                             formInputs[i].className += " has-error";
  327.                         }
  328.                         $(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
  329.                          valid = false;
  330.                     }
  331.                     //formInputs[i].nextElementSibling.style.display = "block";                   
  332.                 }
  333.             }
  334.             return valid;
  335.         }
  336.         function isEmail(email) {
  337.             var EmailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  338.             return EmailRegex.test(email);
  339.         }
  340.     </script>
  341.     <script>
  342.        if(document.getElementById("builder")){
  343.         var data_fields = document.getElementById("builder").getAttribute('data-config');
  344.         if(data_fields != ''){
  345.            data_fields = JSON.parse(data_fields);
  346.            console.log(JSON.parse(data_fields));
  347.            Formio.createForm(document.getElementById('builder'), 
  348.               JSON.parse(data_fields),
  349.            ).then(function(form) {
  350.                 // Prevent the submission from going to the form.io server.
  351.                 form.nosubmit = true;
  352.                 // Triggered when they click the submit button.
  353.                 form.on('submit', function(submission) {
  354.                     var data = submission.data;
  355.                     grecaptcha.execute('{{ParametreSite().clekey}}', {action: 'create_comment'}).then(token => {
  356.                         $('#builder').find('[name=g-recaptcha-response]').val(token);
  357.                         data['g-recaptcha-response'] = token;
  358.                         data['IdForm'] = $('#builder').parent().find('input[name="IdForm"]').val();
  359.                         $('#builder').parent().find('button[type="submit"]').attr('disabled','true');
  360.                         $.ajax({
  361.                             type:"POST",
  362.                             cache:false,
  363.                             url:"{{path('save_form')}}",
  364.                             data:data,   
  365.                             success: function (data) {
  366.                                window.location = data
  367.                             }
  368.                         });
  369.                     });
  370.                 });
  371.             });
  372.         }
  373.        }
  374.     </script>
  375.     {% if modele_galerie[0].type == 4 %}
  376.         {{parent()}}
  377.         <script src="{{asset('templates/front/theme1/assets/plugins/flexslider/jquery.flexslider.js')}}" ></script>
  378.         <script>    
  379.             /*-------------------------------------------------*/
  380.             /* =  Sx flexslider 
  381.             /*-------------------------------------------------*/
  382.             if ($(".sx_flexslider").length) {
  383.             $('.flex-carousel').flexslider({
  384.             animation: "slide",
  385.             controlNav: false,
  386.             animationLoop: true,
  387.             slideshow: false,
  388.             itemWidth: 150,
  389.             asNavFor: '.flex-slider'
  390.             });
  391.             $('.flex-slider').flexslider({
  392.             animation: "slide",
  393.             controlNav: false,
  394.             animationLoop: true,
  395.             slideshow: false,
  396.             sync: ".flex-carousel"
  397.             });
  398.             }
  399.         </script>
  400.     {% endif %}
  401.     
  402. {% endblock %}