{# En-tête pleine largeur : fil d'Ariane, nom + étoiles, adresse, partage, TripAdvisor #}
<nav class="hd-crumb" aria-label="breadcrumb">
<a href="{{ path('app_main') }}">{{ 'Pages.HotelDetail.Home'|trans({}, 'messages_front') }}</a>
{% if hotel_data.country is not empty %}<span aria-hidden="true">›</span><span>{{ hotel_data.country }}</span>{% endif %}
{% if hotel_data.city is not empty %}<span aria-hidden="true">›</span><span>{{ hotel_data.city }}</span>{% endif %}
<span aria-hidden="true">›</span><span aria-current="page">{{ hotel_data.name }}</span>
</nav>
<header class="hd-top">
<div class="hd-top-main">
<h1 class="hd-title">
{{ hotel_data.name }}
{# Note 1 à 7 (les sources HUB peuvent renvoyer « 4* ») ; 0 ou vide → pas d'étoiles #}
{% set stars = hotel_data.starRating|default('')|replace({'*': ''})|trim %}
{% if stars matches '/^[1-7]$/' %}
<span class="hd-stars" aria-label="{{ stars }} {{ 'Pages.HotelOfferDetail.Messages.Stars'|trans({}, 'messages_front') }}">
{% for i in 1..stars %}<i class="fas fa-star" aria-hidden="true"></i>{% endfor %}
</span>
{% endif %}
</h1>
<div class="hd-loc">
{% if hotel_address is not empty %}
<span><i class="fas fa-map-marker-alt" aria-hidden="true"></i>{{ hotel_address }}</span>
{% endif %}
<a href="#hotel-location"><i class="bi bi-map" aria-hidden="true"></i>{{ 'Pages.HotelDetail.SeeOnMap'|trans({}, 'messages_front') }}</a>
{% if hotel_data.tripadvisorId is defined and hotel_data.tripadvisorId %}
<span class="hd-tripadvisor" id="tripInfos"></span>
{% endif %}
</div>
</div>
<div class="dropdown hd-share">
<button class="hd-btn-ghost" type="button" data-bs-toggle="dropdown" aria-expanded="false"
aria-label="{{ 'Pages.HotelOfferDetail.Messages.Share'|trans({}, 'messages_front') }}">
<i class="bi bi-share" aria-hidden="true"></i>
<span class="hd-share-label">{{ 'Pages.HotelDetail.Share'|trans({}, 'messages_front') }}</span>
</button>
<div class="dropdown-menu dropdown-menu-end hd-share-menu">
{{ include('front/social-media/index.html.twig') }}
</div>
</div>
</header>
{% if hotel_data.tripadvisorId is defined and hotel_data.tripadvisorId %}
{# Note TripAdvisor : appel conservé tel quel, seul l'emplacement d'affichage change #}
<script>
$(document).ready(function () {
function publishTripadvisor(data) {
var htmlview = '<img alt="' + data.rating + ' étoiles" src="' + data.rating_image_url + '"/> ' +
'<a href="' + data.web_url + '" target="_blank" rel="noopener">' + data.num_reviews + ' Reviews on TripAdvisor</a>';
$("#tripInfos").html(htmlview);
}
$.ajax({
url: 'https://api.tripadvisor.com/api/partner/2.0/location/{{ hotel_data.tripadvisorId }}?key=c1603974aae14de9b91f3156bc107e6c',
type: "POST",
dataType: "json",
success: publishTripadvisor,
error: function (xhr) {
console.log("TripAdvisor error " + xhr.status);
},
});
});
</script>
{% endif %}