<!-- font awesome -->
<script src="{{ asset('js/all.min.js') }}"></script>
<!-- jquery 3.4 -->
<script src="{{ asset('js/vendor-all.min.js') }}"></script>
{# histogram slider uses jquery ui #}
<script src="{{ asset('js/plugins/jquery-ui.min.js') }}"></script>
<script src="{{ asset('js/plugins/please-wait.min.js') }}"></script>
<script src="{{ asset('js/plugins/bootstrap.min.js') }}"></script>
<script src="{{ asset('js/plugins/slick.min.js') }}"></script>
<!-- polyfill for position sticky to work on ie9 + -->
<script src="{{ asset('js/plugins/stickyfill.min.js') }}"></script>
<script src="{{ asset('js/plugins/moment.min.js') }}"></script>
<script src="{{ asset('js/pages/ox-alerts.js') }}"></script>
<script src="{{ asset('js/jquery.toast.js') }}"></script>
<script src="{{ asset('js/plugins/sweetalert.min.js') }}"></script>
<script src="{{ asset('js/plugins/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('js/plugins/dataTables.bootstrap4.min.js') }}"></script>
<script src="{{ asset('js/plugins/dataTables.responsive.min.js') }}"></script>
{# Rating (used for Guest and room Numbers) #}
<script src="{{ asset('js/plugins/jquery.barrating.js') }}"></script>
<script src="{{ asset('js/pages/ox-rating.js') }}"></script>
<script src="{{ asset('js/plugins/daterangepicker.js') }}"></script>
<script src="{{ asset('js/plugins/fab-histogram.slider.js') }}"></script>
<script src="{{ asset('js/star-rating.js') }}"></script>
<script src="{{ asset('js/plugins/isotope.pkgd.min.js') }}"></script>
<script src="{{ asset('js/jquery.fix.clone.js') }}"></script>
{#- CHILD Management in SEARCH BAR -#}
{% include "appParts/childFormJs.html.twig" %}
<script src="{{ asset('js/custom.js') }}"></script>
{#- MODAL UPDATE for TRIP RENAME -#}
<script>
$('#ModalQuoteName').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget);
console.log(event.relatedTarget);
var quoteName = button.data('quoteName');
var idQuote = button.data('idQuote');
var modal = $(this);
modal.find('#current_name').text(quoteName);
modal.find('#idQuoteRenameForm').val(idQuote);
modal.find('#quoteName').val(quoteName);
});
$(document).on('click', '#renameQuoteAction', function () {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: 'POST',
url: '{{ path('trip_rename') }}', /*trip.item_delete*/
dataType: 'json',
data: {quote: $('#idQuoteRenameForm').val(), quoteName: $('#quoteName').val()},
})
.done(function (data) {
let quoteNameLabel = $('#quote-name');
quoteNameLabel.text(data.quote.title);
quoteNameLabel.data('quoteName', data.quote.title);
quoteNameLabel.data('idQuote', data.quote.id);
$.toast({
heading: '{% trans %}Trip has been renamed{% endtrans %}',
text: '{% trans %} {% endtrans %}',
position: 'top-center',
loaderBg: '#77aa3b',
icon: 'success',
hideAfter: 5000,
stack: 6
});
})
.fail(function () {
$.toast({
heading: '{% trans %}CONNECTION ISSUE{% endtrans %}',
text: '{% trans %}Please check your internet connection and try later{% endtrans %}',
position: 'top-center',
loaderBg: '#ff6849',
icon: 'warning',
hideAfter: 4000,
stack: 6
});
});
});
$(document).on('click', '.hotel__name--favorite', function () {
$(this).toggleClass('pressed');
});
</script>
{#- AJAX: ADD TO FAVORITE -#}
<script>
$(document).ready(function () {
$(document).on('click', '.hotel__name--favorite', function () {
$.ajax({
type: 'POST',
url: '{{ path('hotel_add_to_favorite') }}', /*trip.item_delete*/
dataType: 'json',
data: $(this).data(),
}).done(function (data) {
if (data === "removed") {
$(this).removeClass('pressed');
console.log('pressed')
} else {
$(this).addClass('pressed');
}
}).fail(function (data) {
$.toast({
heading: '{% trans %}CONNECTION ISSUE{% endtrans %}',
text: '{% trans %}Please check your internet connection and try later{% endtrans %}',
position: 'top-center',
loaderBg: '#ff6849',
icon: 'warning',
hideAfter: 4000,
stack: 6
});
});
})
});
</script>
{#- AJAX: REFRESH PRICES -#}
<script>
$(document).ready(function () {
$('#refresh-button').on('click', function () {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: 'GET',
{# url: '{{ path('home') }}', trip.refresh_prices #}
dataType: 'json',
data: $(this).data(),
})
.done(function (data) {
var quoteTotal = 0;
data.itemInCart.forEach(function (item) {
priceLine = '<p class="m-b-0 text-nowrap"><span class="text-muted f-12">{% trans %}Taxes{% endtrans %}: </span><span class="f-14 text-dark">$' + Math.round(item.newTotalTax * 100) / 100 + '</span>';
priceLine += ' - <span class="text-muted f-12">{% trans %}Fees{% endtrans %}: </span><span class="f-14 text-nowrap text-dark">$' + Math.round(item.newFee * 100) / 100 + '</span></p>';
priceLine += '<p class="m-b-0 text-primary"><span class="text-muted f-12">{% trans %}Total{% endtrans %}: </span>';
priceLine += '<span class="f-w-900 f-14 text-primary">$<span class="sub-total">' + (Math.round(item.newPrice * 100) / 100).toLocaleString('en-GB', {minimumFractionDigits: 2}) + '</span></span></p>';
quoteTotal += Number(item.newPrice);
if (item.newPrice == 0) {
$('#' + item.itemId).find('#not-available').slideDown('slow');
} else {
$('#' + item.itemId).find('.prices').html(priceLine).slideDown('slow');
}
})
$('#quote-total').text((Math.round(quoteTotal * 100) / 100).toLocaleString('en-GB', {minimumFractionDigits: 2}));
$('.refresh').slideUp('slow');
$('.progress').slideDown('slow');
$('#hr-total-price').slideDown('slow');
$('#total-price').slideDown('slow');
start = new Date();
timerRun();
})
.fail(function () {
console.log(this.url);
$.toast({
heading: '{% trans %}CONNECTION ISSUE{% endtrans %}',
text: '{% trans %}Please check your internet connection and try later{% endtrans %}',
position: 'top-center',
loaderBg: '#ff6849',
icon: 'warning',
hideAfter: 4000,
stack: 6
});
});
});
// =========== TIMER ===========
maxTime = 60000;
timeoutVal = Math.floor(maxTime / 100);
function updateProgress(percentage) {
$('.progress-bar').css("width", 100 - percentage + "%");
}
function timerRun() {
var now = new Date();
var timeDiff = now.getTime() - start.getTime();
var perc = Math.round((timeDiff / maxTime) * 100);
if (perc <= 100) {
updateProgress(perc);
setTimeout(timerRun, timeoutVal);
} else {
$('.progress').slideUp('slow', function () {
$('.prices').slideUp(1000);
$('#total-price').slideUp(1000, function () {
$('#hr-total-price').hide();
});
$('.refresh').slideDown(1000);
});
}
}
{# $(document).on('click', '.btn-disable-customer_account', function (e) { #}
{# var btnDisable = $(this); #}
{# swal({ #}
{# title: btnDisable.hasClass('btn-danger') ? "Disable Customer Account" : "Enable Customer Account", #}
{# text: "Are you sure you want to " + (btnDisable.hasClass('btn-danger') ? "disable" : "enable") + " \"" + btnDisable.data('customerAccount-name') + "\" customerAccount?", #}
{# icon: "warning", #}
{# buttons: ['Cancel', 'Yes'], #}
{# dangerMode: true, #}
{# }) #}
{# .then(function (isConfirm) { #}
{# if (isConfirm) { #}
{# $.ajaxSetup({ #}
{# headers: { #}
{# 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') #}
{# } #}
{# }); #}
{# $.ajax({ #}
{# type: 'POST', #}
{# url: '{{ path('deactivate_customer_account') }}/' + btnDisable.data('customerAccount-id'), #}
{# dataType: 'json' #}
{# }) #}
{# .done(function (data) { #}
{# if (data.status == "activated") { #}
{# btnDisable.html("Disable"); #}
{# btnDisable.removeClass("btn-success"); #}
{# btnDisable.addClass("btn-danger"); #}
{# } else { #}
{# btnDisable.html("Enable"); #}
{# btnDisable.removeClass("btn-danger"); #}
{# btnDisable.addClass("btn-success"); #}
{# } #}
{# }) #}
{# .fail(function (data) { #}
{# console.log(data); #}
{# $.toast({ #}
{# heading: '{% trans %}CONNECTION ISSUE{% endtrans %}', #}
{# text: '{% trans %}Please check your internet connection and try later{% endtrans %}', #}
{# position: 'top-center', #}
{# loaderBg: '#ff6849', #}
{# icon: 'warning', #}
{# hideAfter: 4000, #}
{# stack: 6 #}
{# }); #}
{# }); #}
{# } #}
{# }); #}
{# }); #}
{# $(document).on('click', '.btn-disable-agent', function (e) { #}
{# var btnDisable = $(this); #}
{# swal({ #}
{# title: btnDisable.hasClass('btn-danger') ? "Disable Agent" : "Enable Agent", #}
{# text: "Are you sure you want to " + (btnDisable.hasClass('btn-danger') ? "disable" : "enable") + " \"" + btnDisable.data('agent-name') + "\" agent?", #}
{# icon: "warning", #}
{# buttons: ['Cancel', 'Yes'], #}
{# dangerMode: true, #}
{# }) #}
{# .then(function (isConfirm) { #}
{# if (isConfirm) { #}
{# $.ajaxSetup({ #}
{# headers: { #}
{# 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') #}
{# } #}
{# }); #}
{# $.ajax({ #}
{# type: 'POST', #}
{# url: '{{ path('deactivate_user') }}/' + btnDisable.data('agent-id'), #}
{# dataType: 'json' #}
{# }) #}
{# .done(function (data) { #}
{# if (data.status == "activated") { #}
{# btnDisable.html("Disable"); #}
{# btnDisable.removeClass("btn-success"); #}
{# btnDisable.addClass("btn-danger"); #}
{# } else { #}
{# btnDisable.html("Enable"); #}
{# btnDisable.removeClass("btn-danger"); #}
{# btnDisable.addClass("btn-success"); #}
{# } #}
{# }) #}
{# .fail(function (data) { #}
{# console.log(data); #}
{# $.toast({ #}
{# heading: '{% trans %}CONNECTION ISSUE{% endtrans %}', #}
{# text: '{% trans %}Please check your internet connection and try later{% endtrans %}', #}
{# position: 'top-center', #}
{# loaderBg: '#ff6849', #}
{# icon: 'warning', #}
{# hideAfter: 4000, #}
{# stack: 6 #}
{# }); #}
{# }); #}
{# } #}
{# }); #}
{# }); #}
$('.custom-file-input').on('change', function (event) {
var inputFile = event.currentTarget;
$(inputFile).parent()
.find('.custom-file-label')
.html(inputFile.files[0].name);
$('.logo-preview').hide();
});
});
</script>
{#- AJAX: SAVE FOR LATER -#}
<script>
$(document).ready(function () {
$(document).on('click', '#save-for-later', function () {
let idQuote = $('#quote-name div').data('idQuote');
console.log(idQuote);
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: 'GET',
url: '{{ path('home') }}',/*trip.save_for_later*/
dataType: 'json',
data: {idQuote: idQuote},
})
.done(function (data) {
console.log(data);
$('#quote-name').html("{% trans %}empty{% endtrans %}");
$('#cart-content').html("");
$('#badge-cart-count').text("0");
$.toast({
heading: '{% trans %}Trip has been saved{% endtrans %}',
text: '{% trans %}It can be accessed in the Trip Folder{% endtrans %}',
position: 'top-center',
loaderBg: '#77aa3b',
icon: 'success',
hideAfter: 5000,
stack: 6,
afterShown: function () {
location.reload();
}
});
})
.fail(function () {
console.log(this.url);
$.toast({
heading: '{% trans %}CONNECTION ISSUE{% endtrans %}',
text: '{% trans %}Please check your internet connection and try later{% endtrans %}',
position: 'top-center',
loaderBg: '#ff6849',
icon: 'warning',
hideAfter: 4000,
stack: 6
});
});
});
});
var displayingMessage = -1;
function getLoadingMessage() {
loadingMsgs = [{
'time': 8000,
'msg': 'There are 61,000 people in the air over the US at any given moment of any given day.'
},
{'time': 8000, 'msg': 'Honolulu is the only place in the U.S. that has a royal palace.'},
{'time': 8000, 'msg': 'With more than 3 million lakes, Canada has the most lakes in the world.'},
{
'time': 10000,
'msg': 'The longest flight in the world is from Sydney to Dallas. It lasts around 16 hours and covers approximately 8,500 miles.'
},
{
'time': 9000,
'msg': 'Traveling is good reason to meet new people and establish friendly relations with foreigners.'
},
{
'time': 10000,
'msg': 'If you want to spend a night in all of Las Vegas’ hotels, it would take you almost three hundred years to do it.'
},
{
'time': 10000,
'msg': 'The Finger Lakes area in New York is the largest wine producing region in the United States, besides California.'
},
{'time': 10000, 'msg': 'Deer in the Florida Keys are about the size of collie dogs.'},
{'time': 9000, 'msg': 'Key West is closer to Havana than to Miami.'},
{'time': 10000, 'msg': 'New York City is actually further south than Rome is.'},
{'time': 10000, 'msg': 'The city of Monaco is smaller in size than Central Park in New York City'},
{
'time': 12000,
'msg': 'The largest human migration in America occurs annually at Thanksgiving, with nearly 51 million traveling home for the holidays.'
},
{'time': 9000, 'msg': 'California has more people than all of Canada.'},
{
'time': 12000,
'msg': 'St. Augustine was the first city in America. Therefore making it the oldest city in the United States, founded by the Spanish in 1565.'
},
{
'time': 10000,
'msg': 'Australia is wider than the moon.'
},
{
'time': 10000,
'msg': 'The Florida Everglades are the only place on the planet where crocodiles and alligators live together.'
},
{
'time': 10000,
'msg': 'Panama is the only place in the world where you can see the sun rise on the Pacific and set on the Atlantic.'
},
{
'time': 10000,
'msg': 'The entire world\'s population could fit inside Los Angeles if everyone stood shoulder to shoulder.'
},
{
'time': 10000,
'msg': 'Surfing was introduced to the U.S. mainland in 1885, when three visiting Hawaiian princes paddled into the waves off Santa Cruz\'s Main Beach.'
},
{
'time': 10000,
'msg': 'No spot in Central America is further than 125 miles (200 kilometers) from the ocean.'
},
{
'time': 10000,
'msg': 'The whole of China operates on Beijing time, even though the country covers five time zones.'
},
{
'time': 10000,
'msg': 'The shortest international commercial flight is a 15 minute trip from Sint Maarten to Anguilla.'
},
{
'time': 10000,
'msg': 'Continents shift at about the same rate as your fingernails grow.'
},
{
'time': 10000,
'msg': 'Gravity in the Hudson Bay area of Canada is lower than in the rest of the world.'
},
{
'time': 10000,
'msg': 'The UK has almost three times the population of Australia.'
},
{
'time': 10000,
'msg': 'The northern hemisphere is home to 90% of the world’s population.'
},
{
'time': 10000,
'msg': 'The Spanish national anthem has no words.'
},
{
'time': 10000,
'msg': 'In Drachten, a town in Holland, there are 50,000 residents and zero traffic lights.'
},
{
'time': 10000,
'msg': 'Every sixty seconds, more than thirty thousand tons of water will go over the Niagara Falls.'
},
{
'time': 10000,
'msg': 'Japan has the world\'s oldest hotel that\'s been in operations for 1,300 years, which has stayed in the same family for 52 generations.'
},
{
'time': 10000,
'msg': 'Michigan has over 300 waterfalls and more coastline than California, thanks to the great lakes.'
},
{
'time': 10000,
'msg': 'La Paz, Bolivia is the highest capital city in the world.'
},
{
'time': 10000,
'msg': 'More than one-third of the world’s airports are in the United States of America.'
},
{
'time': 10000,
'msg': 'Angel Falls in Venezuela is the world\'s highest uninterrupted waterfall.'
},
{
'time': 10000,
'msg': 'Australia has over 10,000 beaches.'
},
{
'time': 10000,
'msg': 'Bulgaria is the only country in Europe that hasn\'t changed it\'s name since it was first created.'
},
{
'time': 10000,
'msg': 'In a nation known for its winter, Calgary, Alberta averages 333 sunny days a year.'
},
{
'time': 10000,
'msg': 'Sweden has over 220,000 islands (more than anywhere else in the world).'
},
{
'time': 10000,
'msg': 'Many sections of the Great Wall Of China are held together by a paste of sticky rice flour and slaked lime.'
},
{
'time': 10000,
'msg': 'The country with the most time zones is France, thanks to its overseas territories. France uses 12 time zones.'
},
{
'time': 10000,
'msg': 'Russia shares a border with 14 countries, No other country has as many borders.'
},
{
'time': 10000,
'msg': 'Dubai’s artificial Palm Islands use enough sand to fill 2.5 Empire State buildings.'
},
{
'time': 10000,
'msg': 'Everyday, 3,000 euros worth of coins are thrown into the Trevi Fountain in Rome - and then donated to charity.'
},
{
'time': 10000,
'msg': 'Two-thirds of the world’s eggplant is grown in New Jersey.'
},
{
'time': 10000,
'msg': 'The Grand Canyon creates its own weather due to its elevation.'
},
{
'time': 10000,
'msg': 'In the Caribbean, there are oysters that can climb trees.'
},
{
'time': 10000,
'msg': 'The city of Portland, Oregon was named after a coin toss. Heads for Portland and tails for Boston.'
},
{
'time': 10000,
'msg': 'There is enough fuel in a full tank of a jumbo jet to drive an average car around the world four times.'
},
{
'time': 10000,
'msg': 'Peru has more pyramids than Egypt.'
},
{
'time': 10000,
'msg': 'Holland\'s famous tulips originated in Turkey.'
},
{
'time': 10000,
'msg': 'There\'s a city called Rome on each of the five continents.'
},
{
'time': 10000,
'msg': 'Estonia has the cleanest air in the world.'
},
{
'time': 10000,
'msg': 'Istanbul, Turkey is the only city built on two continents.'
},
{
'time': 10000,
'msg': 'Only 5% of the world’s population has ever been on an airplane.'
},
{
'time': 10000,
'msg': 'Greek is the oldest written language still in existence.'
},
{
'time': 10000,
'msg': 'The largest cave in the world is in Han Son Doong, Vietnam and has its own climate, jungle, and river. It is so massive that clouds form inside.'
},
{
'time': 10000,
'msg': 'There\'s a giant limestone wall in Bolivia that has over 5,000 dinosaur footprints on it.'
},
{
'time': 10000,
'msg': 'Indonesia\'s volcano, Kawah Ijen, spews blue lava.'
},
{
'time': 10000,
'msg': 'The oldest living organism in the world is "Pando” in Utah. It looks like a forest, but it\'s actually one tree spread across 100 acres.'
},
{
'time': 10000,
'msg': 'New York City is built on an ancient mountain range so old that it has eroded away entirely. Skyscrapers stand where the mountains once stood.'
},
{
'time': 10000,
'msg': 'There are secret poems written on Boston\'s sidewalks that are only visible when it rains.'
},
{
'time': 10000,
'msg': 'There are enough restaurants in New York City for one person to eat out every night for 54 years and never visit the same place twice.'
},
{
'time': 10000,
'msg': 'The soft soil that causes the Leaning Tower of Pisa to tilt has protected it from at least 4 strong earthquakes.'
},
{
'time': 10000,
'msg': 'The pink cherry blossom trees in Washington D.C were a gift from Japan in 1912, as a symbol of friendship.'
},
{
'time': 10000,
'msg': 'The tallest tree and the oldest tree in the world are located in California.'
},
{
'time': 10000,
'msg': 'An Egyptian city named Thonis was discovered underwater in 2013 after being lost for 1,200 years in the Mediterranean sea.'
},
{
'time': 10000,
'msg': 'The Pacific ocean is larger than all of the land on Earth.'
},
{
'time': 10000,
'msg': 'Every day, people in the UK drink 164 million cups of tea.'
},
{
'time': 10000,
'msg': 'There are more chickens than humans in the UK.'
},
{
'time': 10000,
'msg': 'About one fourth of the Netherlands lies below sea level.'
},
{
'time': 10000,
'msg': 'Moisture from the Amazon falls as far away as Texas.'
},
{
'time': 10000,
'msg': 'If you drive south from Detroit, Michigan, you\'ll reach Canada.'
},
{
'time': 10000,
'msg': 'Brazil is home to the largest Japanese population outside Japan.'
},
{
'time': 10000,
'msg': 'DFW Airport is larger than Manhattan.'
},
{
'time': 10000,
'msg': 'The West Edmonton Mall in Canada has the largest parking spot in the world (20,000 spaces).'
},
{
'time': 10000,
'msg': 'Walt Disney World\'s property is the same size as San Francisco.'
},
{
'time': 10000,
'msg': 'Due to the bulge at the equator, the peak of Mount Chimborazo in Ecuador is the closest point on earth to the moon (not Mount Everest).'
},
{
'time': 10000,
'msg': 'The population of Texas is larger than the entire population of Australia.'
},
{
'time': 10000,
'msg': 'There are 45 million motorcycles in Vietnam (almost as many as the entire population of Canada).'
},
{
'time': 10000,
'msg': '“Traveling – it leaves you speechless, then turns you into a storyteller.” — Ibn Battuta'
},
{
'time': 10000,
'msg': '“The journey of a thousand miles begins with a single step.”—Lao Tzu'
}
];
position = Math.floor(Math.random() * loadingMsgs.length);
if (displayingMessage != position) {
displayingMessage = position;
} else {
displayingMessage = position < loadingMsgs.length ? position + 1 : 0;
}
loadingMsgs[displayingMessage].msg = "<p class='loading-message'>" + loadingMsgs[displayingMessage].msg + "</p><div class='sk-spinner sk-spinner-double-bounce'><div class='sk-double-bounce1'></div><div class='sk-double-bounce2'></div></div>";
return loadingMsgs[displayingMessage];
}
function hidePreloader() {
var preloader = $('.pg-loading-screen');
preloader.fadeOut(100);
}
$(document).on('submit', '#searchbar form', function () {
loadingScreenFunction();
});
let pleaseWaitLoadingScreen
const loadingScreenFunction = async () => {
let loadingMessage = getLoadingMessage();
{% set websiteLogo = 'img/logo/overseas-xpress-logo-horizontal.png' %}
{% if app.session.get("customerAccountDomain") %}
{% set customerAccountDomain = app.session.get("customerAccountDomain") %}
{% set websiteLogo = 'uploads/customerAccountLogo/logoWebsite/' ~ customerAccountDomain.getWebsiteLogo() %}
{% endif %}
pleaseWaitLoadingScreen = pleaseWait({
logo: "{{ asset(websiteLogo) }}",
backgroundColor: 'rgb(255, 255, 255, 1)',
loadingHtml: loadingMessage.msg,
});
let i = 0;
while (i < 10) {
await delay(loadingMessage.time);
loadingMessage = getLoadingMessage();
pleaseWaitLoadingScreen.updateLoadingHtml(loadingMessage.msg);
i++;
}
};
const delay = ms => new Promise(res => setTimeout(res, ms));
$('body').on('click', '.booknow', function () {
loadingScreenFunction();
});
$(document).on('submit', '#searchbar .hotel__results .refinements__search form', function () {
loadingScreenFunction();
});
$(document).on('submit', '#searchHotelModal', function () {
loadingScreenFunction();
});
$(document).ready(function () {
$(document).on('submit', '#carRentalForm', function () {
loadingScreenFunction();
});
})
</script>
{#- DATE Picker -#}
<script>
let checkIn = {% if checkIn is defined and checkIn %} new Date("{{ checkIn }}T00:12:00") {% else %} moment().add(7, 'days') {% endif %} ;
let checkOut = {% if checkOut is defined and checkOut %} new Date("{{ checkOut }}T00:12:00") {% else %} moment().add(10, 'days'){% endif %} ;
</script>
<script src="{{ asset('js/pages/ox-datepicker.js') }}"></script>
<script>
$(window).ready(function () {
// HOTEL AUTOCOMPLETE
let hotelAutocomplete = $("#hotel_destination");
if (hotelAutocomplete.length) {
hotelAutocomplete.keydown(function (event) {
//Prevent enter
if (event.keyCode == 13) {
event.preventDefault();
return false;
}
});
hotelAutocomplete.autocomplete({
// autoFocus: true,
source: function (request, response) {
$.ajax({
url: "{{ path('autocomplete_hotel') }}",
dataType: "json",
data: {
searchTerm: request.term
},
success: function (data) {
response(data);
}, error: function (d) {
console.log(2);
console.log(d);
}
});
},
minLength: 3,
focus: function (event, ui) {
$("#hotel_destination").val(ui.item.label);
$("#hidden_hotel_id").val(ui.item.itemId);
return false;
},
change: function (event, ui) {
// console.log('ui');
// console.log(ui);
if (ui === null || ui.item === null) {
let autocompleteItem = $('.autocompleteItem');
$("#hotel_destination").val(autocompleteItem.first().data('label'));
$("#hidden_hotel_id").val(autocompleteItem.first().data('item_id'));
}
return false;
},
}).autocomplete("instance")._renderItem = function (ul, item) {
return $("<li class='autocompleteItem " + item.class + "' data-label='" + item.label + "' data-item_id='" + item.itemId + "' >")
.append("<div> <i class='autocompleteItemIcon fas fa-bed'></i> <i class='autocompleteItemIcon far fa-map'></i>" + item.label + " </div>")
.appendTo(ul);
};
}
// ACTIVITY AUTOCOMPLETE
let activityAutocomplete = $("#experience_destination");
if (activityAutocomplete.length) {
activityAutocomplete.autocomplete({
source: function (request, response) {
$.ajax({
url: "{{ path('autocomplete_activity') }}",
dataType: "json",
data: {
searchTerm: request.term
},
success: function (data) {
console.log(123);
response(data);
}, error: function (d) {
console.log(2);
console.log(d);
}
});
},
minLength: 3,
focus: function (event, ui) {
$("#experience_destination").val(ui.item.label);
return false;
},
change: function (event, ui) {
console.log(ui);
if (ui.item === null) {
let autocompleteItem = $('.autocompleteItem');
$("#experience_destination").val(autocompleteItem.first().data('label'));
}
return false;
},
}).autocomplete("instance")._renderItem = function (ul, item) {
return $("<li class='autocompleteItem " + item.class + "' data-label='" + item.label + "' data-item_id='" + item.itemId + "' >")
.append("<div> <i class='autocompleteItemIcon fas fa-hiking'></i> <i class='autocompleteItemIcon far fa-map'></i>" + item.label + " </div>")
.appendTo(ul);
};
}
// TRANSFER AUTOCOMPLETE
let transferAutocomplete = $("#transfer_destination");
if (transferAutocomplete.length) {
transferAutocomplete.autocomplete({
source: function (request, response) {
$.ajax({
url: "{{ path('autocomplete_transfer') }}",
dataType: "json",
data: {
searchTerm: request.term
},
success: function (data) {
response(data);
}, error: function (d) {
console.log(2);
console.log(d);
}
});
},
minLength: 3,
focus: function (event, ui) {
$("#transfer_destination").val(ui.item.label);
return false;
},
change: function (event, ui) {
console.log(ui);
if (ui.item === null) {
let autocompleteItem = $('.autocompleteItem');
$("#transfer_destination").val(autocompleteItem.first().data('label'));
}
return false;
},
}).autocomplete("instance")._renderItem = function (ul, item) {
return $("<li class='autocompleteItem " + item.class + "' data-label='" + item.label + "' data-item_id='" + item.itemId + "' >")
.append("<div> <i class='autocompleteItemIcon fas fa-plane'></i> <i class='autocompleteItemIcon far fa-map'></i>" + item.label + " </div>")
.appendTo(ul);
};
}
});
</script>
{#- GOOGLE ANALYTICS -#}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-117506295-7"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-117506295-7');
</script>
<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/7009910.js"></script>
<!-- End of HubSpot Embed Code -->