templates/home/landing_page.html.twig line 1

  1. {% extends 'base_landing.html.twig' %}
  2. {% block title %}{{ 'landing.title'|trans }}{% endblock %}
  3. {% block body %}
  4. <!-- Section de l'image "sleep" en pleine largeur -->
  5. <div class="relative w-screen h-[80vh] md:h-[60vh] flex items-center justify-center bg-cover bg-center bg-no-repeat mb-200" style="background-image: url('/images/sleep1.png');">
  6.     <div class="absolute inset-0 bg-black bg-opacity-25"></div>
  7.     <div class="absolute text-center w-full px-4">
  8.         <h1 class="text-4xl text-white font-bold mb-4">{{ 'landing.find_accommodation'|trans }}</h1>
  9.          <form id="search-form" method="GET" action="{{ path('advanced_search') }}" class="space-y-4">
  10.             
  11.             <div class="flex justify-center mb-5 gap-2 md:gap-6">
  12.                 {% include 'components/selectCountry.html.twig' with {countrySelected: app.request.query.get('selectCountry')} %}
  13.             </div>
  14.             <div class="relative flex items-center w-full max-w-sm mx-auto rounded-full overflow-hidden">
  15.                 <input type="text" id="address-landing" name="city" placeholder="{{ 'landing.destination'|trans }}" class="w-full px-4 py-2 rounded-full text-black focus:outline-none hidden">
  16.                 <button type="submit" class="absolute right-[-0rem] bg-[#ffcc00] text-black w-10 h-10 rounded-full flex items-center justify-center hover:bg-[#ffcc00] transition border border-2 border-white">
  17.                     <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
  18.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
  19.                     </svg>
  20.                 </button>
  21.             </div>
  22.             <input type="hidden" name="lat" id="lat">
  23.             <input type="hidden" name="lng" id="lng">
  24.         </form>
  25.         <p class="text-xl text-white mt-4">{{ 'landing.thousands_accommodations'|trans }}</p>
  26.     </div>
  27. </div>
  28. <div class="container mx-auto px-4 py-8 text-center">
  29.     <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
  30.         <div class="bg-transparent p-6 text-center max-lg:p-4">
  31.             <img src="/images/icons/attestation.png" alt="Attestation Icon" class="mx-auto mb-4 w-28 h-auto">
  32.             <h3 class="text-xl font-semibold mb-4">{{ 'landing.attestation'|trans }}</h3>
  33.         </div>
  34.         <div class="bg-transparent p-6 text-center max-lg:p-4">
  35.             <img src="/images/icons/sans-deplacement.png" alt="Sans Déplacement Icon" class="mx-auto mb-4 w-28 h-auto">
  36.             <h3 class="text-xl font-semibold mb-4">{{ 'landing.no_displacement'|trans }}</h3>
  37.         </div>
  38.         <div class="bg-transparent p-6 text-center max-lg:p-4">
  39.             <img src="/images/icons/securite.png" alt="Sécurité Icon" class="mx-auto mb-4 w-28 h-auto">
  40.             <h3 class="text-xl font-semibold mb-4">{{ 'landing.security'|trans }}</h3>
  41.         </div>
  42.     </div>
  43. </div>
  44. <div class="bg-gray-200 w-full px-4 py-8 text-left mb-200 max-lg:p-4">
  45.     <h2 class="text-4xl font-bold text-center mb-6 max-lg:text-3xl">{{ 'landing.selection_accommodations'|trans }} <span id="accommodation-title-country">{{'search.France'|trans}}</span>{{ 'landing.selection_accommodations2'|trans }}</h2> <br/>
  46.     {% include 'components/sectionAccommodationCountry.html.twig'%} <!-- Section biens récents par pays -->
  47. </div>
  48. <div class="container text-center mx-auto px-4 py-8 mb-200">
  49.     <h2 class="text-4xl font-bold mb-6 text-center">
  50.         {{ 'landing.roomlers_solution'|trans }}
  51.     </h2>
  52.     <br/>
  53.     <div class="grid grid-cols-1 md:grid-cols-3 gap-12 md:gap-6">
  54.         <!-- Section 1 -->
  55.         <div class="bg-gray-200 p-6 rounded-lg shadow-md flex flex-col md:w-11/12 mx-auto max-lg:p-4 min-h-[250px]">
  56.             <h3 class="text-xl mb-2">
  57.                 <span class="text-2xl font-bold">1.</span><br/>
  58.                 <strong>{{ 'landing.create_account'|trans }}</strong>
  59.             </h3>
  60.             <p class="text-gray-700 flex-grow">
  61.                 {{ 'landing.access_catalog'|trans }}
  62.             </p>
  63.         </div>
  64.         <!-- Section 2 -->
  65.         <div class="bg-gray-200 p-6 rounded-lg shadow-md flex flex-col md:w-11/12 mx-auto max-lg:p-4 min-h-[250px]">
  66.             <h3 class="text-xl mb-2">
  67.                 <span class="text-2xl font-bold">2.</span><br/>
  68.                 <strong>{{ 'landing.generate_attestation'|trans }}</strong><br/>{{ 'landing.step'|trans }}
  69.             </h3>
  70.             <p class="text-gray-700 flex-grow">
  71.                 {{ 'landing.complete_visa'|trans }}
  72.             </p>
  73.         </div>
  74.         <!-- Section 3 -->
  75.         <div class="bg-gray-200 p-6 rounded-lg shadow-md flex flex-col md:w-11/12 mx-auto max-lg:p-4 min-h-[250px]">
  76.             <h3 class="text-xl mb-2">
  77.                 <span class="text-2xl font-bold">3.</span><br/>
  78.                 <strong>{{ 'landing.book_accommodation'|trans }}</strong>
  79.             </h3>
  80.             <p class="text-gray-700 flex-grow">
  81.                 {{ 'landing.choose_accommodation'|trans }}
  82.             </p>
  83.         </div>
  84.     </div>
  85.     <br/>
  86.     <div class="text-center mt-8">
  87.         {% if app.user %}
  88.             {% if app.user.asRole('ROLE_TENANT') %}
  89.                 <a href="{{ path('tenant_home') }}" class="bg-[#FFCC00] text-black px-6 py-2 rounded-lg font-semibold hover:bg-[#FFCC00] transition w-full md:w-[calc(33.333%-2rem)]">
  90.                     {{ 'landing.start'|trans }}
  91.                 </a>
  92.             {% elseif app.user.asRole('ROLE_AGENT') %}
  93.                 <button id="openPopLink1" class="bg-[#FFCC00] text-black px-6 py-2 rounded-lg font-semibold hover:bg-[#FFCC00] transition w-full md:w-[calc(33.333%-2rem)]">
  94.                     {{ 'landing.start'|trans }}
  95.                 </a>
  96.             {% elseif app.user.asRole('ROLE_SUPER_AGENT') %}
  97.                 <button id="openPopLink1" class="bg-[#FFCC00] text-black px-6 py-2 rounded-lg font-semibold hover:bg-[#FFCC00] transition w-full md:w-[calc(33.333%-2rem)]">
  98.                     {{ 'landing.start'|trans }}
  99.                 </a>
  100.             {% elseif app.user.asRole('ROLE_LESSOR') or app.user.asRole('ROLE_LESSOR_RESIDENT') %}
  101.                 <button id="openPopLink1" class="inline-block bg-yellow-400 text-black font-semibold px-8 py-4 rounded-lg hover:bg-yellow-500 transition-colors">
  102.                     {{ 'landing.start'|trans }}
  103.                 </button>
  104.             {% endif %}
  105.         {% else %}
  106.             <button id="openConnectModalBtn" class="bg-[#FFCC00] text-black px-6 py-2 rounded-lg font-semibold hover:bg-[#FFCC00] transition w-full md:w-[calc(33.333%-2rem)]">
  107.                 {{ 'landing.start'|trans }}
  108.             </button>
  109.         {% endif %}
  110.     </div>
  111. </div>
  112. <div class="bg-gray-200 w-full px-4 py-8 mb-200">
  113.     <h2 class="text-4xl md:text-3xl font-bold mb-6 text-center">{{ 'landing.things'|trans }}</h2>
  114.     <br/>
  115.     <div class=" text-center grid grid-cols-1 md:grid-cols-3 gap-12">
  116.         <div class="bg-white p-6 rounded-lg shadow-md md:w-11/12 mx-auto max-lg:p-4 text-center">
  117.             <img src="/images/icons/citation.png" alt="Icône de citation" class="w-8 h-8 mb-4 mx-auto">
  118.             <p class="text-gray-700">{{ 'landing.testimonial_alejandro'|trans }} <br/>
  119.                 <br/><em>{{ 'landing.alejandro'|trans }}</em>
  120.             </p>
  121.         </div>
  122.         <div class="bg-white p-6 rounded-lg shadow-md md:w-11/12 mx-auto max-lg:p-4 text-center">
  123.             <img src="/images/icons/citation.png" alt="Icône de citation" class="w-8 h-8 mb-4 mx-auto">
  124.             <p class="text-gray-700">{{ 'landing.testimonial_mei'|trans }} <br/>
  125.                 <br/><em>{{ 'landing.mei'|trans }}</em>
  126.             </p>
  127.         </div>
  128.         <div class="bg-white p-6 rounded-lg shadow-md md:w-11/12 mx-auto max-lg:p-4 text-center">
  129.             <img src="/images/icons/citation.png" alt="Icône de citation" class="w-8 h-8 mb-4 mx-auto">
  130.             <p class="text-gray-700">{{ 'landing.testimonial_luca'|trans }} <br/>
  131.                 <br/><em>{{ 'landing.luca'|trans }}</em>
  132.             </p>
  133.         </div>
  134.     </div>
  135. </div>
  136. <style>
  137.     .faq-section {
  138.         display: flex;
  139.         align-items: center;
  140.     }
  141.     .faq-title {
  142.         display: flex;
  143.         align-items: center;
  144.         justify-content: center;
  145.     }
  146.     .faq-questions {
  147.         display: flex;
  148.         flex-direction: column;
  149.     }
  150.     .faq-answer {
  151.         max-height: 0;
  152.         overflow: hidden;
  153.         transition: max-height 0.3s ease-out;
  154.     }
  155.     .faq-answer.active {
  156.         max-height: 200px; /* Ajustez cette valeur selon vos besoins */
  157.         overflow: visible;
  158.     }
  159. </style>
  160. <div class="container mx-auto px-4 py-8 mb-24 flex flex-col md:flex-row items-start justify-between faq-section">
  161.     <div class="w-full md:w-1/3 p-4 faq-title">
  162.         <h2 class="text-3xl font-bold mb-4">{{ 'landing.weanswer'|trans }}<br/> {{ 'landing.questions'|trans }}</h2>
  163.     </div>
  164.     <div class="w-full md:w-2/3 p-4 space-y-4 faq-questions">
  165.         <!-- Question 1 -->
  166.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  167.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  168.                 <div class="flex-1 text-left pr-4">{{ 'landing.question1'|trans }}</div>
  169.                 <div class="flex-shrink-0 w-6 h-6">
  170.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  171.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  172.                     </svg>
  173.                 </div>
  174.             </button>
  175.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  176.                 <p class="p-4 text-gray-700">{{ 'landing.faq_fees'|trans }}</p>
  177.             </div>
  178.         </div>
  179.         <!-- Question 2 -->
  180.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  181.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  182.                 <div class="flex-1 text-left pr-4">{{ 'landing.question2'|trans }}</div>
  183.                 <div class="flex-shrink-0 w-6 h-6">
  184.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  185.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  186.                     </svg>
  187.                 </div>
  188.             </button>
  189.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  190.                 <p class="p-4 text-gray-700">{{ 'landing.faq_refund'|trans }}</p>
  191.             </div>
  192.         </div>
  193.         <!-- Question 3 -->
  194.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  195.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  196.                 <div class="flex-1 text-left pr-4">{{ 'landing.question3'|trans }}</div>
  197.                 <div class="flex-shrink-0 w-6 h-6">
  198.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  199.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  200.                     </svg>
  201.                 </div>
  202.             </button>
  203.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  204.                 <p class="p-4 text-gray-700">{{ 'landing.faq_apl'|trans }}</p>
  205.             </div>
  206.         </div>
  207.         <!-- Question 4 -->
  208.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  209.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  210.                 <div class="flex-1 text-left pr-4">{{ 'landing.question4'|trans }}</div>
  211.                 <div class="flex-shrink-0 w-6 h-6">
  212.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  213.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  214.                     </svg>
  215.                 </div>
  216.             </button>
  217.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  218.                 <p class="p-4 text-gray-700">{{ 'landing.faq_furnished'|trans }}</p>
  219.             </div>
  220.         </div>
  221.         <!-- Question 5 -->
  222.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  223.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  224.                 <div class="flex-1 text-left pr-4">{{ 'landing.question5'|trans }}</div>
  225.                 <div class="flex-shrink-0 w-6 h-6">
  226.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  227.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  228.                     </svg>
  229.                 </div>
  230.             </button>
  231.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  232.                 <p class="p-4 text-gray-700">{{ 'landing.faq_lease_duration'|trans }}</p>
  233.             </div>
  234.         </div>
  235.         <!-- Question 6 -->
  236.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  237.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  238.                 <div class="flex-1 text-left pr-4">{{ 'landing.question6'|trans }}</div>
  239.                 <div class="flex-shrink-0 w-6 h-6">
  240.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  241.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  242.                     </svg>
  243.                 </div>
  244.             </button>
  245.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  246.                 <p class="p-4 text-gray-700">{{ 'landing.faq_leave_accommodation'|trans }}</p>
  247.             </div>
  248.         </div>
  249.         <!-- Question 7 -->
  250.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  251.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  252.                 <div class="flex-1 text-left pr-4">{{ 'landing.question7'|trans }}</div>
  253.                 <div class="flex-shrink-0 w-6 h-6">
  254.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  255.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  256.                     </svg>
  257.                 </div>
  258.             </button>
  259.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  260.                 <p class="p-4 text-gray-700">{{ 'landing.faq_insurance'|trans }}</p>
  261.             </div>
  262.         </div>
  263.         <!-- Question 8 -->
  264.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  265.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  266.                 <div class="flex-1 text-left pr-4">{{ 'landing.question8'|trans }}</div>
  267.                 <div class="flex-shrink-0 w-6 h-6">
  268.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  269.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  270.                     </svg>
  271.                 </div>
  272.             </button>
  273.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  274.                 <p class="p-4 text-gray-700">{{ 'landing.faq_guarantor'|trans }}</p>
  275.             </div>
  276.         </div>
  277.         <!-- Question 9 -->
  278.         <div class="border border-gray-300 rounded-lg overflow-hidden shadow-md relative faq-item">
  279.             <button class="faq-question flex justify-between items-center w-full p-4 font-semibold text-left hover:bg-gray-200 transition">
  280.                 <div class="flex-1 text-left pr-4">{{ 'landing.question9'|trans }}</div>
  281.                 <div class="flex-shrink-0 w-6 h-6">
  282.                     <svg class="w-6 h-6 text-gray-600 transition-transform transform rotate-0" fill="none" stroke="currentColor" viewBox="0 0 24 24">
  283.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
  284.                     </svg>
  285.                 </div>
  286.             </button>
  287.             <div class="faq-answer max-h-0 overflow-hidden transition-all duration-300 ease-in-out">
  288.                 <p class="p-4 text-gray-700">{{ 'landing.faq_no_guarantor'|trans|raw }}</p>
  289.             </div>
  290.         </div>
  291.     </div>
  292. </div>
  293. <div class="bg-gray-200 w-full px-4 py-8 mb-200">
  294.     <h2 class="text-4xl md:text-3xl font-bold mb-6 text-center">{{ 'landing.popular_destinations'|trans }}</h2> <br/>
  295.     <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
  296.         <a href="{{ path('advanced_search', {'city': 'Paris', 'lat': 48.8575475, 'lng': 2.3513765}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  297.             <h3 class="text-lg md:text-xl font-semibold mb-2">Paris et sa banlieue</h3>
  298.         </a>
  299.         <a href="{{ path('advanced_search', {'city': 'Lille', 'lat': 50.624378, 'lng': 3.0678588}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  300.             <h3 class="text-lg md:text-xl font-semibold mb-2">Lille</h3>
  301.         </a>
  302.         <a href="{{ path('advanced_search', {'city': 'Lyon', 'lat': 45.764043, 'lng': 4.835659}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  303.             <h3 class="text-lg md:text-xl font-semibold mb-2">Lyon</h3>
  304.         </a>
  305.         <a href="{{ path('advanced_search', {'city': 'Toulouse', 'lat': 43.6048462, 'lng': 1.442848}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  306.             <h3 class="text-lg md:text-xl font-semibold mb-2">Toulouse</h3>
  307.         </a>
  308.         <a href="{{ path('advanced_search', {'city': 'Strasbourg', 'lat': 48.5734053, 'lng': 7.752111299999999}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  309.             <h3 class="text-lg md:text-xl font-semibold mb-2">Strasbourg</h3>
  310.         </a>
  311.         <a href="{{ path('advanced_search', {'city': 'Marseille', 'lat': 43.3025742, 'lng': 5.369074299999999}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  312.             <h3 class="text-lg md:text-xl font-semibold mb-2">Marseille</h3>
  313.         </a>
  314.         <a href="{{ path('advanced_search', {'city': 'Rennes', 'lat': 48.117266, 'lng': 1.6777926}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  315.             <h3 class="text-lg md:text-xl font-semibold mb-2">Rennes</h3>
  316.         </a>
  317.         <a href="{{ path('advanced_search', {'city': 'Bordeaux', 'lat': 44.8416106, 'lng': 0.5810938000000001}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  318.             <h3 class="text-lg md:text-xl font-semibold mb-2">Bordeaux</h3>
  319.         </a>
  320.         <a href="{{ path('advanced_search', {'city': 'Montpellier', 'lat': 43.6108535, 'lng': 3.8761323}) }}" class="bg-white p-6 rounded-lg shadow-md text-center">
  321.             <h3 class="text-lg md:text-xl font-semibold mb-2">Montpellier</h3>
  322.         </a>
  323.     </div>
  324. </div> <br/> <br/>
  325. <!-- Modal de connexion/inscription -->
  326. <div id="connectModal" class="fixed inset-0 bg-gray-500 bg-opacity-50 flex justify-center items-center hidden z-50">
  327.     <div class="bg-white p-6 rounded-lg shadow-lg max-w-sm w-full text-center">
  328.         <p class="text-lg font-semibold mb-4">{{ 'landing.option'|trans }}</p>
  329.         <button onclick="window.location.href='{{ path('app_login_site') }}'" class="bg-[#ffcc00] text-black px-4 py-2 rounded-lg font-semibold hover:bg-[#ffcc00] transition mb-2">
  330.             {{ 'landing.login'|trans }}
  331.         </button>
  332.         <button onclick="window.location.href='{{ path('app_register') }}'" class="bg-[#ffcc00] text-black px-4 py-2 rounded-lg font-semibold hover:bg-[#ffcc00] transition">
  333.             {{ 'landing.register'|trans }}
  334.         </button>
  335.     </div>
  336. </div>
  337. <div id="connectPop" class="fixed inset-0 bg-gray-500 bg-opacity-50 flex justify-center items-center hidden z-50">
  338.     <div class="bg-white p-6 rounded-lg shadow-lg max-w-sm w-full text-center">
  339.         <p class="text-lg font-semibold mb-4">{{ 'landing.tenant'|trans }}</p>
  340.         <button onclick="window.location.href='{{ path('app_login_site') }}'" class="bg-yellow-400 text-black px-4 py-2 rounded-lg font-semibold hover:bg-yellow-500 transition mb-2 w-full">
  341.             {{ 'landing.login'|trans }}
  342.         </button>
  343.     </div>
  344. </div>
  345. <button id="scrollToTopBtn" class="fixed bottom-4 right-4 bg-[#FFCC00] text-black px-4 py-2 rounded-lg font-semibold hover:bg-[#e6b800] transition-all z-[1000] border-2 border-black">
  346.     {{ 'landing.search'|trans }}
  347. </button>
  348. <script>
  349.     let autocompleteLanding;
  350.     var countryTranslations = {
  351.         'FR': '{{ 'search.InFrance'|trans }}',
  352.         'BE': '{{ 'search.InBelgique'|trans }}',
  353.         'DE': '{{ 'search.InAllemagne'|trans }}',
  354.         'ES': '{{ 'search.InEspagne'|trans }}',
  355.         'IT': '{{ 'search.InItalie'|trans }}',
  356.         'PT': '{{ 'search.InPortugal'|trans }}',
  357.         'CA': '{{ 'search.InCanada'|trans }}',
  358.         'LU': '{{ 'search.InLuxembourg'|trans }}'
  359.     };
  360.     function initAutocomplete(inputId) {
  361.         const input = document.getElementById(inputId);
  362.         if (!input) {
  363.             console.error("Input non trouvé :", inputId);
  364.             return;
  365.         }
  366.         const options = {
  367.             types: ['(cities)'],
  368.             componentRestrictions: { country: 'FR' }
  369.         };
  370.         try {
  371.             autocompleteLanding = new google.maps.places.Autocomplete(input, options);
  372.             
  373.             document.querySelectorAll('select[name=selectCountry]').forEach(inputSelect => {
  374.                 inputSelect.addEventListener('change', async () => {
  375.                     var countryName = inputSelect.value;
  376.                     inputSelect.value ? document.querySelectorAll('input[name=city]')[0].style.display = 'block' : document.querySelectorAll('input[name=city]')[0].style.display = 'none';
  377.                     autocompleteLanding.setComponentRestrictions({ country: inputSelect.value ? inputSelect.value : 'FR' });
  378.                     spanCountryChecked = document.getElementById('accommodation-title-country');
  379.                     spanCountryChecked.textContent = countryTranslations[countryName];
  380.                     
  381.                     const response = await fetch(`/buildings-country?country=${inputSelect.id}&acronym=${inputSelect.value}`);
  382.                     const html = await response.text();
  383.                     document.getElementById('recent-carousel').innerHTML = html;
  384.                 })
  385.             });
  386.             autocompleteLanding.addListener('place_changed', function () {
  387.                 const place = autocompleteLanding.getPlace();
  388.                 if (!place.geometry) {
  389.                     console.error("Aucune géométrie trouvée pour ce lieu.");
  390.                     return;
  391.                 }
  392.                 const latInput = document.getElementById('lat');
  393.                 const lngInput = document.getElementById('lng');
  394.                 if (latInput && lngInput) {
  395.                     latInput.value = place.geometry.location.lat();
  396.                     lngInput.value = place.geometry.location.lng();
  397.                 }
  398.                 let city = "";
  399.                 place.address_components.forEach(component => {
  400.                     if (component.types.includes("locality")) {
  401.                         city = component.long_name;
  402.                     }
  403.                 });
  404.                 input.value = city || place.name; // Fallback si le nom de la ville n'est pas trouvé
  405.                 const form = input.closest('form');
  406.                 if (form) {
  407.                     form.submit();
  408.                 }
  409.             });
  410.         } catch (error) {
  411.             console.error("Erreur lors de l'initialisation de l'autocomplétion :", error);
  412.         }
  413.     }
  414.     // Fonction pour charger l'API Google Maps de manière asynchrone
  415.     function loadGoogleMapsAPI() {
  416.         if (typeof google === 'undefined' || !google.maps) {
  417.             const script = document.createElement('script');
  418.             script.src = 'https://maps.googleapis.com/maps/api/js?key={{ google_maps_api_key }}&libraries=places&callback=initializeAutocomplete';
  419.             script.async = true;
  420.             script.defer = true;
  421.             script.onerror = () => {
  422.                 console.error("Erreur lors du chargement de l'API Google Maps.");
  423.             };
  424.             document.head.appendChild(script);
  425.         } else {
  426.             initializeAutocomplete();
  427.         }
  428.     }
  429.     // Fonction pour initialiser l'autocomplétion après le chargement de l'API
  430.     function initializeAutocomplete() {
  431.         if (typeof google !== 'undefined' && google.maps && google.maps.places) {
  432.             initAutocomplete('address-landing');
  433.         } else {
  434.             console.error("Google Maps API non chargée correctement.");
  435.         }
  436.     }
  437.     // Fonction pour configurer un carousel
  438.     function setupCarousel(carousel) {
  439.         const carouselId = carousel.id.split('-')[1];
  440.         const slides = carousel.querySelectorAll('a');
  441.         const indicators = document.querySelectorAll(`#carousel-indicators-${carouselId} button`);
  442.         const prevButton = document.querySelector(`[data-carousel-prev="${carouselId}"]`);
  443.         const nextButton = document.querySelector(`[data-carousel-next="${carouselId}"]`);
  444.         let currentIndex = 0;
  445.         const totalSlides = slides.length;
  446.         function updateCarousel() {
  447.             if (slides.length === 0) return;
  448.             slides.forEach((slide, index) => {
  449.                 slide.style.transition = 'opacity 0.6s ease-in-out, transform 0.6s ease-in-out';
  450.                 slide.style.position = 'absolute';
  451.                 slide.style.opacity = '0';
  452.                 slide.style.transform = 'translateX(100%)';
  453.             });
  454.             const currentSlide = slides[currentIndex];
  455.             currentSlide.style.opacity = '1';
  456.             currentSlide.style.transform = 'translateX(0)';
  457.             indicators.forEach((indicator, index) => {
  458.                 if (index === currentIndex) {
  459.                     indicator.classList.add('bg-[#ffcc00]', 'opacity-100');
  460.                     indicator.classList.remove('bg-gray-300', 'opacity-50');
  461.                 } else {
  462.                     indicator.classList.remove('bg-[#ffcc00]', 'opacity-100');
  463.                     indicator.classList.add('bg-gray-300', 'opacity-50');
  464.                 }
  465.             });
  466.         }
  467.         function goToSlide(index) {
  468.             currentIndex = (index + totalSlides) % totalSlides;
  469.             updateCarousel();
  470.         }
  471.         function nextSlide() {
  472.             goToSlide(currentIndex + 1);
  473.         }
  474.         function prevSlide() {
  475.             goToSlide(currentIndex - 1);
  476.         }
  477.         // Événements
  478.         if (nextButton) nextButton.addEventListener('click', nextSlide);
  479.         if (prevButton) prevButton.addEventListener('click', prevSlide);
  480.         indicators.forEach((indicator, index) => {
  481.             indicator.addEventListener('click', () => goToSlide(index));
  482.         });
  483.     }
  484.     // Initialisation du script
  485.     document.addEventListener('DOMContentLoaded', function () {
  486.         // Charger l'API Google Maps
  487.         loadGoogleMapsAPI();
  488.         // Gestion de la modal de connexion/inscription
  489.         const openModalElements = document.querySelectorAll('#openModalLink1, #openConnectModalBtn');
  490.         const connectModal = document.getElementById('connectModal');
  491.         openModalElements.forEach(element => {
  492.             element.addEventListener('click', function (event) {
  493.                 event.preventDefault();
  494.                 connectModal.classList.remove('hidden');
  495.             });
  496.         });
  497.         connectModal.addEventListener('click', function (event) {
  498.             if (event.target === connectModal) {
  499.                 connectModal.classList.add('hidden');
  500.             }
  501.         });
  502.         // Gestion du bouton de recherche (défilement vers le haut)
  503.         const scrollToTopBtn = document.getElementById('scrollToTopBtn');
  504.         scrollToTopBtn.addEventListener('click', function () {
  505.             window.scrollTo({
  506.                 top: 0,
  507.                 behavior: 'smooth'
  508.             });
  509.         });
  510.         // Affichage/masquage du bouton de défilement
  511.         window.addEventListener('scroll', function () {
  512.             if (window.scrollY > 100) {
  513.                 scrollToTopBtn.style.display = 'block';
  514.             } else {
  515.                 scrollToTopBtn.style.display = 'none';
  516.             }
  517.         });
  518.         // Gestion des carrousels
  519.         const carousels = document.querySelectorAll('[id^="carousel-"]');
  520.         carousels.forEach(setupCarousel);
  521.         // Gestion des clics sur les cœurs (affichage de la modal)
  522.         const likeButtons = document.querySelectorAll('.like-button');
  523.         likeButtons.forEach(button => {
  524.             button.addEventListener('click', function () {
  525.                 const connectModal = document.getElementById('connectModal');
  526.                 connectModal.classList.remove('hidden');
  527.             });
  528.         });
  529.         // Gestion du menu de langue
  530.         const languageDropdown = document.getElementById('languageDropdown');
  531.         const languageMenu = document.getElementById('languageMenu');
  532.         if (languageDropdown && languageMenu) {
  533.             languageDropdown.addEventListener('click', function () {
  534.                 languageMenu.classList.toggle('hidden');
  535.             });
  536.         }
  537.         // Gestion de l'accordéon
  538.         const accordionButtons = document.querySelectorAll('.faq-question');
  539.         accordionButtons.forEach(button => {
  540.             button.addEventListener('click', function() {
  541.                 const content = this.nextElementSibling;
  542.                 const isExpanded = content.classList.contains('active');
  543.                 // Fermer tous les autres éléments de l'accordéon
  544.                 accordionButtons.forEach(btn => {
  545.                     const otherContent = btn.nextElementSibling;
  546.                     if (btn !== this) {
  547.                         otherContent.classList.remove('active');
  548.                     }
  549.                 });
  550.                 // Basculer l'état de l'élément cliqué
  551.                 if (isExpanded) {
  552.                     content.classList.remove('active');
  553.                 } else {
  554.                     content.classList.add('active');
  555.                 }
  556.             });
  557.         });
  558.     // Ajout du gestionnaire d'événements pour la touche "Entrée"
  559.     const searchInput = document.getElementById('address-landing');
  560.         if (searchInput) {
  561.             searchInput.addEventListener('keydown', function (event) {
  562.                 if (event.key === 'Enter') {
  563.                     event.preventDefault();
  564.                     document.getElementById('search-form').submit();
  565.                 }
  566.             });
  567.         }
  568.     const openPopElements = document.querySelectorAll('#openPopLink1, #openPopLink2');
  569.     const connectPop = document.getElementById('connectPop');
  570.     if (openPopElements.length > 0 && connectPop) {
  571.         openPopElements.forEach(element => {
  572.             element.addEventListener('click', function (event) {
  573.                 event.preventDefault();
  574.                 connectPop.classList.remove('hidden');
  575.             });
  576.         });
  577.         connectPop.addEventListener('click', function (event) {
  578.             if (event.target === connectPop) {
  579.                 connectPop.classList.add('hidden');
  580.             }
  581.         });
  582.         connectPop.querySelector('.bg-white').addEventListener('click', function (event) {
  583.             event.stopPropagation();
  584.         });
  585.     }
  586.     });
  587. </script>
  588. {% endblock %}