PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 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 All 205 releases
← All changes | includes/_capacity/_src/create_booking.js +198 -145 10.1.3 → 11.9 View file →
@@ -1,8 +1,8 @@
1 1 "use strict";
2 2
3 3 // ---------------------------------------------------------------------------------------------------------------------
4 -// A j a x A d d N e w B o o k i n g
4 +// == A j a x A d d N e w B o o k i n g ==
5 5 // ---------------------------------------------------------------------------------------------------------------------
6 6
7 7
8 8 /**
@@ -24,41 +24,42 @@
24 24 *
25 25 */
26 26 function wpbc_ajx_booking__create( params ){
27 27
28 -console.groupCollapsed( 'WPBC_AJX_BOOKING__CREATE' );
29 -console.groupCollapsed( '== Before Ajax Send ==' );
30 -console.log( params );
31 -console.groupEnd();
28 + console.groupCollapsed( 'WPBC_AJX_BOOKING__CREATE' );
29 + console.groupCollapsed( '== Before Ajax Send ==' );
30 + console.log( params );
31 + console.groupEnd();
32 32
33 33 params = wpbc_captcha__simple__maybe_remove_in_ajx_params( params );
34 34
35 - // Start Ajax
35 + // Trigger hook before sending request to create the booking.
36 + jQuery( 'body' ).trigger( 'wpbc_before_booking_create', [ params['resource_id'], params ] );
37 +
38 + // Start Ajax.
36 39 jQuery.post( wpbc_url_ajax,
37 - {
38 - action : 'WPBC_AJX_BOOKING__CREATE',
39 - wpbc_ajx_user_id: _wpbc.get_secure_param( 'user_id' ),
40 - nonce : _wpbc.get_secure_param( 'nonce' ),
41 - wpbc_ajx_locale : _wpbc.get_secure_param( 'locale' ),
40 + {
41 + action : 'WPBC_AJX_BOOKING__CREATE',
42 + wpbc_ajx_user_id : _wpbc.get_secure_param( 'user_id' ),
43 + nonce : _wpbc.get_secure_param( 'nonce' ),
44 + wpbc_ajx_locale : _wpbc.get_secure_param( 'locale' ),
45 + calendar_request_params: params,
46 + /**
47 + * Usually params = { 'resource_id' : resource_id,
48 + * 'dates_ddmmyy_csv' : document.getElementById( 'date_booking' + resource_id ).value,
49 + * 'formdata' : formdata,
50 + * 'booking_hash' : my_booking_hash,
51 + * 'custom_form' : my_booking_form,
52 + *
53 + * 'captcha_chalange' : captcha_chalange,
54 + * 'user_captcha' : user_captcha,
55 + *
56 + * 'is_emails_send' : is_send_emeils,
57 + * 'active_locale' : wpdev_active_locale
58 + * }
59 + */
60 + },
42 61
43 - calendar_request_params : params
44 -
45 - /**
46 - * Usually params = { 'resource_id' : resource_id,
47 - * 'dates_ddmmyy_csv' : document.getElementById( 'date_booking' + resource_id ).value,
48 - * 'formdata' : formdata,
49 - * 'booking_hash' : my_booking_hash,
50 - * 'custom_form' : my_booking_form,
51 - *
52 - * 'captcha_chalange' : captcha_chalange,
53 - * 'user_captcha' : user_captcha,
54 - *
55 - * 'is_emails_send' : is_send_emeils,
56 - * 'active_locale' : wpdev_active_locale
57 - * }
58 - */
59 - },
60 -
61 62 /**
62 63 * S u c c e s s
63 64 *
64 65 * @param response_data - its object returned from Ajax - class-live-searcg.php
@@ -64,11 +65,39 @@
64 65 * @param response_data - its object returned from Ajax - class-live-searcg.php
65 66 * @param textStatus - 'success'
66 67 * @param jqXHR - Object
67 68 */
68 - function ( response_data, textStatus, jqXHR ) {
69 -console.log( ' == Response WPBC_AJX_BOOKING__CREATE == ' );
70 -for ( var obj_key in response_data ){
69 + function ( response_data, textStatus, jqXHR ) {
70 + var is_valid_response = (
71 + (typeof response_data === 'object')
72 + && (response_data !== null)
73 + && (! Array.isArray( response_data ))
74 + && Object.prototype.hasOwnProperty.call( response_data, 'resource_id' )
75 + && (typeof response_data[ 'ajx_data' ] === 'object')
76 + && (response_data[ 'ajx_data' ] !== null)
77 + && (! Array.isArray( response_data[ 'ajx_data' ] ))
78 + && (typeof response_data[ 'ajx_data' ][ 'status' ] === 'string')
79 + );
80 +
81 + if ( ! is_valid_response ) {
82 + var calendar_id = wpbc_get_resource_id__from_ajx_post_data_url( this.data );
83 + var jq_node = '#booking_form' + calendar_id;
84 + var response_error_message = _wpbc.get_message( 'message_unexpected_server_response' ) || 'The server returned an unexpected response. Please reload the page and try again.';
85 +
86 + wpbc_front_end__log_unexpected_ajax_response( 'WPBC_AJX_BOOKING__CREATE', response_data, jqXHR, textStatus, 'Invalid response structure' );
87 + wpbc_front_end__show_message( response_error_message, { 'type' : 'error',
88 + 'show_here' : {'jq_node': jq_node, 'where': 'after'},
89 + 'is_append' : true,
90 + 'style' : 'text-align:left;',
91 + 'content_mode': 'text',
92 + 'delay' : 0
93 + } );
94 + wpbc_booking_form__on_response__ui_elements_enable( calendar_id );
95 + return;
96 + }
97 +
98 +console.log( ' == Response WPBC_AJX_BOOKING__CREATE == ' );
99 +for ( var obj_key in response_data ){
71 100 console.groupCollapsed( '==' + obj_key + '==' );
72 101 console.log( ' : ' + obj_key + ' : ', response_data[ obj_key ] );
73 102 console.groupEnd();
74 103 }
@@ -74,34 +103,8 @@
74 103 }
75 104 console.groupEnd();
76 105
77 106
78 - // <editor-fold defaultstate="collapsed" desc=" = Error Message! Server response with String. -> E_X_I_T " >
79 - // -------------------------------------------------------------------------------------------------
80 - // This section execute, when server response with String instead of Object -- Usually it's because of mistake in code !
81 - // -------------------------------------------------------------------------------------------------
82 - if ( (typeof response_data !== 'object') || (response_data === null) ){
83 -
84 - var calendar_id = wpbc_get_resource_id__from_ajx_post_data_url( this.data );
85 - var jq_node = '#booking_form' + calendar_id;
86 -
87 - if ( '' == response_data ){
88 - response_data = '<strong>' + 'Error! Server respond with empty string!' + '</strong> ' ;
89 - }
90 - // Show Message
91 - wpbc_front_end__show_message( response_data , { 'type' : 'error',
92 - 'show_here': {'jq_node': jq_node, 'where': 'after'},
93 - 'is_append': true,
94 - 'style' : 'text-align:left;',
95 - 'delay' : 0
96 - } );
97 - // Enable Submit | Hide spin loader
98 - wpbc_booking_form__on_response__ui_elements_enable( calendar_id );
99 - return;
100 - }
101 - // </editor-fold>
102 -
103 -
104 107 // <editor-fold defaultstate="collapsed" desc=" == This section execute, when we have KNOWN errors from Booking Calendar. -> E_X_I_T " >
105 108 // -------------------------------------------------------------------------------------------------
106 109 // This section execute, when we have KNOWN errors from Booking Calendar
107 110 // -------------------------------------------------------------------------------------------------
@@ -114,9 +117,9 @@
114 117 wpbc_captcha__simple__update( {
115 118 'resource_id': response_data[ 'resource_id' ],
116 119 'url' : response_data[ 'ajx_data' ][ 'captcha__simple' ][ 'url' ],
117 120 'challenge' : response_data[ 'ajx_data' ][ 'captcha__simple' ][ 'challenge' ],
118 - 'message' : response_data[ 'ajx_data' ][ 'ajx_after_action_message' ].replace( /\n/g, "<br />" )
121 + 'message' : response_data[ 'ajx_data' ][ 'ajx_after_action_message' ]
119 122 }
120 123 );
121 124 break;
122 125
@@ -156,25 +159,21 @@
156 159
157 160 var calendar_id = wpbc_get_resource_id__from_ajx_post_data_url( this.data );
158 161 var jq_node = '#booking_form' + calendar_id;
159 162
160 - var ajx_after_booking_message = response_data[ 'ajx_data' ][ 'ajx_after_action_message' ].replace( /\n/g, "<br />" );
161 -
162 - console.log( ajx_after_booking_message );
163 -
164 - /**
165 - * // Show Message
166 - var ajx_after_action_message_id = wpbc_front_end__show_message( ajx_after_booking_message,
167 - {
168 - 'type' : ('undefined' !== typeof (response_data[ 'ajx_data' ][ 'ajx_after_action_message_status' ]))
169 - ? response_data[ 'ajx_data' ][ 'ajx_after_action_message_status' ] : 'info',
170 - 'delay' : 10000,
171 - 'show_here': {
172 - 'jq_node': jq_node,
173 - 'where' : 'after'
174 - }
175 - } );
176 - */
163 + var ajx_after_booking_message = response_data[ 'ajx_data' ][ 'ajx_after_action_message' ].replace( /\n/g, "<br />" );
164 +
165 + console.log( ajx_after_booking_message );
166 + wpbc_front_end__show_message( ajx_after_booking_message,
167 + {
168 + 'type' : ('undefined' !== typeof (response_data[ 'ajx_data' ][ 'ajx_after_action_message_status' ]))
169 + ? response_data[ 'ajx_data' ][ 'ajx_after_action_message_status' ] : 'warning',
170 + 'delay' : 0,
171 + 'show_here': {
172 + 'jq_node': jq_node,
173 + 'where' : 'after'
174 + }
175 + } );
177 176 }
178 177 // </editor-fold>
179 178 }
180 179
@@ -235,8 +234,11 @@
235 234
236 235 // Show Confirmation | Payment section
237 236 wpbc_show_thank_you_message_after_booking( response_data );
238 237
238 + // Trigger hook after a booking was created or updated successfully.
239 + jQuery( 'body' ).trigger( 'wpbc_booking_form_submit_success', [ response_data[ 'resource_id' ], response_data, params ] );
240 +
239 241 setTimeout( function (){
240 242 wpbc_do_scroll( '#wpbc_scroll_point_' + response_data[ 'resource_id' ], 10 );
241 243 }, 500 );
242 244
@@ -244,44 +246,29 @@
244 246
245 247 }
246 248 ).fail(
247 249 // <editor-fold defaultstate="collapsed" desc=" = This section execute, when NONCE field was not passed or some error happened at server! = " >
248 - function ( jqXHR, textStatus, errorThrown ) { if ( window.console && window.console.log ){ console.log( 'Ajax_Error', jqXHR, textStatus, errorThrown ); }
250 + function ( jqXHR, textStatus, errorThrown ) {
251 + wpbc_front_end__log_unexpected_ajax_response( 'WPBC_AJX_BOOKING__CREATE', jqXHR.responseText || '', jqXHR, textStatus, errorThrown );
249 252
250 253 // -------------------------------------------------------------------------------------------------
251 254 // This section execute, when NONCE field was not passed or some error happened at server!
252 255 // -------------------------------------------------------------------------------------------------
253 256
254 - // Get Content of Error Message
255 - var error_message = '<strong>' + 'Error!' + '</strong> ' + errorThrown ;
256 - if ( jqXHR.status ){
257 - error_message += ' (<b>' + jqXHR.status + '</b>)';
258 - if (403 == jqXHR.status ){
259 - error_message += '<br> Probably nonce for this page has been expired. Please <a href="javascript:void(0)" onclick="javascript:location.reload();">reload the page</a>.';
260 - error_message += '<br> Otherwise, please check this <a style="font-weight: 600;" href="https://wpbookingcalendar.com/faq/request-do-not-pass-security-check/?after_update=10.1.1">troubleshooting instruction</a>.<br>'
261 - }
262 - }
263 - if ( jqXHR.responseText ){
264 - // Escape tags in Error message
265 - error_message += '<br><strong>Response</strong><div style="padding: 0 10px;margin: 0 0 10px;border-radius:3px; box-shadow:0px 0px 1px #a3a3a3;">' + jqXHR.responseText.replace(/&/g, "&amp;")
266 - .replace(/</g, "&lt;")
267 - .replace(/>/g, "&gt;")
268 - .replace(/"/g, "&quot;")
269 - .replace(/'/g, "&#39;")
270 - +'</div>';
271 - }
272 - error_message = error_message.replace( /\n/g, "<br />" );
257 + var fallback_error_message = _wpbc.get_message( 'message_unexpected_server_response' ) || 'The server returned an unexpected response. Please reload the page and try again.';
258 + var error_message = wpbc_front_end__get_ajax_error_message( jqXHR, fallback_error_message, '' );
273 259
274 260 var calendar_id = wpbc_get_resource_id__from_ajx_post_data_url( this.data );
275 261 var jq_node = '#booking_form' + calendar_id;
276 262
277 263 // Show Message
278 - wpbc_front_end__show_message( error_message , { 'type' : 'error',
279 - 'show_here': {'jq_node': jq_node, 'where': 'after'},
280 - 'is_append': true,
281 - 'style' : 'text-align:left;',
282 - 'delay' : 0
283 - } );
264 + wpbc_front_end__show_message( error_message , { 'type' : 'error',
265 + 'show_here' : {'jq_node': jq_node, 'where': 'after'},
266 + 'is_append' : true,
267 + 'style' : 'text-align:left;',
268 + 'content_mode': 'text',
269 + 'delay' : 0
270 + } );
284 271 // Enable Submit | Hide spin loader
285 272 wpbc_booking_form__on_response__ui_elements_enable( calendar_id );
286 273 }
287 274 // </editor-fold>
@@ -314,14 +301,14 @@
314 301 document.getElementById( 'captcha_img' + params[ 'resource_id' ] ).src = params[ 'url' ];
315 302 document.getElementById( 'wpdev_captcha_challenge_' + params[ 'resource_id' ] ).value = params[ 'challenge' ];
316 303
317 304 // Show warning After CAPTCHA Img
318 - var message_id = wpbc_front_end__show_message__warning( '#captcha_input' + params[ 'resource_id' ] + ' + img', params[ 'message' ] );
305 + var message_id = wpbc_front_end__show_message__warning( '#captcha_input' + params[ 'resource_id' ] + ' + img', params[ 'message' ], 'text' );
319 306
320 307 // Animate
321 308 jQuery( '#' + message_id + ', ' + '#captcha_input' + params[ 'resource_id' ] ).fadeOut( 350 ).fadeIn( 300 ).fadeOut( 350 ).fadeIn( 400 ).animate( {opacity: 1}, 4000 );
322 309 // Focus text field
323 - jQuery( '#captcha_input' + params[ 'resource_id' ] ).trigger( 'focus' ); //FixIn: 8.7.11.12
310 + jQuery( '#captcha_input' + params[ 'resource_id' ] ).trigger( 'focus' ); // FixIn: 8.7.11.12.
324 311
325 312
326 313 // Enable Submit | Hide spin loader
327 314 wpbc_booking_form__on_response__ui_elements_enable( params[ 'resource_id' ] );
@@ -412,16 +399,48 @@
412 399 jQuery( '#booking_form_div' + resource_id + ' button' ).prop( "disabled", true );
413 400 }
414 401
415 402 /**
403 + * Disable 'This' button
404 + *
405 + * @param _this
406 + */
407 + function wpbc_booking_form__this_button__disable( _this ){
408 +
409 + // Disable Send button
410 + jQuery( _this ).prop( "disabled", true );
411 + }
412 +
413 + /**
416 414 * Show booking form Spin Loader
417 415 * @param resource_id
418 416 */
419 417 function wpbc_booking_form__spin_loader__show( resource_id ){
420 418
421 - // Show Spin Loader
419 + var $form_container = jQuery( '#booking_form_div' + resource_id );
420 + var loader_text = 'Saving';
421 + if ( 'undefined' !== typeof _wpbc && _wpbc.get_message ) {
422 + loader_text = _wpbc.get_message( 'message_booking_saving' ) || loader_text;
423 + }
424 + var loader_html = '<div id="wpbc_booking_form_spin_loader' + resource_id + '" class="wpbc_booking_form_spin_loader wpbc_booking_form_submit_overlay" aria-live="polite" aria-hidden="false">'
425 + + '<div class="wpbc_spins_loading_container">'
426 + + '<div class="wpbc_booking_form_spin_loader"><div class="wpbc_spins_loader_wrapper"><div class="wpbc_spin_loader_one_new"></div></div></div>'
427 + + '<span>' + loader_text + '...</span>'
428 + + '</div>'
429 + + '</div>';
430 +
431 + // Remove any previous inline loader before adding the submit overlay.
432 + jQuery( '#wpbc_booking_form_spin_loader' + resource_id ).remove();
433 +
434 + if ( $form_container.length && $form_container.is( ':visible' ) ) {
435 + $form_container.addClass( 'wpbc_booking_form_is_submitting' );
436 + $form_container.prepend( loader_html );
437 + return;
438 + }
439 +
440 + // Fallback for any unexpected legacy markup without #booking_form_div{resource_id}.
422 441 jQuery( '#booking_form' + resource_id ).after(
423 - '<div id="wpbc_booking_form_spin_loader' + resource_id + '" class="wpbc_booking_form_spin_loader" style="position: relative;"><div class="wpbc_spins_loader_wrapper"><div class="wpbc_spins_loader_mini"></div></div></div>'
442 + '<div id="wpbc_booking_form_spin_loader' + resource_id + '" class="wpbc_booking_form_spin_loader" style="position: relative;"><div class="wpbc_spins_loader_wrapper"><div class="wpbc_spin_loader_one_new"></div></div></div>'
424 443 );
425 444 }
426 445
427 446 /**
@@ -431,8 +450,9 @@
431 450 function wpbc_booking_form__spin_loader__hide( resource_id ){
432 451
433 452 // Remove Spin Loader
434 453 jQuery( '#wpbc_booking_form_spin_loader' + resource_id ).remove();
454 + jQuery( '#booking_form_div' + resource_id ).removeClass( 'wpbc_booking_form_is_submitting' );
435 455 }
436 456
437 457
438 458 /**
@@ -441,38 +461,9 @@
441 461 * @param resource_id
442 462 */
443 463 function wpbc_booking_form__animated__hide( resource_id ){
444 464
445 - // jQuery( '#booking_form' + resource_id ).slideUp( 1000
446 - // , function (){
447 - //
448 - // // if ( document.getElementById( 'gateway_payment_forms' + response_data[ 'resource_id' ] ) != null ){
449 - // // wpbc_do_scroll( '#submiting' + resource_id );
450 - // // } else
451 - // if ( jQuery( '#booking_form' + resource_id ).parent().find( '.submiting_content' ).length > 0 ){
452 - // //wpbc_do_scroll( '#booking_form' + resource_id + ' + .submiting_content' );
453 - //
454 - // var hideTimeout = setTimeout(function () {
455 - // wpbc_do_scroll( jQuery( '#booking_form' + resource_id ).parent().find( '.submiting_content' ).get( 0 ) );
456 - // }, 100);
457 - //
458 - // }
459 - // }
460 - // );
461 -
462 465 jQuery( '#booking_form' + resource_id ).hide();
463 -
464 - // var hideTimeout = setTimeout( function (){
465 - //
466 - // if ( jQuery( '#booking_form' + resource_id ).parent().find( '.submiting_content' ).length > 0 ){
467 - // var random_id = Math.floor( (Math.random() * 10000) + 1 );
468 - // jQuery( '#booking_form' + resource_id ).parent().before( '<div id="scroll_to' + random_id + '"></div>' );
469 - // console.log( jQuery( '#scroll_to' + random_id ) );
470 - //
471 - // wpbc_do_scroll( '#scroll_to' + random_id );
472 - // //wpbc_do_scroll( jQuery( '#booking_form' + resource_id ).parent().get( 0 ) );
473 - // }
474 - // }, 500 );
475 466 }
476 467 // </editor-fold>
477 468
478 469
@@ -478,20 +469,76 @@
478 469
479 470 // <editor-fold defaultstate="collapsed" desc=" == Mini Spin Loader == " >
480 471
481 472 /**
473 + *
474 + * @param parent_html_id
475 + */
476 +
477 + /**
478 + * Show micro Spin Loader
479 + *
480 + * @param id ID of Loader, for later hide it by using wpbc__spin_loader__micro__hide( id ) OR wpbc__spin_loader__mini__hide( id )
481 + * @param jq_node_where_insert such as '#estimate_booking_night_cost_hint10' OR '.estimate_booking_night_cost_hint10'
482 + */
483 + function wpbc__spin_loader__micro__show__inside( id , jq_node_where_insert ){
484 +
485 + wpbc__spin_loader__mini__show( id, {
486 + 'color' : '#444',
487 + 'show_here': {
488 + 'where' : 'inside',
489 + 'jq_node': jq_node_where_insert
490 + },
491 + 'style' : 'position: relative;display: inline-flex;flex-flow: column nowrap;justify-content: center;align-items: center;margin: 7px 12px;',
492 + 'class' : 'wpbc_one_spin_loader_micro'
493 + } );
494 + }
495 +
496 + /**
497 + * Remove spinner
498 + * @param id
499 + */
500 + function wpbc__spin_loader__micro__hide( id ){
501 + wpbc__spin_loader__mini__hide( id );
502 + }
503 +
504 +
505 + /**
482 506 * Show mini Spin Loader
483 507 * @param parent_html_id
484 508 */
485 - function wpbc__spin_loader__mini__show( parent_html_id , color = '#0071ce' ){
509 + function wpbc__spin_loader__mini__show( parent_html_id , params = {} ){
486 510
487 - if ( ('undefined' !== typeof (color)) && ('' != color) ){
488 - color = 'border-color:' + color + ';';
511 + var params_default = {
512 + 'color' : '#0071ce',
513 + 'show_here': {
514 + 'jq_node': '', // any jQuery node definition
515 + 'where' : 'after' // 'inside' | 'before' | 'after' | 'right' | 'left'
516 + },
517 + 'style' : 'position: relative;min-height: 2.8rem;',
518 + 'class' : 'wpbc_one_spin_loader_mini 0wpbc_spin_loader_one_new'
519 + };
520 + for ( var p_key in params ){
521 + params_default[ p_key ] = params[ p_key ];
489 522 }
523 + params = params_default;
524 +
525 + if ( ('undefined' !== typeof (params['color'])) && ('' != params['color']) ){
526 + params['color'] = 'border-color:' + params['color'] + ';';
527 + }
528 +
529 + var spinner_html = '<div id="wpbc_mini_spin_loader' + parent_html_id + '" class="wpbc_booking_form_spin_loader" style="' + params[ 'style' ] + '"><div class="wpbc_spins_loader_wrapper"><div class="' + params[ 'class' ] + '" style="' + params[ 'color' ] + '"></div></div></div>';
530 +
531 + if ( '' == params[ 'show_here' ][ 'jq_node' ] ){
532 + params[ 'show_here' ][ 'jq_node' ] = '#' + parent_html_id;
533 + }
534 +
490 535 // Show Spin Loader
491 - jQuery( '#' + parent_html_id ).after(
492 - '<div id="wpbc_mini_spin_loader' + parent_html_id + '" class="wpbc_booking_form_spin_loader" style="position: relative;min-height: 2.8rem;"><div class="wpbc_spins_loader_wrapper"><div class="wpbc_one_spin_loader_mini 0wpbc_spins_loader_mini" style="'+color+'"></div></div></div>'
493 - );
536 + if ( 'after' == params[ 'show_here' ][ 'where' ] ){
537 + jQuery( params[ 'show_here' ][ 'jq_node' ] ).after( spinner_html );
538 + } else {
539 + jQuery( params[ 'show_here' ][ 'jq_node' ] ).html( spinner_html );
540 + }
494 541 }
495 542
496 543 /**
497 544 * Remove / Hide mini Spin Loader
@@ -518,9 +565,9 @@
518 565 && ('undefined' !== typeof (response_data[ 'ajx_confirmation' ][ 'ty_url' ]))
519 566 && ('page' == response_data[ 'ajx_confirmation' ][ 'ty_is_redirect' ])
520 567 && ('' != response_data[ 'ajx_confirmation' ][ 'ty_url' ])
521 568 ){
522 - jQuery( 'body' ).trigger( 'wpbc_booking_created', [ response_data[ 'resource_id' ] , response_data ] ); //FixIn: 10.0.0.30
569 + jQuery( 'body' ).trigger( 'wpbc_booking_created', [ response_data[ 'resource_id' ] , response_data ] ); // FixIn: 10.0.0.30.
523 570 window.location.href = response_data[ 'ajx_confirmation' ][ 'ty_url' ];
524 571 return;
525 572 }
526 573
@@ -551,13 +598,19 @@
551 598 confirm_content += `<div id="wpbc_scroll_point_${resource_id}"></div>`;
552 599 confirm_content += ` <div class="wpbc_after_booking_thank_you_section">`;
553 600 confirm_content += ` <div class="wpbc_ty__message ${ty_message_hide}">${response_data[ 'ajx_confirmation' ][ 'ty_message' ]}</div>`;
554 601 confirm_content += ` <div class="wpbc_ty__container">`;
555 - confirm_content += ` <div class="wpbc_ty__header">${response_data['ajx_confirmation']['ty_message_booking_id']}</div>`;
602 + if ( '' !== response_data[ 'ajx_confirmation' ][ 'ty_message_booking_id' ] ){
603 + confirm_content += ` <div class="wpbc_ty__header">${response_data[ 'ajx_confirmation' ][ 'ty_message_booking_id' ]}</div>`;
604 + }
556 605 confirm_content += ` <div class="wpbc_ty__content">`;
557 606 confirm_content += ` <div class="wpbc_ty__content_text wpbc_ty__payment_description ${ty_payment_payment_description_hide}">${response_data[ 'ajx_confirmation' ][ 'ty_payment_payment_description' ].replace( /\\n/g, '' )}</div>`;
558 - confirm_content += ` <div class="wpbc_ty__content_text wpbc_cols_2">${response_data['ajx_confirmation']['ty_customer_details']}</div>`;
559 - confirm_content += ` <div class="wpbc_ty__content_text wpbc_cols_2">${response_data['ajx_confirmation']['ty_booking_details']}</div>`;
607 + if ( '' !== response_data[ 'ajx_confirmation' ][ 'ty_customer_details' ] ){
608 + confirm_content += ` <div class="wpbc_ty__content_text wpbc_cols_2">${response_data['ajx_confirmation']['ty_customer_details']}</div>`;
609 + }
610 + if ( '' !== response_data[ 'ajx_confirmation' ][ 'ty_booking_details' ] ){
611 + confirm_content += ` <div class="wpbc_ty__content_text wpbc_cols_2">${response_data['ajx_confirmation']['ty_booking_details']}</div>`;
612 + }
560 613 confirm_content += ` <div class="wpbc_ty__content_text wpbc_ty__content_costs ${ty_booking_costs_hide}">${response_data[ 'ajx_confirmation' ][ 'ty_booking_costs' ]}</div>`;
561 614 confirm_content += ` <div class="wpbc_ty__content_text wpbc_ty__content_gateways ${ty_payment_gateways_hide}">${response_data[ 'ajx_confirmation' ][ 'ty_payment_gateways' ].replace( /\\n/g, '' ).replace( /ajax_script/gi, 'script' )}</div>`;
562 615 confirm_content += ` </div>`;
563 616 confirm_content += ` </div>`;