templates/property.html.twig line 7

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