{% extends 'front/base_front.html.twig' %}
{% block title %}{{ 'Pages.Party.Title'|trans({} , 'messages_front') }}{% endblock %}
{% block container %}
<section id="explore_area" class="section_padding">
<div class="container" >
<div class="row">
{% for party in parties %}
{% set hotel = party.hotelStayRequired == 1 ? party.hotelContract.hotel : "" %}
{% set city = party.hotelStayRequired == 1 ? hotel.city : party.city %}
{% set cityName =city|replace({' ': '-'}) %}
{% set currency = party.provider.currency %}
<div class="col-lg-3 col-md-6 col-sm-6 col-12">
<div class="theme_common_box_two img_hover">
<div class="theme_two_box_img">
{% set primary_image = null %}
{% for image in party.images %}
{% if image.displayOrder == 1 %}
{% set primary_image = image %}
{% endif %}
{% endfor %}
<img class="img-party" loading="lazy"
src="{{ absolute_url(primary_image.url |default( asset('front/assets/img/tab-img/hotel1.png'))) }}"
alt="{{ party.title }}">
<p><i class="fas fa-map-marker-alt"></i>{{ city }}
, {{ city is not null ? city.country : '' }}</p>
{% if (party.hotelStayRequired == 1) %}
<div class="ribbon-party">
Séjour <br> obligatoire
</div>
{% endif %}
</div>
<div class="theme_two_box_content">
<a href="{{ path('app_front_party_detail' , {
id : party.id,
partyName:party.title|replace({' ': '-'}),
city:cityName,
hotelName: hotel is not empty? hotel.name|trim |replace({' ': '-'}) : party.address|trim |replace({' ': '-'})
}) }}" target="_blank">
<h4>
{{ party.title }}
</h4>
<p class="text-nowrap">
{% if party.address is not empty %}
<i class="fas fa-map"></i> {{ party.address }}
{% endif %}
{% if hotel is not empty %}
<i class="fas fa-map"></i> {{ hotel }}
{% endif %}
</p>
</a>
<p class=p-date-party>
<span class="date-party"> <i class="bi bi-calendar3"></i> {{ party.date|date('d/m/Y') }}</span>
{% if hotel is not empty %}
<span class="star-hotel-party">
{% for _ in 0 .. hotel.starRating %}
<i class="fas fa-star color_theme"></i>
{% endfor %}
</span>
{% endif %}
</p>
<h3>
<span>Price starts from</span>
{{ party.productElements|reduce( (lowest , partyZone) => min(lowest ??
partyZone.adultSalePrice , partyZone.adultSalePrice )) }}<sup>{{ currency }}</sup>
</h3>
</div>
</div>
</div>
{% else %}
<div>
{{ "Entities.Common.Alerts.InfoNoDataTable"|trans }}
</div>
{% endfor %}
</div>
</div>
</section>
<script>
window.onload = function() {
onloadEvent();
}
var arrayParty = [];
function saveParty(idParty) {
const cookie = getArrayFromCookie('CookieFavoriteParty');
if(cookie !== null){
arrayParty = cookie;
}
var icon = document.getElementById(idParty);
var LinkToFavoriteParty = document.getElementById('FavoriteListLink' + idParty);
if (LinkToFavoriteParty.style.display == 'none') {
LinkToFavoriteParty.style.display = 'block';
} else {
LinkToFavoriteParty.style.display = 'none';
}
icon.classList.toggle('fas');
if (icon.className == "far fa-heart fas") {
arrayParty.push(idParty);
var arrayPartyJSON = JSON.stringify(arrayParty);
} else {
var index = arrayParty.indexOf(idParty);
if (index > -1) {
arrayParty.splice(index, 1);
}
var arrayPartyJSON = JSON.stringify(arrayParty);
}
setCookie("CookieFavoriteParty", arrayPartyJSON, 3);
}
function onloadEvent() {
// Retrieve the cookie
var cookie = getArrayFromCookie('CookieFavoriteParty');
for (var i = 0; i < cookie.length; i++) {
var icon = document.getElementById(cookie[i]);
var LinkToFavoriteHotel = document.getElementById('FavoriteListLink'+ cookie[i]);
icon.classList.add('fas');
LinkToFavoriteHotel.style.display = 'block';
}
}
</script>
{% endblock %}