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