<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>{{ 'widget.simple.title' | trans }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="description" content="{{ 'widget.simple.desc' | trans }}"/>
<style>
body{
margin:0;
padding: 0;
font-family: arial, helvetica, sans-serif;
{% if app.request.query.get('bgImgLink') %}
background-image: url("{{ app.request.query.get('bgImgLink') }}");
background-repeat: no-repeat;
background-size: cover;
background-position: 50%;
{% else %}
background-color: #ffffff;
{% endif %}
height: 100%;
width: 100%;
}
.title {
{% if app.request.query.get('headerType') == "true" %}
background-color: transparent;
color: #000000;
{% else %}
background-color: rgba(0,0,0,0.6) ;/*#7952b3;*/
color: #ffffff;
{% endif %}
margin: 0;
padding: 15px 0;
text-align: center;
}
form{
padding: 10px;
}
.field input{
background: #fff url({{ asset('images/widget/widget-departure.png') }}) no-repeat 3px 50%;
height:30px;
margin: 0 0 10px 0;
border: 1px solid #7e9eab;
width: 100%;
text-indent: 25px;
border-radius: 3px;
width: -webkit-fill-available;
line-height: 1.5;
color: #495057;
}
#arr{
background: #fff url({{ asset('images/widget/widget-arrival.png') }}) no-repeat 3px 50%;
}
#date{
text-indent: 11px;
background: #fff url({{ asset('images/widget/widget-date.png') }}) no-repeat 3px 50%;
}
#bt{
display: block;
width: 100%;
color: {% if app.request.query.get('buttonColor') %} #{{ app.request.query.get("buttonColor") }}{% else %} #ffffff {% endif %}; /*#113c51;/*#7952b3;*/
/*border: 1px solid #113c51;*/ /*#7952b3;*/
padding: 7px 0;
text-align: center;
border-radius: 6px;
text-decoration: none;
background-color: {% if app.request.query.get('buttonBgColor') %} #{{ app.request.query.get("buttonBgColor") }}{% else %} #2ecc71 {% endif %};
font-weight: bold;
}
#bt:hover{
-webkit-animation: bounce 0.6s ;
}
@-webkit-keyframes bounce {
40% {-webkit-transform: translateY(3px) }
80% {-webkit-transform: translateY(-1px) }
100% {-webkit-transform: translateY(0)}
}
#bt-hidden-submit{
display: none;
}
img{
margin: 0 auto;
display: block;
width: 100%;
max-width: 300px;
}
.form-container{
height: 100%;
width: 100%;
}
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?libraries=places&key={{ constant('App\\Service\\MapsApi::GMAPSKEY_JSAUTOCOMPLETE') }}&language={{ app.request.locale | slice(0,2) }}"></script>
</head>
<body>
<p class="title">
{% if app.request.query.get("widgetTitle") %}
<strong>{{ app.request.query.get("widgetTitle") }}</strong>
{% else %}
<strong>{{ 'widget.simple.txt.0' | trans }}</strong>
<br />
<strong>{{ 'widget.simple.txt.1' | trans }}</strong>
{% endif %}
</p>
<div class="form-container">
<form action="{{ path('widget_iframe2_post') }}" method="get" target="_blank" name="form">
<div class="field">
{#<label>Départ</label>#}
<input type="text" id="dep" name="dep" placeholder="{{ 'widget.simple.dep' | trans }}" value="{{ app.request.query.get('dep') }}" required/>
<input type="hidden" id="depLat" name="depLat" value="{{ app.request.query.get('depLat') }}"/>
<input type="hidden" id="depLng" name="depLng" value="{{ app.request.query.get('depLng') }}"/>
</div>
<div class="field">
{#<label>Arrivée</label>#}
<input type="text" id="arr" name="arr" placeholder="{{ 'widget.simple.arr' | trans }}" value="{{ app.request.query.get('arr') }}" required/>
<input type="hidden" id="arrLat" name="arrLat" value="{{ app.request.query.get('arrLat') }}"/>
<input type="hidden" id="arrLng" name="arrLng" value="{{ app.request.query.get('arrLng') }}"/>
</div>
<div class="field">
{#<label>Date</label>#}
<input type="date" id="date" name="date"/>
</div>
<div class="field">
<a href="#" value="Rechercher" id="bt" onClick="document.getElementById('bt-hidden-submit').click(); return false;">{{ 'widget.simple.button' | trans }}</a>
<input type="submit" id="bt-hidden-submit"/>
</div>
</form>
<img id="imgPoweredBy" src="{{asset('images/widget/widget-logo-multimodal.png')}}" onClick="document.getElementById('bt-hidden-submit').click(); return false;" />
</div>
<script>
{% if app.request.query.get('bgImgLink') %}
document.getElementById('imgPoweredBy').remove(); //TODO do that in php, why using js?
// document.getElementsByClassName("form-container")[0].style.padding = "20px 0 50px 0"; // TODO use style class instead, usefull?
{% endif %}
function initializeAutocomplete(id) {
var element = document.getElementById(id);
var autocomplete = new google.maps.places.Autocomplete(element, {types: ['(cities)']});
google.maps.event.addListener(autocomplete, 'place_changed', function(){
place = this.getPlace();
document.getElementById(id+"Lat").value= place.geometry.location.lat();
document.getElementById(id+"Lng").value= place.geometry.location.lng();
});
}
google.maps.event.addDomListener(window, 'load', function () {
initializeAutocomplete('dep');
initializeAutocomplete('arr');
});
</script>
</body>
</html>