{% extends "front/"~ app.request.server.get('APP_THEME') ~"/base.html.twig" %}
{% block stylesheets %}
{{parent()}}
{% endblock %}
{% block body %}
{% if parametreRef.imagebandeau != '' %}
<section class="image-bandeau text-center">
<img alt="{{parametreRef.titreparamref}}" title="{{parametreRef.titreparamref}}" src="{{asset_image(parametreRef.imagebandeau,'large')}}" />
<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">{{title_home_ariane}}</span></a><meta itemprop="position" content="1" /></li>
<li class="breadcrumb-item active" aria-current="page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">{{title_page}}</span><meta itemprop="position" content="2" /></li>
</ol>
<h1 class="page-title">
{% if parametreRef.soustitreparamref is not empty %}
{{parametreRef.soustitreparamref|raw}}
{% elseif (parametreRef.titreparamref) %}
{{parametreRef.titreparamref|raw}}
{% endif %}
</h1>
</div>
</div>
</section>
{% endif %}
<div class="page_cms page_bons_cadeaux pt-5">
{% if parametreRef.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">{{title_home_ariane}}</span></a><meta itemprop="position" content="1" /></li>
<li class="breadcrumb-item active" aria-current="page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name">{{title_page}}</span><meta itemprop="position" content="2" /></li>
</ol>
<h1 class="page-title">
{% if parametreRef.soustitreparamref is not empty %}
{{parametreRef.soustitreparamref|raw}}
{% elseif (parametreRef.titreparamref) %}
{{parametreRef.titreparamref|raw}}
{% endif %}
</h1>
</div>
</div>
</div>
</div>
</div>
{% endif %}
<div class="container-fluid wrapper">
{% if parametreRef.description is not empty %}
<div class="row">
<div class="col-md-12 text-content">{{parametreRef.description|raw}}</div>
</div>
{% endif %}
{% if posts %}
{% set all_tags = [] %}
<div class="bloc_bons_cadeaux d-flex flex-column-reverse mt-5">
<div class="results affichage1 affichage_bons_cadeaux">
{% for post in posts %}
{% set prix_bons_cadeaux = "" %}
{% set caracteristiques_bons_cadeaux = "" %}
{% set nombre_personne_bons_cadeaux = "" %}
{% set lien1_bons_cadeaux = "" %}
{% set lien2_bons_cadeaux = "" %}
{% set info_pack = "" %}
{% if champs_personnalises_posts is not empty %}
{% for champs_personnalises_post in champs_personnalises_posts %}
{% if champs_personnalises_post.id_post == post.id %}
{% for champ_personnalise_post in champs_personnalises_post['champs_personnalises_post'] %}
{% if champ_personnalise_post.value != "" %}
{% if champ_personnalise_post.type == "text" %}
{% if champ_personnalise_post.alias == "prix-par" and post.prixproduit is not empty %}
{% set prix_bons_cadeaux = '<div class="article-prix">'~post.prixproduit~' € '~champ_personnalise_post.value~'</div>' %}
{% elseif champ_personnalise_post.alias == "nombre-personne" %}
{% set nombre_personne_bons_cadeaux = '<div class="article-info"><i class="fa fa-user mr-3"></i>'~champ_personnalise_post.value~'</div>' %}
{% endif %}
{% endif %}
{% if champ_personnalise_post.type == "textarea" %}
{% if champ_personnalise_post.alias == "information-pack" %}
{% set info_pack = '<div class="article-info">'~champ_personnalise_post.value~'</div>' %}
{% endif %}
{% endif %}
{% if champ_personnalise_post.type == "tags" %}
{% set tags = champ_personnalise_post.value|split(',') %}
{% set caracteristiques_bons_cadeaux = tags %}
{% for t in tags %}
{% if t not in all_tags %}
{% set all_tags = all_tags|merge([t]) %}
{% endif %}
{% endfor %}
{% endif %}
{% if champ_personnalise_post.type == "link" %}
{% if champ_personnalise_post.alias == "offrir" %}
{% set lien1_bons_cadeaux = '<a href="'~champ_personnalise_post.value~'" class="btn-cms" target="_blank" title="'~champ_personnalise_post.label~'">'~champ_personnalise_post.label~'</a>' %}
{% endif %}
{% if champ_personnalise_post.alias == "en-savoir-plus" %}
{% set lien2_bons_cadeaux = '<a href="'~champ_personnalise_post.value~'" class="btn-cms" target="_blank" title="'~champ_personnalise_post.label~'">'~champ_personnalise_post.label~'</a>' %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% set class_tags = "" %}
{% if caracteristiques_bons_cadeaux %}
{% for tag in caracteristiques_bons_cadeaux %}
{% set class_tags = class_tags ~" "~ tag %}
{% endfor %}
{% endif %}
<div class="article {{class_tags}}" data-prix="{{post.prixproduit}}">
{% if all_galleries_posts is not empty %}
{% for gallerie_post in all_galleries_posts %}
{% if gallerie_post.id == post.id %}
{% if gallerie_post['gallerie'] is not empty %}
{% if gallerie_post['gallerie']|length > 1 %}
<div class="carousel-bon-cadeaux owl-carousel">
{% for image in gallerie_post['gallerie'] %}
<div class="item-carousel-bon-cadeau">
<img src="{{asset_image_gallery(image.path,['files640'])}}" alt="{{post.title}}" />
</div>
{% endfor %}
</div>
{% else %}
{% for image in gallerie_post['gallerie'] %}
<div class="item-carousel-bon-cadeau">
<img src="{{asset_image_gallery(image.path,['files640'])}}" alt="{{post.title}}" />
</div>
{% endfor %}
{% endif %}
{% elseif parametre.imageVide != null %}
<div class="item-carousel-bon-cadeau">
<img src="{{asset('uploads/images/' ~ parametre.imagevide)}}" alt="{{post.title}}" />
</div>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% if prix_bons_cadeaux %}
{{prix_bons_cadeaux|raw}}
{% endif %}
<div class="article-cnt text-left">
{% if caracteristiques_bons_cadeaux %}
<ul class="tags mb-2">
{% for tag in caracteristiques_bons_cadeaux %}
<li>{{tag}}</li>
{% endfor %}
</ul>
{% endif %}
<div class="article-titre">{{post.title|raw}}</div>
{% if post.summary is not empty %}
<div class="article-txt">{{post.summary|raw}}</div>
{% endif %}
{% if nombre_personne_bons_cadeaux is not empty %}
{{nombre_personne_bons_cadeaux|raw}}
{% endif %}
{% if info_pack is not empty %}
{{info_pack|raw}}
{% endif %}
{% if lien1_bons_cadeaux is not empty or lien2_bons_cadeaux is not empty %}
<div class="boutons-bon-cadeau d-flex flex-wrap align-items-center">{{lien1_bons_cadeaux|raw}}{{lien2_bons_cadeaux|raw}}</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
<div class="info_filtre d-flex flex-wrap justify-content-between align-items-center">
<div class="info_result mr-3">Nos {{posts|length}} bons cadeaux</div>
<div class="filtrages d-flex flex-wrap align-items-center">
<div class="filtre_result">
<div class="trie">
<form action="/bons-cadeaux" method="post" id="form_nb_items">
<div class="form-group show_trie">
<label class="control-label trie_show"> <span>Trier par : </span></label>
<div class="bloc_padding">
<select name="tri" id="tri" class="form-control">
<option value="0" {% if app.request.get('tri') is defined and app.request.get('tri') == "0" %}selected{% endif %} >Prix croissant</option>
<option value="1" {% if app.request.get('tri') is defined and app.request.get('tri') == "1" %}selected{% endif %}>Prix décroissant</option>
</select>
</div>
</div>
</form>
</div>
</div>
{% if all_tags %}
<div class="filtre_tags mb-3 ml-3">
<label class="label">Filtrer par tag : </label>
<select class="form-control" id="filtre-tags">
<option value="all">Tous</option>
{% for tag in all_tags %}
<option value="{{tag}}">{{tag}}</option>
{% endfor %}
</select>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
{% if parametreRef.description2 is not empty %}
<div class="row">
<div class="col-md-12 text-content">{{parametreRef.description2|raw}}</div>
</div>
{% endif %}
</div>
</div>
{% endblock %}
{% block javascripts %}
{{parent()}}
<script type="text/javascript">
$(document).ready(function() {
var $articles = $('.affichage_bons_cadeaux .article');
$articles.sort(function(a, b) {
var priceA = parseInt($(a).data('prix'));
var priceB = parseInt($(b).data('prix'));
return priceA - priceB; // Tri par prix croissant
}).appendTo('.affichage_bons_cadeaux');
$('#tri').on('change', function() {
var selectedTri = $(this).val();
$articles.sort(function(a, b) {
var priceA = parseInt($(a).data('prix'));
var priceB = parseInt($(b).data('prix'));
if (selectedTri === '0') {
return priceA - priceB; // Tri par prix croissant
} else if (selectedTri === '1') {
return priceB - priceA; // Tri par prix décroissant
}
}).appendTo('.affichage_bons_cadeaux');
});
$('#filtre-tags').on('change', function() {
var selectedTag = $(this).val();
if (selectedTag === 'all') {
$('.article').show(); // Afficher tous les articles
} else {
$('.article').hide(); // Cacher tous les articles
$('.article.' + selectedTag.replace('/', '\\/')).show(); // Afficher les articles avec le tag sélectionné
}
});
});
</script>
{% endblock %}