{% extends "front/"~ app.request.server.get('APP_THEME') ~"/base.html.twig" %}
{% block preload %}
{% if post.image is defined and post.image is not empty %}
{% if post.image %}
<link rel="preload" as="image" href="{{asset_image(post.image)}}" />
{% endif %}
{% endif %}
{% if galleries is defined and galleries is not empty %}
{% for item in galleries %}
{% if item.path is defined %}
<link rel="preload" as="image" href="{{asset_image_gallery(item.path)}}" />
{% endif %}
{% endfor %}
{% endif %}
{% endblock %}
{% block stylesheets %}
{{parent()}}
{% if modele_galerie[0].type == 4 %}
<link rel="stylesheet" type="text/css" href="{{asset('templates/front/theme1/assets/plugins/flexslider/flexslider.css')}}" media="screen" >
{% endif %}
{% endblock %}
{% block body %}
{% if post.imageBandeau %}
{% set imagebandeau = post.imageBandeau %}
{% elseif parametre.imageBandeau %}
{% set imagebandeau = 'uploads/images/' ~ parametre.imageBandeau %}
{% else %}
{% set imagebandeau = '' %}
{% endif %}
{% if imagebandeau != '' %}
<section class="image-bandeau text-center">
<img class="lazyload" alt="{{post.title}}" title="{{post.title}}" data-srcset="{{imagebandeau}}" src="{{asset(imagebandeau)}}" />
<div class="cnt-bandeau text-center">
<div class="container-fluid wrapper">
<ol class="breadcrumb d-flex justify-content-center" itemscope itemtype="http://schema.org/BreadcrumbList">
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('index_page_home')}}" itemprop="item"><span itemprop="name">Accueil</span></a><meta itemprop="position" content="1" /></li>
{% set niveau = 2 %}
{% if categorieTree %}
{% for item in categorieTree %}
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('page',{slug:item.slug})}}" title="{{item.titre}}" itemprop="item"><span itemprop="name">{{item.titre}}</span></a><meta itemprop="position" content="2" /></li>
{% set niveau = 3 %}
{% if item.child is defined %}
{% for item in item.child %}
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('page',{slug:item.slug})}}" title="{{item.titre}}" itemprop="item"><span itemprop="name">{{item.titre}}</span></a><meta itemprop="position" content="3" /></li>
{% set niveau = 4 %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
<li class="breadcrumb-item active" aria-current="page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">{{post.title}}</span><meta itemprop="position" content="{{niveau}}" /></li>
</ol>
{% if categorieTree %}
{# {% for item in categorieTree %} #}
<a class="article-retour text-center" href="{{path('page',{slug:categorieTree[0].slug})}}" title="Retour">Retour</a>
{# {% endfor %} #}
{% endif %}
<h1 class="page-title">{{post.title}}</h1>
</div>
</div>
</section>
{% endif %}
<div class="page_cms pt-5">
{% if imagebandeau == '' %}
<div class="breadcrumb-style-default">
<div class="container-fluid wrapper">
<div class="row">
<div class="col-lg-12">
<div class="inner text-center">
<ol class="breadcrumb d-flex justify-content-center" itemscope itemtype="http://schema.org/BreadcrumbList">
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('index_page_home')}}" itemprop="item"><span itemprop="name">Accueil</span></a><meta itemprop="position" content="1" /></li>
{% set niveau = 2 %}
{% if categorieTree %}
{% for item in categorieTree %}
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('page',{slug:item.slug})}}" title="{{item.titre}}" itemprop="item"><span itemprop="name">{{item.titre}}</span></a><meta itemprop="position" content="2" /></li>
{% set niveau = 3 %}
{% if item.child is defined %}
{% for item in item.child %}
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="{{path('page',{slug:item.slug})}}" title="{{item.titre}}" itemprop="item"><span itemprop="name">{{item.titre}}</span></a><meta itemprop="position" content="3" /></li>
{% set niveau = 4 %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
<li class="breadcrumb-item active" aria-current="page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">{{post.title}}</span><meta itemprop="position" content="{{niveau}}" /></li>
</ol>
{% if categorieTree %}
{# {% for item in categorieTree %} #}
<a class="article-retour text-center" href="{{path('page',{slug:categorieTree[0].slug})}}" title="Retour">Retour</a>
{# {% endfor %} #}
{% endif %}
<h1 class="page-title">{{post.title}}</h1>
</div>
</div>
</div>
</div>
</div>
{% endif %}
<div class="container-fluid wrapper mt-3">
<div class="row gx-5 py-2">
{% if post.summary is not empty and post.summary != "" %}
<div class="col-sm-12 text-center">
<h2 class="sub-title wow">{{post.summary}}</h2>
</div>
{% endif %}
{% if post.image and post.image is not empty and categorieTree is empty %}
<div class="col-sm-12 text-center my-4">
<img class="lazyload img-fluid principal-img" data-srcset="{{asset_image(post.image)}}" src="{{asset_image(post.image)}}" alt="{{post.title}}" />
</div>
{% endif %}
{% if post.content is not empty and post.content != "" %}
<div class="col-lg-12 content_post">
{{post.content|raw}}
{% if post.typelien == null %}
{% if categorieTree is defined and categorieTree[0] is defined %}
<div class="text-center py-2">
<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>
</div>
{% endif %}
{% elseif post.typelien != 1 %}
{% if post.typelien == '4' %}
<div class="text-center py-2">
<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>
</div>
{% elseif post.typelien == '2' %}
<div class="text-center py-2">
<a href="{{post.lieninterne}}" class="btn btn-primary py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
</div>
{% elseif post.typelien == '3' %}
<div class="text-center py-2">
<a href="{{post.lienexterne}}" target="_blank" class="btn btn-primary py-3 px-5 mt-3 btn-plus">{{post.titrelien}}</a>
</div>
{% endif %}
{% endif %}
{% if docs and docs is not empty %}
<div class="col-md-12 bloc-docs d-flex justify-content-center">
{% for doc in docs %}
<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>
{% endfor %}
</div>
{% endif %}
{% if champsPersonnalises %}
{% for key1, champ in champsPersonnalises %}
{% if champ %}
<div class="my-4">
{% for key2, lbl in lblchampsPersonnalises %}
{% if key2 == key1 %}
{{lbl}} :
{% endif %}
{% endfor %}
<a href="{{champ}}" title="{{champ}}" target="_blank">{{champ}}</a></div>
{% endif %}
{% endfor %}
{% endif %}
</div>
{% endif %}
</div>
{% if next_article is defined and next_article is not empty or prev_article is defined and prev_article is not empty %}
<div class="row gx-5 py-4">
<div class="col-lg-12 d-flex justify-content-between">
<div class="">
{% if prev_article is defined and prev_article is not empty %}
<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>
{% endif %}
</div>
<div class="">
{% if next_article is defined and next_article is not empty %}
<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>
{% endif %}
</div>
</div>
</div>
{% endif %}
</div>
{# {% if galleries and galleries is not empty %}
{{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/galleries.html.twig',{galleries: galleries,post:post}, with_context = false)}}
{% endif %} #}
{% if galleries and galleries is not empty and template_model_gallerie is defined and template_model_gallerie is not empty %}
{{ include(template_from_string(template_model_gallerie)) }}
{% endif %}
{% if post.urlvideo is not empty %}
<div class="container-fluid wrapper mt-3">
<div class="col-md-12 mt-1">
<div class="video">
{% set id_video_externe = post.urlvideo|split('?v=')[1] %}
<a class="video-thumbnail m-0" href="{{post.urlvideo}}" data-fancybox="video">
<img src="https://img.youtube.com/vi/{{id_video_externe}}/maxresdefault.jpg" class="img-fluid" alt=""/>
</a>
</div>
</div>
</div>
{% endif %}
{% if blocs is defined %}
{% for bloc in blocs.Bloc %}
{% if is_mobile() and bloc.mobile == true %}
{{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/bloc.html.twig',{
bloc: bloc,
}, with_context = false)}}
{% endif %}
{% if is_full_view() and is_mobile() == false and bloc.desktop == true %}
{{ include ('front/'~ app.request.server.get('APP_THEME') ~'/bloc/bloc.html.twig',{
bloc: bloc,
}, with_context = false)}}
{% endif %}
{% endfor %}
{% endif %}
</div>
{% endblock %}
{% block javascripts %}
{{parent()}}
<script src="{{ asset('assets-admin/plugins/form-builder-io/formio.full.min.js') }}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script>
var current_fs, next_fs, previous_fs;
var left, opacity, scale;
var animating;
$(".next").click(function(){
current_fs = $(this).parent();
next_fs = $(this).parent().next();
if (!validateForm(current_fs)) {
return false;
}
if(animating) return false;
animating = true;
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
next_fs.show();
//hide the current fieldset with style
current_fs.animate({opacity: 0}, {
step: function(now, mx) {
//as the opacity of current_fs reduces to 0 - stored in "now"
//1. scale current_fs down to 80%
scale = 1 - (1 - now) * 0.2;
//2. bring next_fs from the right(50%)
left = (now * 50)+"%";
//3. increase opacity of next_fs to 1 as it moves in
opacity = 1 - now;
current_fs.css({
'transform': 'scale('+scale+')',
'position': 'absolute'
});
next_fs.css({'left': left, 'opacity': opacity});
},
duration: 1000,
complete: function(){
current_fs.hide();
animating = false;
},
//this comes from the custom easing plugin
easing: 'easeInOutBack'
});
});
$(".previous").click(function(){
current_fs = $(this).parent();
previous_fs = $(this).parent().prev();
// if (!validateForm(current_fs)) {
// return false;
// }
if(animating) return false;
animating = true;
//de-activate current step on progressbar
$("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
//show the previous fieldset
previous_fs.show();
//hide the current fieldset with style
previous_fs.css({'transform': 'scale(1)', 'opacity': '1','position':'relative'});
current_fs.hide();
animating = false;
// current_fs.animate({opacity: 0}, {
// step: function(now, mx) {
// //as the opacity of current_fs reduces to 0 - stored in "now"
// //1. scale previous_fs from 80% to 100%
// scale = 0.8 + (1 - now) * 0.2;
// //2. take current_fs to the right(50%) - from 0%
// left = ((1-now) * 50)+"%";
// //3. increase opacity of previous_fs to 1 as it moves in
// opacity = 1 - now;
// current_fs.css({'left': left});
// previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity,'position':'relative'});
// },
// duration: 800,
// complete: function(){
// current_fs.hide();
// animating = false;
// },
// //this comes from the custom easing plugin
// easing: 'easeInOutBack'
// });
});
// $(".form-wizrd .submit.action-button").click(function(e){
// current_fs = $(this).parent();
// if (!validateForm(current_fs)) {
// return false;
// }
// });
function validateForm(current_fs) {
let formTabs, formInputs, i, valid = true;
formInputs = current_fs[0].querySelectorAll('[data-form-input]');
for (i = 0; i < formInputs.length; i++) {
if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') != 'checkbox') {
formInputs[i].addEventListener('keyup', (event) => {
event.target.classList.remove("has-error");
$(event.target.parentElement).find('.invalid-feedback').css('display','none');
// event.target.nextElementSibling.style.display = "none";
});
}
if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') == 'checkbox') {
formInputs[i].addEventListener('change', (event) => {
if($(event.target).is(':checked')){
$(event.target).attr('checked', true);
}else{
$(event.target).attr('checked', false);
}
event.target.classList.remove("has-error");
$(event.target.parentElement).find('.invalid-feedback').css('display','none');
//event.target.nextElementSibling.style.display = "none";
});
}
if (formInputs[i].hasAttribute("required") && formInputs[i].nodeName == 'SELECT') {
formInputs[i].addEventListener('change', (event) => {
console.log('select change');
event.target.classList.remove("has-error");
$(event.target.parentElement).find('.invalid-feedback').css('display','none');
//event.target.nextElementSibling.style.display = "none";
});
}
if (formInputs[i].hasAttribute("required") && $(formInputs[i]).attr('type') == 'email') {
formInputs[i].addEventListener('keyup', (event) => {
console.log(isEmail(event.target.value));
if (isEmail(event.target.value) == true) {
event.target.classList.remove("has-error");
$(event.target.parentElement).find('.invalid-feedback').css('display','none');
}else{
if (!event.target.classList.contains('has-error')) {
event.target.className += " has-error";
}
$(event.target.parentElement).find('.invalid-feedback').html('Veuillez choisir un email valide.');
$(event.target.parentElement).find('.invalid-feedback').css('display','block');
}
// event.target.nextElementSibling.style.display = "none";
});
}
if(formInputs[i].hasAttribute("required")){
if ($(formInputs[i]).attr('type') == 'checkbox' && $(formInputs[i]).is(':checked') == false) {
if (!formInputs[i].classList.contains('has-error')) {
formInputs[i].className += " has-error";
}
$(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
valid = false;
}else if(formInputs[i].value == "" && ($(formInputs[i]).attr('type') == 'text' || formInputs[i].nodeName == 'SELECT' || formInputs[i].nodeName == 'TEXTAREA')){
if (!formInputs[i].classList.contains('has-error')) {
formInputs[i].className += " has-error";
}
$(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
valid = false;
}else if(!isEmail(formInputs[i].value) && $(formInputs[i]).attr('type') == 'email'){
if (!formInputs[i].classList.contains('has-error')) {
formInputs[i].className += " has-error";
}
$(formInputs[i].parentElement).find('.invalid-feedback').css('display','block');
valid = false;
}
//formInputs[i].nextElementSibling.style.display = "block";
}
}
return valid;
}
function isEmail(email) {
var EmailRegex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return EmailRegex.test(email);
}
</script>
<script>
if(document.getElementById("builder")){
var data_fields = document.getElementById("builder").getAttribute('data-config');
if(data_fields != ''){
data_fields = JSON.parse(data_fields);
console.log(JSON.parse(data_fields));
Formio.createForm(document.getElementById('builder'),
JSON.parse(data_fields),
).then(function(form) {
// Prevent the submission from going to the form.io server.
form.nosubmit = true;
// Triggered when they click the submit button.
form.on('submit', function(submission) {
var data = submission.data;
grecaptcha.execute('{{ParametreSite().clekey}}', {action: 'create_comment'}).then(token => {
$('#builder').find('[name=g-recaptcha-response]').val(token);
data['g-recaptcha-response'] = token;
data['IdForm'] = $('#builder').parent().find('input[name="IdForm"]').val();
$('#builder').parent().find('button[type="submit"]').attr('disabled','true');
$.ajax({
type:"POST",
cache:false,
url:"{{path('save_form')}}",
data:data,
success: function (data) {
window.location = data
}
});
});
});
});
}
}
</script>
{% if modele_galerie[0].type == 4 %}
{{parent()}}
<script src="{{asset('templates/front/theme1/assets/plugins/flexslider/jquery.flexslider.js')}}" ></script>
<script>
/*-------------------------------------------------*/
/* = Sx flexslider
/*-------------------------------------------------*/
if ($(".sx_flexslider").length) {
$('.flex-carousel').flexslider({
animation: "slide",
controlNav: false,
animationLoop: true,
slideshow: false,
itemWidth: 150,
asNavFor: '.flex-slider'
});
$('.flex-slider').flexslider({
animation: "slide",
controlNav: false,
animationLoop: true,
slideshow: false,
sync: ".flex-carousel"
});
}
</script>
{% endif %}
{% endblock %}