document.head.appendChild(scriptTag); } else return bookingStart(); } //start script injection injectLibFromStack(); })(); }else{ bookingStart(); } } function bookingStart(){ $('.ui.resort.dropdown').dropdown(); booking_calendar = new Lightpick({ minDays: 1, firstDay: 7, lang: `en`, minDate: moment(new Date()).add(1,'days'), parentEl:document.getElementById('calendarParent'), field: document.getElementById('Cinm1'), singleDate: false, hideOnBodyClick: false, hoveringTooltip: false, autoclose: false, format: 'YYYY-MM-DD', onSelect: function(start, end){ var str = ''; var visible = ''; $('form.reservation input[name=cin]').val(start.format('YYYY-MM-DD')); str += start ? start.format('MMMM DD, YYYY') + ` - ` : ''; visible += start ? start.format('MMMM DD') + ` - ` : ''; document.getElementById('Cinm1').value = str; if(end){ $('form.reservation input[name=cout]').val( end.format('YYYY-MM-DD') ); let array1 = datesArray(start.format('YYYY-MM-D'), end.format('MMMM DD, YYYY')); let intersection = closedDates.filter(value => -1 !== array1.indexOf(value)); if(intersection.length > 0){ //alert('some days are closed, only allowed for checkout: '+intersection[0]) //$('#roomsStepBtn').addClass('disabled') }else{ //$('#roomsStepBtn').removeClass('disabled') str += end ? end.format('MMMM DD, YYYY') : '...'; visible += end ? end.format('MMMM DD') : '...'; } } document.getElementById('Cinm1').value = str; booking_calendar.show(); }, }); booking_calendar.show() $('.ui.booking.modal').modal('show'); $('#booking_link').unbind('click').attr('onclick','').click(function(){ $('.ui.booking.modal').modal('show'); }); $('#booking_link2').unbind('click').attr('onclick','').click(function(){ $('.ui.booking.modal').modal('show'); }); } function startBookingC(event){ let target = $(event.target); if(typeof booking_calendar == 'undefined'){ startBooking(); target.attr('onclick','').unbind('click').click(function(){ $('.ui.booking.modal').modal('show'); }); }else{ $('.ui.booking.modal').modal('show'); } } function setResort(resort, event){ let form = $(event.target).closest('form'); form.find('input[name='resort']').val(resort); //$('#booking_form .resort.button .text').text(event.target.innerText); } Chat Royal Solaris Los Cabos Royal Solaris Cancun GR Solaris Caribe GR Solaris Cancun GR Solaris Lighthouse FROM THE USA/CAN: 1(855) 218 8333 WORLDWIDE: +52 (998) 800 1353 FROM MEXICO: (800) 284 7394 DESDE MEXICO: (800) 284 7394 DESDE USA/CAN: 1(855) 218 8333 INTERNACIONAL: +52 (998) 800 1353