| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php /** |
| 2 | 2 | * @version 1.0 |
| 3 | 3 | * @description Templates for Setup pages |
| 4 | 4 | * @category Setup Templates |
| @@ -47,8 +47,37 @@ | ||
| 47 | 47 | wp_enqueue_script( 'wpbc-settings_obj', trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/settings_obj.js', array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer ); |
| 48 | 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 ); |
| 49 | 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 ); |
| 50 | 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 | + ); | |
| 51 | 80 | } |
| 52 | 81 | } |
| 53 | 82 | |
| 54 | 83 | |
| @@ -57,8 +86,10 @@ | ||
| 57 | 86 | |
| 58 | 87 | if ( wpbc_is_setup_wizard_page() ){ |
| 59 | 88 | |
| 60 | 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 ); | |
| 61 | 92 | } |
| 62 | 93 | } |
| 63 | 94 | |
| 64 | 95 | // </editor-fold> |
| @@ -82,14 +113,8 @@ | ||
| 82 | 113 | wpbc_stp_wiz__template__welcome(); |
| 83 | 114 | wpbc_stp_wiz__template__general_info(); |
| 84 | 115 | wpbc_stp_wiz__template__date_time_formats(); |
| 85 | 116 | wpbc_stp_wiz__template__bookings_types(); |
| 86 | - wpbc_stp_wiz__template__form_structure(); | |
| 87 | - wpbc_stp_wiz__template__cal_availability(); | |
| 88 | - wpbc_stp_wiz__template__color_theme(); | |
| 89 | - wpbc_stp_wiz__template__optional_other_settings(); | |
| 90 | - wpbc_stp_wiz__template__wizard_publish(); | |
| 91 | - wpbc_stp_wiz__template__get_started(); | |
| 92 | 117 | |
| 93 | 118 | $this->wpbc_template__stp_wiz__left_navigation(); |
| 94 | 119 | $this->wpbc_template__stp_wiz__left_navigation_item(); |
| 95 | 120 | |
| @@ -125,11 +150,11 @@ | ||
| 125 | 150 | ?><script type="text/html" id="tmpl-wpbc_template__stp_wiz__main_content"> |
| 126 | 151 | <# |
| 127 | 152 | var wpbc_template__timeline_steps = wp.template( 'wpbc_template__timeline_steps' ); |
| 128 | 153 | |
| 129 | - 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 ) ); | |
| 130 | 155 | #> |
| 131 | - <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> | |
| 132 | 157 | <div class="wpbc_setup_wizard_page__container wpbc_ajx_page__container"> |
| 133 | 158 | |
| 134 | 159 | <# if ( false !== data.steps[ data.current_step ][ 'show_section_left' ] ) { #> |
| 135 | 160 | |
| @@ -167,33 +192,8 @@ | ||
| 167 | 192 | case 'bookings_types': |
| 168 | 193 | template__main_section = wp.template( 'wpbc_stp_wiz__template__bookings_types' ); |
| 169 | 194 | break; |
| 170 | 195 | |
| 171 | - case 'form_structure': | |
| 172 | - template__main_section = wp.template( 'wpbc_stp_wiz__template__form_structure' ); | |
| 173 | - break; | |
| 174 | - | |
| 175 | - case 'cal_availability': | |
| 176 | - template__main_section = wp.template( 'wpbc_stp_wiz__template__cal_availability' ); | |
| 177 | - break; | |
| 178 | - | |
| 179 | - case 'color_theme': | |
| 180 | - template__main_section = wp.template( 'wpbc_stp_wiz__template__color_theme' ); | |
| 181 | - break; | |
| 182 | - | |
| 183 | - case 'optional_other_settings': | |
| 184 | - | |
| 185 | - template__main_section = wp.template( 'wpbc_stp_wiz__template__optional_other_settings' ); | |
| 186 | - break; | |
| 187 | - | |
| 188 | - case 'wizard_publish': | |
| 189 | - template__main_section = wp.template( 'wpbc_stp_wiz__template__wizard_publish' ); | |
| 190 | - break; | |
| 191 | - | |
| 192 | - case 'get_started': | |
| 193 | - template__main_section = wp.template( 'wpbc_stp_wiz__template__get_started' ); | |
| 194 | - break; | |
| 195 | - | |
| 196 | 196 | default: |
| 197 | 197 | // Default |
| 198 | 198 | template__main_section = wp.template( 'wpbc_stp_wiz__template__general_info' ); |
| 199 | 199 | } |
| @@ -234,11 +234,21 @@ | ||
| 234 | 234 | <div class="wpbc_steps_for_timeline_container"> |
| 235 | 235 | <div class="wpbc_steps_for_timeline"> |
| 236 | 236 | <# |
| 237 | 237 | |
| 238 | - var steps_count = wpbc_setup_wizard_page__get_steps_count(); | |
| 239 | - 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; | |
| 240 | 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 | + | |
| 241 | 251 | var css_class_for_step = ''; |
| 242 | 252 | var css_class_for_line = ''; |
| 243 | 253 | var is_line_exist = false; |
| 244 | 254 | |
| @@ -293,65 +303,60 @@ | ||
| 293 | 303 | // ------------------------------------------------------------------------------------------------------------- |
| 294 | 304 | private function wpbc_template__stp_wiz__footer_buttons(){ |
| 295 | 305 | |
| 296 | 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 | + #> | |
| 297 | 316 | <div class="wpbc__form__div"> |
| 298 | 317 | <hr> |
| 299 | - <div class="wpbc__row wpbc__row__btn_prior_next"> | |
| 300 | - <?php /* ?> | |
| 301 | - <div class="wpbc__field"> | |
| 302 | - <input type="button" value="<?php esc_attr_e('Reset Wizard and Start from Beginning','booking'); ?>" | |
| 303 | - class="wpbc_button_light wpbc_button_danger tooltip_top " style="" | |
| 304 | - onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'make_reset' } ); "> | |
| 305 | - </div> | |
| 306 | - <?php */ ?> | |
| 307 | - <div class="wpbc__field"> | |
| 308 | - <# if ( '' != data['steps'][ data['current_step'] ]['prior'] ) { #> | |
| 309 | - <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" | |
| 310 | 334 | id="btn__toolbar__buttons_prior" |
| 311 | 335 | onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { |
| 312 | - 'current_step': '{{data.steps[ data.current_step ].prior}}', | |
| 336 | + 'current_step': '{{priorStep}}', | |
| 313 | 337 | 'do_action': 'none', |
| 314 | 338 | 'ui_clicked_element_id': 'btn__toolbar__buttons_prior' |
| 315 | 339 | } ); |
| 316 | 340 | wpbc_button_enable_loading_icon( this ); |
| 317 | - wpbc_admin_show_message_processing( '' );" ><i class="menu_icon icon-1x wpbc_icn_arrow_back_ios"></i><span> {{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> {{priorTitle}}</span></a> | |
| 318 | 342 | |
| 319 | 343 | <# } else { #> |
| 320 | 344 | <span style="margin-left:auto;"></span> |
| 321 | 345 | <# } #> |
| 322 | - <a class="wpbc_button_light button-primary" tabindex="0" | |
| 346 | + <a class="button button-primary" tabindex="0" | |
| 323 | 347 | id="btn__toolbar__buttons_next" |
| 324 | 348 | onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { |
| 325 | - 'current_step': '{{data.steps[ data.current_step ].next}}', | |
| 326 | - 'do_action': '{{data.steps[ data.current_step ].do_action}}', | |
| 349 | + 'current_step': '{{nextStep}}', | |
| 350 | + 'do_action': '{{doAction}}', | |
| 327 | 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}}' ) : {} | |
| 328 | 353 | } ); |
| 329 | 354 | wpbc_button_enable_loading_icon( this ); |
| 330 | - wpbc_admin_show_message_processing( '' );" ><span>{{data.steps[ data.current_step ].next_title}} </span><i class="menu_icon icon-1x wpbc_icn_arrow_forward_ios"></i></a> | |
| 331 | - </div> | |
| 332 | - </div> | |
| 333 | - <div class="wpbc__row wpbc__row__btn_skip_exist"> | |
| 334 | - <div class="wpbc__field"> | |
| 335 | - <p class="wpbc_exit_link_small"> | |
| 336 | - <a href="javascript:void(0)" tabindex="-1" | |
| 337 | - onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'skip_wizard' } ); " | |
| 338 | - title="<?php esc_attr_e('Exit and skip the setup wizard','booking'); ?>" | |
| 339 | - ><?php | |
| 340 | - esc_html_e('Exit and skip the setup wizard','booking'); | |
| 341 | - ?></a> | |
| 342 | - <?php ?> | |
| 343 | - <a href="javascript:void(0)" class="wpbc_button_danger" style="margin: 25px 0 0; font-size: 12px;" tabindex="-1" | |
| 344 | - onclick=" wpbc_ajx__setup_wizard_page__send_request_with_params( { 'do_action': 'make_reset' } ); " | |
| 345 | - title="<?php esc_attr_e('Start Setup from Beginning','booking'); ?>" | |
| 346 | - ><?php | |
| 347 | - esc_html_e('Reset Wizard','booking'); | |
| 348 | - ?></a> | |
| 349 | - <?php /**/ ?> | |
| 350 | - </p> | |
| 351 | - </div> | |
| 352 | - </div> | |
| 353 | - </div> | |
| 355 | + wpbc_admin_show_message_processing( '' );" ><span>{{nextTitle}} </span><i class="menu_icon icon-1x wpbc_icn_arrow_forward_ios"></i></a> | |
| 356 | + </div> | |
| 357 | + </div> | |
| 358 | + </div> | |
| 354 | 359 | </script><?php |
| 355 | 360 | } |
| 356 | 361 | |
| 357 | 362 | |