Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defaultView: "agendaWeek",
- defaultDate: today,
- selectable:true,
- selectHelper:true,
- selectOverlap :false,
- footer:false,
- slotDuration:"01:00:00",
- hiddenDays:['2,4'],
- validRange: {
- start: today,
- end: "2025-06-01"
- },
- allDayText:"hours",
- allDay :false,
- forceEventDuration:true,
- defaultTimedEventDuration:"05:00:00",
- navLinks: false,
- weekNumbers: false,
- weekNumbersWithinDays: false,
- weekNumberCalculation: "ISO",
- var booking_started=0;
- price_array=[];
- booking_array=[];
- booking_array = JSON.parse (control_vars.booking_array);
- var today = new Date();
- var listing_book_dates=[];
- for (var key in booking_array) {
- if (booking_array.hasOwnProperty(key)) {
- var temp_book=[];
- temp_book["title"] = "reserved",
- temp_book ["start"] = moment.unix(key).utc().format(),
- temp_book ["end"] = moment.unix( booking_array[key]).utc().format(),
- temp_book ["editable"] = false,
- temp_book["textEscape"] = false;
- listing_book_dates.push(temp_book);
- }
- }
- console.log(booking_array);
- jQuery("#book_per_hour_calendar").fullCalendar({
- defaultView: "agendaWeek",
- defaultDate: today,
- selectable:true,
- selectHelper:true,
- selectOverlap :false,
- footer:false,
- slotDuration:"01:00:00",
- hiddenDays:['.get_post_meta($post->ID, 'checkin_change_over', true).','.get_post_meta($post->ID, 'checkin_checkout_change_over', true).'],
- validRange: {
- start: today,
- end: "2025-06-01"
- },
- allDayText:"hours",
- allDay :false,
- forceEventDuration:true,
- defaultTimedEventDuration:"05:00:00",
- navLinks: false,
- weekNumbers: false,
- weekNumbersWithinDays: false,
- weekNumberCalculation: "ISO",
- editable: true,
- eventLimit: { "default": false },
- unselectAuto:false,
- nowIndicator :true,
- defaultEventMinutes :200,
- isRTL:control_vars.rtl_book_hours_calendar,
- longPressDelay :100,
- eventLongPressDelay:100,
- selectLongPressDelay:100,
- header: {
- left: "prev,next today",
- center: "title",
- right: ""
- },
- minTime:control_vars.booking_start_hour,
- maxTime:control_vars.booking_end_hour,
- dayClick: function(date, jsEvent, view) {
- },
- select:function( start, end, jsEvent, view ){
- end = moment(end);
- var min_hours = parseFloat( control_vars.min_days_booking);
- var start_of_day=( moment(start).startOf("day") )/1000;
- if( mega_details[start_of_day] !== undefined){
- min_hours= mega_details[start_of_day]["period_min_days_booking"];
- }
- var should_end = moment(start).add(min_hours, "hours");
- if(should_end>end){
- end = should_end;
- }
- jQuery("#book_per_hour_calendar").fullCalendar("unselect");
- jQuery("#book_per_hour_calendar").fullCalendar("removeEvents","rentals_custom_book_initial");
- jQuery("#book_per_hour_calendar").fullCalendar("renderEvent",{
- id:"rentals_custom_book_initial",
- start: start,
- end: end,
- allDay: false,
- editable:false,
- },
- true // stick the event
- );
- $("#book_per_hour_calendar").fullCalendar("removeEvents");
- $("#book_per_hour_calendar").fullCalendar("addEventSource", listing_book_dates);
- $("#book_per_hour_calendar").fullCalendar("rerenderEvents");
- jQuery("#book_per_hour_calendar").fullCalendar("removeEvents","rentals_custom_book");
- var date_format = control_vars.date_format.toUpperCase()+" HH:mm";
- var new_date_format=date_format.replace("YY", "YYYY");
- jQuery("#start_date").val(start.format(new_date_format));
- jQuery("#end_date").val(end.format(new_date_format));
- jQuery(".fc-center .hour_selection").empty().html(start.format(new_date_format)+" to "+end.format(new_date_format));
- var prop_id=jQuery("#listing_edit").val();
- wpestate_setCookie("booking_prop_id_cookie", prop_id , 1);
- wpestate_setCookie("booking_start_date_cookie", start.format(new_date_format) , 1);
- wpestate_setCookie("booking_end_date_cookie", end.format(new_date_format) , 1);
- booking_started=1;
- },
- events:listing_book_dates
- });
Add Comment
Please, Sign In to add comment