PluginProbe
Booking Calendar / 10.15.7
Booking Calendar v10.15.7
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 10.11.2 10.11.3 All 202 releases
booking / includes / _toolbar_ui / toolbar_ui.php

toolbar_ui.php in Booking Calendar 10.15.7, at includes/_toolbar_ui/toolbar_ui.php

1,498 lines 80.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.1
3 * @package Any
4 * @category Toolbar. UI Elements for Admin Panel
5 * @author wpdevelop
6 *
7 * @web-site http://oplugins.com/
8 * @email info@oplugins.com
9 *
10 * @modified 2022-05-07
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly
14
15 // ---------------------------------------------------------------------------------------------------------------------
16 // T o o l b a r s
17 // ---------------------------------------------------------------------------------------------------------------------
18
19 /**
20 * Show top toolbar on Booking Listing page
21 *
22 * @param $escaped_search_request_params - escaped search request parameters array
23 */
24 function wpbc_ajx_bookings_toolbar( $escaped_search_request_params ) {
25
26 wpbc_clear_div();
27
28 // Toolbar ////////////////////////////////////////////////////////////////
29
30 $default_param_values = wpbc_ajx_get__request_params__names_default( 'default' );
31
32
33 ?><div id="toolbar_booking_listing" class="wpbc_ajx_toolbar" style="box-shadow: none;"><?php
34
35 // -------------------------------------------------------------------------------------------------------------
36 // Filters
37 // -------------------------------------------------------------------------------------------------------------
38 ?><div><?php //Required for bottom border radius in container
39
40 ?><div class="ui_container ui_container_toolbar ui_container_filters ui_container_filter_row_1" style="display: flex;background: transparent;padding: 6px 0;border: 0;"><?php
41
42 ?><div class="ui_group ui_group__dates_status ui_search_fields_group_1"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
43
44 wpbc_ajx__ui__booked_dates( $escaped_search_request_params, $default_param_values );
45
46 wpbc_ajx__ui__booking_status( $escaped_search_request_params, $default_param_values );
47
48 ?></div><?php
49
50 ?><div class="ui_group ui_group__keyword ui_search_fields_group_2"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
51
52 wpbc_ajx__ui__booking_resources( $escaped_search_request_params, $default_param_values );
53
54 wpbc_ajx_toolbar_keyword_search( $escaped_search_request_params, $default_param_values );
55
56 wpbc_ajx_toolbar_clear_keyword_search( $escaped_search_request_params, $default_param_values ); // FixIn: 9.7.2.3.
57
58 wpbc_ajx_toolbar_force_reload_button( $escaped_search_request_params, $default_param_values );
59
60 ?></div><?php
61
62 ?></div><?php
63
64
65 ?><div class="ui_container ui_container_toolbar ui_container_small ui_container_filters ui_container_filter_row_2" style="display: flex;background: transparent;padding: 6px 0;border: 0;"><?php
66
67 ?><div class="ui_group ui_group__statuses ui_search_fields_group_1"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
68
69
70
71 wpbc_ajx__ui__existing_or_trash( $escaped_search_request_params, $default_param_values );
72
73 wpbc_ajx__ui__all_or_new( $escaped_search_request_params, $default_param_values );
74
75 wpbc_ajx__ui__creation_date( $escaped_search_request_params, $default_param_values );
76
77 wpbc_ajx__ui__payment_status( $escaped_search_request_params, $default_param_values );
78
79 wpbc_ajx__ui__cost_min_max( $escaped_search_request_params, $default_param_values );
80
81 wpbc_ajx_toolbar_reset_button( $escaped_search_request_params, $default_param_values );
82
83 ?></div><?php
84
85 ?></div><?php
86
87 ?></div><?php //Required for bottom border radius in container
88
89
90 ?></div><?php
91 }
92
93
94
95 // <editor-fold defaultstate="collapsed" desc=" T o o l b a r F i l t e r B u t t o n s " >
96
97 // ---------------------------------------------------------------------------------------------------------------------
98 /// 1st row
99 // ---------------------------------------------------------------------------------------------------------------------
100
101 /**
102 * Booked dates
103 *
104 * @param $escaped_search_request_params - escaped search request parameters array
105 * @param $defaults - default parameters values
106 */
107 function wpbc_ajx__ui__booked_dates( $escaped_search_request_params, $defaults ){
108
109 $params_addon = array(
110 'type' => 'span'
111 , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
112 , 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' )
113 , 'class' => 'wpbc_ui_button inactive'
114 , 'style' => ''
115 , 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' )
116 , 'attr' => array()
117 );
118
119 $dates_interval = array(
120 1 => '1' . ' ' . __('day' ,'booking')
121 , 2 => '2' . ' ' . __('days' ,'booking')
122 , 3 => '3' . ' ' . __('days' ,'booking')
123 , 4 => '4' . ' ' . __('days' ,'booking')
124 , 5 => '5' . ' ' . __('days' ,'booking')
125 , 6 => '6' . ' ' . __('days' ,'booking')
126 , 7 => '1' . ' ' . __('week' ,'booking')
127 , 14 => '2' . ' ' . __('weeks' ,'booking')
128 , 30 => '1' . ' ' . __('month' ,'booking')
129 , 60 => '2' . ' ' . __('months' ,'booking')
130 , 90 => '3' . ' ' . __('months' ,'booking')
131 , 183 => '6' . ' ' . __('months' ,'booking')
132 , 365 => '1' . ' ' . __('Year' ,'booking')
133 );
134
135 $request_input_el_default = array(
136 'wh_booking_date' => isset( $escaped_search_request_params['wh_booking_date'] ) ? $escaped_search_request_params['wh_booking_date'] : $defaults['wh_booking_date'],
137 'ui_wh_booking_date_radio' => isset( $escaped_search_request_params['ui_wh_booking_date_radio'] ) ? $escaped_search_request_params['ui_wh_booking_date_radio'] : $defaults['ui_wh_booking_date_radio'],
138 'ui_wh_booking_date_next' => isset( $escaped_search_request_params['ui_wh_booking_date_next'] ) ? $escaped_search_request_params['ui_wh_booking_date_next'] : $defaults['ui_wh_booking_date_next'],
139 'ui_wh_booking_date_prior' => isset( $escaped_search_request_params['ui_wh_booking_date_prior'] ) ? $escaped_search_request_params['ui_wh_booking_date_prior'] : $defaults['ui_wh_booking_date_prior'],
140 'ui_wh_booking_date_checkin' => isset( $escaped_search_request_params['ui_wh_booking_date_checkin'] ) ? $escaped_search_request_params['ui_wh_booking_date_checkin'] : $defaults['ui_wh_booking_date_checkin'],
141 'ui_wh_booking_date_checkout' => isset( $escaped_search_request_params['ui_wh_booking_date_checkout'] ) ? $escaped_search_request_params['ui_wh_booking_date_checkout'] : $defaults['ui_wh_booking_date_checkout']
142 );
143
144 $options = array (
145 // 'header2' => array( 'type' => 'header', 'title' => __( 'Complex Days', 'booking' ) ),
146 // 'disabled1' => array( 'type' => 'simple', 'value' => '19', 'title' => __( 'This is option was disabled', 'booking' ), 'disabled' => true ),
147 //todo: 2023-06-10
148 'fixed' => array(
149 'type' => 'complex',
150 'class' => 'ui_complex_option_element',
151 'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value']
152 'selected_options_title' => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ), 'text2' => ' - ' ,7 => array( 'value' ) ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ]
153 'style' => 'min-width:290px',
154 'input_options' => array(
155 array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;display:none;">' )
156 , array(
157 'type' => 'radio'
158
159 , 'id' => 'ui_wh_booking_date_radio_3' // HTML ID of element
160 , 'name' => 'ui_wh_booking_date_radio'
161 , 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' )
162 , 'style' => '' // CSS of select element
163 , 'class' => '' // CSS Class of select element
164 , 'disabled' => false
165 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
166 , 'legend' => '' // aria-label parameter
167 , 'value' => '6' // Some Value from optins array that selected by default
168 , 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '6' ) ? true : false // Selected or not
169 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
170 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
171 )
172 , array( 'type' => 'html', 'html' => '</div>' )
173 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;flex: 0 1 90px;order: 2;">' )
174 , array(
175 'type' => 'text'
176 , 'id' => 'ui_wh_booking_date_checkin' // HTML ID of element
177 , 'name' => 'ui_wh_booking_date_checkin'
178 , 'label' => ''//__('Check-in' ,'booking')
179 , 'style' => 'width:100%;' // CSS of select element
180 , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
181 , 'disabled' => false
182 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
183 , 'placeholder' => __('Check-in' ,'booking')
184 , 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkin'] // Some Value from optins array that selected by default
185 // , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code
186 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
187 )
188 , array( 'type' => 'html', 'html' => '</div>' )
189 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;flex: 0 1 90px;order: 4;">' )
190 , array(
191 'type' => 'text'
192 , 'id' => 'ui_wh_booking_date_checkout' // HTML ID of element
193 , 'name' => 'ui_wh_booking_date_checkout'
194 , 'label' => ''//__('Check-out' ,'booking')
195 , 'style' => 'width:100%;' // CSS of select element
196 , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
197 , 'disabled' => false
198 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
199 , 'placeholder' => __('Check-out' ,'booking')
200 , 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkout'] // Some Value from optins array that selected by default
201 // , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code
202 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
203 )
204 , array( 'type' => 'html', 'html' => '</div>' )
205 // FixIn: 9.7.2.2.
206 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding:0;flex: 0 1 14px;order: 2;">' )
207 , array(
208 'type' => 'button'
209 , 'title' => '' // Title of the button
210 , 'hint' => ''
211 , 'link' => 'javascript:void(0)' // Direct link or skip it
212 , 'action' => "jQuery('#ui_wh_booking_date_checkin').val('');jQuery('#ui_wh_booking_date_checkout').val('');"
213 , 'class' => 'wpbc_button_as_icon' // wpbc_ui_button | wpbc_ui_button_primary
214 , 'icon' => array( 'icon_font' => 'wpbc_icn_horizontal_rule', 'position' => 'left', 'icon_img' => '' )
215 , 'font_icon' => ''
216 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
217 , 'style' => 'padding: 0px;font-size: 20px;color: #555;' // Any CSS class here
218 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
219 , 'attr' => array()
220 )
221 , array( 'type' => 'html', 'html' => '</div>' )
222
223 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;flex: 0 1 35px;order: 5;">' )
224 , array(
225 'type' => 'button'
226 , 'title' => '' // Title of the button
227 , 'hint' => array( 'title' => __('Apply' ,'booking') , 'position' => 'top' )
228 , 'link' => 'javascript:void(0)' // Direct link or skip it
229 , 'action' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);".
230 "wpbc_ui_dropdown_apply_click( {
231 'dropdown_id' : 'wh_booking_date',
232 'dropdown_radio_name': 'ui_wh_booking_date_radio'
233 } );" // JavaScript code
234 , 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary
235 , 'icon' => array( 'icon_font' => 'wpbc_icn_arrow_forward', 'position' => 'left', 'icon_img' => '' )
236 , 'font_icon' => ''
237 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
238 , 'style' => 'padding:5px 7px;' // Any CSS class here
239 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
240 , 'attr' => array()
241 )
242 , array( 'type' => 'html', 'html' => '</div>' )
243 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px;flex: 0 1 20px;margin-left: auto;margin-right:-5px;order: 6;">' )
244 , array(
245 'type' => 'button'
246 , 'title' => '' // Title of the button
247 , 'hint' => array( 'title' => __('Reset check in/out dates filter' ,'booking') , 'position' => 'top' )
248 , 'link' => 'javascript:void(0)' // Direct link or skip it
249 , 'action' =>"if ( ( jQuery('#ui_wh_booking_date_checkin').val() == '') && ( jQuery('#ui_wh_booking_date_checkout').val() == '') ) { wpbc_field_highlight( '#ui_wh_booking_date_checkin' ); wpbc_field_highlight( '#ui_wh_booking_date_checkout' ); return false; }"
250 . "jQuery('#ui_wh_booking_date_checkin').val('');jQuery('#ui_wh_booking_date_checkout').val('');"
251 , 'class' => 'wpbc_button_as_icon' // wpbc_ui_button | wpbc_ui_button_primary
252 , 'icon' => array( 'icon_font' => 'wpbc_icn_close', 'position' => 'left', 'icon_img' => '' )
253 , 'font_icon' => ''
254 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
255 , 'style' => 'padding-left: 0;padding-right: 0;' // Any CSS class here
256 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
257 , 'attr' => array()
258 )
259 , array( 'type' => 'html', 'html' => '</div>' )
260
261 )
262 ),
263 'divider4' => array( 'type' => 'html', 'html' => '<hr/>' ),
264
265
266 '0' => __( 'Current dates', 'booking' ),
267 '1' => __( 'Today', 'booking' ),
268 '2' => __( 'Previous dates', 'booking' ),
269 '3' => __( 'All dates', 'booking' ),
270
271 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
272
273 '9' => __( 'Today check in/out', 'booking' ),
274 '10' => __( 'Check in - Today', 'booking' ),
275 '11' => __( 'Check out - Today', 'booking' ),
276 '7' => __( 'Check in - Tomorrow', 'booking' ),
277 '8' => __( 'Check out - Tomorrow', 'booking' ),
278
279 'divider2' => array( 'type' => 'html', 'html' => '<hr/>' ),
280
281 // Next [ '4', '10' ] - radio button (if selected) value '4' and select-box with selected value '10'
282 'next' => array(
283 'type' => 'complex',
284 'class' => 'ui_complex_option_element',
285 // recheck if LI selected: $options['next']['selected_options_value'] == $params['default], e.g. ~ [ '4', '10' ]
286 'selected_options_value' => array(
287 1 => array( 'value' ), // $options['next']['input_options'][ 1 ]['value'] '4'
288 4 => array( 'value' ) // $options['next']['input_options'][ 4 ]['value'] '10'
289 ),
290 // Get selected Title, for dropdown if $options['next'] selected
291 'selected_options_title' => array(
292 1 => array( 'label', 'title' ), // $options['next']['input_options'][ 1 ]['label'][ 'title' ] 'Next'
293 'text1' => ': ', // if key 'text1' not exist in ['input_options'], then it text ': '
294 4 => array( 'options', $request_input_el_default['ui_wh_booking_date_next'] ) // '10 days'
295 ),
296 'input_options' => array(
297 array( 'type' => 'html', 'html' => '<div class="ui_element">' )
298 , array( // Default options from simple input element, like: wpbc_flex_radio()
299 'type' => 'radio'
300 , 'id' => 'ui_wh_booking_date_radio_1' // HTML ID of element
301 , 'name' => 'ui_wh_booking_date_radio'
302 , 'label' => array( 'title' => __('Next' ,'booking') , 'position' => 'right' )
303 , 'style' => '' // CSS of select element
304 , 'class' => '' // CSS Class of select element
305 , 'disabled' => false
306 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
307 , 'legend' => '' // aria-label parameter
308 , 'value' => '4'
309 , 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '4' ) ? true : false // Selected or not
310 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
311 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
312 )
313 , array( 'type' => 'html', 'html' => '</div>' )
314 , array( 'type' => 'html', 'html' => '<div class="ui_element">' )
315 , array(
316 'type' => 'select'
317 , 'attr' => array()
318 , 'name' => 'ui_wh_booking_date_next'
319 , 'id' => 'ui_wh_booking_date_next'
320 , 'options' => $dates_interval
321 , 'value' => $request_input_el_default[ 'ui_wh_booking_date_next']
322 , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_1').prop('checked', true);" // JavaScript code
323 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
324 )
325 , array( 'type' => 'html', 'html' => '</div>' )
326 )
327 ),
328
329 // Prior [ '5', '10' ]
330 'prior' => array(
331 'type' => 'complex',
332 'class' => 'ui_complex_option_element',
333 'style' => 'min-width: 244px;',
334 'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value']
335 'selected_options_title' => array( 1 => array( 'label', 'title' )
336 , 'text1' => ': '
337 , 4 => array( 'options' , $request_input_el_default[ 'ui_wh_booking_date_prior'] )
338 ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ]
339 'input_options' => array(
340 array( 'type' => 'html', 'html' => '<div class="ui_element">' )
341 , array(
342 'type' => 'radio'
343
344 , 'id' => 'ui_wh_booking_date_radio_2' // HTML ID of element
345 , 'name' => 'ui_wh_booking_date_radio'
346 , 'label' => array( 'title' => __('Prior' ,'booking') , 'position' => 'right' )
347 , 'style' => '' // CSS of select element
348 , 'class' => '' // CSS Class of select element
349 , 'disabled' => false
350 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
351 , 'legend' => '' // aria-label parameter
352 , 'value' => '5' // Some Value from optins array that selected by default
353 , 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '5' ) ? true : false // Selected or not
354 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
355 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
356 )
357 , array( 'type' => 'html', 'html' => '</div>' )
358 , array( 'type' => 'html', 'html' => '<div class="ui_element">' )
359 , array(
360 'type' => 'select'
361 , 'attr' => array()
362 , 'name' => 'ui_wh_booking_date_prior'
363 , 'id' => 'ui_wh_booking_date_prior'
364 , 'options' => $dates_interval
365 , 'value' => $request_input_el_default[ 'ui_wh_booking_date_prior']
366 , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_2').prop('checked', true);" // JavaScript code
367 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
368 )
369 , array( 'type' => 'html', 'html' => '</div>' )
370 )
371 ),
372 /* //todo: 2023-06-10
373 // Fixed [ '6', '', '2022-05-21']
374 'fixed' => array(
375 'type' => 'complex',
376 'class' => 'ui_complex_option_element',
377 'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value']
378 'selected_options_title' => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ), 'text2' => ' - ' ,7 => array( 'value' ) ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ]
379 'input_options' => array(
380 array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' )
381 , array(
382 'type' => 'radio'
383
384 , 'id' => 'ui_wh_booking_date_radio_3' // HTML ID of element
385 , 'name' => 'ui_wh_booking_date_radio'
386 , 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' )
387 , 'style' => '' // CSS of select element
388 , 'class' => '' // CSS Class of select element
389 , 'disabled' => false
390 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
391 , 'legend' => '' // aria-label parameter
392 , 'value' => '6' // Some Value from optins array that selected by default
393 , 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '6' ) ? true : false // Selected or not
394 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
395 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
396 )
397 , array( 'type' => 'html', 'html' => '</div>' )
398 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;">' )
399 , array(
400 'type' => 'text'
401 , 'id' => 'ui_wh_booking_date_checkin' // HTML ID of element
402 , 'name' => 'ui_wh_booking_date_checkin'
403 , 'label' => ''//__('Check-in' ,'booking')
404 , 'style' => 'width:100%;' // CSS of select element
405 , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
406 , 'disabled' => false
407 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
408 , 'placeholder' => __('Check-in' ,'booking')
409 , 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkin'] // Some Value from optins array that selected by default
410 , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code
411 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
412 )
413 , array( 'type' => 'html', 'html' => '</div>' )
414 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;">' )
415 , array(
416 'type' => 'text'
417 , 'id' => 'ui_wh_booking_date_checkout' // HTML ID of element
418 , 'name' => 'ui_wh_booking_date_checkout'
419 , 'label' => ''//__('Check-out' ,'booking')
420 , 'style' => 'width:100%;' // CSS of select element
421 , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
422 , 'disabled' => false
423 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
424 , 'placeholder' => __('Check-out' ,'booking')
425 , 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkout'] // Some Value from optins array that selected by default
426 , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code
427 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
428 )
429 , array( 'type' => 'html', 'html' => '</div>' )
430 )
431 ),
432 */
433 'divider3' => array( 'type' => 'html', 'html' => '<hr/>' ),
434
435 // Buttons
436 'buttons1' => array(
437 'type' => 'complex',
438 'class' => 'ui_complex_option_element',
439 'style' => 'justify-content: flex-end;',
440 'input_options' => array(
441 array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' )
442 , array(
443 'type' => 'button'
444 , 'title' => __( 'Apply', 'booking' ) // Title of the button
445 , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
446 , 'link' => 'javascript:void(0)' // Direct link or skip it
447 , 'action' => "wpbc_ui_dropdown_apply_click( {
448 'dropdown_id' : 'wh_booking_date',
449 'dropdown_radio_name': 'ui_wh_booking_date_radio'
450 } );" // JavaScript code
451 , 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary
452 , 'icon' => ''
453 , 'font_icon' => ''
454 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
455 , 'style' => '' // Any CSS class here
456 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
457 , 'attr' => array()
458 )
459 , array( 'type' => 'html', 'html' => '</div>' )
460 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' )
461 , array(
462 'type' => 'button'
463 , 'title' => __( 'Close', 'booking' ) // Title of the button
464 , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
465 , 'link' => 'javascript:void(0)' // Direct link or skip it
466 , 'action' => "wpbc_ui_dropdown_close_click( 'wh_booking_date' );" // JavaScript code
467 , 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary
468 , 'icon' => ''
469 , 'font_icon' => ''
470 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
471 , 'style' => '' // Any CSS class here
472 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
473 , 'attr' => array()
474 )
475 , array( 'type' => 'html', 'html' => '</div>' )
476 )
477 ),
478 );
479
480 $params = array(
481 'id' => 'wh_booking_date'
482 , 'default' => $request_input_el_default[ 'wh_booking_date' ]
483 , 'label' => ''//__('Approve 1', 'booking') . ':'
484 , 'title' => ''//__('Approve 2', 'booking')
485 , 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' )
486 , 'align' => 'left'
487 , 'li_options' => $options
488 );
489
490 ?><div class="ui_element ui_nowrap"><?php
491
492 wpbc_flex_addon( $params_addon );
493
494 wpbc_flex_dropdown( $params );
495
496 ?></div><?php
497 }
498
499 /**
500 * Approved | Pending | All
501 *
502 * @param $escaped_search_request_params - escaped search request parameters array
503 * @param $defaults - default parameters values
504 */
505 function wpbc_ajx__ui__booking_status( $escaped_search_request_params, $defaults ){
506
507 $params_addon = array(
508 'type' => 'span'
509 , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
510 , 'icon' => array( 'icon_font' => 'wpbc_icn_done_all', 'position' => 'right', 'icon_img' => '' )
511 , 'class' => 'wpbc_ui_button inactive'
512 , 'style' => ''
513 , 'attr' => array()
514 );
515
516 $params = array(
517 'id' => 'wh_approved'
518 , 'default' => isset( $escaped_search_request_params['wh_approved'] ) ? $escaped_search_request_params['wh_approved'] : $defaults['wh_approved']
519 , 'label' => ''//__('Status', 'booking') . ':'
520 , 'title' => __('Status', 'booking')
521 , 'hint' => array( 'title' => __('Filter bookings by booking status' ,'booking') , 'position' => 'top' )
522 , 'li_options' => array (
523 '0' => __( 'Pending', 'booking' ),
524 '1' => __( 'Approved', 'booking' ),
525 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
526 // 'header1' => array( 'type' => 'header', 'title' => __( 'Default', 'booking' ) ),
527 'any' => array(
528 'type' => 'simple',
529 'value' => '',
530 // 'disabled' => true,
531 'title' => __( 'Any', 'booking' )
532 ),
533 )
534 );
535
536 ?><div class="ui_element ui_nowrap"><?php
537
538 //wpbc_flex_addon( $params_addon );
539
540 wpbc_flex_dropdown( $params );
541
542 ?></div><?php
543 }
544
545 /**
546 * Keywords
547 *
548 * @param $escaped_search_request_params - escaped search request parameters array
549 * @param $defaults - default parameters values
550 */
551 function wpbc_ajx_toolbar_keyword_search( $escaped_search_request_params, $defaults ){
552
553 $el_id = 'wpbc_search_field';
554
555 $default_value = '';
556
557 // Old way of searching booking ID
558 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
559 if ( ! empty( $_REQUEST['wh_booking_id'] ) ) {
560 $wh_booking_id = intval( $_REQUEST['wh_booking_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
561 if ( $wh_booking_id > 0 ) {
562 $_REQUEST['overwrite'] = 1;
563 $_REQUEST['keyword'] = 'id:' . $wh_booking_id;
564 }
565 }
566
567 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
568 if ( ( ! empty( $_REQUEST['overwrite'] ) ) && ( ! empty( $_REQUEST['keyword'] ) ) ) {
569
570 // Searching for booking(s) from URL: http://beta/wp-admin/admin.php?page=wpbc&tab=vm_booking_listing&keyword=id:2&overwrite=1 .
571
572 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
573 $default_value = wpbc_sanitize_text( $_REQUEST['keyword'] );
574
575 ?><script type="text/javascript">
576 jQuery( document ).ready( function (){
577 // setTimeout( function () {
578 // wpbc_ajx_booking_listing.search_set_param( 'wh_booking_type', [0] );
579 // }, 950 );
580 wpbc_ajx_booking_searching_after_few_seconds( '#<?php echo esc_attr( $el_id ); ?>', 1000 ); // Immediate search after 0.5 second
581 } );
582 </script><?php
583 }
584
585 $params = array(
586 'type' => 'text',
587 'id' => $el_id,
588 'name' => $el_id,
589 'label' => '',
590 'disabled' => false,
591 'class' => '',
592 'style' => '',
593 'placeholder' => __( 'Enter keyword to search...', 'booking' ),
594 'attr' => array(),
595 'value' => $default_value,
596 'onfocus' => '',
597 );
598 ?><div class="ui_element"><?php
599 wpbc_flex_text( $params );
600 ?></div><?php
601 }
602
603
604 // FixIn: 9.7.2.3.
605 function wpbc_ajx_toolbar_clear_keyword_search( $escaped_search_request_params, $defaults ){
606
607 $params = array(
608 'type' => 'button' ,
609 'title' => '',//__( 'Reset', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
610 'hint' => array( 'title' => __( 'Reset keyword text field', 'booking' ), 'position' => 'top' ), // Hint
611 'link' => 'javascript:void(0)', // Direct link or skip it
612 'action' => "jQuery( '#wpbc_search_field').val('');
613 wpbc_ajx_booking_send_search_request_with_params( {
614 'keyword' : '',
615 'page_num': 1
616 } );
617 ", // JavaScript
618 'icon' => array(
619 'icon_font' => 'wpbc_icn_close', //'wpbc_icn_rotate_left',
620 'position' => 'left',
621 'icon_img' => ''
622 ),
623 'class' => 'wpbc_button_as_icon', // '' | 'wpbc_ui_button_primary'
624 'style' => '', // Any CSS class here
625 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
626 'attr' => array()
627 );
628
629 ?><div class="ui_element" style="flex: 0 1 auto;margin-left: -50px;z-index: 1;"><?php
630 wpbc_flex_button( $params );
631 ?></div><?php
632 }
633
634 /**
635 * Reset button - init default filter options
636 *
637 * @param $escaped_search_request_params - escaped search request parameters array
638 * @param $defaults - default parameters values
639 */
640 function wpbc_ajx_toolbar_reset_button( $escaped_search_request_params, $defaults ){
641
642 $params = array(
643 'type' => 'button' ,
644 'title' => __( 'Reset', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
645 'hint' => array( 'title' => __( 'Reset search filter and user options to default values', 'booking' ) . '. ' . __( 'Show all bookings.', 'booking' ), 'position' => 'top' ), // Hint
646 'link' => 'javascript:void(0)', // Direct link or skip it
647 'action' => "wpbc_ajx_booking_send_search_request_with_params( {
648 'ui_reset': 'make_reset',
649 'page_num': 1
650 } );", // JavaScript
651 'icon' => array(
652 'icon_font' => 'wpbc_icn_settings_backup_restore', //'wpbc_icn_rotate_left',
653 'position' => 'left',
654 'icon_img' => ''
655 ),
656 'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary'
657 'style' => '',// 'color: #ef6500;', //FixIn: 9.7.2.1 // Any CSS class here
658 'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size).
659 'attr' => array()
660 );
661
662 ?><div class="ui_element" style="margin-left: auto;"><?php
663 wpbc_flex_button( $params );
664 ?></div><?php
665 }
666
667 // ---------------------------------------------------------------------------------------------------------------------
668 /// 2nd row
669 // ---------------------------------------------------------------------------------------------------------------------
670
671 /**
672 * Booking resources
673 *
674 * @param $escaped_search_request_params - escaped search request parameters array
675 * @param $defaults - default parameters values
676 */
677 function wpbc_ajx__ui__booking_resources( $escaped_search_request_params, $defaults ){
678
679 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
680 return false;
681 }
682
683 wpbc_bo_listing__resource_choosen( $escaped_search_request_params, $defaults );
684
685 return; //TODO: 2025-04-29 relpace it.
686
687 $params_button = array(
688 'type' => 'button' ,
689 'title' => '',//__( 'Reset', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
690 'hint' => array( 'title' => __( 'Remove all booking resources', 'booking' ), 'position' => 'top' ), // Hint
691 'link' => 'javascript:void(0)', // Direct link or skip it
692 'action' => "remove_all_options_from_choozen('#wh_booking_type');", // JavaScript
693 'icon' => array(
694 'icon_font' => 'wpbc_icn_close',
695 'position' => 'left',
696 'icon_img' => ''
697 ),
698 'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary'
699 'style' => '', // Any CSS class here
700 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
701 'attr' => array( 'id' => 'wpbc_booking_listing_reload_button')
702 );
703
704 /**
705 * result = {array} [12]
706 1 = {array} [10]
707 booking_type_id = "1"
708 title = "Standard"
709 users = "3"
710 import = null
711 export = null
712 cost = "25"
713 default_form = "owner-custom-form-1"
714 prioritet = "2"
715 parent = "0"
716 visitors = "2"
717 2 = {array} [10]
718 booking_type_id = "2"
719 title = "Apartment#1" ...
720 */
721 $resources_sql_arr = wpbc_ajx_get_all_booking_resources_arr();
722
723 /**
724 * $resources_arr = array( linear_resources = {array} [12] single_or_parent = {array} [5] child = {array} [2] )
725 *
726 $resources_arr = {array} [3]
727 linear_resources = {array} [12]
728 1 = {array} [12]
729 booking_type_id = "1"
730 title = "Standard"
731 users = "3"
732 import = null
733 export = null
734 cost = "25"
735 default_form = "owner-custom-form-1"
736 prioritet = "2"
737 parent = "0"
738 visitors = "2"
739 id = "1"
740 count = {int} 5
741 5 = {array} [12]
742 booking_type_id = "5"
743 title = "Standard-1"
744 users = "1"
745 import = null
746 */
747 $resources_arr = wpbc_ajx_arrange_booking_resources_arr( $resources_sql_arr );
748 $style = '';
749 $select_box_options = array(); // FixIn: 4.3.2.1.
750 if ( ! empty( $resources_arr ) ) {
751
752 $linear_resources_arr = $resources_arr['linear_resources'];
753
754
755
756 if ( count( $linear_resources_arr ) > 1 ) {
757
758 $resources_id_arr = array();
759 foreach ( $linear_resources_arr as $bkr ) {
760 $resources_id_arr[] = $bkr['id'];
761 }
762
763 $select_box_options[ /*implode( ',', $resources_id_arr )*/0 ] = array(
764 'title' => __( 'All resources', 'booking' )
765 , 'attr' => array( 'title' => '<strong>' . esc_html__( 'All resources', 'booking' ) . '</strong>' )
766 , 'style' => 'font-weight:600;'
767 );
768 }
769
770 foreach ( $linear_resources_arr as $bkr ) {
771
772 $option_title = wpbc_lang( $bkr['title'] );
773
774 if ( isset( $bkr['parent'] ) ) {
775 if ( $bkr ['parent'] == 0 ) {
776 $option_title = $option_title;
777 $style = 'font-weight:600;';
778 } else {
779 $option_title = '&nbsp;&nbsp;&nbsp;' . $option_title;
780 $style = 'font-weight:400;';
781 }
782 }
783 $select_box_options[ $bkr ['id'] ] = array(
784 'title' => $option_title
785 , 'attr' => array( 'title' => $option_title )
786 , 'style' => $style
787 );
788 }
789 }
790
791
792
793 $el_id = 'wh_booking_type';
794 $params_select = array(
795 'id' => $el_id // HTML ID of element
796 , 'name' => $el_id
797 , 'label' => '' // __( 'Next Days', 'booking' ) // Label (optional)
798 , 'style' => 'display:none;' // CSS of select element
799 , 'class' => 'chzn-select' // CSS Class of select element
800 , 'multiple' => true
801 , 'attr' => array( 'data-placeholder' => __( 'Select booking resources', 'booking' ) ) // Any additional attributes, if this radio | checkbox element
802 , 'disabled' => false
803 , 'disabled_options' => array() // If some options disabled, then it has to list here
804 , 'options' => $select_box_options
805
806 , 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
807 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
808 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
809
810 );
811
812 // Booking resources
813 ?><div class="ui_element ui_nowrap"><?php
814
815 wpbc_flex_select( $params_select );
816
817 wpbc_flex_button( $params_button );
818
819 ?></div><?php
820
821 ?><script type="text/javascript">
822 function remove_all_options_from_choozen( selectbox_id ){
823 jQuery( selectbox_id + ' option' ).prop( 'selected', false ); // Disable selection in the real selectbox
824 jQuery( selectbox_id ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field // FixIn: 8.7.9.9.
825 jQuery( selectbox_id ).trigger( 'change' );
826 }
827 <?php
828 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
829 echo wpbc_jq_ready_start();
830 ?>
831 if ( 'function' === typeof( jQuery("#<?php echo esc_attr( $el_id ); ?>").chosen ) ) {
832
833 jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).chosen( {no_results_text: "No results matched"} );
834
835 jQuery("#<?php echo esc_attr( $el_id ); ?>").chosen().on('change', function(va){ // Catch any selections in the Choozen
836
837 if ( jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).val() != null ){
838 //So we are having aready values
839 jQuery.each( jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).val(), function ( index, value ){
840
841 if ( (value.indexOf( ',' ) > 0) || ('0' === value) ){ // Ok we are have array with all booking resources ID
842
843 // Disable selection in the real selectbox
844 jQuery( '#<?php echo esc_attr( $el_id ); ?>' + ' option' ).removeAttr( 'selected' );
845
846 // Select "All resources" option in real selectbox
847 jQuery( '#<?php echo esc_attr( $el_id ); ?>' + ' option:first-child' ).prop( "selected", true );
848
849 //Highlight options in chosen, before removing
850 jQuery('#<?php echo esc_attr( $el_id ); ?>_chosen li.search-choice:not(:contains(' + '<?php
851 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
852 echo html_entity_decode( esc_js( __( 'All resources', 'booking' ) ) ); ?>' + '))')
853 .fadeOut(350).fadeIn(300)
854 .fadeOut(350).fadeIn(400)
855 .fadeOut(350).fadeIn(300)
856 .fadeOut(350).fadeIn(400)
857 .animate({opacity: 1}, 4000);
858
859 // Update chosen LI choices, relative selected options in selectbox
860 var all_resources_timer = setTimeout( function (){
861
862 jQuery( '#<?php echo esc_attr( $el_id ); ?>' ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field
863 }, 2000 );
864
865 var my_message = '<?php echo esc_js( __( 'Please note, its not possible to add new resources, if "All resources" option is selected. Please clear the selection, then add new resources.', 'booking' ) ); ?>';
866 wpbc_admin_show_message( my_message, 'warning', 10000 );
867 }
868 } );
869 }
870 });
871
872 } else {
873 alert( 'WPBC Error. JavaScript library "chosen" was not defined.' );
874 }
875 <?php
876 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
877 echo wpbc_jq_ready_end();
878 ?>
879 </script><?php
880 }
881
882 /**
883 * Existing | Trash | Any
884 *
885 * @param $escaped_search_request_params - escaped search request parameters array
886 * @param $defaults - default parameters values
887 */
888 function wpbc_ajx__ui__existing_or_trash( $escaped_search_request_params, $defaults ){
889
890 $params_addon = array(
891 'type' => 'span'
892 , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
893 , 'icon' => array( 'icon_font' => 'wpbc_icn_delete_outline', 'position' => 'right', 'icon_img' => '' )
894 , 'class' => 'wpbc_ui_button inactive'
895 , 'style' => ''
896 , 'attr' => array()
897 , 'hint' => array( 'title' => __('Show trashed or existing bookings' ,'booking') , 'position' => 'top' )
898 );
899
900 $el_id = 'wh_trash';
901 $params = array(
902 'id' => $el_id
903 , 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]
904 , 'label' => ''
905 , 'title' => '' //__('Bookings', 'booking')
906 , 'hint' => array( 'title' => __('Show trashed or existing bookings' ,'booking') , 'position' => 'top' )
907 , 'li_options' => array(
908 '0' => __( 'Existing', 'booking' ),
909 'trash' => __( 'In Trash / Rejected', 'booking' ),
910 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
911 'any' => __( 'Any', 'booking' )
912 )
913 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
914 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
915 //, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() )[0], 'page_num': 1 } );"
916 );
917
918 ?><div class="ui_element ui_nowrap"><?php
919
920 wpbc_flex_addon( $params_addon );
921
922 wpbc_flex_dropdown( $params );
923
924 ?></div><?php
925 }
926
927 /**
928 * All bookings | New bookings | Imported bookings | Plugin bookings
929 *
930 * @param $escaped_search_request_params - escaped search request parameters array
931 * @param $defaults - default parameters values
932 */
933 function wpbc_ajx__ui__all_or_new( $escaped_search_request_params, $defaults ){
934
935 $params_addon = array(
936 'type' => 'span'
937 , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
938 , 'icon' => array( 'icon_font' => 'wpbc_icn_visibility', 'position' => 'right', 'icon_img' => '' )
939 , 'class' => 'wpbc_ui_button inactive'
940 , 'style' => ''
941 , 'attr' => array()
942 , 'hint' => array( 'title' => __('Filter bookings by additional criteria' ,'booking') , 'position' => 'top' )
943 );
944
945 $el_id = 'wh_what_bookings';
946 $params = array(
947 'id' => $el_id
948 , 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]
949 , 'label' => ''
950 , 'title' => '' //__('Show', 'booking')
951 , 'hint' => array( 'title' => __('Filter bookings by additional criteria' ,'booking') , 'position' => 'top' )
952 , 'li_options' => array(
953 'all' => array(
954 'type' => 'simple',
955 'value' => 'any',
956 'title' => __( 'Any', 'booking' )
957 ),
958 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
959 'new' => __( 'New', 'booking' ),
960 'imported' => __( 'Imported', 'booking' ),
961 'in_plugin' => __( 'Plugin bookings', 'booking' )
962 )
963 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
964 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
965 //, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() )[0], 'page_num': 1 } );"
966 );
967
968
969 ?><div class="ui_element ui_nowrap"><?php
970
971 wpbc_flex_addon( $params_addon );
972
973 wpbc_flex_dropdown( $params );
974
975 ?></div><?php
976 }
977
978 /**
979 * "Creation Date" of bookings
980 *
981 * @param $escaped_search_request_params - escaped search request parameters array
982 * @param $defaults - default parameters values
983 */
984 function wpbc_ajx__ui__creation_date( $escaped_search_request_params, $defaults ){
985
986 $params_addon = array(
987 'type' => 'span'
988 , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
989 , 'icon' => array( 'icon_font' => 'wpbc_icn_edit_calendar', 'position' => 'right', 'icon_img' => '' )
990 , 'class' => 'wpbc_ui_button inactive'
991 , 'style' => ''
992 , 'attr' => array()
993 , 'hint' => array( 'title' => __('Filter bookings by creation booking date' ,'booking') , 'position' => 'top' )
994 );
995
996 $dates_interval = array(
997 1 => '1' . ' ' . __('day' ,'booking')
998 , 2 => '2' . ' ' . __('days' ,'booking')
999 , 3 => '3' . ' ' . __('days' ,'booking')
1000 , 4 => '4' . ' ' . __('days' ,'booking')
1001 , 5 => '5' . ' ' . __('days' ,'booking')
1002 , 6 => '6' . ' ' . __('days' ,'booking')
1003 , 7 => '1' . ' ' . __('week' ,'booking')
1004 , 14 => '2' . ' ' . __('weeks' ,'booking')
1005 , 30 => '1' . ' ' . __('month' ,'booking')
1006 , 60 => '2' . ' ' . __('months' ,'booking')
1007 , 90 => '3' . ' ' . __('months' ,'booking')
1008 , 183 => '6' . ' ' . __('months' ,'booking')
1009 , 365 => '1' . ' ' . __('Year' ,'booking')
1010 );
1011
1012 $el_id = 'wh_modification_date';
1013
1014 $request_input_el_default = array(
1015 $el_id => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ],
1016 'ui_wh_modification_date_radio' => isset( $escaped_search_request_params['ui_wh_modification_date_radio'] ) ? $escaped_search_request_params['ui_wh_modification_date_radio'] : $defaults['ui_wh_modification_date_radio'],
1017 'ui_wh_modification_date_prior' => isset( $escaped_search_request_params['ui_wh_modification_date_prior'] ) ? $escaped_search_request_params['ui_wh_modification_date_prior'] : $defaults['ui_wh_modification_date_prior'],
1018 'ui_wh_modification_date_checkin' => isset( $escaped_search_request_params['ui_wh_modification_date_checkin'] ) ? $escaped_search_request_params['ui_wh_modification_date_checkin'] : $defaults['ui_wh_modification_date_checkin'],
1019 'ui_wh_modification_date_checkout' => isset( $escaped_search_request_params['ui_wh_modification_date_checkout'] ) ? $escaped_search_request_params['ui_wh_modification_date_checkout'] : $defaults['ui_wh_modification_date_checkout']
1020 );
1021
1022 $options = array (
1023 '1' => __( 'Today', 'booking' ),
1024 '3' => __( 'All dates', 'booking' ),
1025
1026 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
1027
1028 // Prior [ '5', '10' ]
1029 'prior' => array(
1030 'type' => 'complex',
1031 'class' => 'ui_complex_option_element',
1032 'style' => 'min-width: 244px;',
1033 'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value']
1034 'selected_options_title' => array( 1 => array( 'label', 'title' )
1035 , 'text1' => ': '
1036 , 4 => array( 'options' , $request_input_el_default[ 'ui_wh_modification_date_prior'] )
1037 ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ]
1038 'input_options' => array(
1039 array( 'type' => 'html', 'html' => '<div class="ui_element">' )
1040 , array(
1041 'type' => 'radio'
1042
1043 , 'id' => 'ui_wh_modification_date_radio_2' // HTML ID of element
1044 , 'name' => 'ui_wh_modification_date_radio'
1045 , 'label' => array( 'title' => __('Prior' ,'booking') , 'position' => 'right' )
1046 , 'style' => '' // CSS of select element
1047 , 'class' => '' // CSS Class of select element
1048 , 'disabled' => false
1049 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1050 , 'legend' => '' // aria-label parameter
1051 , 'value' => '5' // Some Value from optins array that selected by default
1052 , 'selected' => ( $request_input_el_default[ 'ui_wh_modification_date_radio' ] == '5' ) ? true : false // Selected or not
1053 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1054 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1055 )
1056 , array( 'type' => 'html', 'html' => '</div>' )
1057 , array( 'type' => 'html', 'html' => '<div class="ui_element">' )
1058 , array(
1059 'type' => 'select'
1060 , 'attr' => array()
1061 , 'name' => 'ui_wh_modification_date_prior'
1062 , 'id' => 'ui_wh_modification_date_prior'
1063 , 'options' => $dates_interval
1064 , 'value' => $request_input_el_default[ 'ui_wh_modification_date_prior']
1065 , 'onfocus' => "jQuery('#ui_wh_modification_date_radio_2').prop('checked', true);" // JavaScript code
1066 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1067 )
1068 , array( 'type' => 'html', 'html' => '</div>' )
1069 )
1070 ),
1071
1072 // Fixed [ '6', '', '2022-05-21']
1073 'fixed' => array(
1074 'type' => 'complex',
1075 'class' => 'ui_complex_option_element',
1076 'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value']
1077 'selected_options_title' => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ), 'text2' => ' - ' ,7 => array( 'value' ) ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ]
1078 'input_options' => array(
1079 array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' )
1080 , array(
1081 'type' => 'radio'
1082
1083 , 'id' => 'ui_wh_modification_date_radio_3' // HTML ID of element
1084 , 'name' => 'ui_wh_modification_date_radio'
1085 , 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' )
1086 , 'style' => '' // CSS of select element
1087 , 'class' => '' // CSS Class of select element
1088 , 'disabled' => false
1089 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1090 , 'legend' => '' // aria-label parameter
1091 , 'value' => '6' // Some Value from optins array that selected by default
1092 , 'selected' => ( $request_input_el_default[ 'ui_wh_modification_date_radio' ] == '6' ) ? true : false // Selected or not
1093 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1094 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1095 )
1096 , array( 'type' => 'html', 'html' => '</div>' )
1097 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;">' )
1098 , array(
1099 'type' => 'text'
1100 , 'id' => 'ui_wh_modification_date_checkin' // HTML ID of element
1101 , 'name' => 'ui_wh_modification_date_checkin'
1102 , 'label' => ''//__('Check-in' ,'booking')
1103 , 'style' => 'width:100%;' // CSS of select element
1104 , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
1105 , 'disabled' => false
1106 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1107 , 'placeholder' => __('From' ,'booking') // gmdate( 'Y-m-d' )
1108 , 'value' => $request_input_el_default[ 'ui_wh_modification_date_checkin'] // Some Value from optins array that selected by default
1109 , 'onfocus' => "jQuery('#ui_wh_modification_date_radio_3').prop('checked', true);" // JavaScript code
1110 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1111 )
1112 , array( 'type' => 'html', 'html' => '</div>' )
1113 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;">' )
1114 , array(
1115 'type' => 'text'
1116 , 'id' => 'ui_wh_modification_date_checkout' // HTML ID of element
1117 , 'name' => 'ui_wh_modification_date_checkout'
1118 , 'label' => ''//__('Check-out' ,'booking')
1119 , 'style' => 'width:100%;' // CSS of select element
1120 , 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element
1121 , 'disabled' => false
1122 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1123 , 'placeholder' => __('To' ,'booking') // gmdate( 'Y-m-d' )
1124 , 'value' => $request_input_el_default[ 'ui_wh_modification_date_checkout'] // Some Value from optins array that selected by default
1125 , 'onfocus' => "jQuery('#ui_wh_modification_date_radio_3').prop('checked', true);" // JavaScript code
1126 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1127 )
1128 , array( 'type' => 'html', 'html' => '</div>' )
1129 )
1130 ),
1131
1132 'divider3' => array( 'type' => 'html', 'html' => '<hr/>' ),
1133
1134 // Buttons
1135 'buttons1' => array(
1136 'type' => 'complex',
1137 'class' => 'ui_complex_option_element',
1138 'style' => 'justify-content: flex-end;',
1139 'input_options' => array(
1140 array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' )
1141 , array(
1142 'type' => 'button'
1143 , 'title' => __( 'Apply', 'booking' ) // Title of the button
1144 , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
1145 , 'link' => 'javascript:void(0)' // Direct link or skip it
1146 , 'action' => "wpbc_ui_dropdown_apply_click( {
1147 'dropdown_id' : 'wh_modification_date',
1148 'dropdown_radio_name': 'ui_wh_modification_date_radio'
1149 } );" // JavaScript code
1150 , 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary
1151 , 'icon' => ''
1152 , 'font_icon' => ''
1153 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
1154 , 'style' => '' // Any CSS class here
1155 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
1156 , 'attr' => array()
1157 )
1158 , array( 'type' => 'html', 'html' => '</div>' )
1159 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' )
1160 , array(
1161 'type' => 'button'
1162 , 'title' => __( 'Close', 'booking' ) // Title of the button
1163 , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
1164 , 'link' => 'javascript:void(0)' // Direct link or skip it
1165 , 'action' => "wpbc_ui_dropdown_close_click( 'wh_modification_date' );" // JavaScript code
1166 , 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary
1167 , 'icon' => ''
1168 , 'font_icon' => ''
1169 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
1170 , 'style' => '' // Any CSS class here
1171 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
1172 , 'attr' => array()
1173 )
1174 , array( 'type' => 'html', 'html' => '</div>' )
1175 )
1176 ),
1177 );
1178
1179 $params = array(
1180 'id' => $el_id
1181 , 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]
1182 , 'label' => ''
1183 , 'title' => ''//__('Creation', 'booking')
1184 , 'hint' => array( 'title' => __('Filter bookings by creation booking date' ,'booking') , 'position' => 'top' )
1185 , 'li_options' => $options
1186 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1187 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1188 //, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() ), 'page_num': 1 "
1189 // // Frontend selected elements (saving for future use, after F5)
1190 // . " ,'ui_wh_modification_date_radio' : jQuery( 'input[name=\"ui_wh_modification_date_radio\"]:checked' ).val()"
1191 // . " ,'ui_wh_modification_date_prior' : jQuery( '#ui_wh_modification_date_prior' ).val()"
1192 // . " ,'ui_wh_modification_date_checkin' : jQuery( '#ui_wh_modification_date_checkin' ).val()"
1193 // . " ,'ui_wh_modification_date_checkout': jQuery( '#ui_wh_modification_date_checkout' ).val()"
1194 // ."} );"
1195 );
1196
1197 ?><div class="ui_element ui_nowrap"><?php
1198
1199 wpbc_flex_addon( $params_addon );
1200
1201 wpbc_flex_dropdown( $params );
1202
1203 ?></div><?php
1204 }
1205
1206 /**
1207 * Payment Status
1208 *
1209 * @param $escaped_search_request_params - escaped search request parameters array
1210 * @param $defaults - default parameters values
1211 */
1212 function wpbc_ajx__ui__payment_status( $escaped_search_request_params, $defaults ){
1213
1214 if ( ! class_exists( 'wpdev_bk_biz_s' ) ) {
1215 return false;
1216 }
1217
1218 $params_addon = array(
1219 'type' => 'span'
1220 , 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>'
1221 , 'icon' => array( 'icon_font' => 'wpbc_icn_payments', 'position' => 'right', 'icon_img' => '' )
1222 , 'class' => 'wpbc_ui_button inactive'
1223 , 'style' => ''
1224 , 'attr' => array()
1225 , 'hint' => array( 'title' => __('Filter bookings by payment status' ,'booking') , 'position' => 'top' )
1226 );
1227
1228 $el_id = 'wh_pay_status';
1229
1230 $request_input_el_default = array(
1231 $el_id => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ],
1232 'ui_wh_pay_status_radio' => isset( $escaped_search_request_params['ui_wh_pay_status_radio'] ) ? $escaped_search_request_params['ui_wh_pay_status_radio'] : $defaults['ui_wh_pay_status_radio'],
1233 'ui_wh_pay_status_custom' => isset( $escaped_search_request_params['ui_wh_pay_status_custom'] ) ? $escaped_search_request_params['ui_wh_pay_status_custom'] : $defaults['ui_wh_pay_status_custom']
1234 );
1235
1236 $options = array (
1237 'all' => __( 'Any Status', 'booking' ),
1238 'divider0' => array( 'type' => 'html', 'html' => '<hr/>' ),
1239 'group_ok' => __( 'Paid OK', 'booking' ),
1240 'group_unknown' => __( 'Unknown Status', 'booking' ),
1241 'group_pending' => __( 'Not Completed', 'booking' ),
1242 'group_failed' => __( 'Failed', 'booking' ),
1243
1244 'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ),
1245
1246 // Fixed [ '6', '', '2022-05-21']
1247 'custom' => array(
1248 'type' => 'complex',
1249 'class' => 'ui_complex_option_element',
1250 'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value']
1251 'selected_options_title' => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ) ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ]
1252 'input_options' => array(
1253 array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' )
1254 , array(
1255 'type' => 'radio'
1256
1257 , 'id' => 'ui_wh_pay_status_radio_1' // HTML ID of element
1258 , 'name' => 'ui_wh_pay_status_radio'
1259 , 'label' => array( 'title' => __('Custom' ,'booking') , 'position' => 'right' )
1260 , 'style' => '' // CSS of select element
1261 , 'class' => '' // CSS Class of select element
1262 , 'disabled' => false
1263 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1264 , 'legend' => '' // aria-label parameter
1265 , 'value' => 'user_entered' // Some Value from optins array that selected by default
1266 , 'selected' => ( $request_input_el_default[ 'ui_wh_pay_status_radio' ] == 'user_entered' ) ? true : false // Selected or not
1267 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1268 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1269 )
1270 , array( 'type' => 'html', 'html' => '</div>' )
1271 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;">' )
1272 , array(
1273 'type' => 'text'
1274 , 'id' => 'ui_wh_pay_status_custom' // HTML ID of element
1275 , 'name' => 'ui_wh_pay_status_custom'
1276 , 'label' => ''//__('Check-out' ,'booking')
1277 , 'style' => 'max-width:100%;width:100%;' // CSS of select element
1278 , 'class' => '' // CSS Class of select element
1279 , 'disabled' => false
1280 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1281 , 'placeholder' => __('Payment status' ,'booking') // gmdate( 'Y-m-d' )
1282 , 'value' => $request_input_el_default[ 'ui_wh_pay_status_custom'] // Some Value from optins array that selected by default
1283 , 'onfocus' => "jQuery('#ui_wh_pay_status_radio_1').prop('checked', true);" // JavaScript code
1284 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1285 )
1286 , array( 'type' => 'html', 'html' => '</div>' )
1287 )
1288 ),
1289
1290
1291 // Buttons
1292 'buttons1' => array(
1293 'type' => 'complex',
1294 'class' => 'ui_complex_option_element',
1295 'style' => 'justify-content: flex-end;',
1296 'input_options' => array(
1297 array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' )
1298 , array(
1299 'type' => 'button'
1300 , 'title' => __( 'Apply', 'booking' ) // Title of the button
1301 , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
1302 , 'link' => 'javascript:void(0)' // Direct link or skip it
1303 , 'action' => "wpbc_ui_dropdown_apply_click( {
1304 'dropdown_id' : 'wh_pay_status',
1305 'dropdown_radio_name': 'ui_wh_pay_status_radio'
1306 } );" // JavaScript code
1307 , 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary
1308 , 'icon' => ''
1309 , 'font_icon' => ''
1310 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
1311 , 'style' => '' // Any CSS class here
1312 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
1313 , 'attr' => array()
1314 )
1315 , array( 'type' => 'html', 'html' => '</div>' )
1316 , array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' )
1317 , array(
1318 'type' => 'button'
1319 , 'title' => __( 'Close', 'booking' ) // Title of the button
1320 , 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' )
1321 , 'link' => 'javascript:void(0)' // Direct link or skip it
1322 , 'action' => "wpbc_ui_dropdown_close_click( 'wh_pay_status' );" // JavaScript code
1323 , 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary
1324 , 'icon' => ''
1325 , 'font_icon' => ''
1326 , 'icon_position' => 'left' // Position of icon relative to Text: left | right
1327 , 'style' => '' // Any CSS class here
1328 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
1329 , 'attr' => array()
1330 )
1331 , array( 'type' => 'html', 'html' => '</div>' )
1332 )
1333 ),
1334 );
1335
1336 $params = array(
1337 'id' => $el_id
1338 , 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]
1339 , 'label' => ''
1340 , 'title' => ''//__('Payment', 'booking')
1341 , 'hint' => array( 'title' => __('Filter bookings by payment status' ,'booking') , 'position' => 'top' )
1342 , 'li_options' => $options
1343 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1344 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1345 ///*, 'onchange' =>*/. "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() ), 'page_num': 1 "
1346 // // Frontend selected elements (saving for future use, after F5)
1347 // . " ,'ui_wh_pay_status_radio' : ( undefined === jQuery( 'input[name=\"ui_wh_pay_status_radio\"]:checked' ).val() ) ? '' : jQuery( 'input[name=\"ui_wh_pay_status_radio\"]:checked' ).val()"
1348 // . " ,'ui_wh_pay_status_custom' : jQuery( '#ui_wh_pay_status_custom' ).val()"
1349 // ."} );"
1350 );
1351
1352
1353 ?><div class="ui_element ui_nowrap"><?php
1354
1355 wpbc_flex_addon( $params_addon );
1356
1357 wpbc_flex_dropdown( $params );
1358
1359 ?></div><?php
1360 }
1361
1362 /**
1363 * Costs Min - Max
1364 *
1365 * @param $escaped_search_request_params - escaped search request parameters array
1366 * @param $defaults - default parameters values
1367 */
1368 function wpbc_ajx__ui__cost_min_max( $escaped_search_request_params, $defaults ){
1369
1370 if ( ! class_exists( 'wpdev_bk_biz_s' ) ) {
1371 return false;
1372 }
1373
1374 $el_id = 'wh_cost';
1375
1376 $params = array(
1377 'id' => $el_id // HTML ID of element
1378 , 'name' => $el_id
1379 , 'label' => '<span class="" style="font-weight:600;">' . esc_html__( 'Cost', 'booking' ) . ' <em style="color:#888;">(' . esc_html__( 'min-max', 'booking' ) . '):</em></span>'
1380 , 'style' => 'max-width: 69px;' // CSS of select element
1381 , 'class' => '' // CSS Class of select element
1382 , 'disabled' => false
1383 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1384 , 'placeholder' => '0'
1385 , 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]
1386 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1387 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1388 );
1389 ?><div class="ui_element" style="margin-right: 5px;"><?php
1390
1391 wpbc_flex_text( $params );
1392
1393 ?></div><?php
1394
1395
1396 $el_id = 'wh_cost2';
1397
1398 $params = array(
1399 'id' => $el_id // HTML ID of element
1400 , 'name' => $el_id
1401 , 'label' => '<span class="" style="font-weight:600;"> &dash; </span>'
1402 , 'style' => 'max-width: 69px;' // CSS of select element
1403 , 'class' => '' // CSS Class of select element
1404 , 'disabled' => false
1405 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1406 , 'placeholder' => '10000'
1407 , 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]
1408 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1409 //, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1410 );
1411 ?><div class="ui_element"><?php
1412
1413 wpbc_flex_text( $params );
1414
1415 ?></div><?php
1416
1417 }
1418
1419 /**
1420 * Reload button - force loading of ajax data
1421 *
1422 * @param $escaped_search_request_params - escaped search request parameters array
1423 * @param $defaults - default parameters values
1424 */
1425 function wpbc_ajx_toolbar_force_reload_button( $escaped_search_request_params, $defaults ){
1426
1427 $params = array(
1428 'type' => 'button' ,
1429 'title' => '',//__( 'Reset', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1430 'hint' => array( 'title' => __( 'Reload bookings listing', 'booking' ), 'position' => 'top' ), // Hint
1431 'link' => 'javascript:void(0)', // Direct link or skip it
1432 'action' => "wpbc_ajx_booking_send_search_request_with_params( { } );", // Some JavaScript
1433 'icon' => array(
1434 'icon_font' => 'wpbc_icn_refresh wpbc_spin', //'wpbc_icn_rotate_left',
1435 'position' => 'left',
1436 'icon_img' => ''
1437 ),
1438 'class' => 'wpbc_ui_button wpbc_ui_button_primary0', // '' | 'wpbc_ui_button_primary'
1439 'style' => '', // Any CSS class here
1440 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1441 'attr' => array( 'id' => 'wpbc_booking_listing_reload_button')
1442 );
1443
1444 ?><div class="ui_element" style="flex: 0 1 auto;"><?php
1445 wpbc_flex_button( $params );
1446 ?></div><?php
1447 }
1448
1449 // </editor-fold>
1450
1451
1452
1453 // ---------------------------------------------------------------------------------------------------------------------
1454 // JS & CSS Loading
1455 // ---------------------------------------------------------------------------------------------------------------------
1456
1457 /**
1458 * CSS files loading
1459 *
1460 * @param string $where_to_load
1461 */
1462 function wpbc_ajx_toolbar_enqueue_css_files( $where_to_load ) {
1463
1464 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
1465
1466 wp_enqueue_style( 'wpbc-flex-toolbar', wpbc_plugin_url( '/includes/_toolbar_ui/_out/toolbar_ui.css' ), array(), WP_BK_VERSION_NUM );
1467 }
1468 }
1469 add_action( 'wpbc_enqueue_css_files', 'wpbc_ajx_toolbar_enqueue_css_files', 50 );
1470
1471
1472 /**
1473 * JS files loading
1474 *
1475 * @param string $where_to_load
1476 */
1477 function wpbc_ajx_toolbar_enqueue_js_files( $where_to_load ) {
1478
1479 $in_footer = true;
1480
1481 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
1482
1483 wp_enqueue_script( 'wpbc-flex-toolbar-ui', wpbc_plugin_url( '/includes/_toolbar_ui/_out/toolbar_ui.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer );
1484
1485 /**
1486 * wp_localize_script( 'wpbc_all', 'wpbc_live_request_obj'
1487 , array(
1488 'contacts' => '',
1489 'reminders' => ''
1490 )
1491 );
1492 */
1493 }
1494 }
1495 add_action( 'wpbc_enqueue_js_files', 'wpbc_ajx_toolbar_enqueue_js_files', 50 );
1496
1497
1498 // 2024-08-13