var firstdate = 1714626000; var lastdate = 1735102800; var currentdate = 1714647336; $(document).ready(function() { $('#check-machu') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-machu').each(function(){ $(this).toggle(checked); }); }); $('#check-wayna') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-wayna').each(function(){ $(this).toggle(checked); }); }); $('#check-mountain') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-mountain').each(function(){ $(this).toggle(checked); }); }); $('#check-huchuy') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-huchuy').each(function(){ $(this).toggle(checked); }); }); $('#check-puente') .checkboxradio() .on('change', function(event){ checked = ($(this).is(':checked')); $('#calendar').find('.serv-box-puente').each(function(){ $(this).toggle(checked); }); }); $('.navigation').on('click', function(e) { event.preventDefault(); var nav=$(this).data('nav'); switch(nav) { case 'first': currentdate = firstdate; break; case 'pageprev': currentdate -= (86400 * 7); break; case 'previous': currentdate -= (86400); break; case 'next': currentdate += (86400); break; case 'pagenext': currentdate += (86400 * 7); break; case 'last': currentdate = lastdate; } if(currentdate < firstdate) currentdate = firstdate; if(currentdate > lastdate) currentdate = lastdate; navigation(currentdate); }); /* $('#div-calendar').on('click', '.serv-status0', function() { //var serv = $(this).data('serv'); //var date = $(this).data('date'); var url = $(this).data('url'); window.location.href="/compra-"+url+"#1"; }); */ var originalContent_subscribe; var window_subscribe = $('#popup-subscribe').dialog({ autoOpen: false, modal: true, position: { my: "top", at: "top", of: window }, width: 400, height: 'auto', resizable: false, title: "SuscripciĆ³n para la nueva temporada", buttons: {}, open : function(event, ui) { originalContent_subscribe = $("#popup-subscribe").html(); }, close: function (event, ui) { $('#popup-subscribe').html(originalContent_subscribe); } }).load('subscribe.php'); $('.ajax-popup-subscribe').click(function(event) { event.preventDefault(); window_subscribe.dialog('open'); }); $('.stats') .qtip({ //var date = $(this).data('date'); //var week = $(this).data('week'); //var qtip = $(this).qtip({ content: { text: "Cargando...", title: { text: "EvoluciĆ³n de los espacios disponibles", button: "Cerrar" }, ajax: { url: 'stats.php', method: 'GET', async: true, data: { //lg: 'es', week: 0 }, }, }, position: { my:'top center', at:'bottom center' }, show: 'click', hide: 'unfocus', style: { classes: 'ui-tooltip-popup ui-tooltip-shadow' } //}); }) .on('click', function () { event.preventDefault(); }); }); navigation(1714626000); function navigation(currentdate) { $('#waiting-spin').fadeIn(200); //var date = $(".select-date").eq(item).attr('data-date'); $.ajax({ url: 'display_calendar-ajax.php?date='+currentdate, async: true, dataType: 'text', success: function(data) { $('#waiting-spin').fadeOut(20); $('#div-calendar').html(data); checked = ($('#check-machu').is(':checked')); $('#calendar').find('.serv-box-machu').each(function(){ $(this).toggle(checked); }); checked = ($('#check-wayna').is(':checked')); $('#calendar').find('.serv-box-wayna').each(function(){ $(this).toggle(checked); }); checked = ($('#check-mountain').is(':checked')); $('#calendar').find('.serv-box-mountain').each(function(){ $(this).toggle(checked); }); checked = ($('#check-huchuy').is(':checked')); $('#calendar').find('.serv-box-huchuy').each(function(){ $(this).toggle(checked); }); checked = ($('#check-puente').is(':checked')); $('#calendar').find('.serv-box-puente').each(function(){ $(this).toggle(checked); }); animateCounters(); $('.soldout').each(function() { $(this).parents('td').addClass('soldout'); }); } }); }; function animateCounters() { $('.spacesbox').each(function() { $(this).find('[class^="bar-"]').animate({ width: $(this).attr('data-pct') }, 2000); }); $('.spaces').each(function () { var spaces = $(this).data('spaces'); var spmax = $(this).data('max'); var nbDigits = (spmax+'').length; var nbDigits = 3; $(this).animate({ Counter: spaces }, { duration: 2000, easing: 'swing', step: function (now) { $(this).text(("000"+Math.ceil(now)).slice(-(nbDigits))); } }); }); }