templates/front/hunt/show.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{ offer.title }}{% endblock %}
  3. {% block meta %}
  4.     <meta name="description" content="{{ offer.unfoldsDay }}">
  5. {% endblock %}
  6. {% block bodyClass %}{{ offer.type }}{% endblock %}
  7. {% block body %}
  8.     <div class="return"><a href="javascript:history.back();"> Retour </a></div>
  9.     {% for message in app.flashes('error') %}
  10.         <div class="alert alert-danger">
  11.             {{ message }}
  12.         </div>
  13.     {% endfor %}
  14.     <div class="offer-show">
  15.         {% set territory = offer.getTerritory() %}
  16.         {% if offer.images|length == 0 %}
  17.             {% set imagesLength = territory.images|length %}
  18.         {% else %}
  19.             {% set imagesLength = offer.images|length %}
  20.         {% endif %}
  21.         <div class="alg">
  22.             <div class=" images offer-mobile-image {% if imagesLength == 0 %} i_one {% elseif imagesLength == 1 %} i_two  {% else %}  i_three {% endif %}"
  23.                  {% if imagesLength == 1 %}style="grid-template-columns:100%"
  24.                  {% elseif imagesLength == 2 %}style="grid-template-columns:50% 50%"
  25.                  {% else %}style="grid-template-columns:40% repeat({{ imagesLength }},30%)"{% endif %}>
  26.                 {% if offer.getImages()|length == 0 %}
  27.                     {% if territory and territory.images and territory.images|length > 0 %}
  28.                         {% for image in territory.images %}
  29.                             <a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
  30.                                         src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
  31.                         {% endfor %}
  32.                     {% else %}
  33.                         <a class="single_image" data-fancybox="gallery"
  34.                            href="{{ asset('build/images/default.png') }}"><img class="full-width"
  35.                                                                                      src="{{ asset('build/images/default.png') }}"
  36.                                                                                      alt="{{ offer.title }}"></a>
  37.                     {% endif %}
  38.                 {% elseif offer.getImages()|length == 1 %}
  39.                     <a class="single_image" data-fancybox="gallery"
  40.                        href="{{ asset('upload/'~offer.getImages()[0]) }}"><img class="full-width"
  41.                                                                                src="{{ asset('upload/'~offer.getImages()[0]) }}"
  42.                                                                                alt="{{ offer.title }}"></a>
  43.                 {% else %}
  44.                     {% for image in offer.getImages() %}
  45.                         <a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
  46.                                     src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
  47.                     {% endfor %}
  48.                 {% endif %}
  49.             </div>
  50.             <div class=" images offer-pc-image {% if imagesLength == 0 %} i_one {% elseif imagesLength == 1 %} i_two  {% else %}  i_three {% endif %}"
  51.                  {% if imagesLength == 1 %}style="grid-template-columns:100%"
  52.                  {% elseif imagesLength == 2 %}style="grid-template-columns:50% 50%"
  53.                  {% else %}style="grid-template-columns:40% repeat({{ imagesLength }},30%)"{% endif %}>
  54.                 {% if offer.getImages()|length == 0 %}
  55.                     {% if territory and territory.images and territory.images|length > 0 %}
  56.                         {% for image in territory.images %}
  57.                             <a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
  58.                                         src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
  59.                         {% endfor %}
  60.                     {% else %}
  61.                         <a class="single_image" data-fancybox="gallery"
  62.                            href="{{ asset('build/images/default.png') }}"><img class="full-width"
  63.                                                                                src="{{ asset('build/images/default.png') }}"
  64.                                                                                alt="{{ offer.title }}"></a>
  65.                     {% endif %}
  66.                 {% elseif offer.getImages()|length == 1 %}
  67.                     <a class="single_image" data-fancybox="gallery"
  68.                        href="{{ asset('upload/'~offer.getImages()[0]) }}"><img class="full-width"
  69.                                                                                src="{{ asset('upload/'~offer.getImages()[0]) }}"
  70.                                                                                alt="{{ offer.title }}"></a>
  71.                 {% else %}
  72.                     {% if offer.getImages()|length >= 4 %}
  73.                         {% for image in offer.getImages() %}
  74.                             {% if loop.index0 < 2 %}
  75.                                 <a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
  76.                                             src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
  77.                             {% elseif loop.index >= 2 %}
  78.                                 {% if loop.index0 == 2 %}<div style="height: 530px;" class="four-images-container">{% endif %}
  79.                                 <a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
  80.                                             src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}" style="height: 50%;width:100%"></a>
  81.                                 {% if loop.index0 == 4 %}</div>{% endif %}
  82.                             {% endif %}
  83.                         {% endfor %}
  84.                     {% else %}
  85.                         {% for image in offer.getImages() %}
  86.                             <a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
  87.                                         src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
  88.                         {% endfor %}
  89.                     {% endif %}
  90.                 {% endif %}
  91.             </div>
  92.             {% if imagesLength == 0 %}
  93.                 {% set imagesLength = 1 %}
  94.             {% endif %}
  95.             <span class="nb_images"> {{ imagesLength }} / {{ imagesLength }} <span
  96.                         class="a_mob"> photos </span> </span>
  97.             <a href="javascript:history.back();" class="back-show">
  98.                 <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
  99.                     <path data-name=""
  100.                           d="M233.218 162.145h-11.907l4.936 4.936a1.014 1.014 0 1 1-1.434 1.434l-6.671-6.671a1.007 1.007 0 0 1 0-1.434l6.671-6.671a1.014 1.014 0 1 1 1.434 1.434l-4.936 4.97h11.907a1 1 0 0 1 0 2z"
  101.                           transform="translate(-213.866 -149.485)" style="fill:#172a3b;fill-rule:evenodd"></path>
  102.                 </svg>
  103.             </a>
  104.         </div>
  105.         <div class="body">
  106.             {% if offer.type == 'br' %}
  107.                 {{ include('front/hunt/bracelet.html.twig') }}
  108.             {% endif %}
  109.             {% if offer.type == 'ac' %}
  110.                 {{ include('front/hunt/action.html.twig') }}
  111.             {% endif %}
  112.             {% if offer.type == 'jr' %}
  113.                 {{ include('front/hunt/journey.html.twig') }}
  114.             {% endif %}
  115.         </div>
  116.     </div>
  117.     {% if similarOffers|length > 0 %}
  118.           <div class="similar-offers">
  119.               <div>
  120.                   <ul class="carousel_slides">
  121.                       {% for similar in  similarOffers %}
  122.                           {% set offer = similar[0] %}
  123.                           <li>
  124.                               {{ include('front/hunt/offer_bloc.html.twig') }}
  125.                           </li>
  126.                       {% endfor %}
  127.                   </ul>
  128.                   <h2>Les offres aux alentours</h2>
  129.               </div>
  130.         </div>
  131.     {% endif %}
  132.     <div class="modal fade custom-modal-login in modal-more-info" id="modal-biotope" tabindex="-1" role="dialog">
  133.         <div class="modal-dialog clearfix" role="document">
  134.             <div class="modal-content">
  135.                 <div class="modal-header">
  136.                     <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span
  137.                                 aria-hidden="true">Ă—</span>
  138.                     </button>
  139.                     <span class="modal-title"><icon><img src="{{ asset('assets/img/forest.png') }}"></icon>Biotope <br></span>
  140.                 </div>
  141.                 <div class="modal-body">
  142.                     <span> <b> BIOTOPE </b> </span><br>
  143.                     <span>{% for biotope in territory.biotope %}{{ biotope }}{% if not loop.last %}, {% endif %}{% endfor %}</span>
  144.                     <br> <br>
  145.                     <span style="text-transform:uppercase;"> <b> informations supplĂ©mentaires </b> </span> <br>
  146.                     {{ territory.biotopeText }}
  147.                 </div>
  148.             </div>
  149.         </div>
  150.     </div>
  151. {% endblock %}
  152. {% block javascripts %}
  153.     {{ parent() }}
  154.     <script type="text/javascript">
  155.         initMap();
  156.         function initMap() {
  157.             {% if offer.territory.longitude is not null %}{% set lng = offer.territory.longitude %}{% else %}{% set lng = -0.594 %}{% endif %}
  158.             {% if offer.territory.latitude is not null %}{% set lat = offer.territory.latitude %}{% else %}{% set lat = 44.837789 %}{% endif %}
  159.             var longitude = '{{ lng }}';
  160.             var latitude = '{{ lat }}';
  161.             var map = new google.maps.Map(document.getElementById('map_details'), {
  162.                 zoom: 11,
  163.                 center: {lat: parseFloat(latitude), lng: parseFloat(longitude)},
  164.                 zoomControl: true,
  165.                 scaleControl: false,
  166.                 mapTypeControl: false
  167.             });
  168.             const cityCircle = new google.maps.Circle({
  169.                 strokeColor: "#1db3a3",
  170.                 strokeOpacity: 1,
  171.                 strokeWeight: 2,
  172.                 fillColor: "#1db3a3",
  173.                 fillOpacity: 0.65,
  174.                 map,
  175.                 center: {lat: parseFloat(latitude), lng: parseFloat(longitude)},
  176.                 radius: 5 * 1000,
  177.             });
  178.         }
  179.     </script>
  180. {% endblock %}