templates/reference.html.twig line 7

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}References{% endblock %}
  3. {% block body %}
  4.     {% set headerContent = content('Reference', '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" style="background-image: url('/uploads/images/{{ backgroundImage }}');">
  12.         <div class="col-lg-8 mx-auto div-svg-header">
  13.             {% if headerContent.name is defined %}
  14.                 <div class="header-habiter-div">
  15.                     <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>
  16.                     <h2 class="header-habiter-title col-lg-12">{{ headerContent.name }}</h2>
  17.                 </div>
  18.             {% endif %}
  19.         </div>
  20.     </header>
  21.     #}
  22.     <div class="container-fluid reference-page">
  23.         {% set sectionContent1 = content('Reference', 'Section-1') %}
  24.         <div class="col-lg-8 mx-auto div-svg-header pre-section">
  25.             <div class="col-lg-4" style="font-size: 2.3em;display: flex;flex-direction: column;margin-left: 10px;">
  26.                 <svg xmlns="http://www.w3.org/2000/svg" width="9.089" height="14.77" viewBox="0 0 9.089 14.77">
  27.                     <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"/>
  28.                 </svg>
  29.                 {% if references|length == 0 %}
  30.                     <h1 class="project-title">pas de reference</h1>
  31.                 {% elseif references|length == 1  %}
  32.                     <h1 class="project-title">{{ references|length }} référence</h1>
  33.                 {% else %}
  34.                     <h1 class="project-title">{{ references|length }} références</h1>
  35.                 {% endif %}
  36.             </div>
  37.             {% if sectionContent1.content is defined %}
  38.                 <div class="separator"></div>
  39.                 <div id="section-1-reference" class="col-lg-6 pre-section-content">
  40.                     {{ sectionContent1.content|raw }}
  41.                 </div>
  42.             {% endif %}
  43.         </div>
  44.         <section class="project" style="margin-bottom: 120px">
  45.             <div id="button-reference-page"  class="col-lg-8 mx-auto div-svg-header" style="display: flex; align-items: center; padding-left: 7px">
  46.                 <div class="input-filter">
  47.                     <label for="all-references">TOUS</label>
  48.                     <input data-id="all" type="radio" name="type" id="all-references" class="mr-3 projectButton">
  49.                 </div>
  50.                 <div class="input-filter">
  51.                     <label for="residences-references">RÉSIDENCES</label>
  52.                     <input data-id="residences" type="radio" name="type" id="residences-references" class="mr-3 projectButton">
  53.                 </div>
  54.                 <div class="input-filter">
  55.                     <label for="maisons-references">MAISONS</label>
  56.                     <input data-id="maisons" type="radio" name="type" id="maisons-references" class=" projectButton">
  57.                 </div>
  58.                 <div class="input-filter">
  59.                     <label for="commerces-references">COMMERCES</label>
  60.                     <input data-id="commerces" type="radio" name="type" id="commerces-references" class=" projectButton">
  61.                 </div>
  62.                 <div class="input-filter">
  63.                     <label for="bureaux-references">BUREAUX</label>
  64.                     <input data-id="bureaux" type="radio" name="type" id="bureaux-references" class=" projectButton">
  65.                 </div>
  66.                 {#
  67.                 <button data-id="all" class="btn btn-primary all border-radius projectButton"><span class="span-all">TOUS</span></button>
  68.                 <button data-id="residences" class="btn btn-primary come border-radius projectButton"><span class="span-projects">RÉSIDENCES</span></button>
  69.                 <button data-id="maisons" class="btn btn-primary come border-radius projectButton"><span class="span-projects">MAISONS</span></button>
  70.                 <button data-id="commerces" class="btn btn-primary come border-radius projectButton"><span class="span-projects">COMMERCES</span></button>
  71.                 <button data-id="bureaux" class="btn btn-primary come border-radius projectButton"><span class="span-projects">BUREAUX</span></button>
  72.                 #}
  73.             </div>
  74.             <div id="button-reference-page-mobile" class="col-lg-8 mx-auto div-svg-header" style="display: none; align-items: center">
  75.                 <div id="flick5" class="flicking-viewport">
  76.                     <div class="flicking-camera">
  77.                         <button data-id="all" class="btn btn-primary all border-radius projectButton"><span class="span-all">TOUS</span></button>
  78.                         <button data-id="residences" class="btn btn-primary come border-radius projectButton"><span class="span-projects">RÉSIDENCES</span></button>
  79.                         <button data-id="maisons" class="btn btn-primary come border-radius projectButton"><span class="span-projects">MAISONS</span></button>
  80.                         <button data-id="commerces" class="btn btn-primary come border-radius projectButton"><span class="span-projects">COMMERCES</span></button>
  81.                         <button data-id="bureaux" class="btn btn-primary come border-radius projectButton"><span class="span-projects">BUREAUX</span></button>
  82.                     </div>
  83.                 </div>
  84.             </div>
  85.             <div id="reference" class="col-lg-8 mx-auto div-svg-header" style="display: flex; flex-direction: column; justify-content: center">
  86.                 {% for key, reference in references %}
  87.                     <div class="col-lg-12 div-img-hover-2 position-relative reference-list-single">
  88.                         <div class="div-hover-2" id="div-hover-2" style="position: absolute; bottom: 8px; left: 8px; background-color: #242424; color: white; height: 85px">
  89.                             <div class="d-flex justify-content-between">
  90.                                 <p class="city">{{ reference.city.name }}</p>
  91.                                 <p class="date-ref">{{ reference.updated_at|date("d/m/Y") }}</p>
  92.                             </div>
  93.                             <p class="project-name">{{ reference.reference }}</p>
  94.                             {% if reference.comments[0].comment is not empty %}
  95.                                 <p class="project-content" style="visibility: hidden">
  96.                                     {{ reference.comments[0].comment|slice(0, 350) }}
  97.                                 </p>
  98.                                 <a href="javascript:void(0);" class="project-arrow-2 lightbox-on" data-id="modul-{{ key }}">
  99.                                     <span class="galerry-ref">GALERIES PHOTOS</span><i class="fas fa-arrow-right project-svg-arrow-2"></i>
  100.                                 </a>
  101.                             {% else %}
  102.                                 <a style="margin-top: 180px" href="javascript:void(0);" class="project-arrow-2 lightbox-on">
  103.                                     <span class="galerry-ref">GALERIES PHOTOS</span><i class="fas fa-arrow-right project-svg-arrow-2"></i>
  104.                                 </a>
  105.                             {% endif %}
  106.                         </div>
  107.                         <div class="tag-ref-projet-2"><span class="text-tag-ref">{{ getTypeReferences(reference.type) }}</span></div>
  108.                         {% if reference.pictures is not empty %}
  109.                             {% for picture in reference.pictures|slice(0,1) %}
  110.                                 <div class="img" style="background-image: url('{{ picture.url }}')"></div>
  111.                             {% endfor %}
  112.                         {% else %}
  113.                             <div class="img" style="background-image: url('{{ asset('build/Hudson_Ontario2.png') }}')"></div>
  114.                         {% endif %}
  115.                     </div>
  116.                     <div class="lightbox" id="modul-{{ key }}">
  117.                         <div class="closer"></div>
  118.                         <div class="arrows left">&#8592;</div>
  119.                         <div class="arrows right">&#8594;</div>
  120.                         <div class="counter">1/1</div>
  121.                         <ul class="items">
  122.                             {% for picture in reference.pictures %}
  123.                                 <li class="item">
  124.                                     <img class="img" src="{{ picture.url }}">
  125.                                 </li>
  126.                             {% endfor %}
  127.                         </ul>
  128.                     </div>
  129.                 {% endfor %}
  130.                 <div class="text-center text-capitalize more-projects">
  131.                     <p>AFFICHER PLUS DE REFERENCES</p>
  132.                 </div>
  133.             </div>
  134.         </section>
  135.     </div>
  136.     <script>
  137.         for (const eElement of document.getElementsByClassName('projectButton')) {
  138.             eElement.addEventListener('click', function (e) {
  139.                 e.preventDefault()
  140.                 for (let button of document.getElementsByClassName('projectButton')) {
  141.                     if (button.classList.contains('all')){
  142.                         button.classList.remove('all')
  143.                         button.classList.add('come')
  144.                         //button.querySelector('span').classList.replace('span-all', 'span-projects')
  145.                     }
  146.                 }
  147.                 eElement.classList.remove('come')
  148.                 eElement.classList.add('all')
  149.                 //eElement.querySelector('span').classList.replace('span-projects', 'span-all')
  150.                 fetch('references/display/'+this.dataset.id, {
  151.                     method: 'GET',
  152.                 })
  153.                     .then(response => response.json())
  154.                     .then(data => {
  155.                         console.log(data)
  156.                         document.getElementById('reference').innerHTML = ''
  157.                         document.getElementById('reference').innerHTML = data.data
  158.                         _ww = $(window).width();
  159.                         var lightbox = $('.lightbox'),
  160.                             item = 0;
  161.                         $('.lightbox-on').click(function(e){
  162.                             e.stopPropagation();
  163.                             item = 0;
  164.                             console.log('click btn');
  165.                             var id = $(this).attr('data-id'),
  166.                                 max = 0;
  167.                             $('#'+id).toggle();
  168.                             $('#'+id).animate({opacity: 1}, 300);
  169.                             $('#'+id).find('img').each(function( i ) {
  170.                                 //console.log('h : '+$(this).height());
  171.                                 //console.log('w : '+$(this).width());
  172.                                 max = i;
  173.                                 item = 1;
  174.                                 counter(item, max+1);
  175.                                 itemWidth($(this));
  176.                             });
  177.                         });
  178.                         lightbox.click(function(e) {
  179.                             e.stopPropagation();
  180.                             $(this).animate({opacity: 0}, 300, function(){
  181.                                 $(this).toggle();
  182.                             });
  183.                         });
  184.                         $('.closer').on('click', function (e) {
  185.                             e.stopPropagation();
  186.                             $(this).parent().animate(
  187.                                 {opacity: 0},
  188.                                 300,
  189.                                 function(){
  190.                                     $(this).toggle();
  191.                                 }
  192.                             );
  193.                         });
  194.                         function itemWidth(img){
  195.                             img.closest('.items').width(img.width());
  196.                         }
  197.                         function counter(item, max){
  198.                             $('.counter').text(item + ' / ' + max);
  199.                         }
  200.                         $('.item', lightbox).on('click, swipeleft', function (e) {
  201.                             var wd = $(this).width(),
  202.                                 last = $(this).parent().find('.item').last(),
  203.                                 img = $(this).find('.img');
  204.                             itemWidth(img);
  205.                             $(this).animate(
  206.                                 {marginLeft: -wd, opacity: 0},
  207.                                 500,
  208.                                 'swing',
  209.                                 function(){
  210.                                     $(this).insertAfter(last);
  211.                                     $(this).css({marginLeft: 0, opacity: 1});
  212.                                 }
  213.                             );
  214.                         });
  215.                         $('.item', lightbox).on('swiperight', function (e) {
  216.                             var wd = $(this).width(),
  217.                                 first = $(this).parent().find('.item').first(),
  218.                                 last = $(this).parent().find('.item').last(),
  219.                                 img = $(this).find('.img');
  220.                             itemWidth(img);
  221.                             $(last).insertBefore($(this));
  222.                             $(last).css({marginLeft: -wd, opacity: 0});
  223.                             $(this).parent().find('.item').eq(0).animate(
  224.                                 {marginLeft: 0, opacity: 1},
  225.                                 500,
  226.                                 'swing'
  227.                             );
  228.                         });
  229.                         $('.arrows', lightbox).on('click', function (e) {
  230.                             e.stopPropagation();
  231.                             var wd = $(this).siblings('.items').find('.item').eq(0).width(),
  232.                                 max = $(this)
  233.                                     .siblings('.items').find('.item').length,
  234.                                 first = $(this).siblings('.items').find('.item').first(),
  235.                                 last = $(this).siblings('.items').find('.item').last(),
  236.                                 isRight = $(this).hasClass('right'),
  237.                                 marginL = isRight ? -wd : 0,
  238.                                 marginL0 = isRight ? 0: -wd,
  239.                                 opacOn = isRight ? 1 : 0,
  240.                                 opacOff = isRight ? 0 : 1;
  241.                             if (!isRight){
  242.                                 $(last).insertBefore(first);
  243.                                 $(last).css({marginLeft: -wd, opacity: 0});
  244.                                 item++;
  245.                                 if (item == max+1) {item = 1};
  246.                             } else {
  247.                                 item--;
  248.                                 if (item == 0) {item = max};
  249.                             };
  250.                             counter(item, max);
  251.                             var img = $(this).siblings('.items').find('.item').eq(0).find('.img');
  252.                             itemWidth(img);
  253.                             $(this).siblings('.items').find('.item').eq(1).animate(
  254.                                 {opacity: opacOn},
  255.                                 500,
  256.                                 'swing');
  257.                             $(this).siblings('.items').find('.item').eq(0).animate(
  258.                                 {marginLeft: marginL, opacity: 1},
  259.                                 500,
  260.                                 'swing',
  261.                                 function(){
  262.                                     if (isRight){
  263.                                         $(this).insertAfter(last);
  264.                                         $(this).css({ marginLeft: 0, opacity: 1});
  265.                                     }
  266.                                 }
  267.                             );
  268.                         });
  269.                         if (_ww > 768){
  270.                             $('.div-img-hover-2').hover(function (e) {
  271.                                 $(this).find('.project-arrow-2').animate({opacity: 1}, 150);
  272.                                 var htext = $(this).find('.project-content').height();
  273.                                 if (htext == undefined){htext = 0};
  274.                                 $(this).find('.div-hover-2').animate({height : htext+180}, 150);
  275.                                 $(this).find('.project-content').css({'visibility': 'visible'});
  276.                                 $(this).find('.project-content').animate({opacity: 1}, 150);
  277.                             }, function() {
  278.                                 console.log('down');
  279.                                 $(this).find('.div-hover-2').animate({height : 85}, 150);
  280.                                 $(this).find('.project-arrow-2').animate({opacity: 0}, 150);
  281.                                 $(this).find('.project-content').animate({opacity: 0}, 150, function(){
  282.                                     $(this).find('.project-content').css({'visibility': 'hidden'});
  283.                                 });
  284.                             });
  285.                         } else {
  286.                             $('.div-img-hover-2').on( "tap", function( event ) {
  287.                                 console.log('tap tap');
  288.                                 var opened = $(this).find('.div-hover-2').hasClass('open'),
  289.                                     ht = opened ? 85 : '100%',
  290.                                     vis = opened ? 0 : 1;
  291.                                 $(this).find('.div-hover-2').toggleClass('open');
  292.                                 $(this).find('.div-hover-2').animate({height : ht}, 150);
  293.                                 $(this).find('.project-arrow-2').animate({opacity: vis}, 150);
  294.                             });
  295.                         }
  296.                         $('.div-hover').hover(function (e) {
  297.                             $(this).find('.project-arrow-2').animate({opacity: 1}, 150);
  298.                         }, function() {
  299.                             $(this).find('.project-arrow-2').animate({opacity: 0}, 50);
  300.                         });
  301.                     })
  302.                     .catch((error) => {
  303.                         console.error('Error:', error);
  304.                     });
  305.             })
  306.         }
  307.         if (window.matchMedia("(max-width: 768px)").matches) {
  308.             new Flicking("#flick5", {
  309.                 moveType: "freeScroll",
  310.                 bound: true
  311.             });
  312.         }
  313.     </script>
  314. {#    <script>#}
  315. {#        $('.slider-ref-detail').slick({#}
  316. {#            dots: false,#}
  317. {#            infinite: true,#}
  318. {#            speed: 300,#}
  319. {#            slidesToShow: 1,#}
  320. {#            slidesToScroll: 1,#}
  321. {#            autoplay: true,#}
  322. {#            responsive: [#}
  323. {#                {#}
  324. {#                    breakpoint: 576,#}
  325. {#                    settings: {#}
  326. {#                        slidesToShow: 1,#}
  327. {#                        slidesToScroll: 1#}
  328. {#                    }#}
  329. {#                }#}
  330. {#                // You can unslick at a given breakpoint now by adding:#}
  331. {#                // settings: "unslick"#}
  332. {#                // instead of a settings object#}
  333. {#            ]#}
  334. {#        });#}
  335. {#    </script>#}
  336. {% endblock %}