{% extends 'base_front.html.twig' %}
{% block meta %}
<title>Bourg | {% if contentHeader.preTitle is defined %}{{ contentHeader.preTitle }}{% endif %}</title>
{% if contentHeader.title is defined %}
<meta name="description" content="{% if contentHeader.preTitle is defined %}{{ contentHeader.preTitle ~ ' | ' }}{% endif %}{{ contentHeader.title|striptags }}">
{% endif %}
{% endblock %}
{% block body %}
<section class="slide-header list">
<div class="main-slide">
<div class="img-main-slide position-relative" style="background:url({{ asset(constant('App\\Services\\UploadFileService::POST_IMAGE_DIR') ~ slider.image1) }})no-repeat center;background-size:cover;" id="mainImg">
<div class="title-page bg-blue d-flex gold justify-content-end position-absolute">
<!--img src="{{ asset('img/icons/chevrons-right.svg') }}" alt="chevrons droite"-->
<span class="ml-3">{{ contentHeader.preTitle|capitalize }}</span>
</div>
</div>
</div>
{% set titleSplited = contentHeader.title|split(' ') %}
<div class="slides-title page d-flex align-items-center justify-content-end col-md-11 p-0 float-right position-relative">
<h1 class="title-left-right mr-5">
{% if titleSplited|length > 1 %}
<span>{{ titleSplited.0 }} {{ titleSplited.1 }}</span><br>
<span class="gold">
{% for word in titleSplited|slice(2) %}
{{ ' ' ~ word }}
{% endfor %}
</span>
{% else %}
<span>{{ contentHeader.title }}</span>
{% endif %}
{% if app.user %}
<a href="{{ path('back_content_edit', {'id': contentHeader.id}) }}"><i class="fas fa-pencil-alt" style="color:red"></i></a>
{% endif %}
</h1>
<a href="#" class="position-absolute arrow-slide-single" id="arrowSlideMove" onclick="javascript: return false;">
<img src="{{ asset('img/icons/arrow-right.svg') }}">
</a>
<div class="slide-miniatures d-flex align-self-baseline" id="containerMiniatures">
{% if slider.image2 %}
<div class="slide position-relative float-left">
<img src="{{ asset(constant('App\\Services\\UploadFileService::POST_IMAGE_DIR') ~ slider.image2) }}">
</div>
{% endif %}
{% if slider.image3 %}
<div class="slide position-relative float-left">
<img src="{{ asset(constant('App\\Services\\UploadFileService::POST_IMAGE_DIR') ~ slider.image3) }}">
</div>
{% endif %}
{% if slider.image4 %}
<div class="slide position-relative float-left">
<img src="{{ asset(constant('App\\Services\\UploadFileService::POST_IMAGE_DIR') ~ slider.image4) }}">
</div>
{% endif %}
</div>
</div>
<a href="#targetSeeMore" class="btn-see-more position-absolute d-flex flex-column align-items-center gold text-center">
<span>En savoir plus</span>
<img src="{{ asset('img/icons/arrow-bottom-gold.svg') }}" alt="En savoir plus" class="mb-2">
</a>
</section>
<section class="form-filter" id="targetSeeMore">
<div class="container">
<div class="title-page bg-blue d-flex gold pl-0">
<!--img src="{{ asset('img/icons/chevrons-right.svg') }}" alt="chevrons droite"-->
<span class="ml-3">Vos critères</span>
</div>
<form class="mt-3" id="formFilter">
<input name="advert-type" id="advertTypeFilter" type="hidden" value="{{ type }}">
<div class="row">
<div class="col-md-2">
<select class="w-100" name="type">
<option value="">Type</option>
<option value="Maison">Maison</option>
<option value="Appartement">Appartement</option>
<option value="Commerce">Commerce</option>
<option value="Garage">Garage</option>
<option value="Parking">Parking</option>
<option value="Terrain">Terrain</option>
</select>
</div>
<div class="col-md-2">
<select class="w-100" name="rent">
<option value="">Vente / Location</option>
<option value="vente" {% if type == 'vente' %}selected{% endif %}>Vente</option>
<option value="location" {% if type == 'location' %}selected{% endif %}>Location</option>
</select>
</div>
<div class="col-md-2">
<select class="w-100" name="location">
<option value="">Localisation</option>
{% for city in advertCities %}
<option value="{{ city }}">{{ city }}</option>
{% endfor %}
</select>
</div>
<div class="col-md-2">
{% if type == 'vente' %}
<select class="w-100" name="max_price">
<option value="">Budget Max.</option>
<option value="500000">500 000€</option>
<option value="600000">600 000€</option>
<option value="700000">700 000€</option>
<option value="800000">800 000€</option>
<option value="900000">900 000€</option>
<option value="1000000">1 000 000€</option>
<option value="1500000">1 500 000€</option>
<option value="2000000">2 000 000€</option>
</select>
{% else %}
<select class="w-100" name="max_price">
<option value="">Budget Max.</option>
<option value="600">300€</option>
<option value="400">400€</option>
<option value="500">500€</option>
<option value="600">600€</option>
<option value="700">700€</option>
<option value="800">800€</option>
<option value="900">900€</option>
<option value="1000">1000€</option>
<option value="1500">1 500€</option>
<option value="2000">2 000€</option>
<option value="2500">2 500€</option>
</select>
{% endif %}
</div>
<div class="col-md-2">
<select class="w-100" name="min_room">
<option value="">Chambres(s) min.</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
</div>
</form>
</div>
</section>
<section class="result-properties">
<div class="container">
<div class="text-center mt-5 mb-5">
<h3 class="gold">{{ contentHeader.preTitle|capitalize }}</h3>
<h2 class="gold" id="nbAdvertResult"><span class="gold">{{ countAdverts }}</span> {% if countAdverts > 1 %}annonces trouvées{% else %}annonce trouvée{% endif %}</h2>
</div>
<div class="position-relative col-md-12">
<div id="loader" class="ml-3"></div>
</div>
<ul class="pl-0" id="containerAdvertList">
{% for advert in adverts %}
<li class="col-12 col-md-12 position-relative slide-1 slide-single h-100 p-0 {% if not loop.first %}mt-5{% endif %}">
<div class="d-flex h-100 link-slide-1">
<div class="col-md-6 img-slide img-slide-1 position-relative">
{% for photo in advert.photos %}
<img src="{{ photo.url }}" alt="{{ advert.info.nature}} • {{ advert.info.surface }}m²" onclick="location.href='{{ path('front_property_single', {'id': advert.info.id, 'type': real_estate.toSlug(advert.info.nature), 'city': real_estate.toSlug(advert.localisation.ville)}) }}';" loading="lazy">
{% endfor %}
</div>
<div class="col-md-6 bg-red gold p-5 d-flex flex-column justify-content-center position-relative info-slide info-slide-1" onclick="location.href='{{ path('front_property_single', {'id': advert.info.id, 'type': real_estate.toSlug(advert.info.nature), 'city': real_estate.toSlug(advert.localisation.ville)}) }}';">
<div class="title-page bg-blue d-flex gold pl-0 pt-0">
<!--img src="{{ asset('img/icons/chevrons-right.svg') }}" alt="chevrons droite"-->
<span>{{ advert.info.nature}} {% if advert.info.surface %}• {{ advert.info.surface }}m²{% endif %}</span>
</div>
<h1 class="mb-3">{{ advert.localisation.ville }}</h1>
{% set price = advert.prix.budget|number_format(0, ' ', ' ') %}
<h4>
{% if advert.info.vente_location == 'location' %}
{{ price }}€<sup>/mois</sup>
{% else %}
{{ price }}€
{% endif %}
</h4>
{% if advert.info.disponibilite %}
{% if advert.info.disponibilite == 'immédiate' %}
<p>Disponibilité {{ advert.info.disponibilite }}</p>
{% else %}
<p>Disponible à p. d. {{ advert.info.disponibilite }}</p>
{% endif %}
{% endif %}
{% set parkingOuvert = advert.parking.parking_ouvert ?? 0 %}
{% set parkingsouterrain = advert.parking.parkin_souterrain ?? 0 %}
{% set parkingCollectif = advert.parking.collectif ?? 0 %}
{% set parkings = parkingOuvert + parkingsouterrain + parkingCollectif %}
<div class="description pt-3 pb-5">
{% if advert.info.surface and advert.info.surface > 0 %}
<p>
<img src="{{ asset('img/icons/surface.svg') }}" class="mr-3" loading="lazy">
<span class="gold">{{ advert.info.surface }} m²</span>
<span class="gold">surface d’habitation</span>
</p>
{% endif %}
{% if advert.info.nombre_chambres and advert.info.nombre_chambres > 0 %}
<p>
<img src="{{ asset('img/icons/chambres.svg') }}" class="mr-3" loading="lazy">
<span class="gold">{{ advert.info.nombre_chambres }}</span>
<span class="gold">chambre{% if advert.info.nombre_chambres > 1 %}s{% endif%} à coucher</span>
</p>
{% endif %}
{% if advert.pieces.salles_de_bain and advert.pieces.salles_de_bain > 0 %}
<p>
<img src="{{ asset('img/icons/salles-bain.svg') }}" class="mr-3" loading="lazy">
<span class="gold">{{ advert.pieces.salles_de_bain }}</span>
<span class="gold">salle{% if advert.pieces.salles_de_bain > 1%}s{% endif%} de bain</span>
</p>
{% endif %}
{% if advert.parking.garages and advert.parking.garages > 0 %}
<p>
<img src="{{ asset('img/icons/garage.svg') }}" class="mr-3" loading="lazy">
<span class="gold">{{ advert.parking.garages }}</span>
<span class="gold">garage{% if advert.parking.garages > 1 %}s{% endif %}</span>
</p>
{% endif %}
{% if parkings > 0 %}
<p>
<img src="{{ asset('img/icons/parking.svg') }}" class="mr-3" loading="lazy">
<span class="gold">{{ parkings }}</span>
<span class="gold">parking extérieur</span>
</p>
{% endif %}
</div>
<a href="{{ path('front_property_single', {'id': advert.info.id, 'type': real_estate.toSlug(advert.info.nature), 'city': real_estate.toSlug(advert.localisation.ville)}) }}" class="btn-gold bg-gold gold">Plus</a>
<!--img src="{{ asset('img/icons/chevrons-left.svg') }}" class="chevrons-left position-absolute"-->
</div>
</div>
</li>
{% endfor %}
</ul>
</div>
</section>
{% endblock %}
{% block javascript %}
<script>
$(document).ready(function(){
$('.img-slide').slick({
'prevArrow': '<button class="slick-prev slick-arrow" aria-label="Previous" type="button" style=""><i class="fas fa-arrow-left fa-2x"></i></button>',
'nextArrow': '<button class="slick-next slick-arrow" aria-label="Next" type="button" style=""><i class="fas fa-arrow-right fa-2x"></i></button>',
});
});
</script>
{% endblock %}