{% extends 'base.html.twig' %}
{% block metas %}
<meta name="description" content="Encuentra los mejores menús cerca de ti.">
<meta property="og:title" content="Menu del dia"/>
<meta property="og:url" content="{{ url(app.request.attributes.get("_route"), app.request.attributes.get("_route_params")) }}"/>
<meta property="og:description" content="Encuentra los mejores menús cerca de ti.">
<meta property="og:image" itemprop="image" content="https://menusdeldia.com/uploads/menu.jpg">
{% endblock %}
{% block stylesheets %}
{{ parent() }}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.1/css/ion.rangeSlider.min.css"/>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/ion-rangeslider/2.3.1/js/ion.rangeSlider.min.js"></script>
{% endblock %}
{% block title %}Menu del dia
{% endblock %}
{% block body %}
<div id="image-header" class="position-relative overflow-hidden p-3 p-md-5 text-center">
<div id="search-header" class="col-md-9 col-lg-8 col-xl-7 col-xxl-6 p-3 p-sm-5 mx-auto my-5 bg-white rounded">
<h1 class="fs-3 fw-normal">Encuentra tu menú del día</h1>
<p class="fw-lighter fst-italic">Menús actualizados de restaurantes cerca de tí.</p>
<div class="search">
<i class="fa fa-search"></i>
<form action="{{ path('menus') }}" method="post" role="form" enctype="multipart/form-data" class="w-100">
<input id="input_address" type="text" class="form-control" placeholder="¿Donde deseas buscar Menú?">
<button id="btn-search" class="btn">Ubicación Actual</button>
<input id="input_lat" name="latActual" type="hidden">
<input id="input_lng" name="lngActual" type="hidden">
</form>
</div>
</div>
</div>
<div id="background-header" class="position-relative overflow-hidden p-3 p-lg-5 text-center">
<div class="row col-lg-9 col-xl-7 p-lg-2 mx-auto my-5">
<div class="col-sm-6 col-lg-7">
<h2 class="fs-4 fw-bold">Encuentra tu menú preferido tambien desde el móvil</h2>
<p class="fw-lighter fst-italic">Ya disponible la app de Menus del día para iOS y Android.</p>
<div class="row col-12">
<div class="col-6">
<a href="#" title="Descargar App Menus del día">
<img class="img-responsive" src="/img/app-ios-banner.png" alt="Iphone Android App Menus del día" width="80%">
</a>
</div>
<div class="col-6">
<a href="#" title="Descargar App Menus del día">
<img class="img-responsive" src="/img/app-android-banner.png" alt="Iphone Android App Menus del día" width="80%">
</a>
</div>
</div>
</div>
<div class="col-sm-6 col-lg-5 mt-5 m-sm-0">
<a href="#" title="Descargar App Menus del día">
<img class="img-responsive" src="/img/app-iphone-android.png" alt="Iphone Android App Menus del día" width="50%">
</a>
</div>
</div>
</div>
{% endblock %}
{% block postjavascripts %}
{{ parent() }}
<script src="https://maps.googleapis.com/maps/api/js?key={{ google_key }}&libraries=places"></script>
<!-- parse-ignore-start -->
<script>
$(document).ready(function () {
$("#btn-search").click(function() {
$("form").submit();
});
var placeSearch, autocomplete;
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'
};
var element1 = $("[id*=_address]");
var element2 = $("[id*=_lat]");
var element3 = $("[id*=_lng]");
var input_direccion;
var input_lng;
var input_lat;
if (element1[0]) {
input_direccion = element1[0].id;
}
if (element2[0]) {
input_lat = element2[0].id;
}
if (element3[0]) {
input_lng = element3[0].id;
}
if (input_direccion != null) {
autocomplete = new google.maps.places.Autocomplete((document.getElementById(input_direccion)), {types: ['geocode']});
autocomplete.addListener('place_changed', fillInAddress);
autocomplete.addListener('place_changed', function () {
var place = autocomplete.getPlace();
if (!place.geometry) {
window.alert("Autocomplete's returned place contains no geometry");
return;
}
var address = '';
if (place.address_components) {
address = [
(place.address_components[0] && place.address_components[0].short_name || ''),
(place.address_components[1] && place.address_components[1].short_name || ''),
(place.address_components[2] && place.address_components[2].short_name || '')
].join(' ');
}
});
}
function fillInAddress() {
// Get the place details from the autocomplete object.
var place = autocomplete.getPlace();
document.getElementById(input_lat).value = place.geometry.location.lat();
document.getElementById(input_lng).value = place.geometry.location.lng();
$("form").submit();
}
});
</script>
<!-- parse-ignore-end -->
{% endblock %}