{% extends 'base.html.twig' %}
{% block title %} Détail de la propriété : {{ property.title }} {% endblock %}
{% block body %}
<div class="text-right mr-5">
<h3 style="color:red;">Partager</h3>
<div class="text-right" style="display:flex; flex-direction:row; margin-bottom:2em; justify-content: flex-end;">
<button class="btn btn-light mr-2 text-primary" style="width:2em; height:2em;display:flex;flex-direction: column; align-items: center;" aria-label="Partager sur Facebook" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=https://coupdcoeurimmo.fr/properties/{{ property.id }}', 'facebook-share-dialog', 'width=626,height=626'); return false;">
<i class="fab fa-facebook" style="font-size: 1.5em; color:#4267B2"></i>
</button>
<button class="btn btn-light mr-2 text-primary" style="width:2em; height:2em;display:flex;flex-direction: column; align-items: center; " aria-label="Partager sur Twitter" onclick="window.open('https://twitter.com/share?url=https://coupdcoeurimmo.fr/properties/{{ property.id }}', 'twitter-share-dialog', 'width=626,height=626'); return false;">
<i class="fab fa-twitter" style="font-size: 1.5em; color:#1DA1F2;"></i>
</button>
</div>
<a href="{{ path('app_pdf_generate', {'id': property.id}) }}" target="_blank" class="btn btn-dark mr-2" style=";margin-left: 2rem">Générer une fiche PDF</a>
{% if property.category.name matches '/location/i' %}
<a href="{{ path('app_rental_application_new', {'id': property.id}) }}" class="btn btn-dark" >Soumettre un dossier pour cette location</a>
{% else %}
<a href="{{ path('app_home_interest_new', {'id': property.id}) }}" class="btn btn-dark" >Remplir la fiche d'intérêt</a>
{% endif %}
</div>
<div class="container">
<h1 class="text-center my-5">{{ property.title }}</h1>
<div class="row">
<div class="col-md-8">
{# Image principale avec changement via JavaScript #}
<div id="mainImageContainer" class="d-flex justify-content-center align-items-center" style="height: 500px; background-color: #ffffff;">
{% if property.images is not empty %}
<img id="mainImage" src="{{ asset('images/properties/' ~ property.images[0].imagename) }}" class="img-fluid" alt="Image principale" style="height: -webkit-fill-available;" >
{% endif %}
</div>
</div>
<div class="col-md-4">
{# Galerie des miniatures d'images #}
<div class="row mt-3" id="thumbnailGallery">
{% for image in property.images %}
<div class="col-4 mb-3">
<img src="{{ asset('images/properties/' ~ image.imagename) }}" alt="Image {{ loop.index }}" class="img-thumbnail smallImage" style="height: 70px;">
</div>
{% endfor %}
</div>
</div>
</div>
<hr class="text-danger bg-danger w-75 ">
<div class="row mt-5">
<div class=" col d-flex flex-row">
<i class="fa-solid fa-user mr-2 mt-1 text-secondary "></i>
<div class="">
<h5 class="text-secondary" >Propriétaire </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold"> {{ property.user.name }}</h4>
</div>
</div>
<div class=" col d-flex flex-row">
<i class="fa-solid fa-bed-front mr-2 mt-1 text-secondary "></i>
<div class="">
<h5 class="text-secondary" ><i class="fa-solid fa-bed"></i> Nombre de pièces </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold"> {{ property.roomNumber }}</h4>
</div>
</div>
<div class=" col d-flex flex-row ">
<i class="fa-solid fa-euro-sign mr-2 mt-1 text-secondary"></i>
<div class="">
<h5 class="text-secondary" >Loyer </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold"> {{ property.rent|number_format }} €</h4>
</div>
</div>
</div>
<div class="row mt-3">
<div class=" col d-flex flex-row">
<i class="fa-solid fa-euro-sign mr-2 mt-1 text-secondary"></i>
<div class="">
<h5 class="text-secondary" >Prix </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold">{{ property.price|number_format }} €</h4>
</div>
</div>
<div class=" col d-flex flex-row">
<i class="fa-solid fa-tree mr-2 mt-1 text-secondary"></i>
<div class="">
<h5 class="text-secondary" >Ce bien dispose d'un jardin </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold"> {{ property.garden ? 'Oui' : 'Non' }}</h4>
</div>
</div>
<div class=" col d-flex flex-row">
<i class="fa-solid fa-building mr-2 mt-1 text-secondary "></i>
<div class="">
<h5 class="text-secondary" >Type du logement </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold"> {{ property.housingType == 'house' ? "Maison" : "Appartement" }}</h4>
</div>
</div>
</div>
<div class="row mt-3">
<div class=" col d-flex flex-row">
<i class="fa-solid fa-money-bill-transfer mr-2 mt-1 text-secondary "></i>
<div class="">
<h5 class="text-secondary" >Type de transaction </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold"> {{ property.category.name }}</h4>
</div>
</div>
<div class=" col d-flex flex-row">
<i class="fa-solid fa-calendar-days mr-2 mt-1 text-secondary"></i>
<div class="">
<h5 class="text-secondary" >Date de publication </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold"> {{ property.createdAt|date('d/m/Y') }}</h4>
</div>
</div>
<div class=" col d-flex flex-row">
<i class="fa-solid fa-location-dot mr-2 mt-1 text-secondary "></i>
<div class="">
<h5 class="text-secondary" >Ville </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold">{{ property.address.city }}</h4>
</div>
</div>
</div>
<div class="row mt-3">
<div class=" col d-flex flex-row">
<i class="fa-solid fa-temperature-arrow-up mr-2 mt-1 text-secondary "></i>
<div class="">
<h5 class="text-secondary">Chauffage</h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold">{{ property.heating }}</h4>
</div>
</div>
<div class=" col d-flex flex-row">
<i class="fa-solid fa-calendar-days mr-2 mt-1 text-secondary "></i>
<div class="">
<h5 class="text-secondary"> Année de construction </h5>
<h4 class="text-danger p-2 fs-3 text-white font-weight-bold"> {{ property.yearBuilt|date('Y') }}</h4>
</div>
</div>
<div class="col">
</div>
</div>
<div class="card mt-4 mb-5">
<div class="card-body mb-4">
<h4 class="card-title mb-4">Description</h4>
<p class="card-text fs-3">{{ property.content|raw }}</p>
</div>
</div>
</div>
<!-- Scripts spécifiques à la page Property Show -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
var $jq = jQuery.noConflict();
</script>
<script>
$jq(document).ready(function() {
// Script pour changer l'image principale au clic sur une miniature
$jq('.smallImage').click(function() {
var newSrc = $jq(this).attr('src');
$jq('#mainImage').attr('src', newSrc);
});
});
</script>
{% endblock %}