Changeset 3187065
- Timestamp:
- 11/13/2024 06:08:56 AM (13 months ago)
- Location:
- hydra-booking/trunk
- Files:
-
- 3 added
- 12 edited
- admin/Controller/DateTimeController.php (modified) (3 diffs)
- app/Content/Template/meeting-confirmation.php (modified) (1 diff)
- app/Content/Template/meeting-info.php (modified) (3 diffs)
- app/Content/calendar.php (added)
- app/Enqueue.php (modified) (2 diffs)
- app/Shortcode/HydraBookingShortcode.php (modified) (5 diffs)
- assets/app/css/style.css (modified) (1 diff)
- assets/app/css/tfhb-style.css.css (added)
- assets/app/js/app.js (added)
- assets/app/js/main.js (modified) (1 diff)
- hydra-booking.php (modified) (2 diffs)
- includes/database/Booking.php (modified) (2 diffs)
- includes/helper/helper-functions.php (modified) (1 diff)
- includes/services/Integrations/GoogleCalendar/GoogleCalendar.php (modified) (3 diffs)
- readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hydra-booking/trunk/admin/Controller/DateTimeController.php
r3185407 r3187065 40 40 41 41 public function convert_time_based_on_timezone( $time, $time_zone, $selected_time_zone, $time_format ) { 42 42 43 43 44 $time = new \DateTime( $time, new \DateTimeZone( $time_zone ) ); 44 45 … … 146 147 $booking = new Booking(); 147 148 148 $bookings = $booking->get( 149 array( 150 'meeting_id' => $meeting_id, 151 'meeting_dates' => $selected_date, 152 ), 153 true // Return as array, 154 ); 155 149 $bookings = $booking->getByMeetingIdDates( $meeting_id, $selected_date ); 150 151 156 152 157 153 $disabled_times = array(); … … 178 174 continue; 179 175 } 180 } 176 } 181 177 182 178 $start_time = $this->convert_time_based_on_timezone( $start_time, $time_zone, $selected_time_zone, $selected_time_format ); -
hydra-booking/trunk/app/Content/Template/meeting-confirmation.php
r3185407 r3187065 80 80 if ( ! empty( $booking['meeting_locations'] ) ) { 81 81 $meeting_location = json_decode( $booking['meeting_locations'], true ); 82 83 82 84 83 foreach ( $meeting_location as $key => $location ) { 85 84 -
hydra-booking/trunk/app/Content/Template/meeting-info.php
r3185407 r3187065 52 52 ?> 53 53 </div> 54 <div class="tfhb-host-info" style="background : linear-gradient(181deg, rgba(19, 25, 20, 0.00) 1.18%, rgba(19, 25, 20, 0.50) 98.83%), url(<?php echo esc_url(THB_URL . 'assets/app/images/meeting-cover.png'); ?>) lightgray 50% / cover no-repeat; ?>) lightgray 50% / cover no-repeat;">54 <div class="tfhb-host-info" style="background-image: url(<?php echo esc_attr(THB_URL . 'assets/app/images/meeting-cover.png'); ?>) ;"> 55 55 <div class="tfhb-host-profile tfhb-flexbox tfhb-gap-8"> 56 56 <?php echo ! empty( $host['avatar'] ) ? '<img src="' . esc_url( $host['avatar'] ) . '" alt="">' : '<img src="' . THB_URL.'assets/images/avator.png' . '" alt="">'; ?> … … 179 179 ?> 180 180 181 </ul> 182 181 </ul> 183 182 <div class="tfhb-timezone "> 184 183 185 <select class="tfhb-time-zone-select" name="attendee_time_zone" id="attendee_time_zone ">184 <select class="tfhb-time-zone-select" name="attendee_time_zone" id="attendee_time_zone_<?php echo esc_attr($meeting['id']) ?>"> 186 185 <?php 187 186 if ( ! empty( $time_zone ) ) { … … 216 215 217 216 ?> 218 </select>217 </select> 219 218 <div class="tfhb-timezone-icon "> 220 219 <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> -
hydra-booking/trunk/app/Enqueue.php
r3185407 r3187065 11 11 12 12 add_action( 'wp_enqueue_scripts', array( $this, 'tfhb_enqueue_scripts' ) ); 13 add_action( 'enqueue_block_editor_assets', array( $this, 'tfhb_enqueue_scripts' ) ); 13 14 } 14 15 … … 51 52 wp_register_script( 'tfhb-paypal-script', '//paypalobjects.com/api/checkout.js', array( 'jquery' ), '1.0.0', true ); 52 53 wp_register_script( 'tfhb-select2-script', THB_URL . 'assets/app/js/select2.min.js', array( 'jquery', 'tfhb-app-script' ), THB_VERSION, true ); 53 wp_register_script( 'tfhb-app-script', THB_URL . 'assets/app/js/main.js', array( 'jquery' ), THB_VERSION, true ); 54 55 wp_localize_script( 56 'tfhb-app-script', 57 'tfhb_app_booking', 58 array( 59 'ajax_url' => admin_url( 'admin-ajax.php' ), 60 'nonce' => wp_create_nonce( 'tfhb_nonce' ), 61 'general_settings' => $general_settings, 62 ) 63 ); 54 wp_enqueue_script( 'tfhb-app-script', THB_URL . 'assets/app/js/main.js', array( 'jquery' ), THB_VERSION, true ); 55 wp_localize_script( 56 'tfhb-app-script', 57 'tfhb_app_booking', 58 array( 59 'ajax_url' => admin_url( 'admin-ajax.php' ), 60 'nonce' => wp_create_nonce( 'tfhb_nonce' ), 61 'general_settings' => $general_settings, 62 ) 63 ); 64 64 } 65 65 -
hydra-booking/trunk/app/Shortcode/HydraBookingShortcode.php
r3185407 r3187065 121 121 ob_start(); 122 122 123 // Before Load the Calendar. 124 do_action( 'hydra_booking/before_meeting_render', $meta_data ); 125 126 ?> 127 <div class="tfhb-meeting-box tfhb-meeting-<?php echo esc_attr( $calendar_id ); ?>" data-calendar="<?php echo esc_attr( $calendar_id ); ?>"> 128 129 <?php 130 131 if ( ! empty( $booking_data ) && 'reschedule' == $atts['type'] ) { 132 // Load Reschedule Template 133 // You are rescheduling the booking: 3:15 pm - 3:30 pm, May 27, 2024 (Asia/Dhaka) 134 echo '<div class="tfhb-reschedule-box">'; 135 echo '<p>' . esc_html__( 'You are rescheduling the booking:', 'hydra-booking' ) . ' ' . esc_html( $booking_data->start_time ) . ' - ' . esc_html( $booking_data->end_time ) . ', ' . esc_html( gmdate( 'F j, Y', strtotime( $booking_data->meeting_dates ) ) ) . ' (' . esc_html( $booking_data->attendee_time_zone ) . ')</p>'; 136 echo '</div>'; 137 138 } 139 140 ?> 141 <!-- <form method="post" action="" class="tfhb-meeting-form ajax-submit" enctype="multipart/form-data"> --> 142 <div class="tfhb-meeting-card"> 143 144 <?php 145 // Load Meeting Info Template 146 load_template( 147 THB_PATH . '/app/Content/Template/meeting-info.php', 148 false, 149 array( 150 'meeting' => $meta_data, 151 'host' => $host_meta, 152 'time_zone' => $time_zone, 153 'booking_data' => $booking_data, 154 ) 155 ); 156 ?> 157 <div class="tfhb-calander-times tfhb-flexbox"> 158 <?php 159 // Load Meeting Calendar Template 160 load_template( THB_PATH . '/app/Content/Template/meeting-calendar.php', false, $meta_data ); 161 162 // Load Meeting Time Template 163 load_template( 164 THB_PATH . '/app/Content/Template/meeting-times.php', 165 false, 166 array( 167 'meeting' => $meta_data, 168 'host' => $host_meta, 169 'general_settings' => $general_settings, 170 ) 171 ); 172 ?> 173 </div> 174 <?php 175 // Load Meeting Form Template 176 load_template( 177 THB_PATH . '/app/Content/Template/meeting-form.php', 178 false, 179 array( 180 'meeting' => $meta_data, 181 'booking_data' => $booking_data, 182 ) 183 ); 184 ?> 185 </div> 186 187 <!-- </form> --> 188 189 </div> 190 <?php 191 192 // After Load the Calendar. 193 do_action( 'hydra_booking/after_meeting_render', $meta_data ); 194 123 load_template( 124 THB_PATH . '/app/Content/calendar.php', 125 false, 126 array( 127 'meeting' => $meta_data, 128 'host' => $host_meta, 129 'time_zone' => $time_zone, 130 'booking_data' => $booking_data, 131 'general_settings' => $general_settings, 132 ) 133 ); 195 134 // Return Buffer 196 135 return ob_get_clean(); … … 276 215 wp_enqueue_script( 'tfhb-paypal-sdk', ); 277 216 } 278 // Enqueue Scripts Register scripts279 if ( ! wp_script_is( 'tfhb-app-script', 'enqueued' ) ) {280 wp_enqueue_script( 'tfhb-app-script', );281 }282 283 217 // Enqueue Select2 284 218 if ( ! wp_script_is( 'tfhb-select2-script', 'enqueued' ) ) { 285 219 wp_enqueue_script( 'tfhb-select2-script' ); 286 220 } 287 221 222 // Enqueue Scripts scripts 223 wp_enqueue_script( 'tfhb-app-script-app', THB_URL . 'assets/app/js/app.js', array( 'jquery', 'tfhb-app-script' ), THB_VERSION, true ); 224 225 288 226 289 227 290 228 // Localize Script 291 229 wp_localize_script( 292 'tfhb-app-script ',230 'tfhb-app-script-app', 293 231 'tfhb_app_booking_' . $id, 294 232 array( … … 800 738 801 739 // Booking Table Meeting Location Data 802 $meeting_location_data = json_decode( $single_booking_meta->meeting_locations, true ); 740 // $meeting_location_data = json_decode( $single_booking_meta->meeting_locations, true ); 741 $meeting_location_data = $single_booking_meta->meeting_locations; 742 803 743 804 744 // Meeting Location Check … … 918 858 // Time format if has AM and PM into start time 919 859 $time_format = strpos( $booking_meta['start_time'], 'AM' ) || strpos( $booking_meta['start_time'], 'PM' ) ? '12' : '24'; 860 920 861 $current_time = strtotime( $DateTime->convert_time_based_on_timezone( gmdate( 'Y-m-d H:i:s' ), 'UTC', $booking_meta['attendee_time_zone'], $time_format ) ); 921 862 $meeting_time = strtotime( $booking_meta['meeting_dates'] . ' ' . $booking_meta['start_time'] ); … … 1072 1013 $data = $date_time->getAvailableTimeData( $meeting_id, $selected_date, $selected_time_zone, $selected_time_format ); 1073 1014 1015 1016 1074 1017 if ( empty( $data ) ) { 1075 1018 wp_send_json_error( array( 'message' => 'No time slots are currently available.' ) ); -
hydra-booking/trunk/assets/app/css/style.css
r3185407 r3187065 1 .tfhb-meeting-box{ 2 max-width: 100%; 3 } 1 4 .tfhb-meeting-box input, .tfhb-booking-cencel input { 2 5 box-sizing: border-box; -
hydra-booking/trunk/assets/app/js/main.js
r3185407 r3187065 3 3 $(document).ready(function () { 4 4 5 6 const tfhb_local_timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;7 8 /**9 * Time Zone Change10 * @author Jahid11 */12 $(document).on('click', '.tfhb-timezone-tabs ul li', function (e) {13 $('.tfhb-timezone-tabs ul li').removeClass('active');14 var $this = $(this);15 $this.addClass('active');16 });17 18 // Cencel Booking If .tfhb-meeting-cencel-form form submit using ajax19 20 $(document).on('submit', '.tfhb-meeting-cencel-form', function (e) {21 e.preventDefault();22 $this = $(this);23 var data = new FormData(this);24 25 data.append('action', 'tfhb_meeting_form_cencel');26 data.append('nonce', tfhb_app_booking.nonce);27 $.ajax({28 url: tfhb_app_booking.ajax_url,29 type: 'POST',30 data: data,31 processData: false,32 contentType: false,33 success: function (response) {34 if(response.success){35 36 $this.find('.tfhb-meeting-confirmation .tfhb-forms').html('');37 $this.find('.tfhb-meeting-confirmation').append(`<div class="tfhb-notice tfhb-success">${response.data.message}</div>`);38 39 }else{40 $this.find('.tfhb-meeting-confirmation').append(`<div class="tfhb-notice tfhb-error">${response.data.message}</div>`);41 42 }43 },44 error: function (error) {45 console.log(error);46 }47 });48 });49 50 51 /**52 * Time Select53 * @author Sydur54 * */55 $('.tfhb-meeting-box').each(function(){56 57 // Get Calender Id58 let $this = $(this),59 calenderId = $this.attr('data-calendar'),60 calenderData = eval("tfhb_app_booking_" + calenderId),61 preloader = `<div class="tfhb-preloader"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style="shape-rendering: auto; display: block; background: transparent;" width="200" height="200" xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle stroke-linecap="round" fill="none" stroke-dasharray="51.83627878423159 51.83627878423159" stroke="#2e6b38" stroke-width="4" r="33" cy="50" cx="50">62 <animateTransform values="0 50 50;360 50 50" keyTimes="0;1" dur="1s" repeatCount="indefinite" type="rotate" attributeName="transform"></animateTransform>63 </circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg></span></div>`;64 // Select 2 Time Zone65 $this.find('.tfhb-time-zone-select').select2({66 dropdownCssClass: 'tfhb-select2-dropdown',67 });68 69 // selected local time zone70 $this.find('.tfhb-time-zone-select').val(tfhb_local_timeZone).trigger('change');71 72 73 74 75 76 77 let date = new Date();78 let year = date.getFullYear();79 let month = date.getMonth();80 81 const tfhb_calendar_navs = $this.find(".tfhb-calendar-navigation span");82 5 83 84 // Array of month names85 const months = [86 "January",87 "February",88 "March",89 "April",90 "May",91 "June",92 "July",93 "August",94 "September",95 "October",96 "November",97 "December"98 ];99 100 101 tfhb_date_manipulate( $this, calenderData, year, month, date, months );102 103 104 // Attach a click event listener to each icon105 tfhb_calendar_navs.each(function() {106 // When an icon is clicked107 $(this).on("click", function() {108 // or "tfhb-calendar-next"109 month = $(this).attr("id") === "tfhb-calendar-prev" ? month - 1 : month + 1;110 111 // Check if the month is out of range112 if (month < 0 || month > 11) {113 114 // Set the date to the first day of the115 // month with the new year116 date = new Date(year, month, new Date().getDate());117 118 // Set the year to the new year119 year = date.getFullYear();120 121 // Set the month to the new month122 month = date.getMonth();123 } else {124 125 // Set the date to the current date126 date = new Date();127 }128 129 // Call the tfhb_date_manipulate function to130 // update the tfhb-calendar display131 tfhb_date_manipulate( $this, calenderData, year, month, date, months );132 });133 });134 135 // Select Date136 $(document).on('click', '.tfhb-calendar-dates li', function (e) {137 var $this_li = $(this);138 if($this_li.hasClass('inactive')){139 return false;140 }141 142 // tfhb-meeting-times with animation143 // $this.find('.tfhb-meeting-times').show();144 $this.find('.tfhb-meeting-times').css("display", "block").animate({left: "0%", opacity: 1, width: 224}, 400,);145 146 $this.find('.tfhb-available-times').addClass('inactive');147 148 setTimeout(function(){149 150 $this.find('.tfhb-calendar-dates li').removeClass('active');151 $this_li.addClass('active');152 153 // meeting ID154 var meeting_id = $this.find("input[name='meeting_id']").val();155 // Get the first day of the month156 157 tfhb_times_manipulate( $this, meeting_id, $this_li );158 }, 1000); // 2000 milliseconds = 2 seconds159 160 });161 162 $this.find('input[name="tfhb_time_format"], .tfhb-time-zone-select').on('change', function (e) {163 var $this_li = $this.find('.tfhb-calendar-dates li.active');164 $this.find('.tfhb-meeting-times').css("display", "block").animate({left: "0", opacity: 1, width: 224}, 400 );165 $this.find('.tfhb-available-times').addClass('inactive');166 // Get the first day of the month167 var meeting_id = $this.find("input[name='meeting_id']").val();168 setTimeout(function(){169 // Your code here170 tfhb_times_manipulate( $this, meeting_id, $this_li );171 }, 1000); // 2000 milliseconds = 2 seconds172 173 174 });175 176 177 /**178 * Time Select179 * @author Jahid180 */181 // $this.find('input[name="tfhb_time_format"], .tfhb-time-zone-select').on('change', function (e) {182 $(document).on('click', '.tfhb-available-times li .time', function (e) {183 $this_time = $(this);184 $('.tfhb-available-times li .time').removeClass('active');185 186 // Your code here187 $('.tfhb-available-times li .next').remove();188 var selected_time_start = $this_time.attr('data-time-start');189 var selected_time_end = $this_time.attr('data-time-end');190 $this.find("input[name='meeting_time_start']").val(selected_time_start);191 $this.find("input[name='meeting_time_end']").val(selected_time_end);192 193 $this_time.parent().append('<span class="next tfhb-flexbox tfhb-gap-8"> Next<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 10L14 10" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M9 4.16666L14.8333 9.99999L9 15.8333" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg></span>');194 $this_time.addClass('active');195 196 197 });198 199 $(document).on('click', '.tfhb-available-times li .next', function (e) {200 201 var time_zone = $this.find('#attendee_time_zone').val();202 var meeting_dates = $this.find("#meeting_dates").val();203 var meeting_time_start = $this.find("#meeting_time_start").val();204 var meeting_time_end = $this.find("#meeting_time_end").val();205 206 var thimeZone_html = `<li class="tfhb-flexbox tfhb_time_zone_info tfhb-gap-8">207 <input type="hidden" id="recurring_maximum" name="recurring_maximum" value="' . esc_attr( $meeting['recurring_maximum'] ) . '">208 <div class="tfhb-icon">209 <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">210 <g clip-path="url(#clip0_1840_26071)">211 <path d="M8.00065 14.6667C11.6825 14.6667 14.6673 11.6819 14.6673 8.00001C14.6673 4.31811 11.6825 1.33334 8.00065 1.33334C4.31875 1.33334 1.33398 4.31811 1.33398 8.00001C1.33398 11.6819 4.31875 14.6667 8.00065 14.6667Z" stroke="#273F2B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>212 <path d="M8.00065 1.33334C6.28881 3.13078 5.33398 5.51784 5.33398 8.00001C5.33398 10.4822 6.28881 12.8692 8.00065 14.6667C9.71249 12.8692 10.6673 10.4822 10.6673 8.00001C10.6673 5.51784 9.71249 3.13078 8.00065 1.33334Z" stroke="#273F2B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>213 <path d="M1.33398 8H14.6673" stroke="#273F2B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>214 </g>215 <defs>216 <clipPath id="clip0_1840_26071">217 <rect width="16" height="16" fill="white"/>218 </clipPath>219 </defs>220 </svg>221 </div>222 <div>223 `+time_zone+`(`+meeting_time_start+`)224 </div>225 </li>`;226 // date time format like that 9:00pm, Saturday, April 25227 228 var date_time = new Date(meeting_dates);229 var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };230 231 var date_time_html = `<li class="tfhb-flexbox tfhb_date_time_info tfhb-gap-8">232 <input type="hidden" id="recurring_maximum" name="recurring_maximum" value="' . esc_attr( $meeting['recurring_maximum'] ) . '">233 <div class="tfhb-icon">234 <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">235 <path d="M5.33398 1.33334V4.00001" stroke="#273F2B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>236 <path d="M10.666 1.33334V4.00001" stroke="#273F2B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>237 <path d="M12.6667 2.66666H3.33333C2.59695 2.66666 2 3.26361 2 3.99999V13.3333C2 14.0697 2.59695 14.6667 3.33333 14.6667H12.6667C13.403 14.6667 14 14.0697 14 13.3333V3.99999C14 3.26361 13.403 2.66666 12.6667 2.66666Z" stroke="#273F2B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>238 <path d="M2 6.66666H14" stroke="#273F2B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>239 <path d="M6 10.6667L7.33333 12L10 9.33334" stroke="#273F2B" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>240 </svg>241 </div>242 <div>243 `244 +date_time.toLocaleDateString('en-US', options)+245 `246 </div>247 </li>`;248 249 $this.find('.tfhb-meeting-details ul').append(thimeZone_html);250 $this.find('.tfhb-meeting-details ul').append(date_time_html);251 252 // Your code here253 $this.find('.tfhb-timezone').hide();254 255 256 $this.find('.tfhb-meeting-times').animate({left: "-50%", width: 0, opacity: 0 }, 300,257 function() {258 $(this).css("display", "none");259 260 261 });262 $this.find('.tfhb-calander-times').animate({263 left: "-5%",264 opacity: 0,265 }, 400, function() {266 // After animation is complete, hide the element267 $(this).css("display", "none");268 269 $this.find('.tfhb-meeting-booking-form').css("display", "block").animate({left: "0", opacity: 1, width: 536 }, 300);270 });271 272 273 274 });275 276 // Full Description Showing277 $('span.tfhb-see-description').on('click', function() {278 $('.tfhb-short-description').slideUp();279 $('.tfhb-full-description').slideDown();280 });281 282 // See Less Description Showing283 $('span.tfhb-see-less-description').on('click', function() {284 $('.tfhb-full-description').slideUp();285 $('.tfhb-short-description').slideDown();286 });287 288 $(document).on('click', '.tfhb-meeting-booking-form .tfhb-back-btn', function (e) {289 290 291 $this.find('.tfhb-meeting-booking-form').animate({292 left: "-5%",293 opacity: 0294 }, 300, function() {295 // After animation is complete, hide the element296 $(this).css("display", "none");297 298 $this.find('.tfhb-timezone').show();299 300 $this.find('.tfhb-calander-times').css("display", "flex").animate({301 left: "0",302 opacity: 1303 }, 200, function() {304 // After animation is complete, hide the element305 });306 307 308 $this.find('.tfhb-meeting-times').css("display", "block").animate({left: "0", width: 224}, 400,309 function() {310 $(this).css("opacity", "1");311 312 $this.find('.tfhb-meeting-details ul .tfhb_time_zone_info').remove();313 $this.find('.tfhb-meeting-details ul .tfhb_date_time_info').remove();314 });315 316 });317 318 319 });320 321 // Ajax Submit .tfhb-meeting-form.ajax-submit'322 $this.find('.tfhb-meeting-form.ajax-submit').on('submit', function (e) {323 e.preventDefault();324 var data = new FormData(this);325 // make this form data as Object326 var InformationData = {};327 data.forEach(function(value, key){328 InformationData[key] = value;329 });330 331 332 tfhb_from_submission($this, preloader, InformationData, calenderData);333 });334 document.addEventListener( 'wpcf7mailsent', function( event ) {335 var data = event.detail.formData;336 var InformationData = {};337 data.forEach(function(value, key){338 InformationData[key] = value;339 });340 341 tfhb_from_submission($this, preloader, InformationData, calenderData);342 });343 344 // Forminator Form Submission345 $(document).on('forminator:form:submit:success', function(event, response ) {346 347 var InformationData = {};348 response.forEach(function(value, key){349 InformationData[key] = value;350 });351 352 353 tfhb_from_submission($this, preloader, InformationData, calenderData);354 });355 356 // Fluent Forms Form Submission357 $(document).on('fluentform_submission_success', function(event, response) {358 var data = new FormData(response.form[0]);359 var InformationData = {};360 data.forEach(function(value, key){361 InformationData[key] = value;362 });363 364 365 tfhb_from_submission($this, preloader, InformationData, calenderData);366 });367 368 369 370 });371 372 function tfhb_form_validation($this) {373 374 // has attr required375 var error = [];376 var error_message = '';377 var validation = true;378 // Form Validation379 $this.find('.tfhb-single-form').each(function(){380 381 var $this_form_field = $(this);382 383 384 if($this_form_field.find('input').length > 0 && $this_form_field.find('input').attr('required') == 'required' && $this_form_field.find('input').val() == ''){385 // get the input name386 var input_name = $this_form_field.find('input').attr('name');387 error.push(true);388 error_message += '<p>'+input_name+' field is required.</p>';389 390 }391 392 });393 394 // if in array any error true then show the error395 if(error.includes(true)){396 $this.find('.tfhb-notice').html(error_message);397 $this.find('.tfhb-notice').show();398 validation = false;399 }400 401 return validation;402 }403 404 // render_paypal_payment405 function tfhb_render_paypal_payment($this, responseData){406 var paypal_button = $this.find('.tfhb-paypal-button-container');407 var confirmation_template = responseData.confirmation_template;408 // hide the form .tfhb-confirmation-button409 $this.find('.tfhb-confirmation-button').hide();410 // Render PayPal button into the container411 paypal.Buttons({412 // Create an order413 createOrder: function (data, actions) {414 415 return actions.order.create({416 417 purchase_units: [{418 reference_id : responseData.data.hash,419 description: responseData.data.meeting.title + ' - ' + responseData.data.meeting.duration + ' Minutes | ' + responseData.data.booking.start_time + ' - ' + responseData.data.booking.end_time + ' | ' + responseData.data.booking.meeting_dates,420 custom_id: responseData.data.booking.attendee_id,421 amount: {422 currency_code: responseData.data.meeting.payment_currency,423 value: responseData.data.meeting.meeting_price,// Set the transaction amount424 }425 }]426 });427 },428 429 // On successful payment430 onApprove: function (data, actions) {431 return actions.order.capture().then(function (details) {432 433 $.ajax({434 url: tfhb_app_booking.ajax_url,435 type: 'POST',436 data: {437 nonce: tfhb_app_booking.nonce,438 action: 'tfhb_meeting_paypal_payment_confirmation',439 payment_details: details,440 responseData: responseData,441 },442 success: function (response) {443 if(response.success){444 $this.find('.tfhb-meeting-card').html('');445 $this.find('.tfhb-meeting-card').append(confirmation_template);446 }else{447 $this.find('.tfhb-notice').html(response.data.message);448 $this.find('.tfhb-notice').show();449 }450 },451 error: function (error) {452 console.log(error);453 }454 });455 456 });457 },458 459 // If the buyer cancels the payment460 onCancel: function (data) {461 462 },463 464 // If there is an error465 onError: function (err) {466 console.error('An error occurred during the transaction', err);467 alert('Payment could not be completed due to an error');468 }469 470 }).render('.tfhb-paypal-button-container');471 }472 473 function tfhb_from_submission($this, preloader, InformationData, calenderData){474 475 let submitPreLoader = `<span class="tfhb-submit-preloader"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" style="shape-rendering: auto; display: block; background: transparent;" width="200" height="200" xmlns:xlink="http://www.w3.org/1999/xlink"><g><circle stroke-dasharray="188.49555921538757 64.83185307179586" r="40" stroke-width="4" stroke="#ffffff" fill="none" cy="50" cx="50">476 <animateTransform keyTimes="0;1" values="0 50 50;360 50 50" dur="0.49751243781094534s" repeatCount="indefinite" type="rotate" attributeName="transform"></animateTransform>477 </circle><g></g></g><!-- [ldio] generated by https://loading.io --></svg><span>`478 479 $this.find('.tfhb-booking-submit').append(submitPreLoader);480 $this.find('.tfhb-booking-submit').attr('disabled', 'disabled');481 482 483 // Interval to show the preloader484 $this.find('.tfhb-notice').hide();485 $this.find('.tfhb-notice').html('');486 487 var meeting_id = $this.find("#meeting_id").val();488 var host_id = $this.find("#host_id").val();489 var meeting_duration = $this.find("#meeting_duration").val();490 var meeting_dates = $this.find("#meeting_dates").val();491 var meeting_time_start = $this.find("#meeting_time_start").val();492 var meeting_time_end = $this.find("#meeting_time_end").val();493 var booking_hash = $this.find("#booking_hash").val();494 var action_type = $this.find("#action_type").val();495 var meeting_price = $this.find("#meeting_price").val();496 var recurring_maximum = $this.find("#recurring_maximum").val();497 var attendee_time_zone = $this.find("#attendee_time_zone").val();498 var tfhb_time_format = $this.find("#tfhb_time_format").val();499 var name = $this.find("#name").val();500 var email = $this.find("#email").val();501 var address = $this.find("#address").val();502 503 var payment_type = $this.find("#payment_method").val();504 var meeting_price = $this.find("#meeting_price").val();505 var payment_amount = $this.find("#payment_amount").val();506 var stripe_public_key = $this.find("#stpublic_key").val();507 var paypal_public_key = $this.find("#paypal_public_key").val();508 var payment_currency = $this.find("#payment_currency").val();509 510 // Payment Status511 var payment_status = calenderData.payment_status;512 513 514 var data = {515 action: 'tfhb_meeting_form_submit',516 nonce: tfhb_app_booking.nonce,517 meeting_id: meeting_id,518 host_id: host_id,519 meeting_dates: meeting_dates,520 meeting_duration: meeting_duration,521 meeting_time_start: meeting_time_start,522 meeting_time_end: meeting_time_end,523 booking_hash: booking_hash,524 action_type: action_type,525 recurring_maximum: recurring_maximum,526 attendee_time_zone: attendee_time_zone,527 tfhb_time_format: tfhb_time_format,528 payment_type: payment_type,529 meeting_price: meeting_price,530 payment_amount: payment_amount,531 stripe_public_key: stripe_public_key,532 payment_currency: payment_currency,533 };534 // Push object information data to data535 data = Object.assign(InformationData, data);536 if(payment_status == 1 && ""==payment_type){537 // 5 seconds538 setTimeout(function(){539 $this.find('.tfhb-notice').append('Payment Method Required');540 $this.find('.tfhb-notice').show();541 $this.find('.tfhb-booking-submit .tfhb-submit-preloader').remove();542 }, 2000); // 2000 milliseconds = 2 seconds543 544 }545 546 if(payment_status != 1 || ( payment_status == 1 && "woo_payment"==payment_type ) || ( payment_status == 1 && "paypal_payment"==payment_type ) ){547 548 549 $.ajax({550 url: tfhb_app_booking.ajax_url,551 type: 'POST',552 action: 'tfhb_meeting_form_submit',553 data: data,554 success: function (response) {555 556 $this.find('.tfhb-booking-submit .tfhb-submit-preloader').remove();557 // Remove Disabled558 $this.find('.tfhb-booking-submit').removeAttr('disabled');559 if(response.success){560 561 $this.find('.tfhb-booking-submit').remove('.tfhb-submit-preloader');562 // Remove Disabled563 $this.find('.tfhb-booking-submit').removeAttr('disabled');564 565 // Render Paypal Payment System566 if(payment_status == 1 && "paypal_payment" == payment_type && response.data.data){567 tfhb_render_paypal_payment($this, response.data);568 return569 }570 if(response.data.redirect){571 window.location.href = response.data.redirect;572 return;573 574 }else{575 $this.find('.tfhb-meeting-card').html('');576 $this.find('.tfhb-meeting-card').append(response.data.confirmation_template);577 if(response.data.action == 'rescheduled'){578 $this.find('.tfhb-meeting-hostinfo').append(`579 <div class="tfhb-notice " >580 <span>`+response.data.message+` </span>581 </div>`582 )583 }584 585 }586 587 }else{588 $this.find('.tfhb-notice').append(response.data.message);589 $this.find('.tfhb-notice').show();590 return false;591 }592 },593 error: function (error) {594 console.log(error);595 }596 });597 }598 599 // if("stripe_payment"==payment_type && payment_status == 1){600 601 // var handler = StripeCheckout.configure({602 // key: stripe_public_key, // your publisher key id603 // locale: 'auto',604 // token: function (token) {605 // data = Object.assign(data, {606 // tokenId: token.id,607 // });608 // jQuery.ajax({609 // url: tfhb_app_booking.ajax_url,610 // method: 'POST',611 // data: data,612 // dataType: "json",613 // success: function( response ) {614 // if(response.success){615 // if(response.data.redirect){616 // window.location.href = response.data.redirect;617 // return;618 // }else{619 // $this.find('.tfhb-meeting-card').html('');620 // $this.find('.tfhb-meeting-card').append(response.data.confirmation_template);621 // if(response.data.action == 'rescheduled'){622 // $this.find('.tfhb-meeting-hostinfo').append(`623 // <div class="tfhb-notice " >624 // <span>`+response.data.message+` </span>625 // </div>`626 // )627 // }628 629 // }630 // }else{631 // $this.find('.tfhb-notice').append(response.data.message);632 // $this.find('.tfhb-notice').show();633 634 // }635 // }636 // })637 // }638 // });639 640 // handler.open({641 // name: 'Hydra Booking',642 // description: '2 widgets',643 // amount: meeting_price * 100,644 // currency: payment_currency,645 // // closed: function () {646 // // location.reload();647 // // }648 // });649 // }650 651 // if("paypal_payment"==payment_type && payment_status == 1){652 // // 'AQyFCpzKPySeYI-n5FvZZ91zosqIEjguVDGrkUVFsW74o89Rj620Tol_4n-4JnaB_Fu8WojSvlSpzifa'653 654 // $this.find('.tfhb-confirmation-button').empty();655 // paypal.Button.render({656 // // Configure environment657 // env: 'sandbox',658 // client: {659 // sandbox: paypal_public_key,660 // },661 // // Customize button (optional)662 // locale: 'en_US',663 // style: {664 // size: 'small',665 // color: 'gold',666 // shape: 'pill',667 // },668 // // Set up a payment669 // payment: function (data, actions) {670 // return actions.payment.create({671 // transactions: [{672 // amount: {673 // total: meeting_price,674 // currency: payment_currency675 // }676 // }]677 // });678 // },679 // // Execute the payment680 // onAuthorize: function (data, actions) {681 // return actions.payment.execute()682 // .then(function () {683 // jQuery.ajax({684 // url: tfhb_app_booking.ajax_url,685 // method: 'POST',686 // data: {687 // action: 'tfhb_meeting_form_submit',688 // nonce: tfhb_app_booking.nonce,689 // meeting_id: $this.find("#meeting_id").val(),690 // host_id: $this.find("#host_id").val(),691 // meeting_dates: $this.find("#meeting_dates").val(),692 // meeting_time_start: $this.find("#meeting_time_start").val(),693 // meeting_time_end: $this.find("#meeting_time_end").val(),694 // name: $this.find("#name").val(),695 // email: $this.find("#email").val(),696 // address: $this.find("#address").val(),697 // paymentID: data.paymentID,698 // paymentToken: data.paymentToken,699 // payerID: data.payerID,700 // },701 // dataType: "json",702 // success: function( response ) {703 // if(response.success){704 // if(response.data.redirect){705 // window.location.href = response.data.redirect;706 // return;707 // }else{708 // $this.find('.tfhb-meeting-card').html('');709 // $this.find('.tfhb-meeting-card').append(response.data.confirmation_template);710 // if(response.data.action == 'rescheduled'){711 // $this.find('.tfhb-meeting-hostinfo').append(`712 // <div class="tfhb-notice " >713 // <span>`+response.data.message+` </span>714 // </div>`715 // )716 // }717 718 // }719 // }else{720 // $this.find('.tfhb-notice').append(response.data.message);721 // $this.find('.tfhb-notice').show();722 723 // }724 // }725 // })726 727 // });728 // }729 // }, $this.find('.tfhb-confirmation-button').get(0)); // Ensure the element is correctly passed to PayPal730 731 732 // }733 }734 735 // Function to generate the tfhb-calendar736 function tfhb_date_manipulate($this, calenderData, year, month, date, months) {737 738 const day = $this.find(".tfhb-calendar-dates");739 const currdate = $this.find(".tfhb-calendar-current-date");740 741 let calender_data = calenderData;742 let availability = calender_data.availability;743 let date_slots = availability.date_slots;744 let time_slots = availability.time_slots;745 let availability_range = calender_data.availability_range;746 let availability_range_type = calender_data.availability_range_type;747 let availabilitys_range_start = calender_data.availability_range.start;748 let availabilitys_range_end = calender_data.availability_range.end;749 let dayNameText = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];750 let DisableDays = [];751 752 // Get Disable Days753 for (var i = 0; i < time_slots.length; i++) {754 if(time_slots[i].status == false){755 DisableDays.push(time_slots[i].day);756 }757 }758 759 760 761 // Get the first day of the month762 let dayone = new Date(year, month, 1).getDay();763 764 // Get the last date of the month765 let lastdate = new Date(year, month + 1, 0).getDate();766 767 // Get the day of the last date of the month768 let dayend = new Date(year, month, lastdate).getDay();769 770 // Get the last date of the previous month771 let monthlastdate = new Date(year, month, 0).getDate();772 773 // Variable to store the generated tfhb-calendar HTML774 let lit = "";775 776 // If Time slots status is not true disbale that day777 // Loop to add the last dates of the previous month778 for (let i = dayone; i > 0; i--) {779 lit += `<li class="inactive">${monthlastdate - i + 1}</li>`;780 }781 782 // Loop to add the dates of the current month783 for (let i = 1; i <= lastdate; i++) {784 785 // Check if the current date is today786 let isToday = i === date.getDate() && month === new Date().getMonth() && year === new Date().getFullYear() ? "active" : "";787 788 // Check if the current date has availability slots789 let dateKey = year + "-" + (month + 1).toString().padStart(2, '0') + "-" + i.toString().padStart(2, '0');790 let dateSlot = typeof date_slots !== 'undefined' ? date_slots.find(slot => slot.date.match(dateKey) ) : "";791 let availabilityClass = typeof dateSlot !== 'undefined' && dateSlot !== '' && dateSlot.available == true ? "inactive " : " ";792 let dataAvailable = typeof dateSlot !== 'undefined' && dateSlot !== '' && dateSlot.available != true ? "available" : "";793 794 // Before today Days Disable795 if(new Date() > new Date(year, month, i) && i !== date.getDate() ){796 availabilityClass = "inactive ";797 dataAvailable = "unavailable";798 }799 800 // if current date day is disable then disable that day.801 if(DisableDays.includes(dayNameText[new Date(year, month, i).getDay()])){802 availabilityClass = "inactive ";803 dataAvailable = "unavailable";804 }805 // if current date is out of range then disable that day.806 807 if(availability_range_type != 'indefinitely'){808 if(new Date(year, month, i) < new Date(availabilitys_range_start) || new Date(year, month, i) > new Date(availabilitys_range_end)){809 availabilityClass = "inactive ";810 dataAvailable = "unavailable";811 isToday = "";812 }813 }814 815 lit += `<li data-date="${dateKey}" data-available="${dataAvailable}" class="${isToday} current ${availabilityClass}">${i}</li>`;816 }817 818 // Loop to add the first dates of the next month819 for (let i = dayend; i < 6; i++) {820 lit += `<li class="inactive">${i - dayend + 1}</li>`;821 }822 823 // Update the text of the current date element824 // with the formatted current month and year825 currdate.text(`${months[month]} ${year}`);826 827 // update the HTML of the dates element828 // with the generated tfhb-calendar829 day.html(lit);830 }831 832 // Function to generate the tfhb-calendar833 function tfhb_times_manipulate($this, meeting_id, $this_li) {834 835 836 var selected_date = $this_li.attr('data-date');837 // Selectedate date format Saturday, 11 April838 selected_date_format = new Date(selected_date).toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric' });839 var data_available = $this_li.attr('data-available');840 // input radio data name tfhb_time_format841 var time_format = $this.find('input[name="tfhb_time_format"]:checked').val();842 var time_zone = $this.find('.tfhb-time-zone-select').val();843 $this.find('.tfhb-meeting-times .tfhb-select-date').html(selected_date_format);844 845 $this.find("input[name='meeting_dates']").val(selected_date);846 847 $.ajax({848 url: tfhb_app_booking.ajax_url,849 type: 'POST',850 data: {851 action: 'tfhb_already_booked_times',852 nonce: tfhb_app_booking.nonce,853 selected_date: selected_date,854 meeting_id: meeting_id,855 time_format: time_format,856 time_zone: time_zone,857 },858 success: function (response) {859 if(response.success == true){860 861 // var already_booked_times = response.data;862 // console.log(response.data);863 let data = response.data;864 $this.find('.tfhb-available-times').removeClass('inactive');865 $this.find('.tfhb-available-times').html('');866 $this.find('.tfhb-available-times').append('<ul></ul>');867 868 for (var i = 0; i < data.length; i++) {869 870 // Remove871 // Add with animation when data available872 $this.find('.tfhb-available-times ul').append('<li class="tfhb-flexbox"> <span class="time" data-time-start="'+ data[i].start +'" data-time-end="'+ data[i].end +'">' + data[i].start + '</span> </li>');873 874 875 876 }877 878 879 880 }881 if(response.success == false){882 $this.find('.tfhb-available-times').removeClass('inactive');883 $this.find('.tfhb-available-times').html('');884 $this.find('.tfhb-available-times').append('<ul></ul>');885 $this.find('.tfhb-available-times ul').append('<li > <p>'+response.data.message+'</p></li>');886 $this.find('.tfhb-meeting-times').css("display", "block").animate({left: "0", opacity: 1, width: 224}, 400 );887 }888 },889 error: function (error) {890 console.log(error);891 }892 });893 894 895 896 897 898 }899 900 // Generate Time Slots901 function generateTimeSlots(startTime, endTime, duration, meeting_interval, buffer_time_before, buffer_time_after, selected_date, time_format, time_zone) {902 var timeSlots = [];903 904 var skip_before_meeting_start = tfhb_app_booking.general_settings.allowed_reschedule_before_meeting_start; // exp 100 minutes905 // start date data format = 2024-05-04906 var start = new Date(selected_date + " " + startTime);907 var end = new Date(selected_date + " " + endTime);908 var current = new Date(start);909 var before = new Date(start);910 var after = new Date(start);911 var diff = duration * 60000;912 var before_diff = buffer_time_before * 60000;913 var after_diff = buffer_time_after * 60000;914 var meeting_interval = meeting_interval * 60000;915 var total_diff = diff +before_diff + after_diff;916 while (current < end) {917 918 919 // new Date(current.getTime() + total_diff).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })920 var start_time = formatTime(current, time_format, time_zone);921 var end_time = formatTime(new Date(current.getTime() + total_diff), time_format, time_zone);922 923 // if current time is passed then skip skip_before_meeting_start924 925 if(new Date() > new Date(current.getTime() - skip_before_meeting_start * 60000)){926 current = new Date(current.getTime() + total_diff + meeting_interval);927 continue;928 }929 timeSlots.push({930 931 start: start_time,932 // before_diff and after_diff need to use933 end: end_time,934 935 });936 current = new Date(current.getTime() + total_diff + meeting_interval);937 }938 return timeSlots;939 }940 941 function formatTime(date, timeFormat, timeZone) {942 var options = {943 hour: '2-digit',944 minute: '2-digit',945 hour12: timeFormat === '12',946 timeZone: timeZone947 };948 return date.toLocaleTimeString([], options);949 }950 951 6 }); 952 7 953 8 })(jQuery); 954 9 955 // let date = new Date(); 956 // let year = date.getFullYear(); 957 // let month = date.getMonth(); 958 959 // const day = document.querySelector(".tfhb-calendar-dates"); 960 // const currdate = document.querySelector(".tfhb-calendar-current-date"); 961 // const tfhb_calendar_navs = document.querySelectorAll(".tfhb-calendar-navigation span"); 962 963 // // Array of month names 964 // const months = [ 965 // "January", 966 // "February", 967 // "March", 968 // "April", 969 // "May", 970 // "June", 971 // "July", 972 // "August", 973 // "September", 974 // "October", 975 // "November", 976 // "December" 977 // ]; 978 979 // // Function to generate the tfhb-calendar 980 // const tfhb_date_manipulate = () => { 981 982 // // Get the first day of the month 983 // let dayone = new Date(year, month, 1).getDay(); 984 985 // // Get the last date of the month 986 // let lastdate = new Date(year, month + 1, 0).getDate(); 987 988 // // Get the day of the last date of the month 989 // let dayend = new Date(year, month, lastdate).getDay(); 990 991 // // Get the last date of the previous month 992 // let monthlastdate = new Date(year, month, 0).getDate(); 993 994 // // Variable to store the generated tfhb-calendar HTML 995 // let lit = ""; 996 997 // // Loop to add the last dates of the previous month 998 // for (let i = dayone; i > 0; i--) { 999 // lit += 1000 // `<li class="inactive">${monthlastdate - i + 1}</li>`; 1001 // } 1002 1003 // // Loop to add the dates of the current month 1004 // for (let i = 1; i <= lastdate; i++) { 1005 1006 // // Check if the current date is today 1007 // let isToday = i === date.getDate() 1008 // && month === new Date().getMonth() 1009 // && year === new Date().getFullYear() 1010 // ? "active" 1011 // : ""; 1012 // lit += `<li data-date="${i} ${months[month]}, ${year}" class="${isToday} current">${i}</li>`; 1013 // } 1014 1015 // // Loop to add the first dates of the next month 1016 // for (let i = dayend; i < 6; i++) { 1017 // lit += `<li class="inactive">${i - dayend + 1}</li>` 1018 // } 1019 1020 // // Update the text of the current date element 1021 // // with the formatted current month and year 1022 // currdate.innerText = `${months[month]} ${year}`; 1023 1024 // // update the HTML of the dates element 1025 // // with the generated tfhb-calendar 1026 // day.innerHTML = lit; 1027 // } 1028 1029 // tfhb_date_manipulate(); 1030 1031 // // Attach a click event listener to each icon 1032 // tfhb_calendar_navs.forEach(icon => { 1033 1034 // // When an icon is clicked 1035 // icon.addEventListener("click", () => { 1036 1037 // // Check if the icon is "tfhb-calendar-prev" 1038 // // or "tfhb-calendar-next" 1039 // month = icon.id === "tfhb-calendar-prev" ? month - 1 : month + 1; 1040 1041 // // Check if the month is out of range 1042 // if (month < 0 || month > 11) { 1043 1044 // // Set the date to the first day of the 1045 // // month with the new year 1046 // date = new Date(year, month, new Date().getDate()); 1047 1048 // // Set the year to the new year 1049 // year = date.getFullYear(); 1050 1051 // // Set the month to the new month 1052 // month = date.getMonth(); 1053 // } 1054 1055 // else { 1056 1057 // // Set the date to the current date 1058 // date = new Date(); 1059 // } 1060 1061 // // Call the tfhb_date_manipulate function to 1062 // // update the tfhb-calendar display 1063 // tfhb_date_manipulate(); 1064 // }); 1065 // }); 10 -
hydra-booking/trunk/hydra-booking.php
r3185465 r3187065 4 4 * Plugin URI: https://themefic.com/hydra-booking 5 5 * Description: Create a booking / Appointment Form using Contact Form 7. You can insert Calendar, Time on the form and manage your booking. User can pay using WooCommerce. 6 * Version: 1.0. 26 * Version: 1.0.3 7 7 * Author: Themefic 8 8 * Author URI: https://themefic.com/ … … 23 23 define( 'THB_PATH', plugin_dir_path( __FILE__ ) ); 24 24 define( 'THB_URL', plugin_dir_url( __FILE__ ) ); 25 define( 'THB_VERSION', '1.0. 2' );25 define( 'THB_VERSION', '1.0.3' ); 26 26 27 27 // Load Vendor Auto Load -
hydra-booking/trunk/includes/database/Booking.php
r3185407 r3187065 112 112 // } 113 113 if(isset($request['meeting_locations'])) { 114 $request['meeting_locations'] = wp_json_encode( $request['meeting_locations'] ); 114 $request['meeting_locations'] = is_array($request['meeting_locations']) || is_object($request['meeting_locations']) ? wp_json_encode( $request['meeting_locations'] ) : $request['meeting_locations']; 115 115 116 } 116 117 117 118 // Update Booking 118 119 $result = $wpdb->update( … … 264 265 } 265 266 267 268 /** 269 * Get Booking ID and Dates 270 * 271 */ 272 public function getByMeetingIdDates($meeting_id, $dates) { 273 global $wpdb; 274 275 $table_name = $wpdb->prefix . $this->table; 276 277 $sql = "SELECT * FROM $table_name WHERE meeting_id = %d AND meeting_dates = %s"; 278 $data = $wpdb->get_results( 279 $wpdb->prepare( $sql, $meeting_id, $dates ) 280 ); 281 return $data; 282 283 } 284 285 266 286 public function getFilter( $filterData = '' ) { 267 287 -
hydra-booking/trunk/includes/helper/helper-functions.php
r3185407 r3187065 36 36 } 37 37 } 38 39 /* 40 * Load Template 41 * 42 * @param string $template_path 43 * @param array $data 44 * @return string 45 */ 46 -
hydra-booking/trunk/includes/services/Integrations/GoogleCalendar/GoogleCalendar.php
r3185407 r3187065 446 446 447 447 } 448 $meeting_loaction = (array) $data->meeting_locations;449 $meeting_locations = is_array($meeting_loaction) ? $meeting_loaction : wp_json_decode($meeting_loaction);450 451 452 $ update = array();448 $meeting_loaction = $data->meeting_locations; 449 $meeting_locations = is_array($meeting_loaction) ? json_decode($meeting_loaction) : $meeting_loaction; 450 451 452 $booking = new Booking(); 453 453 $update['id'] = $data->id; 454 454 $update['meeting_calendar'] = $insert_id; … … 475 475 $get_booking_meta = $BookingMeta->getWithIdKey( $data->id, 'booking_calendar' ); 476 476 477 478 479 $MeetingData = $meeting->get( $data->meeting_id ); 480 481 $meta_data = get_post_meta( $MeetingData->post_id, '__tfhb_meeting_opt', true ); 477 482 if ( $get_booking_meta && 'one-to-one' == $meta_data['meeting_type']) { 478 483 $booking_meta_value = json_decode($get_booking_meta->value); … … 481 486 } 482 487 } 483 484 485 $MeetingData = $meeting->get( $data->meeting_id );486 487 $meta_data = get_post_meta( $MeetingData->post_id, '__tfhb_meeting_opt', true );488 488 if ( 'one-to-group' == $meta_data['meeting_type'] ) { 489 489 -
hydra-booking/trunk/readme.txt
r3185526 r3187065 2 2 Contributors: themefic, hasanet, mdrejon, kamrul0424 3 3 Tags: Booking Plugin, hydra booking, booking form, ultimate booking form 4 Requires at least: 4.25 Tested up to: 6. 44 Requires at least: 5.4 5 Tested up to: 6.6 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 27 Stable tag: 1.0.3 8 8 License: GPL-2.0+ 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 79 79 == Installation == 80 80 81 1. Download the plugin ZIP file from the WordPress Plugin Directory or your account if purchased directly. 82 2. In your WordPress dashboard, go to Plugins > Add New and click "Upload Plugin." 83 3. Select the ZIP file and click "Install Now." 84 4. Once installed, click "Activate" to start using HydraBooking. 81 1. Download and Extract: Download the plugin and unzip the folder. 82 2. Upload to WordPress: Upload the unzipped folder to the wp-content/plugins directory of your WordPress installation. 83 3. Go to your WordPress admin panel, navigate to Plugins, and activate Hydra Booking. 84 4. Alternatively, go to Plugins > Add New. In the search bar, type Hydra Booking, then install and activate the plugin. 85 5. Quick Setup Wizard: Complete the Quick Setup wizard to configure essential settings and start using Hydra Booking. 85 86 86 87 == Frequently Asked Questions == … … 115 116 == Changelog == 116 117 118 = 1.0.3 - 13/11/2024 = 119 - Fixed: Compatibility issue with block themes 120 - Fixed: Time zone handling corrected 121 - Improved: System stability enhanced for more reliable performance. 122 117 123 = 1.0.2 - 11/11/2024 = 118 124 - Screenshots Updated … … 127 133 128 134 = 1.0.0 = 129 First official release. Upgraderecommended for access to all initial features.135 First official release. An upgrade is recommended for access to all initial features. 130 136 131 137 == License == 132 138 133 139 This plugin is licensed under the GPL-2.0+ License, meaning it is open-source and free to use, modify, and distribute with the appropriate credit to the original developers. [Learn more about the GPL-2.0+ license](http://www.gnu.org/licenses/gpl-2.0.txt). 134
Note: See TracChangeset for help on using the changeset viewer.