{% if inlineEngine is defined %}
{# if NOT desktop hompage, var from controller #}
{% set dispoEngine = true %}
{% else %}
{% set dispoEngine = false %}
{% endif %}
{# END .search-header #}
{# START .search-body #}
<style type="text/css">
.custom-radio {
width: 20px;
height: 20px;
appearance: none;
border: 1px solid white;
border-radius: 50%;
outline: none;
background-color: transparent;
position: relative;
cursor: pointer;
}
.custom-radio:checked::before {
content: '';
width: 12px;
height: 12px;
border-radius: 50%;
background-color: white;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
@media (max-width: 991px) {
.custom-radio {
width: 20px;
height: 20px;
appearance: none;
border: 1px solid #042A44;
border-radius: 50%;
outline: none;
background-color: transparent;
position: relative;
cursor: pointer;
}
.custom-radio:checked::before {
content: '';
width: 12px;
height: 12px;
border-radius: 50%;
background-color: #042A44;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
</style>
<form action="#" class="search__engine clearfix search-hotel js-searchForm js-searchFormHotel pb-0 w-full">
{% if cookieLastSearch is defined and cookieLastSearch != null %}
<div style="display:none">
<p id="js-cookieLastSearch-destination">{{ cookieLastSearch.destination }}</p>
<p id="js-cookieLastSearch-destinationLabel">{{ cookieLastSearch.destinationLabel }}</p>
<p id="js-cookieLastSearch-date1">{{ cookieLastSearch.date1 }}</p>
<p id="js-cookieLastSearch-date2">{{ cookieLastSearch.date2 }}</p>
<p id="js-cookieLastSearch-adults">{{ cookieLastSearch.adults }}</p>
<p id="js-cookieLastSearch-children">{{ cookieLastSearch.children }}</p>
{% if cookieLastSearch.childAge is iterable %}
{% for child in cookieLastSearch.childAge.age1 %}
<p id="js-cookieLastSearch-childrenAge{{ loop.index }}">{{ child }}</p>
{% endfor %}
{% endif %}
</div>
{% endif %}
{# START .search-header #}
<div
class="search__header clearfix font-[Roboto] py-14 m:py-12 s:pb-4 s:pt-14 xs:pb-4 xs:pt-14 m-0 pl-[144px] l:pl-[0px] m:pl-[32px] s:pl-[0px] xs:pl-[0px] ">
<h1
class="search__title text-[#FFF] text-[1.75rem] m:text-[1.5rem] s:text-[1.5rem] xs:text-[1.5rem] s:text-start xs:text-start s:px-[20px] xs:px-[20px] ">
{# <i class="icon icon_bundle_hotel search__title__icon hide-lap-and-up"></i> #}
{% if articulo is defined and articulo.url is not defined and typeArticle is defined %}
<span class="">
{% set info = typeArticle %}
{% set info = info|replace({ '-': ' ' }) %}Hoteles{% if info == 'destino' %} con pago en destino{% endif %}
{% if info != 'destino' %}
{# <span class="hide-portable">Baratos</span> #}
en {{ info|replace({ oceania: 'oceanía', america: 'américa', africa: 'áfrica' })|capitalize }}
{% endif %}
</span>
{% else %}
{% endif %}
{% if articulo is defined and articulo.url is defined %}
<b>
Reserve su hotel{% set info = articulo.url %}
{% set info = info|replace({ '-': ' ' }) %}
{% set contentInfo = json_decode(articulo.description, true) %}
{% if contentInfo['type'] == 'hoteles' %}
en {{ info|title|replace({ Baru: 'Barú', Medellin: 'Medellín', Bogota: 'Bogotá', 'San Andres': 'San Andrés',
Ibague: 'Ibagué', Cucuta: 'Cúcuta', Monteria: 'Montería', Popayan: 'Popayán', Mexico: 'México', Cancun:
'Cancún', Panama: 'Panamá', Paris: 'París', 'Los Angeles': 'Los Ángeles', Dubai: 'Dubái', Amsterdam:
'Ámsterdam', Milan: 'Milán', Zurich: 'Zúrich', Moscu: 'Moscú', Dublin: 'Dublín', Kazan: 'Kazán', Monaco:
'Mónaco', Malaga: 'Málaga', 'Rio de Janeiro': 'Río de Janeiro', 'San Jose de Costa Rica': 'San José de Costa
Rica', Cordoba: 'Córdoba', Asuncion: 'Asunción', 'Seúl': 'Seúl', America: 'América', Mexico: 'México', 'Ciudad
de Mexico': 'Ciudad de México', Oceania: 'Oceanía', Africa: 'África', 'Kinshasa RepUblica Del Congo': 'Kinshasa
República Del Congo', 'Jartum Sudan': 'Jartum Sudán', 'Shanghai China': 'Shanghái China', Japon: 'Japón',
Turquia: 'Turquía', 'Emiratos Arabes Unidos': 'Emiratos Árabes Unidos', Taiwan: 'Taiwán', Taipei: 'Taipéi' }) }}
{% endif %}
</b>
{% endif %}
{% if articulo is not defined %}
<b class="text-[28px] mb-5 block leading-none whitespace-nowrap">Hoteles Baratos</b>
<b class="text-[22px] block leading-none whitespace-nowrap">Hoteles nacionales e internacionales</b>
{% endif %}
</h1>
</div>
<div
class="search__light--box-opaque-palm h-auto s:p-[16px] xs:p-[16px] m:p-[36px] m:gap-y-[35px] flex flex-col gap-y-[11px]">
<div
class="sm-12 xs:py-[8px] s:px-[4px] m:pb-[24px] xs:w-full s:w-full m:w-full flex">
<label for="onlinepayment" class="search__option no-margin-bottom sp-inset--tiny paymentOnline flex gap-x-[8px] !hidden">
<input type="radio" name="paymentOnline" class="custom-radio" />
<span class="text-white xs:text-[#5A5A5A] s:text-[#5A5A5A] m:!text-[#5A5A5A]">Pago en línea</span>
</label>
{# {% if (booking is defined and booking == 'true' and 'aviatur_search_hotels' in app.request.get('_route')) or
'aviatur_hotel_filtered' in app.request.get('_route') or 'aviatur_hotel_view' in app.request.get('_route') %} #}
{# <label for="onlinepayment"
class="search__option no-margin-bottom sp-inset--tiny paymentDestination flex gap-x-[8px] ">
<input type="radio" name="paymentDestination" checked="true" class="custom-radio" />
<span class="text-white xs:text-[#5A5A5A] s:text-[#5A5A5A] m:!text-[#5A5A5A]">Pago en destino</span>
</label> #}
{# {% endif %} #}
{# Formulario para búsqueda #}
</div>
<div class="search__row-main">
<div id="hotelOptions" class="grid grid-cols-12 w-full justify-center items-center search__row-main-flight m:gap-y-[40px] s:gap-y-[16px] xs:gap-y-[16px] m:gap-x-3">
<div id="cityId" class="px-[24px] l:px-[24px] m:!px-0 s:!px-0 xs:!px-0 col-span-4 xs:col-span-12 s:col-span-12 m:!col-span-6 sm-12 search__col-hotel-city dispo__col-search s:!border-r-0 xs:!border-r-0 m:!border-r-0 border-r-2 border-r-[#D1D1D1]-2">
<div class="form-group xs:!border-b-2 xs:!border-b-[#D1D1D1]-2 s:!border-b-2 s:!border-b-[#D1D1D1]-2 m:!border-b-2 m:!border-b-[#D1D1D1]-2">
<span class="font-[Roboto] xs:text-[12px] xs:text-[#002B46] s:text-[12px] s:text-[#002B46] m:text-[12px] m:text-[#002B46] text-[#FFFFFF]">Ubicación del hotel</span>
<input type="hidden" name="parameters[destination]" id="destination" />
<input type="hidden" name="parameters[destinationText]" id="destinationText" />
<div class="flex items-center justify-between">
{# <i class="icon icon_search_close icon__input icon__input--click js-empty text-white xs:text-[#5A5A5A] s:text-[#5A5A5A] m:!text-[#5A5A5A]"></i> #}
<div class="w-full">
<input id="destinationValidate" class="text-input-flight !p-0 input--white js-searchErrorInput js-scrollToTop js-selectOnFocus cursor-text xs:!text-[#5A5A5A] s:!text-[#5A5A5A] m:!text-[#5A5A5A]" type="text" name="parameters[destinationValidate]" autocomplete="off" placeholder="Ubicación del Hotel"/>
<label id="js-destinationError" class="label--error js-searchError" style="display: none;"></label>
<div id="js-autocomplete-hotelModal" class="absolute z-10 bg-[#FFFFFF] l:bg-[#1E1E1E] text-[#2F2F2F] l:text-white py-6 px-4 w-full rounded-lg font-roboto flex flex-col gap-y-2 max-h-[400px] overflow-y-auto shadow-[0px_1px_12.2px_1px_rgba(0,0,0,0.10)]" style="display: none; scrollbar-width: none; -ms-overflow-style: none;" data-active="false"></div>
</div>
<span id="js-deleteInputDestination" class="material-symbols-rounded cursor-pointer text-white">close</span>
</div>
</div>
</div>
{# DATES #}
<!--Implementación de input para buscar ciudades con Geocoding-->
{# <div id="cityIdGeocoding"
class="px-[24px] l:px-[24px] m:!px-0 s:!px-0 xs:!px-0 col-span-4 xs:col-span-12 s:col-span-12 m:!col-span-6 sm-12 search__col-hotel-city dispo__col-search s:!border-r-0 xs:!border-r-0 m:!border-r-0 border-r-2 border-r-[#D1D1D1]-2">
<div
class="form-group xs:!border-b-2 xs:!border-b-[#D1D1D1]-2 s:!border-b-2 s:!border-b-[#D1D1D1]-2 m:!border-b-2 m:!border-b-[#D1D1D1]-2">
<span
class="font-[Roboto] xs:text-[12px] xs:text-[#002B46] s:text-[12px] s:text-[#002B46] m:text-[12px] m:text-[#002B46] text-[#FFFFFF]">Ciudad</span>
<input type="hidden" name="parameters[destination]" id="destination" />
<i
class="icon icon_search_close icon__input icon__input--click js-empty text-white xs:text-[#5A5A5A] s:text-[#5A5A5A] m:!text-[#5A5A5A]"></i>
<input id="searchCity" class="text-input-flight" type="text" placeholder="Ubicación del Hotel" />
<label id="js-destinationError" class="label--error js-searchError" style="display: none;"></label>
</div>
</div> #}
<div id="datesdisplay1Id" class="px-[24px] l:px-[24px] m:!px-0 s:!px-0 xs:!px-0 col-span-4 xs:!col-span-12 s:!col-span-12 m:!col-span-6 xs:!grid xs:!grid-cols-1 s:!grid s:!grid-cols-1 sm-12 no-padding has-feedback border-r-2 border-r-[#D1D1D1]-2 s:!border-r-0 xs:!border-r-0 m:!border-r-0 xs:!border-b-2 xs:!border-b-[#D1D1D1]-2 s:!border-b-2 s:!border-b-[#D1D1D1]-2 m:!border-b-2 m:!border-b-[#D1D1D1]-2">
<span
class="font-[Roboto] xs:text-[12px] xs:text-[#002B46] s:text-[12px] s:text-[#002B46] m:text-[12px] m:text-[#002B46] xs:col-span-1 s:col-span-1 text-[#FFFFFF]">Fechas</span>
<div
class="xs:grid xs:grid-cols-3 s:grid s:grid-cols-3 items-center text-center flex justify-start items-center h-[40px]">
<div
class="col-5 xs:!col-span-1 s:!col-span-1 sm-12 search__col-hotel-date dispo__col-search s:p-0 xs:p-0 !p-0 w-fit">
<div class="form-group">
{# <span
class="font-[Roboto] xs:text-[12px] xs:text-[#002B46] s:text-[12px] s:text-[#002B46]">Fechas</span> #}
<div class="relative js-createDatepicker js-datepicker-container-open" data-input="#date1"
data-instancenbr="1" role="button" tabindex="0" data-tabopen="1">
<input type="hidden" name="parameters[date1]" id="date1" readonly="readonly" style="display:none" />
<input type="text" id="js-createDatepicker1" name="parameters[date1validate]" placeholder="Fecha Ida"
readonly="readonly"
class="!w-[80px] !font-normal cursor-pointer !focus:outline-none !focus:border-none !bg-transparent input--white l:!text-[#FFFFFF] m:!text-[#5A5A5A] !xs:text-[16px] s:text-[16px] js-searchErrorInput js-inputDatepicker text-input no-focus !p-0 "
tabindex="-1" />
</div>
</div>
</div>
<span
class="col-2 xs:!col-span-1 s:!col-span-1 font-bold text-white xs:!text-[#5A5A5A] s:!text-[#5A5A5A] m:!text-[#5A5A5A] s:w-full xs:w-full">-</span>
<div
class="col-5 xs:!col-span-1 s:!col-span-1 sm-12 search__col-hotel-date dispo__col-search s:p-0 xs:p-0 !p-0 w-fit">
<div class="form-group">
<div class="relative icon__input--inline js-createDatepicker js-datepicker-container-open"
data-input="#date-return1" data-instancenbr="1" role="button" tabindex="0" data-tabopen="1">
<input type="hidden" name="parameters[date-return1]" id="date-return1" readonly="readonly"
style="display:none" />
<input type="text" id="js-createDatepicker-return1" name="parameters[date1validate]"
placeholder="Fecha Ida" readonly="readonly"
class="!w-[80px] !p-0 !font-normal cursor-pointer !focus:outline-none !focus:border-none !bg-transparent input--white l:!text-[#FFFFFF] m:!text-[#5A5A5A] xs:text-[16px] s:text-[16px] js-searchErrorInput js-inputDatepicker text-input no-focus m:text-end"
tabindex="-1" style="padding-top: 0px !important;" />
</div>
</div>
</div>
</div>
</div>
<div
class="col-span-3 xs:!col-span-12 s:!col-span-12 m:!col-span-12 xs:col-span-12 grid grid-cols-12 no-padding">
{% include twig_exists('@AviaturTwig/' ~ agency_folder.twigFlux() ~ '/Search/Hotel/hotelSearch_engine_footer.html.twig') %}
</div>
<label id="js-dateError" class="label--error js-searchError" style="display: none;"></label>
{# END DATES #}
{# SEARCH BUTTON #}
<div
class="col-span-1 sm-12 flex justify-center xs:col-span-12 s:col-span-12 m:col-span-12 s:mt-[30px] xs:mt-[30px]">
<div class="!flex !content-center">
<button type="button" class="js-searchButton js-changeType inline-block h-[3.375rem] w-[270px] l:w-[3.375rem] rounded-full border-0 bg-[#00C382] text-white text-[2.2rem] p-[0.7rem] hover:bg-[#00dd93]"
data-type="online">
<div class="m:hidden s:hidden xs:hidden">
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"
style="vertical-align: top;">
<path
d="M13.8001 25.3484C20.2869 25.3484 25.5455 20.1721 25.5455 13.7868C25.5455 7.40158 20.2869 2.22531 13.8001 2.22531C7.31329 2.22531 2.05469 7.40158 2.05469 13.7868C2.05469 20.1721 7.31329 25.3484 13.8001 25.3484Z"
fill="#00C382" stroke="white" stroke-width="2.71293" stroke-linecap="round" stroke-linejoin="round">
</path>
<path d="M28.4803 28.2407L22.0938 21.9541" stroke="white" stroke-width="2.71293"
stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
</div>
<div class="l:hidden h-[28px] flex items-center font-[500] px-[30px] justify-between !text-white">
<span class="material-symbols-rounded w-[26.182px] h-[24px]">
concierge
</span>
<span class="text-[16px]">Buscar alojamiento</span>
</div>
</button>
</div>
</div>
<div
class="col-6 sm-12 xs:!col-span-12 s:!col-span-12 m:!col-span-12 m:w-full s:w-full xs:w-full xs:col-span-12 m:flex m:justify-center s:flex s:justify-center xs:flex xs:justify-center">
{# END SEARCH BUTTON #}
</div>
</div>
</div>
<div class="hidden sm:flex l:hidden justify-center">
<span class="material-symbols-rounded text-[#8B8B8B]">keyboard_arrow_down</span>
</div>
</div>
</form>
{# END .search-body #}
{# START .search-footer #}
<script>
const d = document
{# let $paymentOnline = d.querySelector('[name="paymentOnline"]')
let $paymentDestination = d.querySelector('[name="paymentDestination"]') #}
let $typeSearch = d.querySelector('.js-changeType')
let $searchCity = d.querySelector('#searchCity');
//Variable del contador de habitaciones que se inicia en 0 ya que al renderizar la pagina hay un evento que agrega una habitacion automaticamente
let roomsCounter = 0;
{# (() => {
if (!d.querySelector('.paymentDestination')) {
d.querySelector('.paymentOnline').classList.add('hide');
}
const savedSearchType = localStorage.getItem('searchType');
if (savedSearchType) {
if (savedSearchType === 'online') {
$paymentOnline.checked = true;
$paymentDestination.checked = false;
$typeSearch.dataset.type = 'online';
} else if (savedSearchType === 'destination') {
$paymentDestination.checked = true;
$paymentOnline.checked = false;
$typeSearch.dataset.type = 'destination';
}
} else {
$paymentDestination.checked = true;
$paymentOnline.checked = false;
$typeSearch.dataset.type = 'destination';
}
})(); #}
{# const saveSearchType = (type) => {
localStorage.setItem('searchType', type);
} #}
// "destination" sea la opción seleccionada por defecto
{# $paymentDestination.checked = true;
$paymentOnline.checked = false;
if ($paymentDestination.checked) {
$typeSearch.dataset.type = 'destination';
} #}
const disableAddButtonsInSearch = (counterPassagers, counterRooms)=>{
let is_buttons_disabled = counterPassagers >= 9 ? true: false;
let is_submit_disabled = counterPassagers > 9 ? true: false;
let is_button_rooms_disabled = counterRooms > 2 || counterPassagers >= 9 ? true : false;
let $btn_add_rooms = document.querySelector(".search__hotel-passengers-block .js-createRoom");
let $submit_search_button = document.querySelector(".js-searchButton");
let $search_error_message = document.querySelector("#search_error_message");
Array.from(document.querySelectorAll(".js-slideContent .search-hotel__col-passenger .js-nextOption")).map(($btn) => {
toogleButtonDisabled($btn, is_buttons_disabled)
})
//Bloqueo boton de añadir habitaciones
toogleButtonDisabled($btn_add_rooms, is_button_rooms_disabled)
//Bloqueo boton de busqueda
toogleButtonDisabled($submit_search_button, is_submit_disabled)
if(counterPassagers >= 9 && !$search_error_message){
document.querySelector(".search__hotel-passengers-block").insertAdjacentHTML("afterBegin",
`<div class="bg-[#00C77C] text-sm text-center rounded-md mb-3 w-full flex flex-wrap p-3 text-white font-bold" id="search_error_message">
<span> Has alcanzado el límite de 9 pasajeros <span>
</div>`
)
}
else if($search_error_message && counterPassagers != 9){
document.querySelector("#search_error_message")?.remove()
}
}
const toogleButtonDisabled = ($button, is_disabled)=>{
if(!$button){
return;
}
if(is_disabled){
$button.classList.add('opacity-30')
}else{
$button.classList.remove('opacity-30')
}
$button.disabled = is_disabled
}
function countRoomPassanger(operation = null) {
let counterPassager = 0
let $inputPassanger = d.querySelectorAll('.search-hotel__col-room .number-input')
for (let i = 0; i < $inputPassanger.length; i++) {
counterPassager += parseInt($inputPassanger[i].value)
}
d.querySelector('.quantityRoom').textContent = d.querySelectorAll('.search-hotel__col-room .js-rooms').length + (d.querySelectorAll('.search-hotel__col-room .js-rooms').length > 1 ? ' habitaciones' : ' habitación')
if (operation === 'remove') {
// console.log('está restando habitaciones')
let $inputPassanger = jQuery('.search-hotel__row-room:last .number-input')
let counter = 0
let rooms_number = d.querySelectorAll('.search-hotel__col-room .js-rooms').length - 1;
for (let i = 0; i < $inputPassanger.length; i++) {
counter += parseInt($inputPassanger[i].value)
}
counterPassager -= counter
// console.log(rooms_number, 'conteo de habitaciones')
d.querySelector('.quantityRoom').textContent = `${rooms_number} ${rooms_number == 1 ? 'habitación': 'habitaciones'}`;
// d.querySelectorAll('.search-hotel__col-room .js-rooms').length - 2 + (d.querySelectorAll('.search-hotel__col-room .js-rooms').length > 1 ? ' habitaciones' : ' habitación')
}
d.querySelector('.quantityPassanger').textContent = counterPassager + (counterPassager > 1 ? ' personas.' : ' persona.')
return counterPassager
}
d.addEventListener('click', (e) => {
if(e.target.matches(".js-createRoom")){
roomsCounter+=1
}
if (e.target.matches('.search__btn-increment *') || e.target.matches('.js-createRoom')) {
let counterPassagers = countRoomPassanger('add');
disableAddButtonsInSearch(counterPassagers, roomsCounter)
}
if (e.target.matches('.js-deleteRoom')) {
let counterPassagers = countRoomPassanger('remove')
roomsCounter-=1
disableAddButtonsInSearch(counterPassagers, roomsCounter)
}
if (e.target.matches('.js-palmPrevModal *') || e.target.matches('.js-palmPrevModal')) {
document.querySelector('.js-travelers').style.display = 'none'
}
})
/**
* Funcion para obtener coordenadas de una ciudad
*
* @param city
*/
function geocode(city) {
$.ajax({
url: 'https://api.opencagedata.com/geocode/v1/json',
method: 'GET',
data: {
'key': 'd4ea2db24f6448dcbb1551c3546851d6',
'q': city,
'no_annotations': 1
},
dataType: 'json',
statusCode: {
200: function(response){
//console.log(response.results);
for (let i = 0; i < response.results.length; i++) {
// console.log('formatted: ' + response.results[i].formatted);
// console.log('geometry: ' + response.results[i].geometry.lat + ', ' + response.results[i].geometry.lng);
$('#cityIdGeocoding').append('<div id="result'+i+'"></div>')
$('#result' + i).append('<h3 style="color: white">' + 'formatted: ' + response.results[i].formatted + '</h3>');
$('#result' + i).append('<h3 style="color: white">' + 'geometry: ' + response.results[i].geometry.lat + ', ' + response.results[i].geometry.lng + '</h3>');
}
}
}
});
}
</script>
{# END .search-footer #}