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