| @@ -32,15 +32,18 @@ | ||
| 32 | 32 | |
| 33 | 33 | public function tabs() { |
| 34 | 34 | |
| 35 | 35 | $is_full_screen = WPBC_User_Custom_Data_Saver::get_user_data_value( wpbc_get_current_user_id(), 'is_full_screen' ); |
| 36 | + $is_full_screen = function_exists( 'wpbc_ui__get_full_screen_mode_from_cookie' ) | |
| 37 | + ? wpbc_ui__get_full_screen_mode_from_cookie( $is_full_screen ) | |
| 38 | + : $is_full_screen; | |
| 36 | 39 | $is_full_screen = ( 'On' === $is_full_screen ); |
| 37 | 40 | |
| 38 | 41 | $tabs = array(); |
| 39 | 42 | $tabs['vm_booking_listing'] = array( |
| 40 | - 'is_show_top_path' => false, // true | false. By default value is: false. | |
| 43 | + 'is_show_top_path' => true, // true | false. By default value is: true. | |
| 41 | 44 | 'is_show_top_navigation' => true, // true | false. By default value is: false. |
| 42 | - 'left_navigation__default_view_mode' => ( $is_full_screen ) ? 'compact' : 'min', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. | |
| 45 | + 'left_navigation__default_view_mode' => '', // FixIn: 11.7.1.1.: ( $is_full_screen ) ? 'compact' : 'min', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. | |
| 43 | 46 | 'page_title' => false, // Header - Title. If false, than hidden. |
| 44 | 47 | 'page_description' => false, // Header - Title Description. If false, than hidden. |
| 45 | 48 | 'title' => __( 'Bookings', 'booking' ), // Menu - Title. |
| 46 | 49 | 'hint' => __( 'Booking Listing', 'booking' ), // Menu - Mouse Over Hint. |
| @@ -178,8 +181,12 @@ | ||
| 178 | 181 | |
| 179 | 182 | |
| 180 | 183 | private function show_ajx_booking_listing_container_ajax( $escaped_search_request_params ) { |
| 181 | 184 | |
| 185 | + if ( class_exists( 'WPBC_AJX_Bookings' ) ) { | |
| 186 | + WPBC_AJX_Bookings::enqueue_js_files_now(); | |
| 187 | + } | |
| 188 | + | |
| 182 | 189 | ?> |
| 183 | 190 | <div class="wpbc__wrap__booking_listing"> |
| 184 | 191 | <div class="wpbc__list__table wpbc_selectable_table"> |
| 185 | 192 | <?php $this->spins_loading_container(); ?> |
| @@ -187,22 +194,41 @@ | ||
| 187 | 194 | </div> |
| 188 | 195 | <script type="text/javascript"> |
| 189 | 196 | jQuery(document).ready(function () { |
| 190 | 197 | |
| 191 | - // Set Security - Nonce for Ajax - Listing | |
| 192 | - wpbc_ajx_booking_listing.set_secure_param( 'nonce', '<?php echo esc_attr( wp_create_nonce( 'wpbc_ajx_booking_listing_ajx' . '_wpbcnonce' ) ); ?>' ); | |
| 193 | - wpbc_ajx_booking_listing.set_secure_param( 'user_id', '<?php echo esc_attr( wpbc_get_current_user_id() ); ?>' ); | |
| 194 | - wpbc_ajx_booking_listing.set_secure_param( 'locale', '<?php echo esc_attr( get_user_locale() ); ?>' ); | |
| 198 | + var wpbc_booking_listing_wait_counter = 0; | |
| 199 | + var wpbc_booking_listing_wait_timer = setInterval( function() { | |
| 195 | 200 | |
| 196 | - // Set other parameters | |
| 197 | - wpbc_ajx_booking_listing.set_other_param( 'listing_container', '.wpbc__list__table' ); | |
| 201 | + wpbc_booking_listing_wait_counter++; | |
| 198 | 202 | |
| 199 | - wpbc_ajx_booking_listing.set_other_param( 'pagination_container', '.wpbc_ajx_booking_pagination' ); | |
| 200 | - wpbc_ajx_booking_listing.set_other_param( 'pagination_container_header', '.wpbc_ajx_booking_pagination_header' ); | |
| 201 | - wpbc_ajx_booking_listing.set_other_param( 'pagination_container_footer', '.wpbc_ajx_booking_pagination_footer' ); | |
| 203 | + if ( | |
| 204 | + 'undefined' === typeof wpbc_ajx_booking_listing | |
| 205 | + || 'function' !== typeof wpbc_ajx_booking_listing.set_secure_param | |
| 206 | + || 'function' !== typeof wpbc_ajx_booking_send_search_request_with_params | |
| 207 | + ) { | |
| 208 | + if ( wpbc_booking_listing_wait_counter > 20 ) { | |
| 209 | + clearInterval( wpbc_booking_listing_wait_timer ); | |
| 210 | + } | |
| 211 | + return; | |
| 212 | + } | |
| 202 | 213 | |
| 203 | - // Send Ajax request and show listing after this. | |
| 204 | - wpbc_ajx_booking_send_search_request_with_params( <?php echo wp_json_encode( $escaped_search_request_params ); ?> ); | |
| 214 | + clearInterval( wpbc_booking_listing_wait_timer ); | |
| 215 | + | |
| 216 | + // Set Security - Nonce for Ajax - Listing | |
| 217 | + wpbc_ajx_booking_listing.set_secure_param( 'nonce', '<?php echo esc_attr( wp_create_nonce( 'wpbc_ajx_booking_listing_ajx' . '_wpbcnonce' ) ); ?>' ); | |
| 218 | + wpbc_ajx_booking_listing.set_secure_param( 'user_id', '<?php echo esc_attr( wpbc_get_current_user_id() ); ?>' ); | |
| 219 | + wpbc_ajx_booking_listing.set_secure_param( 'locale', '<?php echo esc_attr( get_user_locale() ); ?>' ); | |
| 220 | + | |
| 221 | + // Set other parameters | |
| 222 | + wpbc_ajx_booking_listing.set_other_param( 'listing_container', '.wpbc__list__table' ); | |
| 223 | + | |
| 224 | + wpbc_ajx_booking_listing.set_other_param( 'pagination_container', '.wpbc_ajx_booking_pagination' ); | |
| 225 | + wpbc_ajx_booking_listing.set_other_param( 'pagination_container_header', '.wpbc_ajx_booking_pagination_header' ); | |
| 226 | + wpbc_ajx_booking_listing.set_other_param( 'pagination_container_footer', '.wpbc_ajx_booking_pagination_footer' ); | |
| 227 | + | |
| 228 | + // Send Ajax request and show listing after this. | |
| 229 | + wpbc_ajx_booking_send_search_request_with_params( <?php echo wp_json_encode( $escaped_search_request_params ); ?> ); | |
| 230 | + }, 100 ); | |
| 205 | 231 | }); |
| 206 | 232 | </script> |
| 207 | 233 | <?php |
| 208 | 234 | } |