{% extends 'base.html.twig' %}
{% block title %}Accueil - {{ parent() }}{% endblock %}
{% block body %}
<link rel="stylesheet" href="{{ asset('css/swip.css') }}">
<div id="title_annonce">
<h1 class="text-danger fs-1 fs-lg-6 mt-1">Découvrez les dernières annonces</h1>
<h2 class="text-secondary-emphasis">De votre agence immobilière préférée</h2>
<hr>
</div>
<div id="modals">
{% for property in properties %}
{{ include('modal/show.html.twig', { 'property': property }) }}
{% endfor %}
</div>
<div class="swiper-container swiper mySwiper">
<div class="swiper-button-prev"></div>
<div class="swiper-wrapper">
{% for property in properties %}
<div class="swiper-slide">
{% if property.images|length > 0 %}
<img style="width: 450px; height: 400px; " src="{{ asset('images/properties/' ~ property.images[0].imagename) }}" alt="{{ property.title }}">
{% else %}
<img src="{{ asset ('images/no-image.png') }}" style="" alt="No image available">
{% endif %}
<div class="slide-content">
<h2>{{ property.title }}</h2>
<h5 class="text-danger">{{ property.housingType.name }} - {{ property.category.name }}
{% if property.category.name matches '/location/i' and property.subType is not empty %}
- {{ property.subType.name }}
{% endif %}
</h5>
{% if property.category.name matches '/location/i' and property.subType is not empty %}
<h2 id="price">{{ property.rent|number_format }} €/mois</h2>
{% else %}
<h2 id="price">{{ property.price|number_format }} €</h2>
{% endif %}
</div>
<div class="d-flex">
<div class="d-flex flex-row align-items-center">
<button id="favori-button-{{ property.id }}" class="favori-button" onclick="toggleFavori({{ property.id }})" data-property-id="{{ property.id }}"></button>
<h6 class="fs-6 ml-2 position-relative" id="favori_numb" >{{ property.favoritNumber }}</h6>
</div>
<button id="voir"type="button" class="btn open-modal-btn mt-4 text-white px-4 py-2 rounded" data-toggle="modal" data-target="#exampleModal-{{ property.id }}">Voir</button>
</div>
</div>
{% endfor %}
</div>
<div class="swiper-button-next"></div>
</div>
</div>
<button aria-label="Prendre un Rendez-vous" type="button" data-toggle="tooltip" data-custom-class="custom-tooltip" data-placement="left" title="Prendre un Rendez-vous" class="btn btn-danger position-fixed" style="bottom: 0; right: 0; margin: 2em; z-index: 2; border-radius: 3em; width: 5em; height: 5em;" onclick="window.location='{{ path('app_appointment_new') }}';">
<i class="fa-solid fa-calendar-days" style="font-size: 2em;"></i>
</button>
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip({
delay: { "show": 500, "hide": 100 },
customClass: 'custom-tooltip'
});
});
window.favoriUpdateUrl = '{{ path('app_favori_update') }}';
</script>
<script src="{{asset('js/swiper.js')}}"> </script>
<script src="{{ asset('js/favorit.js') }}"></script>
{% endblock %}