{% extends 'base_front.html.twig' %}
{% block meta %}
<title>Les resultats</title>
<meta name="description" content="Les produits disponibles. Actuellement, {{ countProducts }} produits disponibles.">
{% endblock %}
{% block style %}
<link rel="stylesheet" href="{{ asset('css/styleFiltreHebergement.css') }}">
<link rel="stylesheet" href="{{ asset('css/front/promo.css') }}">
{% endblock %}
{% block body %}
<div class="page-header heor-section-style mine" style="
height: 100%;
{% if categoryBackground is defined and categoryBackground is not null and categoryBackground.image is not null %}
background: url({{ asset(constant('App\\Services\\File::IMAGE_CATEGORY_DIR') ~ categoryBackground.image) }})
{% else %}
background: url({{ asset('images/vacance_background.jpg') }})
{% endif %}
no-repeat center;background-size: cover">
<div class="container">
<div
class="row">
<!-- page caption -->
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 ">
<div class="page-caption">
<h1 class="page-title">Resultat</h1>
</div>
</div>
<!-- /.page caption -->
</div>
</div>
<!-- page caption -->
<div class="page-breadcrumb">
<div class="container">
<div class="row">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{{ path('front_home') }}" class="breadcrumb-link">Accueil</a>
</li>
<li class="breadcrumb-item active text-white" aria-current="page">Recherche :
{% if app.session.get('categoryName') %}
{{ app.session.get('categoryName') }}
{% endif %}
{% if app.session.get('departmentName') %}-
{{ app.session.get('departmentName') }}
{% endif %}
{% if app.session.get('weddingdate') %}-
{{ app.session.get('weddingdate') }}
{% endif %}
{% if app.session.get('weddingdate_start') and app.session.get('weddingdate_end') %}
- {{ app.session.get('weddingdate_start') }} - {{ app.session.get('weddingdate_end') }}
{% endif %}
</li>
</ol>
</nav>
</div>
</div>
</div>
<!-- page breadcrumb -->
</div>
<!-- /.page-header -->
{% if isPromoAdmin %}
<div class="bannier-promo mt-5">
<div class="cont">
Promotion
<span class="percent">{{ isPromoAdmin.value }}%</span>
{# <svg class="outlined-text" width="80%" height="200" viewBox="0 0 800 200" preserveAspectRatio="xMidYMid meet">
<text x="50" y="140">-20%</text>
</svg> #}
de commission en cours jusqu'au <span class="date-fin-prom">{{ isPromoAdmin.endAt|format_date('long', locale='fr') }}</span>
pour tous les serveices
</div>
</div>
{% endif %}
<!-- vendor-section -->
<div class="content">
<div class="container">
<div class="row">
<div class="col-xl-8 col-lg-8 col-md-7 col-sm-12 col-12">
{% for message in app.flashes('success') %}
<div class="alert alert-success">
{{ message }}
</div>
{% endfor %}
<div id="allProduct" class="row">
{% if products|length > 0 %}
{# <div class="col-12">
<button type="button" class="btn btn-primary mb-2" data-toggle="modal" data-target="#modalFilter">Filter</button>
</div> #}
{% for product in products %}
{% set subCategorySlug = product.subCategories.toArray()[0].subCategorySlug %}
<div class="col-lg-6 col-sm-12 col-12">
<div class="container-block-Pcompanies mb-3">
{# <div class="container-imageP zoomimg"> #}
<div class="container-slide-image">
{% if product.photos.first != false %}
{% for imgHebmt in product.photos.toArray() %}
<img src="{{ asset(constant('App\\Services\\File::IMAGE_PRODUCT_DIR') ~ imgHebmt.url) }}" alt="default image" class="img-fluid" style="height: 213px;object-fit: cover; border-radius: .5rem .5rem 0 0;">
{% endfor %}
{% else %}
<img src="{{ asset('images/vecteezy_vector-gear-logo-design-with-multi-colors-range_6172776.jpg') }}" alt="default image" class="img-fluid" style="height: 213px;object-fit: cover; border-radius: .5rem .5rem 0 0;">
{% endif %}
</div>
<div class="container-info-presta" style="padding-bottom: 80px;">
<h2 class="vendor-title">
{# <a href="{{ path('front_product_single', {'slug': product.subCategories[0].categories[0].slug, 'subCategorySlug': product.subCategories[0].subCategorySlug, 'product_id': product.id, 'productSlug': product.productSlug}) }}" class="title">{{ product.name }}</a> #}
{% set subCategory = product.subCategories.toArray()[0] %}
{# <pre>
{{ dump(subCategory.categories.toArray[0].slug) }}
</pre> #}
{% set slug = "" %}
{% if product.typeActivity is not null %}
{% set slug = product.typeActivity.slug %}
{% elseif product.typeHebergements is not null %}
{% set slug = product.typeHebergements.slugTypeHebergm %}
{% else %}
{% set slug = subCategory.categories.toArray[0].slug %}
{% endif %}
<a href="{{ path('front_product_single', {
'slug': slug,
'subCategorySlug': subCategory.subCategorySlug,
'product_id': product.id,
'productSlug': product.productSlug
}) }}" class="title">{{ product.name }}</a>
</h2>
<p class="vendor-address">
{% for department in product.departments %}
{{ department.name }}
{% if not loop.last %},
{% endif %}
{% else %}
Toute la France
{% endfor %}
</p>
<p>
{% if product.typeHebergements is null or product.typeHebergements.slugTypeHebergm != 'hotel' %}
<i class="fas fa-money-bill-wave"></i>
Prix :
{% set today = "now"|date('Y-m-d') %}
{% set customPriceFound = false %}
{% set customPrice = 0 %}
{% set currentPrice = 0 %}
{% set price = 0 %}
{% set difference = null %}
{% set reductionPercentage = 0 %}
{% set duration = null %}
{% set countdown = null %}
{% set reductionValid = false %}
{% for dayPrice in product.dayPrice %}
{% set formattedDate = dayPrice.customDate|date('Y-m-d') %}
{% if formattedDate == today %}
{% set customPriceFound = true %}
{% set customPrice = dayPrice.customPrice|number_format(2, '.') %}
{% endif %}
{% endfor %}
{% set month = "now"|date('n') %}
{% if month >= 3 and month <= 5 %}
{% set springPrice = product.springPrice %}
{% if springPrice is not null %}
{% set currentPrice = product.springPrice %}
{% else %}
{% set currentPrice = 0 %}
{% endif %}
{% elseif month >= 6 and month <= 8 %}
{% set summerPrice = product.summerPrice %}
{% if summerPrice is not null %}
{% set currentPrice = product.summerPrice %}
{% else %}
{% set currentPrice = 0 %}
{% endif %}
{% elseif month >= 9 and month <= 11 %}
{% set autumnPrice = product.autumnPrice %}
{% if autumnPrice is not null %}
{% set currentPrice = product.autumnPrice %}
{% else %}
{% set currentPrice = 0 %}
{% endif %}
{% else %}
{% set winterPrice = product.winterPrice %}
{% if winterPrice is not null %}
{% set currentPrice = product.winterPrice %}
{% else %}
{% set currentPrice = 0 %}
{% endif %}
{% endif %}
{% set day = "now"|date('N') %}
{% if day == 6 or day == 7 %}
{% set weekEndPrice = product.weekEndPrice %}
{% if weekEndPrice is not null %}
{% set currentPrice = product.weekEndPrice %}
{% else %}
{% set currentPrice = 0 %}
{% endif %}
{% endif %}
{% set periodPrice = 0 %}
{% for period in product.periodPrice.toArray() %}
{% set startDate = period.startDate|date("Y-m-d") %}
{% set endDate = period.endDate|date("Y-m-d") %}
{% if today >= startDate and today <= endDate and period.price is not null %}
{% set periodPrice = period.price %}
{% else %}
{% set currentPrice = 0 %}
{% endif %}
{% endfor %}
{% if periodPrice != 0 %}
{% set currentPrice = periodPrice %}
{% endif %}
{% if customPriceFound and customPrice != 0%}
{% set price = customPrice %}
{% elseif currentPrice != 0 and currentPrice is not null and customPrice == 0 %}
{% set price = currentPrice %}
{% elseif currentPrice == 0 or currentPrice is null and customPrice == 0 %}
{% set price = product.price %}
{% endif %}
{% for autoReduce in product.productAutoReduction.toArray %}
{% if autoReduce.createdAt is not null and autoReduce.countdown is not null and autoReduce.duration is not null and autoReduce.reductionPercentage is not null %}
{% set difference = date(today).diff(autoReduce.createdAt).days %}
{% set duration = autoReduce.duration %}
{% set countdown = autoReduce.countdown %}
{% set reductionPercentage = autoReduce.reductionPercentage %}
{% set durationout = duration + countdown %}
{# {{ dump(countdown,difference,durationout,duration) }} #}
{% set reductionValid = difference > countdown and difference <= durationout %}
{% endif %}
{% endfor %}
{# {{ dump(reductionValid) }} #}
{% if product.company.type != "service" %}
<span class="vendor-price">
{{ product.price|number_format(2, '.', '') }}€
</span>
{% elseif reductionValid %}
{% set priceReduced = price - ((price * reductionPercentage) / 100) %}
<strong>{{ priceReduced|number_format(2, '.') }}</strong>€
{% else %}
<strong>{{ price|number_format(2, '.') }}</strong>€
{% endif %}
{% else %}
{% set lengthRoomNight = 0 %}
{% set statusByNight = false %}
{% set allPriceByNight = 0 %}
{% set lengthRoomDay = 0 %}
{% set statusByDay = false %}
{% set allPriceByDay = 0 %}
{% if product.chambres is defined %}
{% for roomOption in product.chambres.toArray %}
{% if roomOption.tarifNuit is defined %}
{% set lengthRoomNight = lengthRoomNight + 1 %}
{% set statusByNight = true %}
{% set allPriceByNight = allPriceByNight + roomOption.tarifNuit %}
{% endif %}
{% if roomOption.tarifJour is not null %}
{% set lengthRoomDay = lengthRoomDay + 1 %}
{% set statusByDay = true %}
{% set allPriceByDay = allPriceByDay + roomOption.tarifJour %}
{% endif %}
{% endfor %}
{% if statusByDay or statusByNight %}
<p>Prix moyen d'une chambre:</p>
{% endif %}
{% if statusByNight %}
<p>
<i class="fas fa-money-bill-wave"></i>
par nuit
<strong>{{ (allPriceByNight / lengthRoomNight)|number_format(2, '.') }}</strong>€
</p>
{% endif %}
{% if statusByDay %}
{# <p>
<i class="fas fa-money-bill-wave"></i>
par jour
<strong>{{ (allPriceByDay / lengthRoomDay)|number_format(2, '.') }}</strong>€
</p> #}
{% endif %}
{% endif %}
{% if not statusByNight and not statusByDay %}
<p>
Prix : <strong>Prix en attente</strong>
</p>
{% endif %}
{# <i class="fas fa-money-bill-wave"></i>
Prix :
<strong>{{ product.price|number_format(2, '.') }}</strong>€ #}
{% endif %}
</p>
<p>
<i class="fa fa-star rated"></i>
{% set notes = 0 %}
{% for avi in product.avis %}
{% set notes = notes + avi.globalNote %}
{% endfor %}
{% set noteTotal = (notes > 0) ? notes / product.avis|length : 0 %}
{{ product.avis|length }} Avis</p>
<p>{{ product.quantity }}
Quantité restante</p>
</div>
<div class="wishlist-sign">
<a href="#" class="btn-wishlist">
<i class="fa fa-heart"></i>
</a>
</div>
{% if product.subCategories[0].categories[0] is defined %}
<a href="{{ path('front_product_single', {
'slug': slug,
'subCategorySlug': product.subCategories[0].subCategorySlug,
'product_id': product.id,
'productSlug': product.productSlug
}) }}" class="title">
<button class="btnVoirP btn">Voir {% if subCategorySlug == "hebergements"%}l'hébergement{% else %}plus{% endif %}
</button>
</a>
{% endif %}
</div>
</div>
{% endfor %}
{% else %}
<div class="col-12">
<button type="button" class="btn btn-primary mb-2" data-toggle="modal" data-target="#modalFilter">Filter</button>
</div>
<div class="vendor-thumbnail list-view p-4">Aucun service correspondant</div>
{% endif %}
</div>
<div class="pagination">
<nav aria-label="Page navigation example">
{{ knp_pagination_render(products) }}
</nav>
</div>
<!-- /.paginations -->
</div>
<!-- sidebar-section -->
{{ include('front/inc/filter_sidebar.html.twig') }}
<!-- /.sidebar-section -->
</div>
</div>
</div>
{% endblock %}
{% block javascript %}
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/gh/maxshuty/accessible-web-components@latest/dist/simpleRange.min.js">
</script>
<script src="{{ asset('js/jsForHebergementFilter.js') }}"></script>
<script src="{{ asset('js/getCommune.js') }}"></script>
{% endblock %}