PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /home/trave494/hotebooking.site/wp-content/themes/travelerc/js/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : /home/trave494/hotebooking.site/wp-content/themes/travelerc/js/availability_rental_partner.js |
jQuery(function($) { if ($(".st_partner_avaiablity.edit-rental").length < 1) return; $('.date-picker').datepicker({ language: st_params.locale || '', dateFormat: "mm/dd/yy", weekStart: 1 }); var RentalCalendar = function(container) { var self = this; this.container = container; this.calendar = null; this.form_container = null; this.init = function() { self.container = container; self.calendar = $('.calendar-content', self.container); self.form_container = $('.calendar-form', self.container); setCheckInOut('', '', self.form_container); self.initCalendar() } this.initCalendar = function() { self.calendar.fullCalendar({ firstDay: 1, lang: st_params.locale, timezone: st_timezone.timezone_string, customButtons: { reloadButton: { text: st_params.text_refresh, click: function() { self.calendar.fullCalendar('refetchEvents') } } }, header: { left: 'today,reloadButton', center: 'title', right: 'prev, next' }, contentHeight: 480, selectable: !0, select: function(start, end, jsEvent, view) { var start_date = new Date(start._d).toString("MM"); var end_date = new Date(end._d).toString("MM"); var today = new Date().toString("MM"); if (start_date < today || end_date < today) { self.calendar.fullCalendar('unselect'); setCheckInOut('', '', self.form_container) } else { var zone = moment(start._d).format('Z'); zone = zone.split(':'); zone = "" + parseInt(zone[0]) + ":00"; var check_in = moment(start._d).utcOffset(zone).format("MM/DD/YYYY"); var check_out = moment(end._d).utcOffset(zone).subtract(1, 'day').format("MM/DD/YYYY"); setCheckInOut(check_in, check_out, self.form_container) } }, events: function(start, end, timezone, callback) { $.ajax({ url: ajaxurl, dataType: 'json', type: 'post', data: { action: 'st_get_availability_rental', post_id: self.container.data('post-id'), start: start.unix(), end: end.unix() }, success: function(doc) { if (typeof doc == 'object') { callback(doc) } }, error: function(e) { alert('Can not get the availability slot. Lost connect with your sever') } }) }, eventClick: function(event, element, view) {}, eventRender: function(event, element, view) { var html = ''; if (event.status == 'available') { html += '<div class="price">'+ st_params.text_price +': ' + event.price + '</div>'; $(element).addClass('bgr-main') } if (typeof event.status == 'undefined' || event.status != 'available') { html += '<div class="not_available">'+ st_params.text_unavailable+'</div>' } $('.fc-content', element).html("<div class='bgr-main'>" + html + "</div>") }, loading: function(isLoading, view) { if (isLoading) { $('.calendar-wrapper-inner .overlay-form').fadeIn() } else { $('.calendar-wrapper-inner .overlay-form').fadeOut() } }, }) } }; function setCheckInOut(check_in, check_out, form_container) { $('#calendar_check_in', form_container).val(check_in); $('#calendar_check_out', form_container).val(check_out) } function resetForm(form_container) { $('#calendar_check_in', form_container).val(''); $('#calendar_check_out', form_container).val(''); $('#calendar_price', form_container).val(''); $('#calendar_priority', form_container).val(''); $('#calendar_number', form_container).val('') } jQuery(document).ready(function($) { if ($('a[href="#availablility_tab"], ul li[data-step="#step_availablility"]').length) { $('a[href="#availablility_tab"], ul li[data-step="#step_availablility"]').click(function(event) { setTimeout(function() { $('.calendar-content', '.calendar-wrapper').fullCalendar('today') }, 1000) }) } $('.calendar-wrapper').each(function(index, el) { var t = $(this); var rental = new RentalCalendar(t); rental.init(); var flag_submit = !1; $('#calendar_submit', t).click(function(event) { var data = $('input, select', '.calendar-form').serializeArray(); data.push({ name: 'action', value: 'st_add_custom_price_rental' }); $('.form-message', t).attr('class', 'form-message').find('p').html(''); $('.overlay', self.container).addClass('open'); if (flag_submit) return !1; flag_submit = !0; $.post(ajaxurl, data, function(respon, textStatus, xhr) { if (typeof respon == 'object') { if (respon.status == 1) { resetForm(t); $('.calendar-content', t).fullCalendar('refetchEvents') } else { $('.form-message', t).addClass(respon.type).find('p').html(respon.message); $('.overlay', self.container).removeClass('open') } } else { $('.overlay', self.container).removeClass('open') } flag_submit = !1 }, 'json'); return !1 }); $('body').on('calendar.change_month', function(event, value){ var date = rental.calendar.fullCalendar('getDate'); var month = date.format('M'); date = date.add(value-month, 'M'); rental.calendar.fullCalendar( 'gotoDate', date.format('YYYY-MM-DD') ); }); }) }) })