{% extends 'base.html.twig' %}
{% block title %}- Recherche{% endblock %}
{% block headersection %}
<div class="fixed-top">
{{ include('flashmessages/flashmessages.html.twig') }}
</div>
<section class="section section-xl bg-primary overlay-dark text-white rounded covernorepeat" data-background="{{ asset('assets/img/cards-3662554_1920.jpg') }}">
<div class="container">
<div class="row justify-content-center">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb breadcrumb-transparent">
<li class="breadcrumb-item"><a href="{{ path('home', {}, relative = false) }}">Accueil</a></li>
<li class="breadcrumb-item active">Recherche</li>
</ol>
</nav>
<!-- Heading -->
<h1 class="display-2">
<i class="fab fa-searchengin mr-2"></i><span class="font-weight-light">Trouvez votre</span> tournoi ou festival
</h1>
<!-- Text -->
<p class="lead text-muted mt-4">
Recherchez parmi tous les tournois et festivals de notre site.
</p>
</div>
</div>
</div>
</section>
{%endblock%}
{%block body%}
<main>
<div class="section pt-5 pt-lg-6" style="min-height: 50vh;">
<div id="spaces-container" class="container">
<div class="row justify-content-center mb-3">
<div class="col-12">
{{ form_start(formsearch, { 'attr': {'class': 'row justify-content-center'} }) }}
<div class="col-12 col-lg-4">
<div class="form-group mb-lg-0">
<div class="input-group input-group-lg mb-lg-0">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fas fa-search-location"></i></span>
</div>
{{ form_widget(formsearch.location, {'attr': {'class': 'form-control autocomplete', 'placeholder': 'Ville', 'onFocus' : 'geolocate()' }}) }}
</div>
{{ form_widget(formsearch.locationhidden)}}
{{ form_widget(formsearch.placeid)}}
</div>
</div>
<div class="col-12 col-lg-3">
<div class="input-group input-group-lg mb-3 mb-lg-0">
<div class="input-group-prepend">
<span class="input-group-text"><i class="far fa-calendar-alt"></i></span>
</div>
{{ form_widget(formsearch.date, {'attr': {'class': 'form-control datepicker', 'placeholder': 'Date', 'data-date-format':'dd/mm/yyyy'}}) }}
<!--<input class="form-control datepicker" placeholder="Select date" type="text" required>-->
</div>
</div>
<div class="col-12 col-lg-2">
{{ form_widget(formsearch.search, {'attr': {'class': 'btn btn-lg btn-primary btn-block mt-3 mt-md-0 animate-up-2' }} ) }}
<!--<button class="btn btn-lg btn-primary btn-block mt-3 mt-md-0 animate-up-2" type="submit">Find a desk</button>-->
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-12 col-lg-9 order-lg-1">
<div class="justify-content-between align-items-center d-flex">
<div class="mr-3">
<p class="mb-0 font-small">
Nombre de résultats : {{ pagination.getTotalItemCount }}
</p>
</div>
<div class="">
<div class="input-group input-group-sm">
<div class="input-group-prepend form-control-sm">
<span class="input-group-text form-control-sm"><i class="fas fa-route"></i></span>
{{ form_widget(formsearch.distance, {'attr': {'class': 'form-control-sm font-small', 'onchange':'this.form.submit()'}}) }}
</div>
</div>
</div>
</div>
{{form_end(formsearch)}}
<div class="tab-content mt-4 mt-lg-4 " id="tabcontentexample-5">
<div class="tab-pane fade show active" id="link-example-13" role="tabpanel" aria-labelledby="tab-link-example-13">
{% for bfedition in pagination %}
{{ render(controller('App\\Controller\\BFEditionController::ShowListView', {id:bfedition.id})) }}
{%endfor%}
</div>
</div>
{{ knp_pagination_render(pagination) }}
</div>
</div>
</div>
</div>
</main>
<script>
var placeSearch, autocompleteinput;
var input = document.getElementById('festival_search_with_distance_location');
var componentForm = {
street_number: 'short_name',
route: 'long_name',
locality: 'long_name',
administrative_area_level_1: 'short_name',
country: 'long_name',
postal_code: 'short_name'
};
function initAutocomplete() {
google.maps.event.addDomListener(input, 'blur', function() {
if (jQuery('.pac-item:hover').length === 0) {
google.maps.event.trigger(this, 'focus', {});
google.maps.event.trigger(this, 'keydown', {
keyCode: 13
});
}
})
// Create the autocomplete object, restricting the search to geographical
// location types.
autocompleteinput = new google.maps.places.Autocomplete(
/** @type {!HTMLInputElement} */
(input), {
types: ['geocode']
});
// When the user selects an address from the dropdown, populate the address
// fields in the form.
autocompleteinput.addListener('place_changed', fillInAddress);
}
function fillInAddress() {
// Get the place details from the autocomplete object.
var place = autocompleteinput.getPlace();
if (place != null && place.place_id) {
//fill the hidden data
document.getElementById('festival_search_with_distance_locationhidden').setAttribute('value', document.getElementById('festival_search_with_distance_location').value)
document.getElementById('festival_search_with_distance_placeid').setAttribute('value', place.place_id)
}
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyArRqV6iNkruffZtVT2G0iX4kfemd1SQD4&libraries=places&callback=initAutocomplete&sessiontoken={{uuid}}" async defer></script>
{%endblock%}