{% extends 'base.html.twig' %}
{% block title %}{{ offer.title }}{% endblock %}
{% block meta %}
<meta name="description" content="{{ offer.unfoldsDay }}">
{% endblock %}
{% block bodyClass %}{{ offer.type }}{% endblock %}
{% block body %}
<div class="return"><a href="javascript:history.back();"> Retour </a></div>
{% for message in app.flashes('error') %}
<div class="alert alert-danger">
{{ message }}
</div>
{% endfor %}
<div class="offer-show">
{% set territory = offer.getTerritory() %}
{% if offer.images|length == 0 %}
{% set imagesLength = territory.images|length %}
{% else %}
{% set imagesLength = offer.images|length %}
{% endif %}
<div class="alg">
<div class=" images offer-mobile-image {% if imagesLength == 0 %} i_one {% elseif imagesLength == 1 %} i_two {% else %} i_three {% endif %}"
{% if imagesLength == 1 %}style="grid-template-columns:100%"
{% elseif imagesLength == 2 %}style="grid-template-columns:50% 50%"
{% else %}style="grid-template-columns:40% repeat({{ imagesLength }},30%)"{% endif %}>
{% if offer.getImages()|length == 0 %}
{% if territory and territory.images and territory.images|length > 0 %}
{% for image in territory.images %}
<a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
{% endfor %}
{% else %}
<a class="single_image" data-fancybox="gallery"
href="{{ asset('build/images/default.png') }}"><img class="full-width"
src="{{ asset('build/images/default.png') }}"
alt="{{ offer.title }}"></a>
{% endif %}
{% elseif offer.getImages()|length == 1 %}
<a class="single_image" data-fancybox="gallery"
href="{{ asset('upload/'~offer.getImages()[0]) }}"><img class="full-width"
src="{{ asset('upload/'~offer.getImages()[0]) }}"
alt="{{ offer.title }}"></a>
{% else %}
{% for image in offer.getImages() %}
<a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
{% endfor %}
{% endif %}
</div>
<div class=" images offer-pc-image {% if imagesLength == 0 %} i_one {% elseif imagesLength == 1 %} i_two {% else %} i_three {% endif %}"
{% if imagesLength == 1 %}style="grid-template-columns:100%"
{% elseif imagesLength == 2 %}style="grid-template-columns:50% 50%"
{% else %}style="grid-template-columns:40% repeat({{ imagesLength }},30%)"{% endif %}>
{% if offer.getImages()|length == 0 %}
{% if territory and territory.images and territory.images|length > 0 %}
{% for image in territory.images %}
<a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
{% endfor %}
{% else %}
<a class="single_image" data-fancybox="gallery"
href="{{ asset('build/images/default.png') }}"><img class="full-width"
src="{{ asset('build/images/default.png') }}"
alt="{{ offer.title }}"></a>
{% endif %}
{% elseif offer.getImages()|length == 1 %}
<a class="single_image" data-fancybox="gallery"
href="{{ asset('upload/'~offer.getImages()[0]) }}"><img class="full-width"
src="{{ asset('upload/'~offer.getImages()[0]) }}"
alt="{{ offer.title }}"></a>
{% else %}
{% if offer.getImages()|length >= 4 %}
{% for image in offer.getImages() %}
{% if loop.index0 < 2 %}
<a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
{% elseif loop.index >= 2 %}
{% if loop.index0 == 2 %}<div style="height: 530px;" class="four-images-container">{% endif %}
<a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}" style="height: 50%;width:100%"></a>
{% if loop.index0 == 4 %}</div>{% endif %}
{% endif %}
{% endfor %}
{% else %}
{% for image in offer.getImages() %}
<a class="single_image" data-fancybox="gallery" href="{{ asset('upload/'~image) }}"><img
src="{{ asset('upload/'~image) }}" alt="{{ offer.title }}"></a>
{% endfor %}
{% endif %}
{% endif %}
</div>
{% if imagesLength == 0 %}
{% set imagesLength = 1 %}
{% endif %}
<span class="nb_images"> {{ imagesLength }} / {{ imagesLength }} <span
class="a_mob"> photos </span> </span>
<a href="javascript:history.back();" class="back-show">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path data-name=""
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"
transform="translate(-213.866 -149.485)" style="fill:#172a3b;fill-rule:evenodd"></path>
</svg>
</a>
</div>
<div class="body">
{% if offer.type == 'br' %}
{{ include('front/hunt/bracelet.html.twig') }}
{% endif %}
{% if offer.type == 'ac' %}
{{ include('front/hunt/action.html.twig') }}
{% endif %}
{% if offer.type == 'jr' %}
{{ include('front/hunt/journey.html.twig') }}
{% endif %}
</div>
</div>
{% if similarOffers|length > 0 %}
<div class="similar-offers">
<div>
<ul class="carousel_slides">
{% for similar in similarOffers %}
{% set offer = similar[0] %}
<li>
{{ include('front/hunt/offer_bloc.html.twig') }}
</li>
{% endfor %}
</ul>
<h2>Les offres aux alentours</h2>
</div>
</div>
{% endif %}
<div class="modal fade custom-modal-login in modal-more-info" id="modal-biotope" tabindex="-1" role="dialog">
<div class="modal-dialog clearfix" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close"><span
aria-hidden="true">Ă—</span>
</button>
<span class="modal-title"><icon><img src="{{ asset('assets/img/forest.png') }}"></icon>Biotope <br></span>
</div>
<div class="modal-body">
<span> <b> BIOTOPE </b> </span><br>
<span>{% for biotope in territory.biotope %}{{ biotope }}{% if not loop.last %}, {% endif %}{% endfor %}</span>
<br> <br>
<span style="text-transform:uppercase;"> <b> informations supplémentaires </b> </span> <br>
{{ territory.biotopeText }}
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script type="text/javascript">
initMap();
function initMap() {
{% if offer.territory.longitude is not null %}{% set lng = offer.territory.longitude %}{% else %}{% set lng = -0.594 %}{% endif %}
{% if offer.territory.latitude is not null %}{% set lat = offer.territory.latitude %}{% else %}{% set lat = 44.837789 %}{% endif %}
var longitude = '{{ lng }}';
var latitude = '{{ lat }}';
var map = new google.maps.Map(document.getElementById('map_details'), {
zoom: 11,
center: {lat: parseFloat(latitude), lng: parseFloat(longitude)},
zoomControl: true,
scaleControl: false,
mapTypeControl: false
});
const cityCircle = new google.maps.Circle({
strokeColor: "#1db3a3",
strokeOpacity: 1,
strokeWeight: 2,
fillColor: "#1db3a3",
fillOpacity: 0.65,
map,
center: {lat: parseFloat(latitude), lng: parseFloat(longitude)},
radius: 5 * 1000,
});
}
</script>
{% endblock %}