templates/property.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}Biens{% endblock %}
  3. {% block metaDescription %}
  4.     {% set headerContent = content('Biens', 'Header') %}
  5.     <meta name="description" content="
  6.     {% if headerContent.content is defined %}
  7.         {{ headerContent.content|striptags }}
  8.     {% else %}
  9.          Tracol Immobilier propose une large offre en immobilier neuf (logements, bureaux, commerces), qui se caractérise par une architecture résolument contemporaine, des matériaux de qualité, et le soin apporté à chaque détail.
  10.     {% endif %}
  11.     ">
  12. {% endblock %}
  13. {% block body %} 
  14.     {% set headerContent = content('Biens', 'Header') %}
  15.     {% if headerContent.picture is defined and headerContent.picture is not empty %}
  16.         {% set backgroundImage = headerContent.picture[0].path %}
  17.     {% else %}
  18.         {% set backgroundImage = 'empty' %}
  19.     {% endif %}
  20.     {#
  21.     <header class="header-tracol slider-home slider-not-home who-is bottom-right-border position-relative overflow-hidden to-right" id="sliderHeader"  style="background: url({% if backgroundImage == 'empty' %}'https://tracol.lu/uploads/images/residences-61c0b1dd3141b610699350.jpeg'{% else %}'/uploads/images/{{ backgroundImage }}'{% endif %}) center center no-repeat;background-size:cover;">
  22.         <div class="container-fluid">
  23.             <div id="header-habiter" class="col-lg-8 mx-auto div-svg-header">
  24.                 <div class="header-habiter-div2">
  25.                     {% if headerContent.name is defined %}
  26.                         <svg id="svg-habiter" width="10" height="16" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:avocode="https://avocode.com/" viewBox="0 0 10 16"><defs></defs><desc>Generated with Avocode.</desc><g><g><title>Tracé 76</title><path d="M9.08929,0.51465v0h-9.08929v0v14.77002v0l9.08929,-1.93109v0z" fill="#f6a400" fill-opacity="1"></path></g></g></svg>
  27.                         <h2 class="header-habiter-title col-lg-8">{{ headerContent.name }}</h2>
  28.                     {% endif %}
  29.                 </div>
  30.             </div>
  31.         </div>
  32.     </header>
  33.     #}
  34.     <div class="container-fluid">
  35.         {% set sectionContent1 = content('Biens', 'Section-1') %}
  36.         {#
  37.         <div class="col-lg-8 mx-auto div-svg-header pre-section">
  38.             <div class="col-lg-5 property-title" style="font-size: 2.3em;display: flex;flex-direction: column;margin-left: 10px;">
  39.                 <svg xmlns="http://www.w3.org/2000/svg" width="9.089" height="14.77" viewBox="0 0 9.089 14.77">
  40.                     <path id="Tracé_76" data-name="Tracé 76" d="M682.759,232.441h-9.089v14.77l9.089-1.931Z" transform="translate(-673.669 -232.441)" fill="#f6a400"/>
  41.                 </svg>
  42.                 {% if properties|length == 0 %}
  43.                     <h1 class="lowercase-title">Nous n'avons aucun bien correspondant à votre recherche.</h1>
  44.                 {% elseif properties|length == 1 %}
  45.                     <h1 class="project-title">{{ properties|length }} bien disponible</h1>
  46.                 {% else %}
  47.                     <h1 class="project-title">{{properties|length }} biens disponibles</h1>
  48.                 {% endif %}
  49.             </div>
  50.             <div class="separator"></div>
  51.             <div class="col-lg-6 pre-section-content">
  52.                 {% if sectionContent1.content is defined %}
  53.                     {{ sectionContent1.content|raw }}
  54.                 {% else %}
  55.                     Que vous soyez un particulier ou un professionnel, que vous recherchiez un appartement, une maison, un bureau ou un commerce, nos équipes d’experts vous accompagnent tout au long de votre projet immobilier.
  56.                 {% endif %}
  57.             </div>
  58.         </div>
  59.         #}
  60.         <section class="project" style="margin-top: 60px">
  61.             
  62.             <div id="button-property-page"  class="col-lg-8 mx-auto div-svg-header" style="display: flex; align-items: center; padding-left: 7px">
  63.                 <button data-id="all" class="btn btn-primary all border-radius projectButton"><span class="span-all">TOUS</span></button>
  64.                 <button data-id="sale" class="btn btn-primary come border-radius projectButton"><span class="span-projects">ACHAT</span></button>
  65.                 <button data-id="rental" class="btn btn-primary come border-radius projectButton"><span class="span-projects">LOCATION</span></button>
  66.             </div>
  67.             <div id="button-property-page-mobile" class="col-lg-8 mx-auto div-svg-header" style="display: none; align-items: center">
  68.                 {#<div id="flick3" class="flicking-viewport">
  69.                     <div class="flicking-camera">
  70.                         <button data-id="all" class="btn btn-primary all border-radius projectButton"><span class="span-all">TOUS</span></button>
  71.                         <button data-id="sale" class="btn btn-primary come border-radius projectButton"><span class="span-projects">ACHAT</span></button>
  72.                         <button data-id="rental" class="btn btn-primary come border-radius projectButton"><span class="span-projects">LOCATION</span></button>
  73.                     </div>
  74.                 </div>#}
  75.             </div>
  76.             <div class="col-xl-8 mx-auto div-svg-header deactive-tablet" style="display: flex; flex-direction: column; justify-content: center">
  77.                 <div class="col-md-4" style="margin-top: 40px">
  78.                     <p>Trier par :</p>
  79.                     <form>
  80.                         <select name="subfilter" class="form-control with-appearance" id="filterProperties">
  81.                             <option value="">Sélectionner</option>
  82.                             <option value="date">Date de publication</option>
  83.                             <option value="asc">Prix croissant</option>
  84.                             <option value="desc">Prix décroissant</option>
  85.                         </select>
  86.                     </form>
  87.                 </div>
  88.                 {#
  89.                 <div style="display: flex; flex-direction: row; padding-left: 7px; align-items: center; margin-top: 15px;">
  90.                     <div id="filter-desktop" class="filters-biens">
  91.                         {% for key, subType in getTypeProperties() %}
  92.                             <button data-id="{{ key }}" class="select-projet">{{ subType }} <i class="fas fa-times"></i></button>
  93.                         {% endfor %}
  94.                     </div>
  95.                     <div id="filter-mobile" class="col-lg-3 div-form selectSubFilter property" style="display: none">
  96.                         <div class="input-group dropdown show">
  97.                             <label class="label-search-filter" for="location">Filtrer par Type</label>
  98.                             <input style="height: 75px; width: 60px;" type="text" autocomplete="off" name="filters" id="filters"
  99.                                    class="form-control" aria-expanded="false">
  100.                             <ul id="form-search-filter-ajax" class="dropdown-menu form-search-filter-ajax" aria-labelledby="">
  101.                                 {% for key, subType in getTypeProperties() %}
  102.                                     <li value="{{ key }}" data-id="{{ key }}" class="select-filter"><i class="fas fa-times"></i>{{ subType }}</li>
  103.                                 {% endfor %}
  104.                             </ul>
  105.                         </div>
  106.                     </div>
  107.                 </div>
  108.                 #}
  109.                 <div id="loading">
  110.                     <h1 id="showOutput"></h1>
  111.                 </div>
  112.                 <div id="properties" class="row col-lg-12">
  113.                     {% for property in properties %}
  114.                         <div  class="property col-xxl-4 col-xl-6 col-lg-6 col-md-6 col-sm-12 div-img-hover-2" data-date="{{ property.created_at }}" data-price="{{ property.price.value }}" style="cursor: pointer">
  115.                             {#
  116.                             <div class="div-hover-2" id="div-hover-2" aria-haspopup="true" style="position: absolute; bottom: 8px; left: 9px; background-color: #242424; color: white; width: 291px; height: 70px">
  117.                                                             {% if property.comments[0].comment is not empty %}
  118.                                                                 <p class="project-content">
  119.                                                                     {{ property.comments[0].comment|slice(0, 350) }}</p>
  120.                                                                 <a href="{{ path('property-detail', {'id': property.id}) }}" class="project-arrow-2">
  121.                                                                     <span class="galerry-ref"></span><i class="fas fa-arrow-right project-svg-arrow-2"></i>
  122.                                                                 </a>
  123.                                                             {% else %}
  124.                                                                 <a style="margin-top: 180px" href="{{ path('property-detail', {'id': property.id}) }}" class="project-arrow-2">
  125.                                                                     <span class="galerry-ref"></span><i class="fas fa-arrow-right project-svg-arrow-2"></i>
  126.                                                                 </a>
  127.                                                             {% endif %}
  128.                                                         </div>
  129.                                                         <div class="col-lg-3 properties-price-absolute" style="background-color: #c48300; height: 56px;">
  130.                                                             <p style="font-size: 20px;" class="properties-price">
  131.                                                                 {{ property.price.value == null ? '<span style="font-size: 14px !important;">sur demande</span>' : property.price.value ~  property.price.currency|replace({"EUR": " €"})  }}
  132.                                                             </p>
  133.                                                         </div>
  134.                             #}
  135.                             {# <div class="tag-ref-projet-2"><span class="text-tag-ref">{{ specialPropertyCategory(property.category) }}</span></div> #}
  136.                             {% if property.pictures is not empty %}
  137.                                 <div class="position-relative properties-slide slick-slide-single-{{ loop.index }} image">
  138.                                     {% for picture in property.pictures|slice(0,3) %}
  139.                                         {% set url = 'http' in picture.url ? picture.url : asset('uploads/images/properties/'~property.id~'/'~picture.url) %}
  140.                                         <div class="img" style="background: url('{{ url }}')no-repeat center;background-size:cover;"  onclick="location.href='{{ path('property-detail', {'id': property.id}) }}'">
  141.                                         </div>
  142.                                     {% endfor %}
  143.                                 </div>
  144.                             {% else %}
  145.                             <div class="position-relative properties-slide image">
  146.                                 <a href="{{ path('property-detail', {'id': property.id}) }}"><img src="{{ asset('build/Hudson_Ontario2.png') }}" /></a>
  147.                             </div>
  148.                             {% endif %}
  149.                             <a href="{{ path('property-detail', {'id': property.id}) }}">
  150.                             <div class="row col-md-12 justify-content-between">
  151.                                 <ul class="col-md-4 items">
  152.                                     <li class="item surface">
  153.                                         {#
  154.                                         <img src="{{ asset('img/surface.svg') }}" class="surface-logo">
  155.                                         #}
  156.                                          {{ property.area.value == null ? '' : property.area.value ~ areaConversion(property.area.unit) }}
  157.                                     </li>
  158.                                     {% if property.bedrooms != 0 %}
  159.                                         <li class="item surface">
  160.                                             <img src="{{ asset('img/icons/chambre.svg') }}" alt="Icone chambre" style="width:22px;margin-right:10px;margin-top:5px;"> {{ property.bedrooms }}
  161.                                         </li>
  162.                                     {% endif %}
  163.                                 </ul>
  164.                                 <div class="col-md-8 properties-price d-flex justify-content-end">
  165.                                     {{ property.price.value == null ? '<span style="font-size: 21px !important;">sur demande</span>' : property.price.value|number_format(2, ',', ' ') ~  property.price.currency|replace({"EUR": " €"})  }}
  166.                                 </div>
  167.                             </div>
  168.                             <p class="city">{{ property.city.name }}</p>
  169.                             <p class="project-name">{{ getTypeProperty(property.type) }}</p>
  170.                             </a>
  171.                         </div>
  172.                     {% else %}
  173.                         <h4>Aucun bien disponible avec ces critères</h4>
  174.                     {% endfor %}
  175.                 </div>
  176.                 {#<div class="text-center text-capitalize more-projects">
  177.                     <p>AFFICHER PLUS DE BIENS</p>
  178.                 </div>#}
  179.             </div>
  180.         </section>
  181.         <section class="other-properties pt-5 pb-5" style="background:#F7F7F7">
  182.             <div class="col-lg-8 mx-auto div-svg-header" style="display: flex;">
  183.                 <div class="col-lg-6">
  184.                     <svg xmlns="http://www.w3.org/2000/svg" width="9.089" height="14.77" viewBox="0 0 9.089 14.77">
  185.                         <path id="Tracé_76" data-name="Tracé 76" d="M682.759,232.441h-9.089v14.77l9.089-1.931Z" transform="translate(-673.669 -232.441)" fill="#f6a400"></path>
  186.                     </svg>
  187.                     <h1 class="project-title">
  188.                         {% if app.request.attributes.get('_route_params')['keyword'] is defined or idCategory is defined %}
  189.                             {% if (app.request.attributes.get('_route_params')['keyword'] is defined and app.request.attributes.get('_route_params')['keyword'] == 'location') or (idCategory is defined and idCategory == 1) %}
  190.                                 {% set otherDispo = 'vente' %}
  191.                             {% else %}
  192.                                 {% set otherDispo = 'location' %}
  193.                             {% endif %}
  194.                         {% else %}
  195.                             {% set otherDispo = null %}
  196.                         {% endif %}
  197.                         NOS biens disponibles<br> {% if otherDispo %}À la <span style="color:#F6A400">{{ otherDispo }}</span>{% endif %}
  198.                     </h1>
  199.                 </div>
  200.             </div>
  201.             <div  class="col-lg-8 mx-auto">
  202.                 <div id="propertiesOther" class="col-lg-12 property-other-list" style="display: flex; flex-wrap: wrap; flex-direction: row">
  203.                     {% for property in otherProperties %}
  204.                         <div  class="property-other other col-xl-4 col-lg-6 col-md-12 col-sm-12 div-img-hover-2" style="cursor: pointer">
  205.                             {#
  206.                             <div class="div-hover-2" id="div-hover-2" aria-haspopup="true" style="position: absolute; bottom: 8px; left: 9px; background-color: #242424; color: white; width: 291px; height: 70px">
  207.                                                             {% if property.comments[0].comment is not empty %}
  208.                                                                 <p class="project-content">
  209.                                                                     {{ property.comments[0].comment|slice(0, 350) }}</p>
  210.                                                                 <a href="{{ path('property-detail', {'id': property.id}) }}" class="project-arrow-2">
  211.                                                                     <span class="galerry-ref"></span><i class="fas fa-arrow-right project-svg-arrow-2"></i>
  212.                                                                 </a>
  213.                                                             {% else %}
  214.                                                                 <a style="margin-top: 180px" href="{{ path('property-detail', {'id': property.id}) }}" class="project-arrow-2">
  215.                                                                     <span class="galerry-ref"></span><i class="fas fa-arrow-right project-svg-arrow-2"></i>
  216.                                                                 </a>
  217.                                                             {% endif %}
  218.                                                         </div>
  219.                                                         <div class="col-lg-3 properties-price-absolute" style="background-color: #c48300; height: 56px;">
  220.                                                             <p style="font-size: 20px;" class="properties-price">
  221.                                                                 {{ property.price.value == null ? '<span style="font-size: 14px !important;">sur demande</span>' : property.price.value ~  property.price.currency|replace({"EUR": " €"})  }}
  222.                                                             </p>
  223.                                                         </div>
  224.                             #}
  225.                             {# <div class="tag-ref-projet-2"><span class="text-tag-ref">{{ specialPropertyCategory(property.category) }}</span></div> #}
  226.                             {% if property.pictures is not empty %}
  227.                                 <div class="position-relative properties-slide slick-slide-single-{{ loop.index }}">
  228.                                     {% for picture in property.pictures|slice(0,3) %}
  229.                                         {#                                    <img class="img-100" src="{{ picture.url }}">#}
  230.                                         {% set url = 'http' in picture.url ? picture.url : asset('uploads/images/properties/'~property.id~'/'~picture.url) %}
  231.                                         <div class="img" style="background-image: url('{{ url }}')"  onclick="location.href='{{ path('property-detail', {'id': property.id}) }}'">
  232.                                         </div>
  233.                                     {% endfor %}
  234.                                 </div>
  235.                             {% else %}
  236.                                 <div class="position-relative properties-slide">
  237.                                     <a href="{{ path('property-detail', {'id': property.id}) }}"><img src="{{ asset('build/Hudson_Ontario2.png') }}" /></a>
  238.                                 </div>
  239.                             {% endif %}
  240.                             <a href="{{ path('property-detail', {'id': property.id}) }}">
  241.                             <div class="row col-md-12 justify-content-between infos-list">
  242.                                 <ul class="col-md-4 items">
  243.                                     <li class="item surface">
  244.                                         {# <img src="{{ asset('img/surface.svg') }}" alt="icon surface" class="surface-logo"> #}
  245.                                         {{ property.area.value == null ? '' : property.area.value ~ areaConversion(property.area.unit) }}
  246.                                     </li>
  247.                                 </ul>
  248.                                 <div class="col-md-8 properties-price d-flex justify-content-end">
  249.                                     {{ property.price.value == null ? '<span style="font-size: 14px !important;">sur demande</span>' : property.price.value|number_format(2, ',', ' ') ~  property.price.currency|replace({"EUR": " €"})  }}
  250.                                 </div>
  251.                             </div>
  252.                             <p class="city">{{ property.city.name }}</p>
  253.                             <p class="project-name">{{ getTypeProperty(property.type) }}</p>
  254.                             </a>
  255.                         </div>
  256.                     {% endfor %}
  257.                 </div>
  258.                 {% set paramUrl = app.request.get('keyword') %}
  259.                 {% if app.request.get('keyword') == 'location' %}
  260.                     {% set paramUrl = 'vente' %}
  261.                 {% elseif app.request.get('keyword') == 'vente' %}
  262.                     {% set paramUrl = 'location' %}
  263.                 {% endif %}
  264.                 <div id="link-none" class="col-lg-12 mx-auto other-property-link div-svg-header d-flex justify-content-end">
  265.                     <div>
  266.                         <a id="link-none-a d-flex" class="property-span-arrow" href="{{ path('properties', {'keyword': paramUrl}) }}">Découvrir plus
  267.                             <svg class="svg-inline--fa fa-arrow-right fa-w-14 property-arrow" aria-hidden="true" focusable="false" data-prefix="fas" data-icon="arrow-right" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" data-fa-i2svg=""><path fill="currentColor" d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path></svg><!-- <i class="fas fa-arrow-right property-arrow"></i> Font Awesome fontawesome.com -->
  268.                         </a>
  269.                     </div>
  270.                 </div>
  271.             </div>
  272.         </section>
  273.         {#
  274.         <section style="margin-bottom: 80px; margin-top: 150px;">
  275.             <div class="col-lg-8 mx-auto div-svg-header">
  276.                 {% set sectionContent1 = content('Biens', 'Section-2') %}
  277.                 <div id="habiter-content-id" class="col-lg-6 habiter-content">
  278.                     <svg xmlns="http://www.w3.org/2000/svg" width="9.089" height="14.77" viewBox="0 0 9.089 14.77">
  279.                         <path id="Tracé_76" data-name="Tracé 76" d="M682.759,232.441h-9.089v14.77l9.089-1.931Z" transform="translate(-673.669 -232.441)" fill="#f6a400"/>
  280.                     </svg>
  281.                     <div class="col-lg-7">
  282.                         <h1 class="habiter-title mb-5">
  283.                             {% if sectionContent1.name is defined %}
  284.                                 {{ sectionContent1.name }}
  285.                             {% else %}
  286.                                 HABITER AU LUXEMBOURG
  287.                             {% endif %}
  288.                         </h1>
  289.                         {% if sectionContent1.content is defined %}
  290.                             {{ sectionContent1.content|raw }}
  291.                         {% else %}
  292.                             Vous avez découvert l’appartement ou la maison de vos rêves ? Parfait ! En achetant au Luxembourg vous pouvez bénéficier de plusieurs avantages fiscaux.
  293.                         {% endif %}
  294.                     </div>
  295.                 </div>
  296.                 <div id="display-none-mobile" class="col-lg-6 habiter-img">
  297.                     {% if sectionContent1.picture is defined %}
  298.                         <img id="img-property-section" class="img-100" src="/uploads/images/{{ sectionContent1.picture[0].path }}">
  299.                     {% else %}
  300.                         <img id="img-property-section" class="img-100" src="https://tracol.lu/uploads/images/millebierg-6194cb6331d44212004123.png">
  301.                     {% endif %}
  302.                 </div>
  303.             </div>
  304.             <div id="link-none" class="col-lg-8 mx-auto div-svg-header">
  305.                 <div style="display: flex; align-content: center">
  306.                     <a id="link-none-a" class="property-span-arrow" href="{{ path('habiter') }}">Découvrir les avantages
  307.                         <i class="fas fa-arrow-right property-arrow"></i>
  308.                     </a>
  309.                 </div>
  310.             </div>
  311.         </section>
  312.         #}
  313.     </div>
  314.     
  315.     <div id="img-property-section" class="container-fluid" style="display: none">
  316.         <div id="link-ok" class="col-lg-3" style="display: flex; align-content: center">
  317.             <a class="property-span-arrow" href="{{ path('habiter') }}">Découvrir les avantages
  318.                 <i class="fas fa-arrow-right property-arrow"></i>
  319.             </a>
  320.         </div>
  321.         <div class="col-lg-6 habiter-img">
  322.             {% if sectionContent1.picture is defined and sectionContent1.picture[0] is defined %}
  323.                 <img style="padding: 0px;"  class="img-100" src="/uploads/images/{{ sectionContent1.picture[0].path }}">
  324.             {% else %}
  325.                 <img style="padding: 0px;"  class="img-100" src="https://tracol.lu/uploads/images/millebierg-6194cb6331d44212004123.png">
  326.             {% endif %}
  327.         </div>
  328.     </div>
  329.     <script>
  330.         {#const slideNextHeader = document.getElementById('slideNextHeader');#}
  331.         {#const slidePreviousHeader = document.getElementById('slidePreviousHeader');#}
  332.         {#const propertiesCity = document.getElementsByClassName('properties-city')#}
  333.         {#const propertiesArea = document.getElementsByClassName('properties-area')#}
  334.         {#const propertiesReference = document.getElementsByClassName('properties-reference')#}
  335.         {#const propertiesPrice = document.getElementsByClassName('properties-price')#}
  336.         {#const propertiesLink = document.getElementsByClassName('properties-link')#}
  337.         {#const currentFigure = document.getElementsByClassName('current-figure')#}
  338.         {#const lastFigure = document.getElementsByClassName('last-figure')#}
  339.         {#let slideHeader = document.getElementById('sliderHeader');#}
  340.         {#let positionHeader = 0;#}
  341.         {#let positionThumbHeader = 1;#}
  342.         {#arraySlidesHeader = [#}
  343.         {#    {#}
  344.         {#        'position': 1,#}
  345.         {#        'img': '{{ saleProperties[0].pictures[0].url }}',#}
  346.         {#        'city': '{{ saleProperties[0].city.name }}',#}
  347.         {#        'area': '{{ saleProperties[0].area.value == null ? '' : saleProperties[0].area.value ~ areaConversion(saleProperties[0].area.unit) }}',#}
  348.         {#        'reference': '{{ saleProperties[0].reference }}',#}
  349.         {#        'price':  '{{ saleProperties[0].price.value == null ? '<span style="font-size: 14px !important;">sur demande</span>' : saleProperties[0].price.value ~  saleProperties[0].price.currency|replace({"EUR": " €"})  }}',#}
  350.         {#        'link': '{{ path('property-detail', {'id': saleProperties[0].id}) }}',#}
  351.         {#        'dot': 'dot1'#}
  352.         {#    },#}
  353.         {#    {#}
  354.         {#        'position': 2,#}
  355.         {#        'img': '{{ saleProperties[1].pictures[0].url }}',#}
  356.         {#        'city': '{{ saleProperties[1].city.name }}',#}
  357.         {#        'area': '{{ saleProperties[1].area.value == null ? '' : saleProperties[1].area.value ~ areaConversion(saleProperties[1].area.unit) }}',#}
  358.         {#        'reference': '{{ saleProperties[1].reference }}',#}
  359.         {#        'price':  '{{ saleProperties[1].price.value == null ? '<span style="font-size: 14px !important;">sur demande</span>' : saleProperties[1].price.value ~  saleProperties[1].price.currency|replace({"EUR": " €"})  }}',#}
  360.         {#        'link': '{{ path('property-detail', {'id': saleProperties[1].id}) }}',#}
  361.         {#        'dot': 'dot2'#}
  362.         {#    },#}
  363.         {#    {#}
  364.         {#        'position': 3,#}
  365.         {#        'img': '{{ saleProperties[2].pictures[0].url }}',#}
  366.         {#        'city': '{{ saleProperties[2].city.name }}',#}
  367.         {#        'area': '{{ saleProperties[2].area.value == null ? '' : saleProperties[2].area.value ~ areaConversion(saleProperties[2].area.unit) }}',#}
  368.         {#        'reference': '{{ saleProperties[2].reference }}',#}
  369.         {#        'price':  '{{ saleProperties[2].price.value == null ? '<span style="font-size: 14px !important;">sur demande</span>' : saleProperties[2].price.value ~  saleProperties[2].price.currency|replace({"EUR": " €"})  }}',#}
  370.         {#        'link': '{{ path('property-detail', {'id': saleProperties[2].id}) }}',#}
  371.         {#        'dot': 'dot3'#}
  372.         {#    },#}
  373.         {#];#}
  374.         {#slidePreviousHeader.addEventListener('click', () => {#}
  375.         {#    if (arraySlidesHeader.length < (positionThumbHeader  + 1)) {#}
  376.         {#        positionHeader = 0;#}
  377.         {#        positionThumbHeader = 1;#}
  378.         {#    } else {#}
  379.         {#        positionHeader++;#}
  380.         {#        positionThumbHeader++;#}
  381.         {#    }#}
  382.         {#    slideHeader.style.background =  `url(${arraySlidesHeader[positionHeader].img})no-repeat center`;#}
  383.         {#    propertiesCity[0].innerHTML = arraySlidesHeader[positionHeader].city#}
  384.         {#    propertiesArea[0].innerHTML = arraySlidesHeader[positionHeader].area#}
  385.         {#    propertiesReference[0].innerHTML = arraySlidesHeader[positionHeader].reference#}
  386.         {#    propertiesPrice[0].innerHTML = arraySlidesHeader[positionHeader].price#}
  387.         {#    propertiesLink[0].setAttribute('href', arraySlidesHeader[positionHeader].link)#}
  388.         {#    currentFigure[0].innerHTML = '0'+positionThumbHeader#}
  389.         {#    slideHeader.style.backgroundSize = `cover`;#}
  390.         {#});#}
  391.         {#slideNextHeader.addEventListener('click', () => {#}
  392.         {#    if (positionThumbHeader === 1) {#}
  393.         {#        positionHeader = (arraySlidesHeader.length - 1);#}
  394.         {#        positionThumbHeader = arraySlidesHeader.length;#}
  395.         {#    } else {#}
  396.         {#        positionHeader = positionHeader - 1;#}
  397.         {#        positionThumbHeader = positionThumbHeader - 1;#}
  398.         {#    }#}
  399.         {#    slideHeader.style.background =  `url(${arraySlidesHeader[positionHeader].img})no-repeat center`;#}
  400.         {#    propertiesCity[0].innerHTML = arraySlidesHeader[positionHeader].city#}
  401.         {#    propertiesArea[0].innerHTML = arraySlidesHeader[positionHeader].area#}
  402.         {#    propertiesReference[0].innerHTML = arraySlidesHeader[positionHeader].reference#}
  403.         {#    propertiesPrice[0].innerHTML = arraySlidesHeader[positionHeader].price#}
  404.         {#    currentFigure[0].innerHTML = '0'+positionThumbHeader#}
  405.         {#    slideHeader.style.backgroundSize = `cover`;#}
  406.         {#});#}
  407.         const futurProjects = document.getElementById('properties')
  408.         let buttons = document.getElementsByClassName('projectButton')
  409.         for (const eElement of buttons) {
  410.             eElement.addEventListener('click', function (e) {
  411.                 e.preventDefault()
  412.                 for (let button of buttons) {
  413.                     if (button.classList.contains('all')){
  414.                         button.classList.remove('all')
  415.                         button.classList.add('come')
  416.                         button.querySelector('span').classList.replace('span-all', 'span-projects')
  417.                     }
  418.                 }
  419.                 eElement.classList.remove('come')
  420.                 eElement.classList.add('all')
  421.                 eElement.querySelector('span').classList.replace('span-projects', 'span-all')
  422.                 fetch('properties/display/'+this.dataset.id, {
  423.                     method: 'GET',
  424.                 })
  425.                     .then(response => response.json())
  426.                     .then(data => {
  427.                         futurProjects.innerHTML = ''
  428.                         futurProjects.innerHTML = data.data
  429.                         _ww = $(window).width();
  430.                         var lightbox = $('.lightbox'),
  431.                             item = 0;
  432.                         $('.lightbox-on').click(function(e){
  433.                             e.stopPropagation();
  434.                             item = 0;
  435.                             var id = $(this).attr('data-id'),
  436.                                 max = 0;
  437.                             $('#'+id).toggle();
  438.                             $('#'+id).animate({opacity: 1}, 300);
  439.                             $('#'+id).find('img').each(function( i ) {
  440.                                 max = i;
  441.                                 item = 1;
  442.                                 counter(item, max+1);
  443.                                 itemWidth($(this));
  444.                             });
  445.                         });
  446.                         lightbox.click(function(e) {
  447.                             e.stopPropagation();
  448.                             $(this).animate({opacity: 0}, 300, function(){
  449.                                 $(this).toggle();
  450.                             });
  451.                         });
  452.                         $('.closer').on('click', function (e) {
  453.                             e.stopPropagation();
  454.                             $(this).parent().animate(
  455.                                 {opacity: 0},
  456.                                 300,
  457.                                 function(){
  458.                                     $(this).toggle();
  459.                                 }
  460.                             );
  461.                         });
  462.                         function itemWidth(img){
  463.                             img.closest('.items').width(img.width());
  464.                         }
  465.                         function counter(item, max){
  466.                             $('.counter').text(item + ' / ' + max);
  467.                         }
  468.                         $('.item', lightbox).on('click, swipeleft', function (e) {
  469.                             var wd = $(this).width(),
  470.                                 last = $(this).parent().find('.item').last(),
  471.                                 img = $(this).find('.img');
  472.                             itemWidth(img);
  473.                             $(this).animate(
  474.                                 {marginLeft: -wd, opacity: 0},
  475.                                 500,
  476.                                 'swing',
  477.                                 function(){
  478.                                     $(this).insertAfter(last);
  479.                                     $(this).css({marginLeft: 0, opacity: 1});
  480.                                 }
  481.                             );
  482.                         });
  483.                         $('.item', lightbox).on('swiperight', function (e) {
  484.                             var wd = $(this).width(),
  485.                                 first = $(this).parent().find('.item').first(),
  486.                                 last = $(this).parent().find('.item').last(),
  487.                                 img = $(this).find('.img');
  488.                             itemWidth(img);
  489.                             $(last).insertBefore($(this));
  490.                             $(last).css({marginLeft: -wd, opacity: 0});
  491.                             $(this).parent().find('.item').eq(0).animate(
  492.                                 {marginLeft: 0, opacity: 1},
  493.                                 500,
  494.                                 'swing'
  495.                             );
  496.                         });
  497.                         $('.arrows', lightbox).on('click', function (e) {
  498.                             e.stopPropagation();
  499.                             var wd = $(this).siblings('.items').find('.item').eq(0).width(),
  500.                                 max = $(this)
  501.                                     .siblings('.items').find('.item').length,
  502.                                 first = $(this).siblings('.items').find('.item').first(),
  503.                                 last = $(this).siblings('.items').find('.item').last(),
  504.                                 isRight = $(this).hasClass('right'),
  505.                                 marginL = isRight ? -wd : 0,
  506.                                 marginL0 = isRight ? 0: -wd,
  507.                                 opacOn = isRight ? 1 : 0,
  508.                                 opacOff = isRight ? 0 : 1;
  509.                             if (!isRight){
  510.                                 $(last).insertBefore(first);
  511.                                 $(last).css({marginLeft: -wd, opacity: 0});
  512.                                 item++;
  513.                                 if (item == max+1) {item = 1};
  514.                             } else {
  515.                                 item--;
  516.                                 if (item == 0) {item = max};
  517.                             };
  518.                             counter(item, max);
  519.                             var img = $(this).siblings('.items').find('.item').eq(0).find('.img');
  520.                             itemWidth(img);
  521.                             $(this).siblings('.items').find('.item').eq(1).animate(
  522.                                 {opacity: opacOn},
  523.                                 500,
  524.                                 'swing');
  525.                             $(this).siblings('.items').find('.item').eq(0).animate(
  526.                                 {marginLeft: marginL, opacity: 1},
  527.                                 500,
  528.                                 'swing',
  529.                                 function(){
  530.                                     if (isRight){
  531.                                         $(this).insertAfter(last);
  532.                                         $(this).css({ marginLeft: 0, opacity: 1});
  533.                                     }
  534.                                 }
  535.                             );
  536.                         });
  537.                         if (_ww > 768){
  538.                             $('.div-img-hover-2').hover(function (e) {
  539.                                 $(this).find('.project-arrow-2').animate({opacity: 1}, 150);
  540.                                 var htext = $(this).find('.project-content').height();
  541.                                 if (htext == undefined){htext = 0};
  542.                                 $(this).find('.div-hover-2').animate({height : htext+180}, 150);
  543.                                 $(this).find('.project-content').css({'visibility': 'visible'});
  544.                                 $(this).find('.project-content').animate({opacity: 1}, 150);
  545.                             }, function() {
  546.                                 $(this).find('.div-hover-2').animate({height : 85}, 150);
  547.                                 $(this).find('.project-arrow-2').animate({opacity: 0}, 150);
  548.                                 $(this).find('.project-content').animate({opacity: 0}, 150, function(){
  549.                                     $(this).find('.project-content').css({'visibility': 'hidden'});
  550.                                 });
  551.                             });
  552.                         } else {
  553.                             $('.div-img-hover-2').on( "tap", function( event ) {
  554.                                 var opened = $(this).find('.div-hover-2').hasClass('open'),
  555.                                     ht = opened ? 85 : '100%',
  556.                                     vis = opened ? 0 : 1;
  557.                                 $(this).find('.div-hover-2').toggleClass('open');
  558.                                 $(this).find('.div-hover-2').animate({height : ht}, 150);
  559.                                 $(this).find('.project-arrow-2').animate({opacity: vis}, 150);
  560.                             });
  561.                         }
  562.                     })
  563.                     .catch((error) => {
  564.                         console.error('Error:', error);
  565.                     });
  566.             })
  567.         }
  568.         if (window.matchMedia("(max-width: 768px)").matches) {
  569.             new Flicking("#flick3", {
  570.                 moveType: "freeScroll",
  571.                 bound: true
  572.             });
  573.         }
  574.         if (window.matchMedia("(max-width: 768px)").matches) {
  575.             const test = document.getElementsByClassName('select-filter')
  576.             for (const testElement of test) {
  577.                 testElement.addEventListener('click', function (e) {
  578.                     e.preventDefault()
  579.                     testElement.classList.toggle('select-projet-active')
  580.                     const infos = document.querySelector('.projectButton.all')
  581.                     const dataId = []
  582.                     const tests = document.querySelectorAll('.select-filter.select-projet-active')
  583.                     for (const test1 of tests) {
  584.                         dataId.push(parseFloat(test1.dataset.id))
  585.                     }
  586.                     fetch('properties/display/'+infos.dataset.id+'/params/' + JSON.stringify(dataId), {
  587.                         method: 'GET',
  588.                     })
  589.                         .then(response => response.json())
  590.                         .then(data => {
  591.                             futurProjects.innerHTML = data.data
  592.                         })
  593.                         .catch((error) => {
  594.                             console.error('Error:', error);
  595.                         });
  596.                 })
  597.             }
  598.         } else {
  599.             const test = document.getElementsByClassName('select-projet')
  600.             const textOutput = document.querySelector("#showOutput");
  601.             for (const testElement of test) {
  602.                 testElement.addEventListener('click', function (e) {
  603.                     displayLoading()
  604.                     e.preventDefault()
  605.                     testElement.classList.toggle('select-projet-active')
  606.                     const infos = document.querySelector('.projectButton.all')
  607.                     const dataId = []
  608.                     const tests = document.querySelectorAll('.select-projet.select-projet-active')
  609.                     for (const test1 of tests) {
  610.                         dataId.push(parseFloat(test1.dataset.id))
  611.                     }
  612.                     fetch('properties/display/'+infos.dataset.id+'/params/' + JSON.stringify(dataId), {
  613.                         method: 'GET'
  614.                     })
  615.                         .then(response => response.json())
  616.                         .then(data => {
  617.                             hideLoading()
  618.                             futurProjects.innerHTML = data.data
  619.                             _ww = $(window).width();
  620.                             var lightbox = $('.lightbox'),
  621.                                 item = 0;
  622.                             $('.lightbox-on').click(function(e){
  623.                                 e.stopPropagation();
  624.                                 item = 0;
  625.                                 var id = $(this).attr('data-id'),
  626.                                     max = 0;
  627.                                 $('#'+id).toggle();
  628.                                 $('#'+id).animate({opacity: 1}, 300);
  629.                                 $('#'+id).find('img').each(function( i ) {
  630.                                     max = i;
  631.                                     item = 1;
  632.                                     counter(item, max+1);
  633.                                     itemWidth($(this));
  634.                                 });
  635.                             });
  636.                             lightbox.click(function(e) {
  637.                                 e.stopPropagation();
  638.                                 $(this).animate({opacity: 0}, 300, function(){
  639.                                     $(this).toggle();
  640.                                 });
  641.                             });
  642.                             $('.closer').on('click', function (e) {
  643.                                 e.stopPropagation();
  644.                                 $(this).parent().animate(
  645.                                     {opacity: 0},
  646.                                     300,
  647.                                     function(){
  648.                                         $(this).toggle();
  649.                                     }
  650.                                 );
  651.                             });
  652.                             function itemWidth(img){
  653.                                 img.closest('.items').width(img.width());
  654.                             }
  655.                             function counter(item, max){
  656.                                 $('.counter').text(item + ' / ' + max);
  657.                             }
  658.                             $('.item', lightbox).on('click, swipeleft', function (e) {
  659.                                 var wd = $(this).width(),
  660.                                     last = $(this).parent().find('.item').last(),
  661.                                     img = $(this).find('.img');
  662.                                 itemWidth(img);
  663.                                 $(this).animate(
  664.                                     {marginLeft: -wd, opacity: 0},
  665.                                     500,
  666.                                     'swing',
  667.                                     function(){
  668.                                         $(this).insertAfter(last);
  669.                                         $(this).css({marginLeft: 0, opacity: 1});
  670.                                     }
  671.                                 );
  672.                             });
  673.                             $('.item', lightbox).on('swiperight', function (e) {
  674.                                 var wd = $(this).width(),
  675.                                     first = $(this).parent().find('.item').first(),
  676.                                     last = $(this).parent().find('.item').last(),
  677.                                     img = $(this).find('.img');
  678.                                 itemWidth(img);
  679.                                 $(last).insertBefore($(this));
  680.                                 $(last).css({marginLeft: -wd, opacity: 0});
  681.                                 $(this).parent().find('.item').eq(0).animate(
  682.                                     {marginLeft: 0, opacity: 1},
  683.                                     500,
  684.                                     'swing'
  685.                                 );
  686.                             });
  687.                             $('.arrows', lightbox).on('click', function (e) {
  688.                                 e.stopPropagation();
  689.                                 var wd = $(this).siblings('.items').find('.item').eq(0).width(),
  690.                                     max = $(this)
  691.                                         .siblings('.items').find('.item').length,
  692.                                     first = $(this).siblings('.items').find('.item').first(),
  693.                                     last = $(this).siblings('.items').find('.item').last(),
  694.                                     isRight = $(this).hasClass('right'),
  695.                                     marginL = isRight ? -wd : 0,
  696.                                     marginL0 = isRight ? 0: -wd,
  697.                                     opacOn = isRight ? 1 : 0,
  698.                                     opacOff = isRight ? 0 : 1;
  699.                                 if (!isRight){
  700.                                     $(last).insertBefore(first);
  701.                                     $(last).css({marginLeft: -wd, opacity: 0});
  702.                                     item++;
  703.                                     if (item == max+1) {item = 1};
  704.                                 } else {
  705.                                     item--;
  706.                                     if (item == 0) {item = max};
  707.                                 };
  708.                                 counter(item, max);
  709.                                 var img = $(this).siblings('.items').find('.item').eq(0).find('.img');
  710.                                 itemWidth(img);
  711.                                 $(this).siblings('.items').find('.item').eq(1).animate(
  712.                                     {opacity: opacOn},
  713.                                     500,
  714.                                     'swing');
  715.                                 $(this).siblings('.items').find('.item').eq(0).animate(
  716.                                     {marginLeft: marginL, opacity: 1},
  717.                                     500,
  718.                                     'swing',
  719.                                     function(){
  720.                                         if (isRight){
  721.                                             $(this).insertAfter(last);
  722.                                             $(this).css({ marginLeft: 0, opacity: 1});
  723.                                         }
  724.                                     }
  725.                                 );
  726.                             });
  727.                             if (_ww > 768){
  728.                                 $('.div-img-hover-2').hover(function (e) {
  729.                                     $(this).find('.project-arrow-2').animate({opacity: 1}, 150);
  730.                                     var htext = $(this).find('.project-content').height();
  731.                                     if (htext == undefined){htext = 0};
  732.                                     $(this).find('.div-hover-2').animate({height : htext+180}, 150);
  733.                                     $(this).find('.project-content').css({'visibility': 'visible'});
  734.                                     $(this).find('.project-content').animate({opacity: 1}, 150);
  735.                                 }, function() {
  736.                                     $(this).find('.div-hover-2').animate({height : 85}, 150);
  737.                                     $(this).find('.project-arrow-2').animate({opacity: 0}, 150);
  738.                                     $(this).find('.project-content').animate({opacity: 0}, 150, function(){
  739.                                         $(this).find('.project-content').css({'visibility': 'hidden'});
  740.                                     });
  741.                                 });
  742.                             } else {
  743.                                 $('.div-img-hover-2').on( "tap", function( event ) {
  744.                                     var opened = $(this).find('.div-hover-2').hasClass('open'),
  745.                                         ht = opened ? 85 : '100%',
  746.                                         vis = opened ? 0 : 1;
  747.                                     $(this).find('.div-hover-2').toggleClass('open');
  748.                                     $(this).find('.div-hover-2').animate({height : ht}, 150);
  749.                                     $(this).find('.project-arrow-2').animate({opacity: vis}, 150);
  750.                                 });
  751.                             }
  752.                             $('.div-hover').hover(function (e) {
  753.                                 $(this).find('.project-arrow-2').animate({opacity: 1}, 150);
  754.                             }, function() {
  755.                                 $(this).find('.project-arrow-2').animate({opacity: 0}, 50);
  756.                             });
  757.                         })
  758.                         .catch((error) => {
  759.                         });
  760.                 })
  761.             }
  762.         }
  763.         const filter = document.getElementById('filters')
  764.         const filterElement = document.getElementById('form-search-filter-ajax')
  765.         filter.addEventListener('click', function (e) {
  766.             e.preventDefault()
  767.             filterElement.classList.toggle('show')
  768.         })
  769.         const loader = document.querySelector("#loading");
  770.         function displayLoading() {
  771.             loader.classList.add("display");
  772.             // to stop loading after some time
  773.             setTimeout(() => {
  774.                 loader.classList.remove("display");
  775.             }, 5000);
  776.         }
  777.         // hiding loading
  778.         function hideLoading() {
  779.             loader.classList.remove("display");
  780.         }
  781.     </script>
  782.     <script>
  783.         const arrowPrev = `<svg xmlns="http://www.w3.org/2000/svg" width="7.985" height="13.211" viewBox="0 0 7.985 13.211">
  784.                                 <path id="np_arrow-up_888648_000000" d="M13.211,1.381l-6.606,6.6L0,1.381,1.381,0,6.606,5.022h0L11.83,0Z" transform="translate(7.985) rotate(90)" fill="#fff"/>
  785.                             </svg>`;
  786.         const arrowNext= `<svg xmlns="http://www.w3.org/2000/svg" width="7.985" height="13.211" viewBox="0 0 7.985 13.211">
  787.                             <path id="np_arrow-up_888648_000000" d="M13.211,1.381l-6.606,6.6L0,1.381,1.381,0,6.606,5.022h0L11.83,0Z" transform="translate(7.985) rotate(90)" fill="#fff"/>
  788.                         </svg>`;
  789.         var countProperties = '{{ properties|length }}';
  790.         var loopProp = 1;
  791.         while (loopProp <= countProperties+3) {
  792.             $('.slick-slide-single-'+loopProp).slick({
  793.                 'slidesToShow': 1,
  794.                 'prevArrow': `<div class="arrow-left square-black d-flex justify-content-center align-items-center position-absolute">${arrowPrev}</div>`,
  795.                 'nextArrow': `<div class="arrow-right square-black d-flex justify-content-center align-items-center position-absolute">${arrowNext}</div>`
  796.             });
  797.             {#
  798.             if (window.innerWidth > 768) {
  799.                 $('.slick-slide-single-'+loopProp).slick({
  800.                     'slidesToShow': 1,
  801.                     'prevArrow': `<div class="arrow-left square-black d-flex justify-content-center align-items-center position-absolute">${arrowPrev}</div>`,
  802.                     'nextArrow': `<div class="arrow-right square-black d-flex justify-content-center align-items-center position-absolute">${arrowNext}</div>`
  803.                 });
  804.             }
  805.             #}
  806.             loopProp++;
  807.         }
  808.     </script>
  809. {% endblock %}