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/_capacity/_src/create_booking.js +200 -145 10.1.311.8.4 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,31 @@
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 error_message = _wpbc.get_message( 'message_unexpected_server_response' ) || 'The server returned an unexpected response. Please reload the page and try again.';
258 + if ( jqXHR.status ){
259 + error_message += ' (' + parseInt( jqXHR.status, 10 ) + ')';
260 + }
273 261
274 262 var calendar_id = wpbc_get_resource_id__from_ajx_post_data_url( this.data );
275 263 var jq_node = '#booking_form' + calendar_id;
276 264
277 265 // 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 - } );
266 + wpbc_front_end__show_message( error_message , { 'type' : 'error',
267 + 'show_here' : {'jq_node': jq_node, 'where': 'after'},
268 + 'is_append' : true,
269 + 'style' : 'text-align:left;',
270 + 'content_mode': 'text',
271 + 'delay' : 0
272 + } );
284 273 // Enable Submit | Hide spin loader
285 274 wpbc_booking_form__on_response__ui_elements_enable( calendar_id );
286 275 }
287 276 // </editor-fold>
@@ -314,14 +303,14 @@
314 303 document.getElementById( 'captcha_img' + params[ 'resource_id' ] ).src = params[ 'url' ];
315 304 document.getElementById( 'wpdev_captcha_challenge_' + params[ 'resource_id' ] ).value = params[ 'challenge' ];
316 305
317 306 // Show warning After CAPTCHA Img
318 - var message_id = wpbc_front_end__show_message__warning( '#captcha_input' + params[ 'resource_id' ] + ' + img', params[ 'message' ] );
307 + var message_id = wpbc_front_end__show_message__warning( '#captcha_input' + params[ 'resource_id' ] + ' + img', params[ 'message' ], 'text' );
319 308
320 309 // Animate
321 310 jQuery( '#' + message_id + ', ' + '#captcha_input' + params[ 'resource_id' ] ).fadeOut( 350 ).fadeIn( 300 ).fadeOut( 350 ).fadeIn( 400 ).animate( {opacity: 1}, 4000 );
322 311 // Focus text field
323 - jQuery( '#captcha_input' + params[ 'resource_id' ] ).trigger( 'focus' ); //FixIn: 8.7.11.12
312 + jQuery( '#captcha_input' + params[ 'resource_id' ] ).trigger( 'focus' ); // FixIn: 8.7.11.12.
324 313
325 314
326 315 // Enable Submit | Hide spin loader
327 316 wpbc_booking_form__on_response__ui_elements_enable( params[ 'resource_id' ] );
@@ -412,16 +401,48 @@
412 401 jQuery( '#booking_form_div' + resource_id + ' button' ).prop( "disabled", true );
413 402 }
414 403
415 404 /**
405 + * Disable 'This' button
406 + *
407 + * @param _this
408 + */
409 + function wpbc_booking_form__this_button__disable( _this ){
410 +
411 + // Disable Send button
412 + jQuery( _this ).prop( "disabled", true );
413 + }
414 +
415 + /**
416 416 * Show booking form Spin Loader
417 417 * @param resource_id
418 418 */
419 419 function wpbc_booking_form__spin_loader__show( resource_id ){
420 420
421 - // Show Spin Loader
421 + var $form_container = jQuery( '#booking_form_div' + resource_id );
422 + var loader_text = 'Saving';
423 + if ( 'undefined' !== typeof _wpbc && _wpbc.get_message ) {
424 + loader_text = _wpbc.get_message( 'message_booking_saving' ) || loader_text;
425 + }
426 + 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">'
427 + + '<div class="wpbc_spins_loading_container">'
428 + + '<div class="wpbc_booking_form_spin_loader"><div class="wpbc_spins_loader_wrapper"><div class="wpbc_spin_loader_one_new"></div></div></div>'
429 + + '<span>' + loader_text + '...</span>'
430 + + '</div>'
431 + + '</div>';
432 +
433 + // Remove any previous inline loader before adding the submit overlay.
434 + jQuery( '#wpbc_booking_form_spin_loader' + resource_id ).remove();
435 +
436 + if ( $form_container.length && $form_container.is( ':visible' ) ) {
437 + $form_container.addClass( 'wpbc_booking_form_is_submitting' );
438 + $form_container.prepend( loader_html );
439 + return;
440 + }
441 +
442 + // Fallback for any unexpected legacy markup without #booking_form_div{resource_id}.
422 443 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>'
444 + '<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 445 );
425 446 }
426 447
427 448 /**
@@ -431,8 +452,9 @@
431 452 function wpbc_booking_form__spin_loader__hide( resource_id ){
432 453
433 454 // Remove Spin Loader
434 455 jQuery( '#wpbc_booking_form_spin_loader' + resource_id ).remove();
456 + jQuery( '#booking_form_div' + resource_id ).removeClass( 'wpbc_booking_form_is_submitting' );
435 457 }
436 458
437 459
438 460 /**
@@ -441,38 +463,9 @@
441 463 * @param resource_id
442 464 */
443 465 function wpbc_booking_form__animated__hide( resource_id ){
444 466
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 467 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 468 }
476 469 // </editor-fold>
477 470
478 471
@@ -478,20 +471,76 @@
478 471
479 472 // <editor-fold defaultstate="collapsed" desc=" == Mini Spin Loader == " >
480 473
481 474 /**
475 + *
476 + * @param parent_html_id
477 + */
478 +
479 + /**
480 + * Show micro Spin Loader
481 + *
482 + * @param id ID of Loader, for later hide it by using wpbc__spin_loader__micro__hide( id ) OR wpbc__spin_loader__mini__hide( id )
483 + * @param jq_node_where_insert such as '#estimate_booking_night_cost_hint10' OR '.estimate_booking_night_cost_hint10'
484 + */
485 + function wpbc__spin_loader__micro__show__inside( id , jq_node_where_insert ){
486 +
487 + wpbc__spin_loader__mini__show( id, {
488 + 'color' : '#444',
489 + 'show_here': {
490 + 'where' : 'inside',
491 + 'jq_node': jq_node_where_insert
492 + },
493 + 'style' : 'position: relative;display: inline-flex;flex-flow: column nowrap;justify-content: center;align-items: center;margin: 7px 12px;',
494 + 'class' : 'wpbc_one_spin_loader_micro'
495 + } );
496 + }
497 +
498 + /**
499 + * Remove spinner
500 + * @param id
501 + */
502 + function wpbc__spin_loader__micro__hide( id ){
503 + wpbc__spin_loader__mini__hide( id );
504 + }
505 +
506 +
507 + /**
482 508 * Show mini Spin Loader
483 509 * @param parent_html_id
484 510 */
485 - function wpbc__spin_loader__mini__show( parent_html_id , color = '#0071ce' ){
511 + function wpbc__spin_loader__mini__show( parent_html_id , params = {} ){
486 512
487 - if ( ('undefined' !== typeof (color)) && ('' != color) ){
488 - color = 'border-color:' + color + ';';
513 + var params_default = {
514 + 'color' : '#0071ce',
515 + 'show_here': {
516 + 'jq_node': '', // any jQuery node definition
517 + 'where' : 'after' // 'inside' | 'before' | 'after' | 'right' | 'left'
518 + },
519 + 'style' : 'position: relative;min-height: 2.8rem;',
520 + 'class' : 'wpbc_one_spin_loader_mini 0wpbc_spin_loader_one_new'
521 + };
522 + for ( var p_key in params ){
523 + params_default[ p_key ] = params[ p_key ];
489 524 }
525 + params = params_default;
526 +
527 + if ( ('undefined' !== typeof (params['color'])) && ('' != params['color']) ){
528 + params['color'] = 'border-color:' + params['color'] + ';';
529 + }
530 +
531 + 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>';
532 +
533 + if ( '' == params[ 'show_here' ][ 'jq_node' ] ){
534 + params[ 'show_here' ][ 'jq_node' ] = '#' + parent_html_id;
535 + }
536 +
490 537 // 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 - );
538 + if ( 'after' == params[ 'show_here' ][ 'where' ] ){
539 + jQuery( params[ 'show_here' ][ 'jq_node' ] ).after( spinner_html );
540 + } else {
541 + jQuery( params[ 'show_here' ][ 'jq_node' ] ).html( spinner_html );
542 + }
494 543 }
495 544
496 545 /**
497 546 * Remove / Hide mini Spin Loader
@@ -518,9 +567,9 @@
518 567 && ('undefined' !== typeof (response_data[ 'ajx_confirmation' ][ 'ty_url' ]))
519 568 && ('page' == response_data[ 'ajx_confirmation' ][ 'ty_is_redirect' ])
520 569 && ('' != response_data[ 'ajx_confirmation' ][ 'ty_url' ])
521 570 ){
522 - jQuery( 'body' ).trigger( 'wpbc_booking_created', [ response_data[ 'resource_id' ] , response_data ] ); //FixIn: 10.0.0.30
571 + jQuery( 'body' ).trigger( 'wpbc_booking_created', [ response_data[ 'resource_id' ] , response_data ] ); // FixIn: 10.0.0.30.
523 572 window.location.href = response_data[ 'ajx_confirmation' ][ 'ty_url' ];
524 573 return;
525 574 }
526 575
@@ -551,13 +600,19 @@
551 600 confirm_content += `<div id="wpbc_scroll_point_${resource_id}"></div>`;
552 601 confirm_content += ` <div class="wpbc_after_booking_thank_you_section">`;
553 602 confirm_content += ` <div class="wpbc_ty__message ${ty_message_hide}">${response_data[ 'ajx_confirmation' ][ 'ty_message' ]}</div>`;
554 603 confirm_content += ` <div class="wpbc_ty__container">`;
555 - confirm_content += ` <div class="wpbc_ty__header">${response_data['ajx_confirmation']['ty_message_booking_id']}</div>`;
604 + if ( '' !== response_data[ 'ajx_confirmation' ][ 'ty_message_booking_id' ] ){
605 + confirm_content += ` <div class="wpbc_ty__header">${response_data[ 'ajx_confirmation' ][ 'ty_message_booking_id' ]}</div>`;
606 + }
556 607 confirm_content += ` <div class="wpbc_ty__content">`;
557 608 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>`;
609 + if ( '' !== response_data[ 'ajx_confirmation' ][ 'ty_customer_details' ] ){
610 + confirm_content += ` <div class="wpbc_ty__content_text wpbc_cols_2">${response_data['ajx_confirmation']['ty_customer_details']}</div>`;
611 + }
612 + if ( '' !== response_data[ 'ajx_confirmation' ][ 'ty_booking_details' ] ){
613 + confirm_content += ` <div class="wpbc_ty__content_text wpbc_cols_2">${response_data['ajx_confirmation']['ty_booking_details']}</div>`;
614 + }
560 615 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 616 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 617 confirm_content += ` </div>`;
563 618 confirm_content += ` </div>`;