Guest User

Untitled

a guest
Dec 19th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.94 KB | None | 0 0
  1. defaultView: "agendaWeek",
  2. defaultDate: today,
  3.  
  4. selectable:true,
  5. selectHelper:true,
  6. selectOverlap :false,
  7. footer:false,
  8. slotDuration:"01:00:00",
  9. hiddenDays:['2,4'],
  10. validRange: {
  11. start: today,
  12. end: "2025-06-01"
  13. },
  14. allDayText:"hours",
  15. allDay :false,
  16. forceEventDuration:true,
  17. defaultTimedEventDuration:"05:00:00",
  18. navLinks: false,
  19. weekNumbers: false,
  20. weekNumbersWithinDays: false,
  21. weekNumberCalculation: "ISO",
  22.  
  23.  
  24.  
  25.  
  26. var booking_started=0;
  27. price_array=[];
  28. booking_array=[];
  29. booking_array = JSON.parse (control_vars.booking_array);
  30. var today = new Date();
  31. var listing_book_dates=[];
  32.  
  33. for (var key in booking_array) {
  34. if (booking_array.hasOwnProperty(key)) {
  35. var temp_book=[];
  36. temp_book["title"] = "reserved",
  37. temp_book ["start"] = moment.unix(key).utc().format(),
  38. temp_book ["end"] = moment.unix( booking_array[key]).utc().format(),
  39. temp_book ["editable"] = false,
  40. temp_book["textEscape"] = false;
  41. listing_book_dates.push(temp_book);
  42. }
  43. }
  44. console.log(booking_array);
  45.  
  46. jQuery("#book_per_hour_calendar").fullCalendar({
  47.  
  48. defaultView: "agendaWeek",
  49. defaultDate: today,
  50.  
  51. selectable:true,
  52. selectHelper:true,
  53. selectOverlap :false,
  54. footer:false,
  55. slotDuration:"01:00:00",
  56. hiddenDays:['.get_post_meta($post->ID, 'checkin_change_over', true).','.get_post_meta($post->ID, 'checkin_checkout_change_over', true).'],
  57. validRange: {
  58. start: today,
  59. end: "2025-06-01"
  60. },
  61. allDayText:"hours",
  62. allDay :false,
  63. forceEventDuration:true,
  64. defaultTimedEventDuration:"05:00:00",
  65. navLinks: false,
  66. weekNumbers: false,
  67. weekNumbersWithinDays: false,
  68. weekNumberCalculation: "ISO",
  69. editable: true,
  70. eventLimit: { "default": false },
  71. unselectAuto:false,
  72. nowIndicator :true,
  73. defaultEventMinutes :200,
  74. isRTL:control_vars.rtl_book_hours_calendar,
  75. longPressDelay :100,
  76. eventLongPressDelay:100,
  77. selectLongPressDelay:100,
  78. header: {
  79. left: "prev,next today",
  80. center: "title",
  81. right: ""
  82. },
  83. minTime:control_vars.booking_start_hour,
  84. maxTime:control_vars.booking_end_hour,
  85.  
  86. dayClick: function(date, jsEvent, view) {
  87.  
  88. },
  89.  
  90. select:function( start, end, jsEvent, view ){
  91. end = moment(end);
  92. var min_hours = parseFloat( control_vars.min_days_booking);
  93.  
  94. var start_of_day=( moment(start).startOf("day") )/1000;
  95. if( mega_details[start_of_day] !== undefined){
  96. min_hours= mega_details[start_of_day]["period_min_days_booking"];
  97. }
  98.  
  99. var should_end = moment(start).add(min_hours, "hours");
  100.  
  101.  
  102.  
  103.  
  104. if(should_end>end){
  105. end = should_end;
  106. }
  107.  
  108. jQuery("#book_per_hour_calendar").fullCalendar("unselect");
  109. jQuery("#book_per_hour_calendar").fullCalendar("removeEvents","rentals_custom_book_initial");
  110.  
  111. jQuery("#book_per_hour_calendar").fullCalendar("renderEvent",{
  112. id:"rentals_custom_book_initial",
  113. start: start,
  114. end: end,
  115. allDay: false,
  116. editable:false,
  117. },
  118. true // stick the event
  119. );
  120.  
  121. $("#book_per_hour_calendar").fullCalendar("removeEvents");
  122. $("#book_per_hour_calendar").fullCalendar("addEventSource", listing_book_dates);
  123. $("#book_per_hour_calendar").fullCalendar("rerenderEvents");
  124.  
  125. jQuery("#book_per_hour_calendar").fullCalendar("removeEvents","rentals_custom_book");
  126. var date_format = control_vars.date_format.toUpperCase()+" HH:mm";
  127. var new_date_format=date_format.replace("YY", "YYYY");
  128.  
  129. jQuery("#start_date").val(start.format(new_date_format));
  130. jQuery("#end_date").val(end.format(new_date_format));
  131. jQuery(".fc-center .hour_selection").empty().html(start.format(new_date_format)+" to "+end.format(new_date_format));
  132. var prop_id=jQuery("#listing_edit").val();
  133. wpestate_setCookie("booking_prop_id_cookie", prop_id , 1);
  134. wpestate_setCookie("booking_start_date_cookie", start.format(new_date_format) , 1);
  135. wpestate_setCookie("booking_end_date_cookie", end.format(new_date_format) , 1);
  136. booking_started=1;
  137.  
  138.  
  139.  
  140. },
  141.  
  142. events:listing_book_dates
  143.  
  144.  
  145.  
  146. });
Add Comment
Please, Sign In to add comment