var language = 'es'; // LANGUAGE var booking_page = 'https://mesonainsa.com/es/reservas'; // BOOKING PAGE WITH BOOKING IFRAME INSERTED
jQuery(document).ready(function(){ if (jQuery('.ba-booking-calendar').length > 0) { if (language == 'es') { jQuery.tools.dateinput.localize( 'es', { months: 'Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre', shortMonths:'ene,feb,mar,abr,may,jun,jul,ago,sep,oct,nov,dic', days: 'Domingo,Lunes,Martes,Miércoles,Jueves,Viernes,Sábado', shortDays: 'Dom,Lun,Mar,Mié,Jue,Vie,Sáb' }); } else if (language == 'fr') { jQuery.tools.dateinput.localize( 'fr', { months: 'Janvier,Février,Mars,Avril,Mai,Juin,Juillet,Août,Septembre,Octobre,Novembre,Décembre', shortMonths:'jan,fév,mar,avr,mai,jun,jul,aoû,sep,oct,nov,déc', days: 'Dimanche,Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi', shortDays: 'Dim,Lun,Mar,Mer,Jeu,Ven,Sam' }); } else { jQuery.tools.dateinput.localize( 'en', { months: 'January,February,March,April,May,June,July,August,September,October,November,December', shortMonths:'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec', days: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday', shortDays: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat' }); } jQuery('.ba-booking-calendar .-form :date').dateinput({ trigger: true, format: 'dd mmm yyyy', min: -1, firstDay: 1, lang: language, offset: [0, 0] }); jQuery('.ba-booking-calendar .-form :date').bind('onShow onHide', function() { jQuery(this).parent().toggleClass('active'); });
function ba_calendar_departure() { var d = new Date(jQuery('.ba-booking-calendar .-form :date:first').data('dateinput').getValue()); d.setDate(d.getDate()+1); jQuery('.ba-booking-calendar .-form :date:last').data('dateinput').setMin(d, true); } jQuery('.ba-booking-calendar .-form :date:first').data('dateinput').change(function() { ba_calendar_departure(); }); ba_calendar_departure();
jQuery('.ba-booking-calendar .-form .-button').click(function(e) { var date_in = jQuery('.ba-booking-calendar .-form :date:first').data('dateinput').getValue('yyyy-mm-dd'); var date_out = jQuery('.ba-booking-calendar .-form :date:last').data('dateinput').getValue('yyyy-mm-dd'); var queryStr = 'user_language='+language+'&date_in='+date_in+'&date_out='+date_out; if (jQuery('.ba-booking-calendar .-form .-field-pricegroup select').length > 0){ queryStr += '&price_group='+jQuery('.ba-booking-calendar .-form .-field-pricegroup select').val(); } if (jQuery('.ba-booking-calendar .-form .-field-promocode input').length > 0){ queryStr += '&promo_code='+jQuery('.ba-booking-calendar .-form .-field-promocode input').val(); } document.location.href = booking_page+'?'+queryStr; return false; }); } });