PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
← All changes | includes/page-setup/setup_templates.php +82 -79 10.10.211.8.4 View file →
@@ -1,4 +1,4 @@
1 1 <?php /**
2 2 * @version 1.0
3 3 * @description Templates for Setup pages
4 4 * @category Setup Templates
@@ -43,14 +43,41 @@
43 43 wp_enqueue_script( 'wpbc_all', wpbc_plugin_url( '/_dist/all/_out/wpbc_all.js' ), array( 'jquery' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) );
44 44 wp_enqueue_script( 'wpbc-main-client', wpbc_plugin_url( '/js/client.js' ), array( 'wpbc-datepick' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) );
45 45 wp_enqueue_script( 'wpbc-times', wpbc_plugin_url( '/js/wpbc_times.js' ), array( 'wpbc-main-client' ), WP_BK_VERSION_NUM, array( 'in_footer' => WPBC_JS_IN_FOOTER ) );
46 46
47 - wp_enqueue_script( 'wpbc-general_ui_js_css', wpbc_plugin_url( '/includes/_general_ui_js_css/_out/wpbc_main_ui_funcs.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
48 -
49 47 wp_enqueue_script( 'wpbc-settings_obj', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/settings_obj.js', array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
50 48 wp_enqueue_script( 'wpbc-setup_wizard_obj', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_obj.js', array( 'wpbc-settings_obj' ), WP_BK_VERSION_NUM, $in_footer );
51 49 wp_enqueue_script( 'wpbc-setup_wizard_show', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_show.js', array( 'wpbc-setup_wizard_obj' ), WP_BK_VERSION_NUM, $in_footer );
52 50 wp_enqueue_script( 'wpbc-setup_wizard_ajax', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_ajax.js', array( 'wpbc-setup_wizard_obj' ), WP_BK_VERSION_NUM, $in_footer );
51 +
52 + wp_enqueue_script(
53 + 'wpbc-availability-timeslots-page',
54 + wpbc_plugin_url( '/includes/page-availability-timeslots/_out/availability_timeslots_page.js' ),
55 + array( 'jquery', 'wpbc_all', 'wpbc-datepick' ),
56 + WP_BK_VERSION_NUM,
57 + array( 'in_footer' => WPBC_JS_IN_FOOTER )
58 + );
59 +
60 + wp_localize_script(
61 + 'wpbc-availability-timeslots-page',
62 + 'wpbc_availability_timeslots_page',
63 + array(
64 + 'ajax_url' => admin_url( 'admin-ajax.php' ),
65 + 'nonce' => wp_create_nonce( 'wpbc_availability_timeslots_ajax_nonce' ),
66 + 'i18n' => array(
67 + 'select_slots_first' => __( 'Select one or more time ranges first.', 'booking' ),
68 + 'block_success' => __( 'Selected time ranges have been blocked.', 'booking' ),
69 + 'unblock_success' => __( 'Selected time ranges have been unblocked.', 'booking' ),
70 + 'save_error' => __( 'Unable to save time-slot availability.', 'booking' ),
71 + 'loading' => __( 'Loading', 'booking' ),
72 + 'open_booking' => __( 'Open booking in Booking Listing', 'booking' ),
73 + 'open_availability_rule' => __( 'Open availability settings', 'booking' ),
74 + 'select_one_slot_for_booking' => __( 'Select one time range on one date first.', 'booking' ),
75 + 'add_booking_modal_missing' => __( 'Add Booking popup is not available on this page.', 'booking' ),
76 + 'saving' => __( 'Saving', 'booking' ),
77 + ),
78 + )
79 + );
53 80 }
54 81 }
55 82
56 83
@@ -59,8 +86,10 @@
59 86
60 87 if ( wpbc_is_setup_wizard_page() ){
61 88
62 89 wp_enqueue_style( 'wpbc-setup_wizard_page', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/setup_page.css', array(), WP_BK_VERSION_NUM );
90 + wp_enqueue_style( 'wpbc-availability-general-page', wpbc_plugin_url( '/includes/page-availability-general/_out/availability_general_page.css' ), array( 'wpbc-calendar', 'wpbc-all-admin' ), WP_BK_VERSION_NUM );
91 + wp_enqueue_style( 'wpbc-availability-timeslots-page', wpbc_plugin_url( '/includes/page-availability-timeslots/_out/availability_timeslots_page.css' ), array( 'wpbc-calendar', 'wpbc-all-admin' ), WP_BK_VERSION_NUM );
63 92 }
64 93 }
65 94
66 95 // </editor-fold>
@@ -84,14 +113,8 @@
84 113 wpbc_stp_wiz__template__welcome();
85 114 wpbc_stp_wiz__template__general_info();
86 115 wpbc_stp_wiz__template__date_time_formats();
87 116 wpbc_stp_wiz__template__bookings_types();
88 - wpbc_stp_wiz__template__form_structure();
89 - wpbc_stp_wiz__template__cal_availability();
90 - wpbc_stp_wiz__template__color_theme();
91 - wpbc_stp_wiz__template__optional_other_settings();
92 - wpbc_stp_wiz__template__wizard_publish();
93 - wpbc_stp_wiz__template__get_started();
94 117
95 118 $this->wpbc_template__stp_wiz__left_navigation();
96 119 $this->wpbc_template__stp_wiz__left_navigation_item();
97 120
@@ -127,11 +150,11 @@
127 150 ?><script type="text/html" id="tmpl-wpbc_template__stp_wiz__main_content">
128 151 <#
129 152 var wpbc_template__timeline_steps = wp.template( 'wpbc_template__timeline_steps' );
130 153
131 - jQuery( '.wpbc__container_place__steps_for_timeline' ).html( wpbc_template__timeline_steps( data.steps_is_done ) );
154 + jQuery( '.wpbc__container_place__steps_for_timeline' ).html( wpbc_template__timeline_steps( data ) );
132 155 #>
133 - <div class="wpbc__container_place__steps_for_timeline">{{{ wpbc_template__timeline_steps( data.steps_is_done ) }}}</div>
156 + <div class="wpbc__container_place__steps_for_timeline">{{{ wpbc_template__timeline_steps( data ) }}}</div>
134 157 <div class="wpbc_setup_wizard_page__container wpbc_ajx_page__container">
135 158
136 159 <# if ( false !== data.steps[ data.current_step ][ 'show_section_left' ] ) { #>
137 160
@@ -169,33 +192,8 @@
169 192 case 'bookings_types':
170 193 template__main_section = wp.template( 'wpbc_stp_wiz__template__bookings_types' );
171 194 break;
172 195
173 - case 'form_structure':
174 - template__main_section = wp.template( 'wpbc_stp_wiz__template__form_structure' );
175 - break;
176 -
177 - case 'cal_availability':
178 - template__main_section = wp.template( 'wpbc_stp_wiz__template__cal_availability' );
179 - break;
180 -
181 - case 'color_theme':
182 - template__main_section = wp.template( 'wpbc_stp_wiz__template__color_theme' );
183 - break;
184 -
185 - case 'optional_other_settings':
186 -
187 - template__main_section = wp.template( 'wpbc_stp_wiz__template__optional_other_settings' );
188 - break;
189 -
190 - case 'wizard_publish':
191 - template__main_section = wp.template( 'wpbc_stp_wiz__template__wizard_publish' );
192 - break;
193 -
194 - case 'get_started':
195 - template__main_section = wp.template( 'wpbc_stp_wiz__template__get_started' );
196 - break;
197 -
198 196 default:
199 197 // Default
200 198 template__main_section = wp.template( 'wpbc_stp_wiz__template__general_info' );
201 199 }
@@ -236,11 +234,21 @@
236 234 <div class="wpbc_steps_for_timeline_container">
237 235 <div class="wpbc_steps_for_timeline">
238 236 <#
239 237
240 - var steps_count = wpbc_setup_wizard_page__get_steps_count();
241 - var actual_step_number = wpbc_setup_wizard_page__get_actual_step_number();
238 + var steps_arr = data.steps || {};
239 + var current_step = data.current_step || '';
240 + var steps_keys = _.keys( steps_arr );
241 + var steps_count = steps_keys.length;
242 + var actual_step_number = 1;
242 243
244 + _.each( steps_keys, function( step_key, step_index ) {
245 + if ( step_key === current_step ) {
246 + actual_step_number = step_index + 1;
247 + return false;
248 + }
249 + } );
250 +
243 251 var css_class_for_step = '';
244 252 var css_class_for_line = '';
245 253 var is_line_exist = false;
246 254
@@ -295,65 +303,60 @@
295 303 // -------------------------------------------------------------------------------------------------------------
296 304 private function wpbc_template__stp_wiz__footer_buttons(){
297 305
298 306 ?><script type="text/html" id="tmpl-wpbc_template__stp_wiz__footer_buttons">
307 + <#
308 + var currentStep = data.current_step || '';
309 + var currentStepData = ( data.steps && data.steps[ currentStep ] ) ? data.steps[ currentStep ] : {};
310 + var priorStep = currentStepData.prior || '';
311 + var nextStep = currentStepData.next || '';
312 + var doAction = currentStepData.do_action || 'none';
313 + var priorTitle = currentStepData.prior_title || '<?php echo esc_js( __( 'Go Back', 'booking' ) ); ?>';
314 + var nextTitle = currentStepData.next_title || '<?php echo esc_js( __( 'Save and Continue', 'booking' ) ); ?>';
315 + #>
299 316 <div class="wpbc__form__div">
300 317 <hr>
301 - <div class="wpbc__row wpbc__row__btn_prior_next">
302 - <?php /* ?>
303 - <div class="wpbc__field">
304 - <input type="button" value="<?php esc_attr_e('Reset Wizard and Start from Beginning','booking'); ?>"
305 - class="wpbc_button_light wpbc_button_danger tooltip_top " style=""
306 - onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'make_reset' } ); ">
307 - </div>
308 - <?php */ ?>
309 - <div class="wpbc__field">
310 - <# if ( '' != data['steps'][ data['current_step'] ]['prior'] ) { #>
311 - <a class="wpbc_button_light" style="margin-left:auto;margin-right:10px;" tabindex="0"
318 + <div class="wpbc__row wpbc__row__btn_prior_next wpbc_setup_wizard_navigation_row">
319 + <div class="wpbc__field wpbc_setup_wizard_navigation_links">
320 + <p class="wpbc_exit_link_small">
321 + <a href="javascript:void(0)"
322 + onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'skip_wizard' } ); "
323 + title="<?php esc_attr_e('Exit and skip the setup wizard','booking'); ?>"
324 + ><?php esc_html_e('Exit and skip the setup wizard','booking'); ?></a>
325 + <a href="javascript:void(0)" class="wpbc_button_danger"
326 + onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'make_reset' } ); "
327 + title="<?php esc_attr_e('Start Setup from Beginning','booking'); ?>"
328 + ><?php esc_html_e('Reset Wizard','booking'); ?></a>
329 + </p>
330 + </div>
331 + <div class="wpbc__field wpbc_setup_wizard_navigation_actions">
332 + <# if ( '' != priorStep ) { #>
333 + <a class="button button-secondary" style="margin-left:auto;margin-right:10px;" tabindex="0"
312 334 id="btn__toolbar__buttons_prior"
313 335 onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( {
314 - 'current_step': '{{data.steps[ data.current_step ].prior}}',
336 + 'current_step': '{{priorStep}}',
315 337 'do_action': 'none',
316 338 'ui_clicked_element_id': 'btn__toolbar__buttons_prior'
317 339 } );
318 340 wpbc_button_enable_loading_icon( this );
319 - wpbc_admin_show_message_processing( '' );" ><i class="menu_icon icon-1x wpbc_icn_arrow_back_ios"></i><span>&nbsp;&nbsp;&nbsp;{{data.steps[ data.current_step ].prior_title}}</span></a>
341 + wpbc_admin_show_message_processing( '' );" ><i class="menu_icon icon-1x wpbc_icn_arrow_back_ios"></i><span>&nbsp;&nbsp;&nbsp;{{priorTitle}}</span></a>
320 342
321 343 <# } else { #>
322 344 <span style="margin-left:auto;"></span>
323 345 <# } #>
324 - <a class="wpbc_button_light button-primary" tabindex="0"
346 + <a class="button button-primary" tabindex="0"
325 347 id="btn__toolbar__buttons_next"
326 348 onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( {
327 - 'current_step': '{{data.steps[ data.current_step ].next}}',
328 - 'do_action': '{{data.steps[ data.current_step ].do_action}}',
349 + 'current_step': '{{nextStep}}',
350 + 'do_action': '{{doAction}}',
329 351 'ui_clicked_element_id': 'btn__toolbar__buttons_next'
352 + ,'step_data': ( 'function' === typeof window.wpbc_setup_wizard_get_step_data ) ? window.wpbc_setup_wizard_get_step_data( '{{currentStep}}' ) : {}
330 353 } );
331 354 wpbc_button_enable_loading_icon( this );
332 - wpbc_admin_show_message_processing( '' );" ><span>{{data.steps[ data.current_step ].next_title}}&nbsp;&nbsp;&nbsp;</span><i class="menu_icon icon-1x wpbc_icn_arrow_forward_ios"></i></a>
333 - </div>
334 - </div>
335 - <div class="wpbc__row wpbc__row__btn_skip_exist">
336 - <div class="wpbc__field">
337 - <p class="wpbc_exit_link_small">
338 - <a href="javascript:void(0)" tabindex="-1"
339 - onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'skip_wizard' } ); "
340 - title="<?php esc_attr_e('Exit and skip the setup wizard','booking'); ?>"
341 - ><?php
342 - esc_html_e('Exit and skip the setup wizard','booking');
343 - ?></a>
344 - <?php ?>
345 - <a href="javascript:void(0)" class="wpbc_button_danger" style="margin: 25px 0 0; font-size: 12px;" tabindex="-1"
346 - onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'make_reset' } ); "
347 - title="<?php esc_attr_e('Start Setup from Beginning','booking'); ?>"
348 - ><?php
349 - esc_html_e('Reset Wizard','booking');
350 - ?></a>
351 - <?php /**/ ?>
352 - </p>
353 - </div>
354 - </div>
355 - </div>
355 + wpbc_admin_show_message_processing( '' );" ><span>{{nextTitle}}&nbsp;&nbsp;&nbsp;</span><i class="menu_icon icon-1x wpbc_icn_arrow_forward_ios"></i></a>
356 + </div>
357 + </div>
358 + </div>
356 359 </script><?php
357 360 }
358 361
359 362
@@ -467,7 +470,7 @@
467 470 /**
468 471 * Just for loading CSS and JavaScript files
469 472 */
470 473 if ( true ) {
471 - $setup_wizard_page_loading = new WPBC_AJX__Setup_Wizard__Templates;
472 - $setup_wizard_page_loading->init_load_css_js_tpl();
474 + $wpbc_setup_wizard_page_loading = new WPBC_AJX__Setup_Wizard__Templates;
475 + $wpbc_setup_wizard_page_loading->init_load_css_js_tpl();
473 476 }