templates/front/party/index.html.twig line 1

Open in your IDE?
  1. {% extends 'front/base_front.html.twig' %}
  2. {% block title %}{{ 'Pages.Party.Title'|trans({} , 'messages_front') }}{% endblock %}
  3. {% block container %}
  4. <section id="explore_area" class="section_padding">
  5.     <div class="container" >
  6.         <div class="row">
  7.             {% for party in parties %}
  8.                 {% set hotel = party.hotelStayRequired == 1 ? party.hotelContract.hotel : "" %}
  9.                 {% set city = party.hotelStayRequired == 1 ? hotel.city : party.city %}
  10.                 {% set cityName =city|replace({' ': '-'}) %}
  11.                 {% set currency =  party.provider.currency %}
  12.                 <div class="col-lg-3 col-md-6 col-sm-6 col-12">
  13.                     <div class="theme_common_box_two img_hover">
  14.                         <div class="theme_two_box_img">
  15.                             {% set primary_image = null %}
  16.                             {% for image in party.images %}
  17.                                 {% if image.displayOrder == 1 %}
  18.                                     {% set primary_image = image %}
  19.                                 {% endif %}
  20.                             {% endfor %}
  21.                             <img class="img-party" loading="lazy"
  22.                                  src="{{ absolute_url(primary_image.url |default( asset('front/assets/img/tab-img/hotel1.png'))) }}"
  23.                                  alt="{{ party.title }}">
  24.                             <p><i class="fas fa-map-marker-alt"></i>{{ city }}
  25.                                 , {{ city is not null ? city.country : '' }}</p>
  26.                             {% if (party.hotelStayRequired == 1) %}
  27.                                 <div class="ribbon-party">
  28.                                     Séjour <br> obligatoire
  29.                                 </div>
  30.                             {% endif %}
  31.                         </div>
  32.                         <div class="theme_two_box_content">
  33.                             <a href="{{ path('app_front_party_detail' , {
  34.                                 id : party.id,
  35.                                 partyName:party.title|replace({' ': '-'}),
  36.                                 city:cityName,
  37.                                 hotelName: hotel is not empty? hotel.name|trim |replace({' ': '-'}) :  party.address|trim |replace({' ': '-'})
  38.                             }) }}" target="_blank">
  39.                                 <h4>
  40.                                     {{ party.title }}
  41.                                 </h4>
  42.                                 <p class="text-nowrap">
  43.                                     {% if party.address is not empty %}
  44.                                         <i class="fas fa-map"></i> {{ party.address }}
  45.                                     {% endif %}
  46.                                     {% if hotel is not empty %}
  47.                                         <i class="fas fa-map"></i> {{ hotel }}
  48.                                     {% endif %}
  49.                                 </p>
  50.                             </a>
  51.                             <p class=p-date-party>
  52.                                 <span class="date-party"> <i class="bi bi-calendar3"></i> {{ party.date|date('d/m/Y') }}</span>
  53.                                 {% if hotel is not empty %}
  54.                                     <span class="star-hotel-party">
  55.                                             {% for _ in 0 .. hotel.starRating %}
  56.                                                 <i class="fas fa-star color_theme"></i>
  57.                                             {% endfor %}
  58.                                         </span>
  59.                                 {% endif %}
  60.                             </p>
  61.                             <h3>
  62.                                 <span>Price starts from</span>
  63.                                 {{ party.productElements|reduce( (lowest , partyZone) => min(lowest ??
  64.                                     partyZone.adultSalePrice  , partyZone.adultSalePrice )) }}<sup>{{ currency }}</sup>
  65.                             </h3>
  66.                         </div>
  67.                     </div>
  68.                 </div>
  69.             {% else %}
  70.                 <div>
  71.                     {{ "Entities.Common.Alerts.InfoNoDataTable"|trans }}
  72.                 </div>
  73.             {% endfor %}
  74.         </div>
  75.     </div>
  76. </section>
  77.     <script>
  78.         window.onload = function() {
  79.             onloadEvent();
  80.         }
  81.         var arrayParty = [];
  82.         function saveParty(idParty) {
  83.             const cookie = getArrayFromCookie('CookieFavoriteParty');
  84.             if(cookie !== null){
  85.                 arrayParty = cookie;
  86.             }
  87.             var icon = document.getElementById(idParty);
  88.             var LinkToFavoriteParty = document.getElementById('FavoriteListLink' + idParty);
  89.             if (LinkToFavoriteParty.style.display == 'none') {
  90.                 LinkToFavoriteParty.style.display = 'block';
  91.             } else {
  92.                 LinkToFavoriteParty.style.display = 'none';
  93.             }
  94.             icon.classList.toggle('fas');
  95.             if (icon.className == "far fa-heart fas") {
  96.                 arrayParty.push(idParty);
  97.                 var arrayPartyJSON = JSON.stringify(arrayParty);
  98.             } else {
  99.                 var index = arrayParty.indexOf(idParty);
  100.                 if (index > -1) {
  101.                     arrayParty.splice(index, 1);
  102.                 }
  103.                 var arrayPartyJSON = JSON.stringify(arrayParty);
  104.             }
  105.             setCookie("CookieFavoriteParty", arrayPartyJSON, 3);
  106.         }
  107.         function onloadEvent() {
  108.             // Retrieve the cookie
  109.             var cookie = getArrayFromCookie('CookieFavoriteParty');
  110.             for (var i = 0; i < cookie.length; i++) {
  111.                 var icon = document.getElementById(cookie[i]);
  112.                 var LinkToFavoriteHotel = document.getElementById('FavoriteListLink'+ cookie[i]);
  113.                 icon.classList.add('fas');
  114.                 LinkToFavoriteHotel.style.display = 'block';
  115.             }
  116.         }
  117.     </script>
  118. {% endblock %}