{% extends 'base.html.twig' %} {% block titre %} {{annonce.titre}} {% endblock %} {% block stylesheet %} {% endblock %} {% block body %}



{% set delete_annonce = path('app_annonce_delete', {'slug':annonce.slug}) %}
{# Dans votre template Twig #} {% for flashMessage in app.flashes('error') %}
{{ flashMessage }}
{% endfor %} {% for flashMessage in app.flashes('success') %}
{{ flashMessage }}
{% endfor %}

{{annonce.titre}}

{{annonce.introduction}}

{{annonce.rooms}} chambres pour {{annonce.price | number_format(2, ',', ' ')}}DZD par nuit

{% if app.user != annonce.host.user%} Réserver ! {% endif %} {% if app.user and app.user == annonce.host.user %} Modifier l'annonce Supprimer l'annonce {% endif %}

Ajouter annonce aux liste des favorites

{% if is_granted('IS_AUTHENTICATED_FULLY') %} {% set isFavorite = false %} {% set break = false %} {% if app.user.favorites is not empty %} {% for favorite in app.user.favorites %} {% if favorite.annonce == annonce and favorite.etat == 1 %} {% set isFavorite = true %} {# Si l'annonce est déjà dans les favoris avec un état actif, sortir de la boucle #} {% set break = true %} {% endif %} {% endfor %} {% endif %} {% if isFavorite is not defined %} {% endif %} {% if not isFavorite %} {% else %}

Cette annonce est déjà dans vos favoris.

{% endif %} {% else %} Veuillez vous connecter pour ajouter cette annonce à vos favoris. {% endif %}

{{ annonce.description | raw }}


{% if annonce.avis|length > 0 %}

Commentaires de nos voyageurs :

Note globale donnée par nos clients
{% include 'includes/rating.html.twig' with {'rating': annonce.avgRatings} %}
(Calculée sur {{ annonce.avis|length }} avis)

{% for comment in annonce.avis %}
{{ comment.user.nom }} a dit :
{{comment.commentaire}}
Note donnée : {% include 'includes/rating.html.twig' with {'rating': comment.rating} %}
{% endfor %} {% else %}

Cette annonce n'a pas encore de commentaires,
soyez le premier !

{% endif %} {#

Commentaire(s)

{% if app.user %}
{{ form_start(form) }} {{ form_label(form.commentaire, 'Nouveau commentaire', {'attr' : {'class' : 'form-label inline-block mb-2 text-gray-700'}}) }} {{ form_widget(form.commentaire, {'attr': {'class': 'form-control block w-full px-3 py-1.5 text-base font-normal text-gray-700 bg-white bg-clip-padding border border-solid border-gray-300 rounded transition ease-in-out m-0 focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none'}}) }}
{% set ratingField = form_row(form.rating) %} {{form_label(form.rating)}}
{% for choice in form.rating.vars.choices %} {% endfor %}
{{ form_end(form) }}
{% endif %}
{% for comment in annonce.avis %} {% include 'includes/_comment.html.twig' %} {% endfor %}
#}
{% set a = annonce.host %}
{% endblock %} {% block javascripts %} {% endblock %}