| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * Free date hints runtime. |
| 3 | 3 | * |
| 4 | 4 | * Mirrors the public Pro cost-hint trigger names when they are not already |
| @@ -57,12 +57,11 @@ | ||
| 57 | 57 | |
| 58 | 58 | if ( |
| 59 | 59 | 'undefined' !== typeof _wpbc && |
| 60 | 60 | 'dynamic' === _wpbc.calendar__get_param_value( resourceId, 'days_select_mode' ) |
| 61 | - ) { | |
| 62 | - inst = ( typeof w.wpbc_calendar__get_inst === 'function' ) ? w.wpbc_calendar__get_inst( resourceId ) : null; | |
| 63 | - $( '.wpbc_select_check_out_date_message' ).remove(); | |
| 64 | - if ( null !== inst && inst.stayOpen === true ) { | |
| 61 | + ) { | |
| 62 | + inst = ( typeof w.wpbc_calendar__get_inst === 'function' ) ? w.wpbc_calendar__get_inst( resourceId ) : null; | |
| 63 | + if ( null !== inst && inst.stayOpen === true ) { | |
| 65 | 64 | $( '.wpbc_free_date_hint' ).html( '...' ); |
| 66 | 65 | return false; |
| 67 | 66 | } |
| 68 | 67 | } |
| @@ -139,15 +138,20 @@ | ||
| 139 | 138 | }; |
| 140 | 139 | } |
| 141 | 140 | |
| 142 | 141 | $( function () { |
| 143 | - $( 'body' ).on( 'wpbc_calendar_ajx__loaded_data', function ( event, loadedResourceId ) { | |
| 144 | - w.wpbc_show_cost_hints_after_few_seconds( loadedResourceId ); | |
| 145 | - } ); | |
| 146 | - | |
| 147 | - $( '.booking_form_div' ).on( 'date_selected', function ( event, resourceId ) { | |
| 148 | - w.wpbc_show_cost_hints_after_few_seconds( resourceId ); | |
| 149 | - } ); | |
| 142 | + $( 'body' ).on( 'wpbc_calendar_ajx__loaded_data', function ( event, loadedResourceId ) { | |
| 143 | + w.wpbc_show_cost_hints_after_few_seconds( loadedResourceId ); | |
| 144 | + } ); | |
| 145 | + | |
| 146 | + // Resource Selector and other workflows can insert native forms after document readiness. | |
| 147 | + $( document ).on( | |
| 148 | + 'date_selected.wpbc_free_date_hints', | |
| 149 | + '.booking_form_div', | |
| 150 | + function ( event, resourceId ) { | |
| 151 | + w.wpbc_show_cost_hints_after_few_seconds( resourceId ); | |
| 152 | + } | |
| 153 | + ); | |
| 150 | 154 | |
| 151 | 155 | $( document ).on( 'change', '.booking_form_div input, .booking_form_div select, .booking_form_div textarea', function () { |
| 152 | 156 | var form = $( this ).closest( 'form.booking_form' ), |
| 153 | 157 | resourceId; |