| 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 |
//wpbc_toolbar_search_by_id_bookings(); // Search bookings by ID - form at the top right side of the page |
| 29 |
|
| 30 |
// wpbc_toolbar_btn__view_mode(); // Vertical Buttons //FixIn: 9.8.15.2 |
| 31 |
|
| 32 |
// Toolbar //////////////////////////////////////////////////////////////// |
| 33 |
|
| 34 |
$default_param_values = wpbc_ajx_get__request_params__names_default( 'default' ); |
| 35 |
|
| 36 |
$selected_tab = ( isset( $escaped_search_request_params['ui_usr__default_selected_toolbar'] ) ) |
| 37 |
? $escaped_search_request_params['ui_usr__default_selected_toolbar'] |
| 38 |
: $default_param_values['ui_usr__default_selected_toolbar']; |
| 39 |
|
| 40 |
?><div id="toolbar_booking_listing" class="wpbc_ajx_toolbar"><?php |
| 41 |
|
| 42 |
// <editor-fold defaultstate="collapsed" desc=" T O P T A B s " > |
| 43 |
|
| 44 |
wpbc_bs_toolbar_tabs_html_container_start(); |
| 45 |
|
| 46 |
wpbc_bs_display_tab( array( |
| 47 |
'title' => ' ' . __('Filters', 'booking') |
| 48 |
, 'hint' => array( 'title' => __('Filter bookings' ,'booking') , 'position' => 'top' ) |
| 49 |
, 'onclick' => "jQuery('.ui_container_toolbar').hide();" |
| 50 |
. "jQuery('.ui_container_filters').show();" |
| 51 |
. "jQuery('.wpbc_ajx_toolbar .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2 |
| 52 |
. "jQuery(this).addClass('nav-tab-active');" |
| 53 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 54 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 55 |
/** |
| 56 |
* It will save such changes, and if we have selected bookings, then deselect them |
| 57 |
*/ |
| 58 |
// . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__default_selected_toolbar': 'filters' });" |
| 59 |
/** |
| 60 |
* It will save changes with NEXT search request, but not immediately |
| 61 |
* it is handy, in case if we have selected bookings, |
| 62 |
* we will not lose selection. |
| 63 |
*/ |
| 64 |
. "wpbc_ajx_booking_listing.search_set_param( 'ui_usr__default_selected_toolbar', 'filters' );" |
| 65 |
, 'font_icon' => 'wpbc_icn_published_with_changes' //FixIn: 9.0.1.4 'glyphicon glyphicon-random' |
| 66 |
, 'default' => ( $selected_tab == 'filters' ) ? true : false |
| 67 |
) ); |
| 68 |
wpbc_bs_display_tab( array( |
| 69 |
'title' => __('Actions', 'booking') |
| 70 |
, 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' ) |
| 71 |
, 'onclick' => "jQuery('.ui_container_toolbar').hide();" |
| 72 |
. "jQuery('.ui_container_actions').show();" |
| 73 |
. "jQuery('.wpbc_ajx_toolbar .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2 |
| 74 |
. "jQuery(this).addClass('nav-tab-active');" |
| 75 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 76 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 77 |
/** |
| 78 |
* It will save such changes, and if we have selected bookings, then deselect them |
| 79 |
*/ |
| 80 |
// . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__default_selected_toolbar': 'actions' });" |
| 81 |
/** |
| 82 |
* It will save changes with NEXT search request, but not immediately |
| 83 |
* it is handy, in case if we have selected bookings, |
| 84 |
* we will not lose selection. |
| 85 |
*/ |
| 86 |
. "wpbc_ajx_booking_listing.search_set_param( 'ui_usr__default_selected_toolbar', 'actions' );" |
| 87 |
, 'font_icon' => 'wpbc_icn_adjust' //FixIn: 9.0.1.4 'glyphicon glyphicon-fire' |
| 88 |
, 'default' => ( $selected_tab == 'actions' ) ? true : false |
| 89 |
|
| 90 |
) ); |
| 91 |
|
| 92 |
if ( class_exists( 'wpdev_bk_personal' ) ) { //FixIn: 9.6.1.5 |
| 93 |
wpbc_bs_display_tab( array( |
| 94 |
'title' => __('Options', 'booking') //FixIn: 9.5.4.3 |
| 95 |
, 'hint' => array( 'title' => __('User Options' ,'booking') , 'position' => 'top' ) |
| 96 |
, 'onclick' => "jQuery('.ui_container_toolbar').hide();" |
| 97 |
. "jQuery('.ui_container_options').show();" |
| 98 |
. "jQuery('.wpbc_ajx_toolbar .nav-tab').removeClass('nav-tab-active');" //FixIn: 9.8.15.2 |
| 99 |
. "jQuery(this).addClass('nav-tab-active');" |
| 100 |
. "jQuery('.nav-tab i.icon-white').removeClass('icon-white');" |
| 101 |
. "jQuery('.nav-tab-active i').addClass('icon-white');" |
| 102 |
/** |
| 103 |
* It will save such changes, and if we have selected bookings, then deselect them |
| 104 |
*/ |
| 105 |
// . "wpbc_ajx_booking_send_search_request_with_params( { 'ui_usr__default_selected_toolbar': 'options' });" |
| 106 |
/** |
| 107 |
* It will save changes with NEXT search request, but not immediately |
| 108 |
* it is handy, in case if we have selected bookings, |
| 109 |
* we will not lose selection. |
| 110 |
*/ |
| 111 |
. "wpbc_ajx_booking_listing.search_set_param( 'ui_usr__default_selected_toolbar', 'options' );" |
| 112 |
, 'font_icon' => 'wpbc_icn_tune' //FixIn: 9.0.1.4 'glyphicon glyphicon-fire' |
| 113 |
, 'default' => ( $selected_tab == 'options' ) ? true : false |
| 114 |
//, 'position' => 'right' |
| 115 |
|
| 116 |
) ); |
| 117 |
} |
| 118 |
wpbc_bs_dropdown_menu_help(); |
| 119 |
|
| 120 |
wpbc_bs_toolbar_tabs_html_container_end(); |
| 121 |
|
| 122 |
// </editor-fold> |
| 123 |
|
| 124 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 125 |
// Filters |
| 126 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 127 |
?><div><?php //Required for bottom border radius in container |
| 128 |
|
| 129 |
?><div class="ui_container ui_container_toolbar ui_container_filters ui_container_filter_row_1" style="<?php echo ( $selected_tab == 'filters' ) ? 'display: flex' : 'display: none' ?>;"><?php |
| 130 |
|
| 131 |
?><div class="ui_group ui_group__dates_status ui_search_fields_group_1"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line |
| 132 |
|
| 133 |
wpbc_ajx__ui__booked_dates( $escaped_search_request_params, $default_param_values ); |
| 134 |
|
| 135 |
wpbc_ajx__ui__booking_status( $escaped_search_request_params, $default_param_values ); |
| 136 |
|
| 137 |
?></div><?php |
| 138 |
|
| 139 |
?><div class="ui_group ui_group__keyword ui_search_fields_group_2"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line |
| 140 |
|
| 141 |
wpbc_ajx_toolbar_keyword_search( $escaped_search_request_params, $default_param_values ); |
| 142 |
|
| 143 |
wpbc_ajx_toolbar_clear_keyword_search( $escaped_search_request_params, $default_param_values ); //FixIn: 9.7.2.3 |
| 144 |
|
| 145 |
wpbc_ajx_toolbar_force_reload_button( $escaped_search_request_params, $default_param_values ); |
| 146 |
|
| 147 |
?></div><?php |
| 148 |
|
| 149 |
?></div><?php |
| 150 |
|
| 151 |
|
| 152 |
?><div class="ui_container ui_container_toolbar ui_container_small ui_container_filters ui_container_filter_row_2" style="<?php echo ( $selected_tab == 'filters' ) ? 'display: flex' : 'display: none' ?>;"><?php |
| 153 |
|
| 154 |
?><div class="ui_group ui_group__statuses ui_search_fields_group_1"><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line |
| 155 |
|
| 156 |
wpbc_ajx__ui__booking_resources( $escaped_search_request_params, $default_param_values ); |
| 157 |
|
| 158 |
wpbc_ajx__ui__existing_or_trash( $escaped_search_request_params, $default_param_values ); |
| 159 |
|
| 160 |
wpbc_ajx__ui__all_or_new( $escaped_search_request_params, $default_param_values ); |
| 161 |
|
| 162 |
wpbc_ajx__ui__creation_date( $escaped_search_request_params, $default_param_values ); |
| 163 |
|
| 164 |
wpbc_ajx__ui__payment_status( $escaped_search_request_params, $default_param_values ); |
| 165 |
|
| 166 |
wpbc_ajx__ui__cost_min_max( $escaped_search_request_params, $default_param_values ); |
| 167 |
|
| 168 |
wpbc_ajx_toolbar_reset_button( $escaped_search_request_params, $default_param_values ); |
| 169 |
|
| 170 |
?></div><?php |
| 171 |
|
| 172 |
?></div><?php |
| 173 |
|
| 174 |
?></div><?php //Required for bottom border radius in container |
| 175 |
|
| 176 |
|
| 177 |
// <editor-fold defaultstate="collapsed" desc=" A c t i o n s t o o l b a r " > |
| 178 |
|
| 179 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 180 |
// Actions |
| 181 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 182 |
|
| 183 |
?><div class="ui_container ui_container_toolbar ui_container_small ui_container_actions ui_container_actions_row_1" style="<?php echo ( $selected_tab == 'actions' ) ? 'display: flex' : 'display: none' ?>;"><?php |
| 184 |
|
| 185 |
?><div class="ui_group"><?php |
| 186 |
|
| 187 |
// Approve // Pending |
| 188 |
?><div class="ui_element hide_button_if_no_selection"><?php |
| 189 |
wpbc_ajx__ui__action_button__approve( $escaped_search_request_params ); |
| 190 |
wpbc_ajx__ui__action_button__pending( $escaped_search_request_params ); |
| 191 |
?></div><?php |
| 192 |
|
| 193 |
// Trash / Reject // Restore // Delete |
| 194 |
?><div class="ui_element hide_button_if_no_selection"><?php |
| 195 |
wpbc_ajx__ui__action_button__trash( $escaped_search_request_params ); |
| 196 |
wpbc_ajx__ui__action_button__restore( $escaped_search_request_params ); |
| 197 |
wpbc_ajx__ui__action_button__delete( $escaped_search_request_params ); |
| 198 |
wpbc_ajx__ui__action_text__delete_reason( $escaped_search_request_params ); |
| 199 |
?></div><?php |
| 200 |
|
| 201 |
// Empty Trash |
| 202 |
?><div class="ui_element"><?php |
| 203 |
wpbc_ajx__ui__action_button__empty_trash( $escaped_search_request_params ); |
| 204 |
?></div><?php |
| 205 |
|
| 206 |
// Read All // Read // Unread |
| 207 |
?><div class="ui_element"><?php |
| 208 |
wpbc_ajx__ui__action_button__readall( $escaped_search_request_params ); |
| 209 |
wpbc_ajx__ui__action_button__read( $escaped_search_request_params ); |
| 210 |
wpbc_ajx__ui__action_button__unread( $escaped_search_request_params ); |
| 211 |
?></div><?php |
| 212 |
|
| 213 |
// Print |
| 214 |
?><div class="ui_element"><?php |
| 215 |
wpbc_ajx__ui__action_button__print( $escaped_search_request_params ); |
| 216 |
?></div><?php |
| 217 |
|
| 218 |
// Import |
| 219 |
?><div class="ui_element"><?php |
| 220 |
wpbc_ajx__ui__action_button__import( $escaped_search_request_params ); |
| 221 |
?></div><?php |
| 222 |
|
| 223 |
// Export page to CSV // Export all pages to CSV |
| 224 |
?><div class="ui_element"><?php |
| 225 |
wpbc_ajx__ui__action_button__export_csv( $escaped_search_request_params ); |
| 226 |
// wpbc_ajx__ui__action_button__export_csv_page( $escaped_search_request_params ); |
| 227 |
// wpbc_ajx__ui__action_button__export_csv_all( $escaped_search_request_params ); |
| 228 |
?></div><?php |
| 229 |
|
| 230 |
?></div><?php |
| 231 |
|
| 232 |
?></div><?php |
| 233 |
// </editor-fold> |
| 234 |
|
| 235 |
|
| 236 |
// <editor-fold defaultstate="collapsed" desc=" O p t i o n s t o o l b a r " > |
| 237 |
|
| 238 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 239 |
// Options |
| 240 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 241 |
if ( class_exists( 'wpdev_bk_personal' ) ) { //FixIn: 9.6.1.5 |
| 242 |
?><div class="ui_container ui_container_toolbar ui_container_small ui_container_options ui_container_options_row_1" style="<?php echo ( $selected_tab == 'options' ) ? 'display: flex' : 'display: none' ?>;"><?php |
| 243 |
|
| 244 |
?><div class="ui_group"><?php |
| 245 |
|
| 246 |
/* |
| 247 |
// Is send Emails //FixIn: 9.6.1.5 |
| 248 |
?><div class="ui_element"><?php |
| 249 |
wpbc_ajx__ui__options_checkbox__send_emails( $escaped_search_request_params, $default_param_values ); |
| 250 |
?></div><?php |
| 251 |
*/ |
| 252 |
|
| 253 |
if ( class_exists( 'wpdev_bk_personal' ) ) { |
| 254 |
// Is Expand Notes |
| 255 |
?><div class="ui_element"><?php |
| 256 |
|
| 257 |
wpbc_ajx__ui__options_checkbox__is_expand_remarks( $escaped_search_request_params, $default_param_values ); |
| 258 |
|
| 259 |
?></div><?php |
| 260 |
} |
| 261 |
|
| 262 |
?></div><?php |
| 263 |
|
| 264 |
?></div><?php |
| 265 |
} |
| 266 |
// </editor-fold> |
| 267 |
|
| 268 |
?></div><?php |
| 269 |
} |
| 270 |
|
| 271 |
/** |
| 272 |
* Sorting |
| 273 |
* |
| 274 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 275 |
* @param $defaults - default parameters values |
| 276 |
*/ |
| 277 |
function wpbc_ajx__ui__booking_sorting( $escaped_search_request_params, $defaults ){ |
| 278 |
|
| 279 |
$params_addon = array( |
| 280 |
'type' => 'span' |
| 281 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 282 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_swap_vert', 'position' => 'right', 'icon_img' => '' ) |
| 283 |
, 'class' => 'wpbc_ui_button inactive' |
| 284 |
, 'style' => '' |
| 285 |
, 'attr' => array() |
| 286 |
); |
| 287 |
|
| 288 |
$select_options = array ( |
| 289 |
'booking_id__asc' => __( 'ID', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-up-short"></i>', |
| 290 |
'booking_id__desc' => __( 'ID', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-down-short"></i>', |
| 291 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 292 |
'dates__asc' => __( 'Dates', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-up-short"></i>', |
| 293 |
'dates__desc' => __( 'Dates', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-down-short"></i>', |
| 294 |
); |
| 295 |
if ( class_exists( 'wpdev_bk_personal' ) ) { |
| 296 |
$select_options['divider2'] = array( 'type' => 'html', 'html' => '<hr/>' ); |
| 297 |
$select_options['resource__asc'] = __( 'Resource', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-up-short"></i>'; |
| 298 |
$select_options['resource__desc'] = __( 'Resource', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-down-short"></i>'; |
| 299 |
|
| 300 |
} |
| 301 |
if ( class_exists( 'wpdev_bk_biz_s' ) ) { |
| 302 |
$select_options['divider3'] = array( 'type' => 'html', 'html' => '<hr/>' ); |
| 303 |
$select_options['cost__asc'] = __( 'Cost', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-up-short"></i>'; |
| 304 |
$select_options['cost__desc'] = __( 'Cost', 'booking' ) . ' <i class="menu_icon icon-1x wpbc-bi-arrow-down-short"></i>'; |
| 305 |
} |
| 306 |
|
| 307 |
$params = array( |
| 308 |
'id' => 'wh_sort' |
| 309 |
, 'default' => isset( $escaped_search_request_params['wh_sort'] ) ? $escaped_search_request_params['wh_sort'] : $defaults['wh_sort'] |
| 310 |
, 'label' => ''//__('Sort by', 'booking') . ':' |
| 311 |
, 'title' => __('Sort by', 'booking') |
| 312 |
, 'hint' => array( 'title' => __('Sort bookings by' ,'booking') , 'position' => 'top' ) |
| 313 |
, 'li_options' => $select_options |
| 314 |
); |
| 315 |
|
| 316 |
?><div class="wpbc_ajx_toolbar wpbc_buttons_row"> |
| 317 |
<div class="ui_container ui_container_small"> |
| 318 |
<div class="ui_group"> |
| 319 |
<div class="ui_element"><?php |
| 320 |
|
| 321 |
//wpbc_flex_addon( $params_addon ); |
| 322 |
|
| 323 |
wpbc_flex_dropdown( $params ); |
| 324 |
|
| 325 |
?></div></div></div></div><?php |
| 326 |
} |
| 327 |
|
| 328 |
|
| 329 |
/** |
| 330 |
* Is email sending option - loacted inside of the page -- under the toolbar |
| 331 |
* |
| 332 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 333 |
* @param $defaults - default parameters values |
| 334 |
*/ |
| 335 |
function wpbc_ajx__ui__booking__no_toolbar__is_email_sending( $escaped_search_request_params, $defaults ) { //FixIn: 9.6.1.5 |
| 336 |
|
| 337 |
?><div class="wpbc_ajx_toolbar wpbc_no_borders wpbc_not_toolbar_is_send_emails"><?php |
| 338 |
?><div class="ui_container ui_container_micro"><?php |
| 339 |
?><div class="ui_group"><?php |
| 340 |
?><div class="ui_element"><?php |
| 341 |
wpbc_ajx__ui__options_checkbox__send_emails( $escaped_search_request_params, $defaults ); |
| 342 |
?></div><?php |
| 343 |
?></div><?php |
| 344 |
?></div><?php |
| 345 |
?></div><?php |
| 346 |
} |
| 347 |
|
| 348 |
|
| 349 |
// <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 " > |
| 350 |
|
| 351 |
//////////////////////////////////////////////////////////////////////////////// |
| 352 |
/// 1st row |
| 353 |
//////////////////////////////////////////////////////////////////////////////// |
| 354 |
|
| 355 |
/** |
| 356 |
* Booked dates |
| 357 |
* |
| 358 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 359 |
* @param $defaults - default parameters values |
| 360 |
*/ |
| 361 |
function wpbc_ajx__ui__booked_dates( $escaped_search_request_params, $defaults ){ |
| 362 |
|
| 363 |
$params_addon = array( |
| 364 |
'type' => 'span' |
| 365 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 366 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' ) |
| 367 |
, 'class' => 'wpbc_ui_button inactive' |
| 368 |
, 'style' => '' |
| 369 |
, 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' ) |
| 370 |
, 'attr' => array() |
| 371 |
); |
| 372 |
|
| 373 |
$dates_interval = array( |
| 374 |
1 => '1' . ' ' . __('day' ,'booking') |
| 375 |
, 2 => '2' . ' ' . __('days' ,'booking') |
| 376 |
, 3 => '3' . ' ' . __('days' ,'booking') |
| 377 |
, 4 => '4' . ' ' . __('days' ,'booking') |
| 378 |
, 5 => '5' . ' ' . __('days' ,'booking') |
| 379 |
, 6 => '6' . ' ' . __('days' ,'booking') |
| 380 |
, 7 => '1' . ' ' . __('week' ,'booking') |
| 381 |
, 14 => '2' . ' ' . __('weeks' ,'booking') |
| 382 |
, 30 => '1' . ' ' . __('month' ,'booking') |
| 383 |
, 60 => '2' . ' ' . __('months' ,'booking') |
| 384 |
, 90 => '3' . ' ' . __('months' ,'booking') |
| 385 |
, 183 => '6' . ' ' . __('months' ,'booking') |
| 386 |
, 365 => '1' . ' ' . __('Year' ,'booking') |
| 387 |
); |
| 388 |
|
| 389 |
$request_input_el_default = array( |
| 390 |
'wh_booking_date' => isset( $escaped_search_request_params['wh_booking_date'] ) ? $escaped_search_request_params['wh_booking_date'] : $defaults['wh_booking_date'], |
| 391 |
'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'], |
| 392 |
'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'], |
| 393 |
'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'], |
| 394 |
'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'], |
| 395 |
'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'] |
| 396 |
); |
| 397 |
|
| 398 |
$options = array ( |
| 399 |
// 'header2' => array( 'type' => 'header', 'title' => __( 'Complex Days', 'booking' ) ), |
| 400 |
// 'disabled1' => array( 'type' => 'simple', 'value' => '19', 'title' => __( 'This is option was disabled', 'booking' ), 'disabled' => true ), |
| 401 |
//todo: 2023-06-10 |
| 402 |
'fixed' => array( |
| 403 |
'type' => 'complex', |
| 404 |
'class' => 'ui_complex_option_element', |
| 405 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 406 |
'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' ] |
| 407 |
'style' => 'min-width:290px', |
| 408 |
'input_options' => array( |
| 409 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;display:none;">' ) |
| 410 |
, array( |
| 411 |
'type' => 'radio' |
| 412 |
|
| 413 |
, 'id' => 'ui_wh_booking_date_radio_3' // HTML ID of element |
| 414 |
, 'name' => 'ui_wh_booking_date_radio' |
| 415 |
, 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' ) |
| 416 |
, 'style' => '' // CSS of select element |
| 417 |
, 'class' => '' // CSS Class of select element |
| 418 |
, 'disabled' => false |
| 419 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 420 |
, 'legend' => '' // aria-label parameter |
| 421 |
, 'value' => '6' // Some Value from optins array that selected by default |
| 422 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '6' ) ? true : false // Selected or not |
| 423 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 424 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 425 |
) |
| 426 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 427 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;flex: 0 1 90px;order: 2;">' ) |
| 428 |
, array( |
| 429 |
'type' => 'text' |
| 430 |
, 'id' => 'ui_wh_booking_date_checkin' // HTML ID of element |
| 431 |
, 'name' => 'ui_wh_booking_date_checkin' |
| 432 |
, 'label' => ''//__('Check-in' ,'booking') |
| 433 |
, 'style' => 'width:100%;' // CSS of select element |
| 434 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 435 |
, 'disabled' => false |
| 436 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 437 |
, 'placeholder' => __('Check-in' ,'booking') |
| 438 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkin'] // Some Value from optins array that selected by default |
| 439 |
// , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code |
| 440 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 441 |
) |
| 442 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 443 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;flex: 0 1 90px;order: 4;">' ) |
| 444 |
, array( |
| 445 |
'type' => 'text' |
| 446 |
, 'id' => 'ui_wh_booking_date_checkout' // HTML ID of element |
| 447 |
, 'name' => 'ui_wh_booking_date_checkout' |
| 448 |
, 'label' => ''//__('Check-out' ,'booking') |
| 449 |
, 'style' => 'width:100%;' // CSS of select element |
| 450 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 451 |
, 'disabled' => false |
| 452 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 453 |
, 'placeholder' => __('Check-out' ,'booking') |
| 454 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkout'] // Some Value from optins array that selected by default |
| 455 |
// , 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code |
| 456 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 457 |
) |
| 458 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 459 |
//FixIn: 9.7.2.2 |
| 460 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding:0;flex: 0 1 14px;order: 2;">' ) |
| 461 |
, array( |
| 462 |
'type' => 'button' |
| 463 |
, 'title' => '' // Title of the button |
| 464 |
, 'hint' => '' |
| 465 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 466 |
, 'action' => "jQuery('#ui_wh_booking_date_checkin').val('');jQuery('#ui_wh_booking_date_checkout').val('');" |
| 467 |
, 'class' => 'wpbc_button_as_icon' // wpbc_ui_button | wpbc_ui_button_primary |
| 468 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_horizontal_rule', 'position' => 'left', 'icon_img' => '' ) |
| 469 |
, 'font_icon' => '' |
| 470 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 471 |
, 'style' => 'padding: 0px;font-size: 20px;color: #555;' // 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 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;flex: 0 1 35px;order: 5;">' ) |
| 478 |
, array( |
| 479 |
'type' => 'button' |
| 480 |
, 'title' => '' // Title of the button |
| 481 |
, 'hint' => array( 'title' => __('Apply' ,'booking') , 'position' => 'top' ) |
| 482 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 483 |
, 'action' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);". |
| 484 |
"wpbc_ui_dropdown_apply_click( { |
| 485 |
'dropdown_id' : 'wh_booking_date', |
| 486 |
'dropdown_radio_name': 'ui_wh_booking_date_radio' |
| 487 |
} );" // JavaScript code |
| 488 |
, 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary |
| 489 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_arrow_forward', 'position' => 'left', 'icon_img' => '' ) |
| 490 |
, 'font_icon' => '' |
| 491 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 492 |
, 'style' => 'padding:5px 7px;' // Any CSS class here |
| 493 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 494 |
, 'attr' => array() |
| 495 |
) |
| 496 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 497 |
, 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;">' ) |
| 498 |
, array( |
| 499 |
'type' => 'button' |
| 500 |
, 'title' => '' // Title of the button |
| 501 |
, 'hint' => array( 'title' => __('Reset check in/out dates filter' ,'booking') , 'position' => 'top' ) |
| 502 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 503 |
, '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; }" |
| 504 |
. "jQuery('#ui_wh_booking_date_checkin').val('');jQuery('#ui_wh_booking_date_checkout').val('');" |
| 505 |
, 'class' => 'wpbc_button_as_icon' // wpbc_ui_button | wpbc_ui_button_primary |
| 506 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_close', 'position' => 'left', 'icon_img' => '' ) |
| 507 |
, 'font_icon' => '' |
| 508 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 509 |
, 'style' => 'padding-left: 0;padding-right: 0;' // Any CSS class here |
| 510 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 511 |
, 'attr' => array() |
| 512 |
) |
| 513 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 514 |
|
| 515 |
) |
| 516 |
), |
| 517 |
'divider4' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 518 |
|
| 519 |
|
| 520 |
'0' => __( 'Current dates', 'booking' ), |
| 521 |
'1' => __( 'Today', 'booking' ), |
| 522 |
'2' => __( 'Previous dates', 'booking' ), |
| 523 |
'3' => __( 'All dates', 'booking' ), |
| 524 |
|
| 525 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 526 |
|
| 527 |
'9' => __( 'Today check in/out', 'booking' ), |
| 528 |
'10' => __( 'Check in - Today', 'booking' ), |
| 529 |
'11' => __( 'Check out - Today', 'booking' ), |
| 530 |
'7' => __( 'Check in - Tomorrow', 'booking' ), |
| 531 |
'8' => __( 'Check out - Tomorrow', 'booking' ), |
| 532 |
|
| 533 |
'divider2' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 534 |
|
| 535 |
// Next [ '4', '10' ] - radio button (if selected) value '4' and select-box with selected value '10' |
| 536 |
'next' => array( |
| 537 |
'type' => 'complex', |
| 538 |
'class' => 'ui_complex_option_element', |
| 539 |
// recheck if LI selected: $options['next']['selected_options_value'] == $params['default], e.g. ~ [ '4', '10' ] |
| 540 |
'selected_options_value' => array( |
| 541 |
1 => array( 'value' ), // $options['next']['input_options'][ 1 ]['value'] '4' |
| 542 |
4 => array( 'value' ) // $options['next']['input_options'][ 4 ]['value'] '10' |
| 543 |
), |
| 544 |
// Get selected Title, for dropdown if $options['next'] selected |
| 545 |
'selected_options_title' => array( |
| 546 |
1 => array( 'label', 'title' ), // $options['next']['input_options'][ 1 ]['label'][ 'title' ] 'Next' |
| 547 |
'text1' => ': ', // if key 'text1' not exist in ['input_options'], then it text ': ' |
| 548 |
4 => array( 'options', $request_input_el_default['ui_wh_booking_date_next'] ) // '10 days' |
| 549 |
), |
| 550 |
'input_options' => array( |
| 551 |
array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 552 |
, array( // Default options from simple input element, like: wpbc_flex_radio() |
| 553 |
'type' => 'radio' |
| 554 |
, 'id' => 'ui_wh_booking_date_radio_1' // HTML ID of element |
| 555 |
, 'name' => 'ui_wh_booking_date_radio' |
| 556 |
, 'label' => array( 'title' => __('Next' ,'booking') , 'position' => 'right' ) |
| 557 |
, 'style' => '' // CSS of select element |
| 558 |
, 'class' => '' // CSS Class of select element |
| 559 |
, 'disabled' => false |
| 560 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 561 |
, 'legend' => '' // aria-label parameter |
| 562 |
, 'value' => '4' |
| 563 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '4' ) ? true : false // Selected or not |
| 564 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 565 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 566 |
) |
| 567 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 568 |
, array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 569 |
, array( |
| 570 |
'type' => 'select' |
| 571 |
, 'attr' => array() |
| 572 |
, 'name' => 'ui_wh_booking_date_next' |
| 573 |
, 'id' => 'ui_wh_booking_date_next' |
| 574 |
, 'options' => $dates_interval |
| 575 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_next'] |
| 576 |
, 'onfocus' => "jQuery('#ui_wh_booking_date_radio_1').prop('checked', true);" // JavaScript code |
| 577 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 578 |
) |
| 579 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 580 |
) |
| 581 |
), |
| 582 |
|
| 583 |
// Prior [ '5', '10' ] |
| 584 |
'prior' => array( |
| 585 |
'type' => 'complex', |
| 586 |
'class' => 'ui_complex_option_element', |
| 587 |
'style' => 'min-width: 244px;', |
| 588 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 589 |
'selected_options_title' => array( 1 => array( 'label', 'title' ) |
| 590 |
, 'text1' => ': ' |
| 591 |
, 4 => array( 'options' , $request_input_el_default[ 'ui_wh_booking_date_prior'] ) |
| 592 |
), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ] |
| 593 |
'input_options' => array( |
| 594 |
array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 595 |
, array( |
| 596 |
'type' => 'radio' |
| 597 |
|
| 598 |
, 'id' => 'ui_wh_booking_date_radio_2' // HTML ID of element |
| 599 |
, 'name' => 'ui_wh_booking_date_radio' |
| 600 |
, 'label' => array( 'title' => __('Prior' ,'booking') , 'position' => 'right' ) |
| 601 |
, 'style' => '' // CSS of select element |
| 602 |
, 'class' => '' // CSS Class of select element |
| 603 |
, 'disabled' => false |
| 604 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 605 |
, 'legend' => '' // aria-label parameter |
| 606 |
, 'value' => '5' // Some Value from optins array that selected by default |
| 607 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '5' ) ? true : false // Selected or not |
| 608 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 609 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 610 |
) |
| 611 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 612 |
, array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 613 |
, array( |
| 614 |
'type' => 'select' |
| 615 |
, 'attr' => array() |
| 616 |
, 'name' => 'ui_wh_booking_date_prior' |
| 617 |
, 'id' => 'ui_wh_booking_date_prior' |
| 618 |
, 'options' => $dates_interval |
| 619 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_prior'] |
| 620 |
, 'onfocus' => "jQuery('#ui_wh_booking_date_radio_2').prop('checked', true);" // JavaScript code |
| 621 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 622 |
) |
| 623 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 624 |
) |
| 625 |
), |
| 626 |
/* //todo: 2023-06-10 |
| 627 |
// Fixed [ '6', '', '2022-05-21'] |
| 628 |
'fixed' => array( |
| 629 |
'type' => 'complex', |
| 630 |
'class' => 'ui_complex_option_element', |
| 631 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 632 |
'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' ] |
| 633 |
'input_options' => array( |
| 634 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' ) |
| 635 |
, array( |
| 636 |
'type' => 'radio' |
| 637 |
|
| 638 |
, 'id' => 'ui_wh_booking_date_radio_3' // HTML ID of element |
| 639 |
, 'name' => 'ui_wh_booking_date_radio' |
| 640 |
, 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' ) |
| 641 |
, 'style' => '' // CSS of select element |
| 642 |
, 'class' => '' // CSS Class of select element |
| 643 |
, 'disabled' => false |
| 644 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 645 |
, 'legend' => '' // aria-label parameter |
| 646 |
, 'value' => '6' // Some Value from optins array that selected by default |
| 647 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '6' ) ? true : false // Selected or not |
| 648 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 649 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 650 |
) |
| 651 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 652 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;">' ) |
| 653 |
, array( |
| 654 |
'type' => 'text' |
| 655 |
, 'id' => 'ui_wh_booking_date_checkin' // HTML ID of element |
| 656 |
, 'name' => 'ui_wh_booking_date_checkin' |
| 657 |
, 'label' => ''//__('Check-in' ,'booking') |
| 658 |
, 'style' => 'width:100%;' // CSS of select element |
| 659 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 660 |
, 'disabled' => false |
| 661 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 662 |
, 'placeholder' => __('Check-in' ,'booking') |
| 663 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkin'] // Some Value from optins array that selected by default |
| 664 |
, 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code |
| 665 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 666 |
) |
| 667 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 668 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;">' ) |
| 669 |
, array( |
| 670 |
'type' => 'text' |
| 671 |
, 'id' => 'ui_wh_booking_date_checkout' // HTML ID of element |
| 672 |
, 'name' => 'ui_wh_booking_date_checkout' |
| 673 |
, 'label' => ''//__('Check-out' ,'booking') |
| 674 |
, 'style' => 'width:100%;' // CSS of select element |
| 675 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 676 |
, 'disabled' => false |
| 677 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 678 |
, 'placeholder' => __('Check-out' ,'booking') |
| 679 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkout'] // Some Value from optins array that selected by default |
| 680 |
, 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code |
| 681 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 682 |
) |
| 683 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 684 |
) |
| 685 |
), |
| 686 |
*/ |
| 687 |
'divider3' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 688 |
|
| 689 |
// Buttons |
| 690 |
'buttons1' => array( |
| 691 |
'type' => 'complex', |
| 692 |
'class' => 'ui_complex_option_element', |
| 693 |
'style' => 'justify-content: flex-end;', |
| 694 |
'input_options' => array( |
| 695 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' ) |
| 696 |
, array( |
| 697 |
'type' => 'button' |
| 698 |
, 'title' => __( 'Apply', 'booking' ) // Title of the button |
| 699 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 700 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 701 |
, 'action' => "wpbc_ui_dropdown_apply_click( { |
| 702 |
'dropdown_id' : 'wh_booking_date', |
| 703 |
'dropdown_radio_name': 'ui_wh_booking_date_radio' |
| 704 |
} );" // JavaScript code |
| 705 |
, 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary |
| 706 |
, 'icon' => '' |
| 707 |
, 'font_icon' => '' |
| 708 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 709 |
, 'style' => '' // Any CSS class here |
| 710 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 711 |
, 'attr' => array() |
| 712 |
) |
| 713 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 714 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' ) |
| 715 |
, array( |
| 716 |
'type' => 'button' |
| 717 |
, 'title' => __( 'Close', 'booking' ) // Title of the button |
| 718 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 719 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 720 |
, 'action' => "wpbc_ui_dropdown_close_click( 'wh_booking_date' );" // JavaScript code |
| 721 |
, 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary |
| 722 |
, 'icon' => '' |
| 723 |
, 'font_icon' => '' |
| 724 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 725 |
, 'style' => '' // Any CSS class here |
| 726 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 727 |
, 'attr' => array() |
| 728 |
) |
| 729 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 730 |
) |
| 731 |
), |
| 732 |
); |
| 733 |
|
| 734 |
$params = array( |
| 735 |
'id' => 'wh_booking_date' |
| 736 |
, 'default' => $request_input_el_default[ 'wh_booking_date' ] |
| 737 |
, 'label' => ''//__('Approve 1', 'booking') . ':' |
| 738 |
, 'title' => ''//__('Approve 2', 'booking') |
| 739 |
, 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' ) |
| 740 |
, 'align' => 'left' |
| 741 |
, 'li_options' => $options |
| 742 |
); |
| 743 |
|
| 744 |
?><div class="ui_element ui_nowrap"><?php |
| 745 |
|
| 746 |
wpbc_flex_addon( $params_addon ); |
| 747 |
|
| 748 |
wpbc_flex_dropdown( $params ); |
| 749 |
|
| 750 |
?></div><?php |
| 751 |
} |
| 752 |
|
| 753 |
/** |
| 754 |
* Approved | Pending | All |
| 755 |
* |
| 756 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 757 |
* @param $defaults - default parameters values |
| 758 |
*/ |
| 759 |
function wpbc_ajx__ui__booking_status( $escaped_search_request_params, $defaults ){ |
| 760 |
|
| 761 |
$params_addon = array( |
| 762 |
'type' => 'span' |
| 763 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 764 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_done_all', 'position' => 'right', 'icon_img' => '' ) |
| 765 |
, 'class' => 'wpbc_ui_button inactive' |
| 766 |
, 'style' => '' |
| 767 |
, 'attr' => array() |
| 768 |
); |
| 769 |
|
| 770 |
$params = array( |
| 771 |
'id' => 'wh_approved' |
| 772 |
, 'default' => isset( $escaped_search_request_params['wh_approved'] ) ? $escaped_search_request_params['wh_approved'] : $defaults['wh_approved'] |
| 773 |
, 'label' => ''//__('Status', 'booking') . ':' |
| 774 |
, 'title' => __('Status', 'booking') |
| 775 |
, 'hint' => array( 'title' => __('Filter bookings by booking status' ,'booking') , 'position' => 'top' ) |
| 776 |
, 'li_options' => array ( |
| 777 |
'0' => __( 'Pending', 'booking' ), |
| 778 |
'1' => __( 'Approved', 'booking' ), |
| 779 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 780 |
// 'header1' => array( 'type' => 'header', 'title' => __( 'Default', 'booking' ) ), |
| 781 |
'any' => array( |
| 782 |
'type' => 'simple', |
| 783 |
'value' => '', |
| 784 |
// 'disabled' => true, |
| 785 |
'title' => __( 'Any', 'booking' ) |
| 786 |
), |
| 787 |
) |
| 788 |
); |
| 789 |
|
| 790 |
?><div class="ui_element ui_nowrap"><?php |
| 791 |
|
| 792 |
//wpbc_flex_addon( $params_addon ); |
| 793 |
|
| 794 |
wpbc_flex_dropdown( $params ); |
| 795 |
|
| 796 |
?></div><?php |
| 797 |
} |
| 798 |
|
| 799 |
/** |
| 800 |
* Keywords |
| 801 |
* |
| 802 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 803 |
* @param $defaults - default parameters values |
| 804 |
*/ |
| 805 |
function wpbc_ajx_toolbar_keyword_search( $escaped_search_request_params, $defaults ){ |
| 806 |
|
| 807 |
$el_id = 'wpbc_search_field'; |
| 808 |
|
| 809 |
$default_value = ''; |
| 810 |
|
| 811 |
// Old way of searching booking ID |
| 812 |
if ( ! empty( $_REQUEST['wh_booking_id'] ) ) { |
| 813 |
$wh_booking_id = intval( $_REQUEST['wh_booking_id'] ); |
| 814 |
if ( $wh_booking_id > 0 ) { |
| 815 |
$_REQUEST['overwrite'] = 1; |
| 816 |
$_REQUEST['keyword'] = 'id:' . $wh_booking_id; |
| 817 |
} |
| 818 |
} |
| 819 |
|
| 820 |
if ( ( ! empty( $_REQUEST['overwrite'] ) ) && ( ! empty( $_REQUEST['keyword'] ) ) ) { |
| 821 |
|
| 822 |
// Searching for booking(s) from URL: http://beta/wp-admin/admin.php?page=wpbc&view_mode=vm_booking_listing&keyword=id:2&overwrite=1 |
| 823 |
|
| 824 |
$default_value = wpbc_sanitize_text( $_REQUEST['keyword'] ); |
| 825 |
|
| 826 |
?><script type="text/javascript"> |
| 827 |
jQuery( document ).ready( function (){ |
| 828 |
// setTimeout( function () { |
| 829 |
// wpbc_ajx_booking_listing.search_set_param( 'wh_booking_type', [0] ); |
| 830 |
// }, 950 ); |
| 831 |
wpbc_ajx_booking_searching_after_few_seconds( '#<?php echo $el_id; ?>', 1000 ); // Immediate search after 0.5 second |
| 832 |
} ); |
| 833 |
</script><?php |
| 834 |
} |
| 835 |
|
| 836 |
$params = array( |
| 837 |
'type' => 'text' |
| 838 |
, 'id' => $el_id |
| 839 |
, 'name' => $el_id |
| 840 |
, 'label' => '' |
| 841 |
, 'disabled' => false |
| 842 |
, 'class' => '' |
| 843 |
, 'style' => '' |
| 844 |
, 'placeholder' => __( 'Enter keyword to search...', 'booking' ) |
| 845 |
, 'attr' => array() |
| 846 |
, 'value' => $default_value |
| 847 |
, 'onfocus' => '' |
| 848 |
); |
| 849 |
?><div class="ui_element"><?php |
| 850 |
wpbc_flex_text( $params ); |
| 851 |
?></div><?php |
| 852 |
} |
| 853 |
|
| 854 |
|
| 855 |
//FixIn: 9.7.2.3 |
| 856 |
function wpbc_ajx_toolbar_clear_keyword_search( $escaped_search_request_params, $defaults ){ |
| 857 |
|
| 858 |
$params = array( |
| 859 |
'type' => 'button' , |
| 860 |
'title' => '',//__( 'Reset', 'booking' ) . ' ', // Title of the button |
| 861 |
'hint' => array( 'title' => __( 'Reset keyword text field', 'booking' ), 'position' => 'top' ), // Hint |
| 862 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 863 |
'action' => "jQuery( '#wpbc_search_field').val(''); |
| 864 |
wpbc_ajx_booking_send_search_request_with_params( { |
| 865 |
'keyword' : '', |
| 866 |
'page_num': 1 |
| 867 |
} ); |
| 868 |
", // JavaScript |
| 869 |
'icon' => array( |
| 870 |
'icon_font' => 'wpbc_icn_close', //'wpbc_icn_rotate_left', |
| 871 |
'position' => 'left', |
| 872 |
'icon_img' => '' |
| 873 |
), |
| 874 |
'class' => 'wpbc_button_as_icon', // '' | 'wpbc_ui_button_primary' |
| 875 |
'style' => '', // Any CSS class here |
| 876 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 877 |
'attr' => array() |
| 878 |
); |
| 879 |
|
| 880 |
?><div class="ui_element" style="flex: 0 1 auto;margin-left: -50px;z-index: 1;"><?php |
| 881 |
wpbc_flex_button( $params ); |
| 882 |
?></div><?php |
| 883 |
} |
| 884 |
|
| 885 |
/** |
| 886 |
* Reset button - init default filter options |
| 887 |
* |
| 888 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 889 |
* @param $defaults - default parameters values |
| 890 |
*/ |
| 891 |
function wpbc_ajx_toolbar_reset_button( $escaped_search_request_params, $defaults ){ |
| 892 |
|
| 893 |
$params = array( |
| 894 |
'type' => 'button' , |
| 895 |
'title' => __( 'Reset', 'booking' ) . ' ', // Title of the button |
| 896 |
'hint' => array( 'title' => __( 'Reset search filter and user options to default values', 'booking' ) . '. ' . __( 'Show all bookings.', 'booking' ), 'position' => 'top' ), // Hint |
| 897 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 898 |
'action' => "wpbc_ajx_booking_send_search_request_with_params( { |
| 899 |
'ui_reset': 'make_reset', |
| 900 |
'page_num': 1 |
| 901 |
} );", // JavaScript |
| 902 |
'icon' => array( |
| 903 |
'icon_font' => 'wpbc_icn_settings_backup_restore', //'wpbc_icn_rotate_left', |
| 904 |
'position' => 'left', |
| 905 |
'icon_img' => '' |
| 906 |
), |
| 907 |
'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary' |
| 908 |
'style' => '',// 'color: #ef6500;', //FixIn: 9.7.2.1 // Any CSS class here |
| 909 |
'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 910 |
'attr' => array() |
| 911 |
); |
| 912 |
|
| 913 |
?><div class="ui_element" style="margin-left: auto;"><?php |
| 914 |
wpbc_flex_button( $params ); |
| 915 |
?></div><?php |
| 916 |
} |
| 917 |
|
| 918 |
//////////////////////////////////////////////////////////////////////////////// |
| 919 |
/// 2nd row |
| 920 |
//////////////////////////////////////////////////////////////////////////////// |
| 921 |
|
| 922 |
/** |
| 923 |
* Booking resources |
| 924 |
* |
| 925 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 926 |
* @param $defaults - default parameters values |
| 927 |
*/ |
| 928 |
function wpbc_ajx__ui__booking_resources( $escaped_search_request_params, $defaults ){ |
| 929 |
|
| 930 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 931 |
return false; |
| 932 |
} |
| 933 |
|
| 934 |
$params_button = array( |
| 935 |
'type' => 'button' , |
| 936 |
'title' => '',//__( 'Reset', 'booking' ) . ' ', // Title of the button |
| 937 |
'hint' => array( 'title' => __( 'Remove all booking resources', 'booking' ), 'position' => 'top' ), // Hint |
| 938 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 939 |
'action' => "remove_all_options_from_choozen('#wh_booking_type');", // JavaScript |
| 940 |
'icon' => array( |
| 941 |
'icon_font' => 'wpbc_icn_close', |
| 942 |
'position' => 'left', |
| 943 |
'icon_img' => '' |
| 944 |
), |
| 945 |
'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary' |
| 946 |
'style' => '', // Any CSS class here |
| 947 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 948 |
'attr' => array( 'id' => 'wpbc_booking_listing_reload_button') |
| 949 |
); |
| 950 |
|
| 951 |
/** |
| 952 |
* result = {array} [12] |
| 953 |
1 = {array} [10] |
| 954 |
booking_type_id = "1" |
| 955 |
title = "Standard" |
| 956 |
users = "3" |
| 957 |
import = null |
| 958 |
export = null |
| 959 |
cost = "25" |
| 960 |
default_form = "owner-custom-form-1" |
| 961 |
prioritet = "2" |
| 962 |
parent = "0" |
| 963 |
visitors = "2" |
| 964 |
2 = {array} [10] |
| 965 |
booking_type_id = "2" |
| 966 |
title = "Apartment#1" ... |
| 967 |
*/ |
| 968 |
$resources_sql_arr = wpbc_ajx_get_all_booking_resources_arr(); |
| 969 |
|
| 970 |
/** |
| 971 |
* $resources_arr = array( linear_resources = {array} [12] single_or_parent = {array} [5] child = {array} [2] ) |
| 972 |
* |
| 973 |
$resources_arr = {array} [3] |
| 974 |
linear_resources = {array} [12] |
| 975 |
1 = {array} [12] |
| 976 |
booking_type_id = "1" |
| 977 |
title = "Standard" |
| 978 |
users = "3" |
| 979 |
import = null |
| 980 |
export = null |
| 981 |
cost = "25" |
| 982 |
default_form = "owner-custom-form-1" |
| 983 |
prioritet = "2" |
| 984 |
parent = "0" |
| 985 |
visitors = "2" |
| 986 |
id = "1" |
| 987 |
count = {int} 5 |
| 988 |
5 = {array} [12] |
| 989 |
booking_type_id = "5" |
| 990 |
title = "Standard-1" |
| 991 |
users = "1" |
| 992 |
import = null |
| 993 |
*/ |
| 994 |
$resources_arr = wpbc_ajx_arrange_booking_resources_arr( $resources_sql_arr ); |
| 995 |
$style = ''; |
| 996 |
$select_box_options = array(); //FixIn: 4.3.2.1 |
| 997 |
if ( ! empty( $resources_arr ) ) { |
| 998 |
|
| 999 |
$linear_resources_arr = $resources_arr['linear_resources']; |
| 1000 |
|
| 1001 |
|
| 1002 |
|
| 1003 |
if ( count( $linear_resources_arr ) > 1 ) { |
| 1004 |
|
| 1005 |
$resources_id_arr = array(); |
| 1006 |
foreach ( $linear_resources_arr as $bkr ) { |
| 1007 |
$resources_id_arr[] = $bkr['id']; |
| 1008 |
} |
| 1009 |
|
| 1010 |
$select_box_options[ /*implode( ',', $resources_id_arr )*/0 ] = array( |
| 1011 |
'title' => __( 'All resources', 'booking' ) |
| 1012 |
, 'attr' => array( 'title' => '<strong>' . __( 'All resources', 'booking' ) . '</strong>' ) |
| 1013 |
, 'style' => 'font-weight:600;' |
| 1014 |
); |
| 1015 |
} |
| 1016 |
|
| 1017 |
foreach ( $linear_resources_arr as $bkr ) { |
| 1018 |
|
| 1019 |
$option_title = wpbc_lang( $bkr['title'] ); |
| 1020 |
|
| 1021 |
if ( isset( $bkr['parent'] ) ) { |
| 1022 |
if ( $bkr ['parent'] == 0 ) { |
| 1023 |
$option_title = $option_title; |
| 1024 |
$style = 'font-weight:600;'; |
| 1025 |
} else { |
| 1026 |
$option_title = ' ' . $option_title; |
| 1027 |
$style = 'font-weight:400;'; |
| 1028 |
} |
| 1029 |
} |
| 1030 |
$select_box_options[ $bkr ['id'] ] = array( |
| 1031 |
'title' => $option_title |
| 1032 |
, 'attr' => array( 'title' => $option_title ) |
| 1033 |
, 'style' => $style |
| 1034 |
); |
| 1035 |
} |
| 1036 |
} |
| 1037 |
|
| 1038 |
|
| 1039 |
|
| 1040 |
$el_id = 'wh_booking_type'; |
| 1041 |
$params_select = array( |
| 1042 |
'id' => $el_id // HTML ID of element |
| 1043 |
, 'name' => $el_id |
| 1044 |
, 'label' => '' // __( 'Next Days', 'booking' ) // Label (optional) |
| 1045 |
, 'style' => '' // CSS of select element |
| 1046 |
, 'class' => 'chzn-select' // CSS Class of select element |
| 1047 |
, 'multiple' => true |
| 1048 |
, 'attr' => array( 'data-placeholder' => __( 'Select booking resources', 'booking' ) ) // Any additional attributes, if this radio | checkbox element |
| 1049 |
, 'disabled' => false |
| 1050 |
, 'disabled_options' => array() // If some options disabled, then it has to list here |
| 1051 |
, 'options' => $select_box_options |
| 1052 |
|
| 1053 |
, '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 |
| 1054 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 1055 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 1056 |
|
| 1057 |
); |
| 1058 |
|
| 1059 |
// Booking resources |
| 1060 |
?><div class="ui_element ui_nowrap"><?php |
| 1061 |
|
| 1062 |
wpbc_flex_select( $params_select ); |
| 1063 |
|
| 1064 |
wpbc_flex_button( $params_button ); |
| 1065 |
|
| 1066 |
?></div><?php |
| 1067 |
|
| 1068 |
?><script type="text/javascript"> |
| 1069 |
function remove_all_options_from_choozen( selectbox_id ){ |
| 1070 |
jQuery( selectbox_id + ' option' ).prop( 'selected', false ); // Disable selection in the real selectbox |
| 1071 |
jQuery( selectbox_id ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field //FixIn: 8.7.9.9 |
| 1072 |
jQuery( selectbox_id ).trigger( 'change' ); |
| 1073 |
} |
| 1074 |
|
| 1075 |
if ( 'function' === typeof( jQuery("#<?php echo $el_id; ?>").chosen ) ) { |
| 1076 |
|
| 1077 |
jQuery( "#<?php echo $el_id; ?>" ).chosen( {no_results_text: "No results matched"} ); |
| 1078 |
|
| 1079 |
jQuery("#<?php echo $el_id; ?>").chosen().on('change', function(va){ // Catch any selections in the Choozen |
| 1080 |
|
| 1081 |
if ( jQuery( "#<?php echo $el_id; ?>" ).val() != null ){ |
| 1082 |
//So we are having aready values |
| 1083 |
jQuery.each( jQuery( "#<?php echo $el_id; ?>" ).val(), function ( index, value ){ |
| 1084 |
|
| 1085 |
if ( (value.indexOf( ',' ) > 0) || ('0' === value) ){ // Ok we are have array with all booking resources ID |
| 1086 |
|
| 1087 |
// Disable selection in the real selectbox |
| 1088 |
jQuery( '#<?php echo $el_id; ?>' + ' option' ).removeAttr( 'selected' ); |
| 1089 |
|
| 1090 |
// Select "All resources" option in real selectbox |
| 1091 |
jQuery( '#<?php echo $el_id; ?>' + ' option:first-child' ).prop( "selected", true ); |
| 1092 |
|
| 1093 |
//Highlight options in chosen, before removing |
| 1094 |
jQuery( '#<?php echo $el_id; ?>_chosen li.search-choice:not(:contains(' + '<?php echo html_entity_decode( esc_js( __( 'All resources', 'booking' ) ) ); ?>' + '))' ) |
| 1095 |
.fadeOut( 350 ).fadeIn( 300 ) |
| 1096 |
.fadeOut( 350 ).fadeIn( 400 ) |
| 1097 |
.fadeOut( 350 ).fadeIn( 300 ) |
| 1098 |
.fadeOut( 350 ).fadeIn( 400 ) |
| 1099 |
.animate( {opacity: 1}, 4000 ) ; |
| 1100 |
|
| 1101 |
// Update chosen LI choices, relative selected options in selectbox |
| 1102 |
var all_resources_timer = setTimeout( function (){ |
| 1103 |
|
| 1104 |
jQuery( '#<?php echo $el_id; ?>' ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field |
| 1105 |
}, 2000 ); |
| 1106 |
|
| 1107 |
var my_message = '<?php echo html_entity_decode( 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' ) ), ENT_QUOTES ); ?>'; |
| 1108 |
wpbc_admin_show_message( my_message, 'warning', 10000 ); |
| 1109 |
} |
| 1110 |
} ); |
| 1111 |
} |
| 1112 |
}); |
| 1113 |
|
| 1114 |
} else { |
| 1115 |
alert( 'WPBC Error. JavaScript library "chosen" was not defined.' ); |
| 1116 |
} |
| 1117 |
</script><?php |
| 1118 |
} |
| 1119 |
|
| 1120 |
/** |
| 1121 |
* Existing | Trash | Any |
| 1122 |
* |
| 1123 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1124 |
* @param $defaults - default parameters values |
| 1125 |
*/ |
| 1126 |
function wpbc_ajx__ui__existing_or_trash( $escaped_search_request_params, $defaults ){ |
| 1127 |
|
| 1128 |
$params_addon = array( |
| 1129 |
'type' => 'span' |
| 1130 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 1131 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_delete_outline', 'position' => 'right', 'icon_img' => '' ) |
| 1132 |
, 'class' => 'wpbc_ui_button inactive' |
| 1133 |
, 'style' => '' |
| 1134 |
, 'attr' => array() |
| 1135 |
, 'hint' => array( 'title' => __('Show trashed or existing bookings' ,'booking') , 'position' => 'top' ) |
| 1136 |
); |
| 1137 |
|
| 1138 |
$el_id = 'wh_trash'; |
| 1139 |
$params = array( |
| 1140 |
'id' => $el_id |
| 1141 |
, 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1142 |
, 'label' => '' |
| 1143 |
, 'title' => '' //__('Bookings', 'booking') |
| 1144 |
, 'hint' => array( 'title' => __('Show trashed or existing bookings' ,'booking') , 'position' => 'top' ) |
| 1145 |
, 'li_options' => array( |
| 1146 |
'0' => __( 'Existing', 'booking' ), |
| 1147 |
'trash' => __( 'In Trash / Rejected', 'booking' ), |
| 1148 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1149 |
'any' => __( 'Any', 'booking' ) |
| 1150 |
) |
| 1151 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1152 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1153 |
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() )[0], 'page_num': 1 } );" |
| 1154 |
); |
| 1155 |
|
| 1156 |
?><div class="ui_element ui_nowrap"><?php |
| 1157 |
|
| 1158 |
wpbc_flex_addon( $params_addon ); |
| 1159 |
|
| 1160 |
wpbc_flex_dropdown( $params ); |
| 1161 |
|
| 1162 |
?></div><?php |
| 1163 |
} |
| 1164 |
|
| 1165 |
/** |
| 1166 |
* All bookings | New bookings | Imported bookings | Plugin bookings |
| 1167 |
* |
| 1168 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1169 |
* @param $defaults - default parameters values |
| 1170 |
*/ |
| 1171 |
function wpbc_ajx__ui__all_or_new( $escaped_search_request_params, $defaults ){ |
| 1172 |
|
| 1173 |
$params_addon = array( |
| 1174 |
'type' => 'span' |
| 1175 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 1176 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_visibility', 'position' => 'right', 'icon_img' => '' ) |
| 1177 |
, 'class' => 'wpbc_ui_button inactive' |
| 1178 |
, 'style' => '' |
| 1179 |
, 'attr' => array() |
| 1180 |
, 'hint' => array( 'title' => __('Filter bookings by additional criteria' ,'booking') , 'position' => 'top' ) |
| 1181 |
); |
| 1182 |
|
| 1183 |
$el_id = 'wh_what_bookings'; |
| 1184 |
$params = array( |
| 1185 |
'id' => $el_id |
| 1186 |
, 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1187 |
, 'label' => '' |
| 1188 |
, 'title' => '' //__('Show', 'booking') |
| 1189 |
, 'hint' => array( 'title' => __('Filter bookings by additional criteria' ,'booking') , 'position' => 'top' ) |
| 1190 |
, 'li_options' => array( |
| 1191 |
'all' => array( |
| 1192 |
'type' => 'simple', |
| 1193 |
'value' => 'any', |
| 1194 |
'title' => __( 'Any', 'booking' ) |
| 1195 |
), |
| 1196 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1197 |
'new' => __( 'New', 'booking' ), |
| 1198 |
'imported' => __( 'Imported', 'booking' ), |
| 1199 |
'in_plugin' => __( 'Plugin bookings', 'booking' ) |
| 1200 |
) |
| 1201 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1202 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1203 |
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() )[0], 'page_num': 1 } );" |
| 1204 |
); |
| 1205 |
|
| 1206 |
|
| 1207 |
?><div class="ui_element ui_nowrap"><?php |
| 1208 |
|
| 1209 |
wpbc_flex_addon( $params_addon ); |
| 1210 |
|
| 1211 |
wpbc_flex_dropdown( $params ); |
| 1212 |
|
| 1213 |
?></div><?php |
| 1214 |
} |
| 1215 |
|
| 1216 |
/** |
| 1217 |
* "Creation Date" of bookings |
| 1218 |
* |
| 1219 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1220 |
* @param $defaults - default parameters values |
| 1221 |
*/ |
| 1222 |
function wpbc_ajx__ui__creation_date( $escaped_search_request_params, $defaults ){ |
| 1223 |
|
| 1224 |
$params_addon = array( |
| 1225 |
'type' => 'span' |
| 1226 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 1227 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_edit_calendar', 'position' => 'right', 'icon_img' => '' ) |
| 1228 |
, 'class' => 'wpbc_ui_button inactive' |
| 1229 |
, 'style' => '' |
| 1230 |
, 'attr' => array() |
| 1231 |
, 'hint' => array( 'title' => __('Filter bookings by creation booking date' ,'booking') , 'position' => 'top' ) |
| 1232 |
); |
| 1233 |
|
| 1234 |
$dates_interval = array( |
| 1235 |
1 => '1' . ' ' . __('day' ,'booking') |
| 1236 |
, 2 => '2' . ' ' . __('days' ,'booking') |
| 1237 |
, 3 => '3' . ' ' . __('days' ,'booking') |
| 1238 |
, 4 => '4' . ' ' . __('days' ,'booking') |
| 1239 |
, 5 => '5' . ' ' . __('days' ,'booking') |
| 1240 |
, 6 => '6' . ' ' . __('days' ,'booking') |
| 1241 |
, 7 => '1' . ' ' . __('week' ,'booking') |
| 1242 |
, 14 => '2' . ' ' . __('weeks' ,'booking') |
| 1243 |
, 30 => '1' . ' ' . __('month' ,'booking') |
| 1244 |
, 60 => '2' . ' ' . __('months' ,'booking') |
| 1245 |
, 90 => '3' . ' ' . __('months' ,'booking') |
| 1246 |
, 183 => '6' . ' ' . __('months' ,'booking') |
| 1247 |
, 365 => '1' . ' ' . __('Year' ,'booking') |
| 1248 |
); |
| 1249 |
|
| 1250 |
$el_id = 'wh_modification_date'; |
| 1251 |
|
| 1252 |
$request_input_el_default = array( |
| 1253 |
$el_id => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ], |
| 1254 |
'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'], |
| 1255 |
'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'], |
| 1256 |
'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'], |
| 1257 |
'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'] |
| 1258 |
); |
| 1259 |
|
| 1260 |
$options = array ( |
| 1261 |
'1' => __( 'Today', 'booking' ), |
| 1262 |
'3' => __( 'All dates', 'booking' ), |
| 1263 |
|
| 1264 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1265 |
|
| 1266 |
// Prior [ '5', '10' ] |
| 1267 |
'prior' => array( |
| 1268 |
'type' => 'complex', |
| 1269 |
'class' => 'ui_complex_option_element', |
| 1270 |
'style' => 'min-width: 244px;', |
| 1271 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 1272 |
'selected_options_title' => array( 1 => array( 'label', 'title' ) |
| 1273 |
, 'text1' => ': ' |
| 1274 |
, 4 => array( 'options' , $request_input_el_default[ 'ui_wh_modification_date_prior'] ) |
| 1275 |
), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ] |
| 1276 |
'input_options' => array( |
| 1277 |
array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 1278 |
, array( |
| 1279 |
'type' => 'radio' |
| 1280 |
|
| 1281 |
, 'id' => 'ui_wh_modification_date_radio_2' // HTML ID of element |
| 1282 |
, 'name' => 'ui_wh_modification_date_radio' |
| 1283 |
, 'label' => array( 'title' => __('Prior' ,'booking') , 'position' => 'right' ) |
| 1284 |
, 'style' => '' // CSS of select element |
| 1285 |
, 'class' => '' // CSS Class of select element |
| 1286 |
, 'disabled' => false |
| 1287 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1288 |
, 'legend' => '' // aria-label parameter |
| 1289 |
, 'value' => '5' // Some Value from optins array that selected by default |
| 1290 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_modification_date_radio' ] == '5' ) ? true : false // Selected or not |
| 1291 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // 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 |
, array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 1296 |
, array( |
| 1297 |
'type' => 'select' |
| 1298 |
, 'attr' => array() |
| 1299 |
, 'name' => 'ui_wh_modification_date_prior' |
| 1300 |
, 'id' => 'ui_wh_modification_date_prior' |
| 1301 |
, 'options' => $dates_interval |
| 1302 |
, 'value' => $request_input_el_default[ 'ui_wh_modification_date_prior'] |
| 1303 |
, 'onfocus' => "jQuery('#ui_wh_modification_date_radio_2').prop('checked', true);" // JavaScript code |
| 1304 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1305 |
) |
| 1306 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1307 |
) |
| 1308 |
), |
| 1309 |
|
| 1310 |
// Fixed [ '6', '', '2022-05-21'] |
| 1311 |
'fixed' => array( |
| 1312 |
'type' => 'complex', |
| 1313 |
'class' => 'ui_complex_option_element', |
| 1314 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 1315 |
'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' ] |
| 1316 |
'input_options' => array( |
| 1317 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' ) |
| 1318 |
, array( |
| 1319 |
'type' => 'radio' |
| 1320 |
|
| 1321 |
, 'id' => 'ui_wh_modification_date_radio_3' // HTML ID of element |
| 1322 |
, 'name' => 'ui_wh_modification_date_radio' |
| 1323 |
, 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' ) |
| 1324 |
, 'style' => '' // CSS of select element |
| 1325 |
, 'class' => '' // CSS Class of select element |
| 1326 |
, 'disabled' => false |
| 1327 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1328 |
, 'legend' => '' // aria-label parameter |
| 1329 |
, 'value' => '6' // Some Value from optins array that selected by default |
| 1330 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_modification_date_radio' ] == '6' ) ? true : false // Selected or not |
| 1331 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1332 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1333 |
) |
| 1334 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1335 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;">' ) |
| 1336 |
, array( |
| 1337 |
'type' => 'text' |
| 1338 |
, 'id' => 'ui_wh_modification_date_checkin' // HTML ID of element |
| 1339 |
, 'name' => 'ui_wh_modification_date_checkin' |
| 1340 |
, 'label' => ''//__('Check-in' ,'booking') |
| 1341 |
, 'style' => 'width:100%;' // CSS of select element |
| 1342 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 1343 |
, 'disabled' => false |
| 1344 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1345 |
, 'placeholder' => __('From' ,'booking') // date( 'Y-m-d' ) |
| 1346 |
, 'value' => $request_input_el_default[ 'ui_wh_modification_date_checkin'] // Some Value from optins array that selected by default |
| 1347 |
, 'onfocus' => "jQuery('#ui_wh_modification_date_radio_3').prop('checked', true);" // JavaScript code |
| 1348 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1349 |
) |
| 1350 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1351 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;">' ) |
| 1352 |
, array( |
| 1353 |
'type' => 'text' |
| 1354 |
, 'id' => 'ui_wh_modification_date_checkout' // HTML ID of element |
| 1355 |
, 'name' => 'ui_wh_modification_date_checkout' |
| 1356 |
, 'label' => ''//__('Check-out' ,'booking') |
| 1357 |
, 'style' => 'width:100%;' // CSS of select element |
| 1358 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 1359 |
, 'disabled' => false |
| 1360 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1361 |
, 'placeholder' => __('To' ,'booking') // date( 'Y-m-d' ) |
| 1362 |
, 'value' => $request_input_el_default[ 'ui_wh_modification_date_checkout'] // Some Value from optins array that selected by default |
| 1363 |
, 'onfocus' => "jQuery('#ui_wh_modification_date_radio_3').prop('checked', true);" // JavaScript code |
| 1364 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1365 |
) |
| 1366 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1367 |
) |
| 1368 |
), |
| 1369 |
|
| 1370 |
'divider3' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1371 |
|
| 1372 |
// Buttons |
| 1373 |
'buttons1' => array( |
| 1374 |
'type' => 'complex', |
| 1375 |
'class' => 'ui_complex_option_element', |
| 1376 |
'style' => 'justify-content: flex-end;', |
| 1377 |
'input_options' => array( |
| 1378 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' ) |
| 1379 |
, array( |
| 1380 |
'type' => 'button' |
| 1381 |
, 'title' => __( 'Apply', 'booking' ) // Title of the button |
| 1382 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1383 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1384 |
, 'action' => "wpbc_ui_dropdown_apply_click( { |
| 1385 |
'dropdown_id' : 'wh_modification_date', |
| 1386 |
'dropdown_radio_name': 'ui_wh_modification_date_radio' |
| 1387 |
} );" // JavaScript code |
| 1388 |
, 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary |
| 1389 |
, 'icon' => '' |
| 1390 |
, 'font_icon' => '' |
| 1391 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1392 |
, 'style' => '' // Any CSS class here |
| 1393 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1394 |
, 'attr' => array() |
| 1395 |
) |
| 1396 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1397 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' ) |
| 1398 |
, array( |
| 1399 |
'type' => 'button' |
| 1400 |
, 'title' => __( 'Close', 'booking' ) // Title of the button |
| 1401 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1402 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1403 |
, 'action' => "wpbc_ui_dropdown_close_click( 'wh_modification_date' );" // JavaScript code |
| 1404 |
, 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary |
| 1405 |
, 'icon' => '' |
| 1406 |
, 'font_icon' => '' |
| 1407 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1408 |
, 'style' => '' // Any CSS class here |
| 1409 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1410 |
, 'attr' => array() |
| 1411 |
) |
| 1412 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1413 |
) |
| 1414 |
), |
| 1415 |
); |
| 1416 |
|
| 1417 |
$params = array( |
| 1418 |
'id' => $el_id |
| 1419 |
, 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1420 |
, 'label' => '' |
| 1421 |
, 'title' => ''//__('Creation', 'booking') |
| 1422 |
, 'hint' => array( 'title' => __('Filter bookings by creation booking date' ,'booking') , 'position' => 'top' ) |
| 1423 |
, 'li_options' => $options |
| 1424 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1425 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1426 |
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() ), 'page_num': 1 " |
| 1427 |
// // Frontend selected elements (saving for future use, after F5) |
| 1428 |
// . " ,'ui_wh_modification_date_radio' : jQuery( 'input[name=\"ui_wh_modification_date_radio\"]:checked' ).val()" |
| 1429 |
// . " ,'ui_wh_modification_date_prior' : jQuery( '#ui_wh_modification_date_prior' ).val()" |
| 1430 |
// . " ,'ui_wh_modification_date_checkin' : jQuery( '#ui_wh_modification_date_checkin' ).val()" |
| 1431 |
// . " ,'ui_wh_modification_date_checkout': jQuery( '#ui_wh_modification_date_checkout' ).val()" |
| 1432 |
// ."} );" |
| 1433 |
); |
| 1434 |
|
| 1435 |
?><div class="ui_element ui_nowrap"><?php |
| 1436 |
|
| 1437 |
wpbc_flex_addon( $params_addon ); |
| 1438 |
|
| 1439 |
wpbc_flex_dropdown( $params ); |
| 1440 |
|
| 1441 |
?></div><?php |
| 1442 |
} |
| 1443 |
|
| 1444 |
/** |
| 1445 |
* Payment Status |
| 1446 |
* |
| 1447 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1448 |
* @param $defaults - default parameters values |
| 1449 |
*/ |
| 1450 |
function wpbc_ajx__ui__payment_status( $escaped_search_request_params, $defaults ){ |
| 1451 |
|
| 1452 |
if ( ! class_exists( 'wpdev_bk_biz_s' ) ) { |
| 1453 |
return false; |
| 1454 |
} |
| 1455 |
|
| 1456 |
$params_addon = array( |
| 1457 |
'type' => 'span' |
| 1458 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 1459 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_payments', 'position' => 'right', 'icon_img' => '' ) |
| 1460 |
, 'class' => 'wpbc_ui_button inactive' |
| 1461 |
, 'style' => '' |
| 1462 |
, 'attr' => array() |
| 1463 |
, 'hint' => array( 'title' => __('Filter bookings by payment status' ,'booking') , 'position' => 'top' ) |
| 1464 |
); |
| 1465 |
|
| 1466 |
$el_id = 'wh_pay_status'; |
| 1467 |
|
| 1468 |
$request_input_el_default = array( |
| 1469 |
$el_id => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ], |
| 1470 |
'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'], |
| 1471 |
'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'] |
| 1472 |
); |
| 1473 |
|
| 1474 |
$options = array ( |
| 1475 |
'all' => __( 'Any Status', 'booking' ), |
| 1476 |
'divider0' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1477 |
'group_ok' => __( 'Paid OK', 'booking' ), |
| 1478 |
'group_unknown' => __( 'Unknown Status', 'booking' ), |
| 1479 |
'group_pending' => __( 'Not Completed', 'booking' ), |
| 1480 |
'group_failed' => __( 'Failed', 'booking' ), |
| 1481 |
|
| 1482 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1483 |
|
| 1484 |
// Fixed [ '6', '', '2022-05-21'] |
| 1485 |
'custom' => array( |
| 1486 |
'type' => 'complex', |
| 1487 |
'class' => 'ui_complex_option_element', |
| 1488 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 1489 |
'selected_options_title' => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ) ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ] |
| 1490 |
'input_options' => array( |
| 1491 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' ) |
| 1492 |
, array( |
| 1493 |
'type' => 'radio' |
| 1494 |
|
| 1495 |
, 'id' => 'ui_wh_pay_status_radio_1' // HTML ID of element |
| 1496 |
, 'name' => 'ui_wh_pay_status_radio' |
| 1497 |
, 'label' => array( 'title' => __('Custom' ,'booking') , 'position' => 'right' ) |
| 1498 |
, 'style' => '' // CSS of select element |
| 1499 |
, 'class' => '' // CSS Class of select element |
| 1500 |
, 'disabled' => false |
| 1501 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1502 |
, 'legend' => '' // aria-label parameter |
| 1503 |
, 'value' => 'user_entered' // Some Value from optins array that selected by default |
| 1504 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_pay_status_radio' ] == 'user_entered' ) ? true : false // Selected or not |
| 1505 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1506 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1507 |
) |
| 1508 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1509 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;">' ) |
| 1510 |
, array( |
| 1511 |
'type' => 'text' |
| 1512 |
, 'id' => 'ui_wh_pay_status_custom' // HTML ID of element |
| 1513 |
, 'name' => 'ui_wh_pay_status_custom' |
| 1514 |
, 'label' => ''//__('Check-out' ,'booking') |
| 1515 |
, 'style' => 'max-width:100%;width:100%;' // CSS of select element |
| 1516 |
, 'class' => '' // CSS Class of select element |
| 1517 |
, 'disabled' => false |
| 1518 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1519 |
, 'placeholder' => __('Payment status' ,'booking') // date( 'Y-m-d' ) |
| 1520 |
, 'value' => $request_input_el_default[ 'ui_wh_pay_status_custom'] // Some Value from optins array that selected by default |
| 1521 |
, 'onfocus' => "jQuery('#ui_wh_pay_status_radio_1').prop('checked', true);" // JavaScript code |
| 1522 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1523 |
) |
| 1524 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1525 |
) |
| 1526 |
), |
| 1527 |
|
| 1528 |
|
| 1529 |
// Buttons |
| 1530 |
'buttons1' => array( |
| 1531 |
'type' => 'complex', |
| 1532 |
'class' => 'ui_complex_option_element', |
| 1533 |
'style' => 'justify-content: flex-end;', |
| 1534 |
'input_options' => array( |
| 1535 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' ) |
| 1536 |
, array( |
| 1537 |
'type' => 'button' |
| 1538 |
, 'title' => __( 'Apply', 'booking' ) // Title of the button |
| 1539 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1540 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1541 |
, 'action' => "wpbc_ui_dropdown_apply_click( { |
| 1542 |
'dropdown_id' : 'wh_pay_status', |
| 1543 |
'dropdown_radio_name': 'ui_wh_pay_status_radio' |
| 1544 |
} );" // JavaScript code |
| 1545 |
, 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary |
| 1546 |
, 'icon' => '' |
| 1547 |
, 'font_icon' => '' |
| 1548 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1549 |
, 'style' => '' // Any CSS class here |
| 1550 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1551 |
, 'attr' => array() |
| 1552 |
) |
| 1553 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1554 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' ) |
| 1555 |
, array( |
| 1556 |
'type' => 'button' |
| 1557 |
, 'title' => __( 'Close', 'booking' ) // Title of the button |
| 1558 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1559 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1560 |
, 'action' => "wpbc_ui_dropdown_close_click( 'wh_pay_status' );" // JavaScript code |
| 1561 |
, 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary |
| 1562 |
, 'icon' => '' |
| 1563 |
, 'font_icon' => '' |
| 1564 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1565 |
, 'style' => '' // Any CSS class here |
| 1566 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1567 |
, 'attr' => array() |
| 1568 |
) |
| 1569 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1570 |
) |
| 1571 |
), |
| 1572 |
); |
| 1573 |
|
| 1574 |
$params = array( |
| 1575 |
'id' => $el_id |
| 1576 |
, 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1577 |
, 'label' => '' |
| 1578 |
, 'title' => ''//__('Payment', 'booking') |
| 1579 |
, 'hint' => array( 'title' => __('Filter bookings by payment status' ,'booking') , 'position' => 'top' ) |
| 1580 |
, 'li_options' => $options |
| 1581 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1582 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1583 |
///*, 'onchange' =>*/. "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() ), 'page_num': 1 " |
| 1584 |
// // Frontend selected elements (saving for future use, after F5) |
| 1585 |
// . " ,'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()" |
| 1586 |
// . " ,'ui_wh_pay_status_custom' : jQuery( '#ui_wh_pay_status_custom' ).val()" |
| 1587 |
// ."} );" |
| 1588 |
); |
| 1589 |
|
| 1590 |
|
| 1591 |
?><div class="ui_element ui_nowrap"><?php |
| 1592 |
|
| 1593 |
wpbc_flex_addon( $params_addon ); |
| 1594 |
|
| 1595 |
wpbc_flex_dropdown( $params ); |
| 1596 |
|
| 1597 |
?></div><?php |
| 1598 |
} |
| 1599 |
|
| 1600 |
/** |
| 1601 |
* Costs Min - Max |
| 1602 |
* |
| 1603 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1604 |
* @param $defaults - default parameters values |
| 1605 |
*/ |
| 1606 |
function wpbc_ajx__ui__cost_min_max( $escaped_search_request_params, $defaults ){ |
| 1607 |
|
| 1608 |
if ( ! class_exists( 'wpdev_bk_biz_s' ) ) { |
| 1609 |
return false; |
| 1610 |
} |
| 1611 |
|
| 1612 |
$el_id = 'wh_cost'; |
| 1613 |
|
| 1614 |
$params = array( |
| 1615 |
'id' => $el_id // HTML ID of element |
| 1616 |
, 'name' => $el_id |
| 1617 |
, 'label' => '<span class="" style="font-weight:600;">' . __( 'Cost', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>' |
| 1618 |
, 'style' => 'max-width: 69px;' // CSS of select element |
| 1619 |
, 'class' => '' // CSS Class of select element |
| 1620 |
, 'disabled' => false |
| 1621 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1622 |
, 'placeholder' => '0' |
| 1623 |
, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1624 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1625 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1626 |
); |
| 1627 |
?><div class="ui_element" style="margin-right: 5px;"><?php |
| 1628 |
|
| 1629 |
wpbc_flex_text( $params ); |
| 1630 |
|
| 1631 |
?></div><?php |
| 1632 |
|
| 1633 |
|
| 1634 |
$el_id = 'wh_cost2'; |
| 1635 |
|
| 1636 |
$params = array( |
| 1637 |
'id' => $el_id // HTML ID of element |
| 1638 |
, 'name' => $el_id |
| 1639 |
, 'label' => '<span class="" style="font-weight:600;"> ‐ </span>' |
| 1640 |
, 'style' => 'max-width: 69px;' // CSS of select element |
| 1641 |
, 'class' => '' // CSS Class of select element |
| 1642 |
, 'disabled' => false |
| 1643 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1644 |
, 'placeholder' => '10000' |
| 1645 |
, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1646 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1647 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1648 |
); |
| 1649 |
?><div class="ui_element"><?php |
| 1650 |
|
| 1651 |
wpbc_flex_text( $params ); |
| 1652 |
|
| 1653 |
?></div><?php |
| 1654 |
|
| 1655 |
} |
| 1656 |
|
| 1657 |
/** |
| 1658 |
* Reload button - force loading of ajax data |
| 1659 |
* |
| 1660 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1661 |
* @param $defaults - default parameters values |
| 1662 |
*/ |
| 1663 |
function wpbc_ajx_toolbar_force_reload_button( $escaped_search_request_params, $defaults ){ |
| 1664 |
|
| 1665 |
$params = array( |
| 1666 |
'type' => 'button' , |
| 1667 |
'title' => '',//__( 'Reset', 'booking' ) . ' ', // Title of the button |
| 1668 |
'hint' => array( 'title' => __( 'Reload bookings listing', 'booking' ), 'position' => 'top' ), // Hint |
| 1669 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1670 |
'action' => "wpbc_ajx_booking_send_search_request_with_params( { } );", // Some JavaScript |
| 1671 |
'icon' => array( |
| 1672 |
'icon_font' => 'wpbc_icn_rotate_right wpbc_spin', //'wpbc_icn_rotate_left', |
| 1673 |
'position' => 'left', |
| 1674 |
'icon_img' => '' |
| 1675 |
), |
| 1676 |
'class' => 'wpbc_ui_button wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary' |
| 1677 |
'style' => '', // Any CSS class here |
| 1678 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1679 |
'attr' => array( 'id' => 'wpbc_booking_listing_reload_button') |
| 1680 |
); |
| 1681 |
|
| 1682 |
?><div class="ui_element" style="flex: 0 1 auto;"><?php |
| 1683 |
wpbc_flex_button( $params ); |
| 1684 |
?></div><?php |
| 1685 |
} |
| 1686 |
|
| 1687 |
// </editor-fold> |
| 1688 |
|
| 1689 |
|
| 1690 |
// <editor-fold defaultstate="collapsed" desc=" T o o l b a r A c t i o n B u t t o n s " > |
| 1691 |
|
| 1692 |
//////////////////////////////////////////////////////////////////////////////// |
| 1693 |
// T o o l b a r A C T I O N S UI elements |
| 1694 |
//////////////////////////////////////////////////////////////////////////////// |
| 1695 |
|
| 1696 |
function wpbc_ajx__ui__action_button__approve( $escaped_search_request_params ){ |
| 1697 |
|
| 1698 |
$booking_action = 'set_booking_approved'; |
| 1699 |
|
| 1700 |
$el_id = 'ui_btn_' . $booking_action; |
| 1701 |
|
| 1702 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1703 |
return false; |
| 1704 |
} |
| 1705 |
|
| 1706 |
$params = array( |
| 1707 |
'type' => 'button' , |
| 1708 |
'title' => __( 'Approve', 'booking' ) . ' ', // Title of the button |
| 1709 |
'hint' => array( 'title' => __( 'Approve selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1710 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1711 |
'action' => "wpbc_ajx_booking_ajax_action_request( { |
| 1712 |
'booking_action' : '{$booking_action}', |
| 1713 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1714 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1715 |
'ui_clicked_element_id': '{$el_id}' |
| 1716 |
} ); |
| 1717 |
wpbc_button_enable_loading_icon( this ); " , |
| 1718 |
'icon' => array( |
| 1719 |
'icon_font' => 'wpbc_icn_check_circle_outline', |
| 1720 |
'position' => 'right', |
| 1721 |
'icon_img' => '' |
| 1722 |
), |
| 1723 |
'class' => 'wpbc_ui_button_primary hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1724 |
'style' => '', // Any CSS class here |
| 1725 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1726 |
'attr' => array( 'id' => $el_id ) |
| 1727 |
); |
| 1728 |
|
| 1729 |
wpbc_flex_button( $params ); |
| 1730 |
} |
| 1731 |
|
| 1732 |
function wpbc_ajx__ui__action_button__pending( $escaped_search_request_params ){ |
| 1733 |
|
| 1734 |
$booking_action = 'set_booking_pending'; |
| 1735 |
|
| 1736 |
$el_id = 'ui_btn_' . $booking_action; |
| 1737 |
|
| 1738 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1739 |
return false; |
| 1740 |
} |
| 1741 |
|
| 1742 |
$params = array( |
| 1743 |
'type' => 'button' , |
| 1744 |
'title' => __( 'Pending', 'booking' ) . ' ', // Title of the button |
| 1745 |
'hint' => array( 'title' => __( 'Set selected bookings as pending', 'booking' ), 'position' => 'top' ), // Hint |
| 1746 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1747 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to set booking as pending ?', 'booking' ) ) . "') ) { |
| 1748 |
wpbc_ajx_booking_ajax_action_request( { |
| 1749 |
'booking_action' : '{$booking_action}', |
| 1750 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1751 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1752 |
'ui_clicked_element_id': '{$el_id}' |
| 1753 |
} ); |
| 1754 |
wpbc_button_enable_loading_icon( this ); |
| 1755 |
}" , |
| 1756 |
'icon' => array( |
| 1757 |
'icon_font' => 'wpbc_icn_block', |
| 1758 |
'position' => 'right', |
| 1759 |
'icon_img' => '' |
| 1760 |
), |
| 1761 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1762 |
'style' => '', // Any CSS class here |
| 1763 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1764 |
'attr' => array( 'id' => $el_id ) |
| 1765 |
); |
| 1766 |
|
| 1767 |
wpbc_flex_button( $params ); |
| 1768 |
} |
| 1769 |
|
| 1770 |
function wpbc_ajx__ui__action_button__trash( $escaped_search_request_params ){ |
| 1771 |
|
| 1772 |
$booking_action = 'move_booking_to_trash'; |
| 1773 |
|
| 1774 |
$el_id = 'ui_btn_' . $booking_action; |
| 1775 |
|
| 1776 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1777 |
return false; |
| 1778 |
} |
| 1779 |
|
| 1780 |
$params = array( |
| 1781 |
'type' => 'button' , |
| 1782 |
'title' => __( 'Trash / Reject', 'booking' ) . ' ', // Title of the button |
| 1783 |
'hint' => array( 'title' => __( 'Reject booking - move selected bookings to trash', 'booking' ), 'position' => 'top' ), // Hint |
| 1784 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1785 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { |
| 1786 |
wpbc_ajx_booking_ajax_action_request( { |
| 1787 |
'booking_action' : '{$booking_action}', |
| 1788 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1789 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1790 |
'ui_clicked_element_id': '{$el_id}' |
| 1791 |
} ); |
| 1792 |
wpbc_button_enable_loading_icon( this ); |
| 1793 |
}" , |
| 1794 |
'icon' => array( |
| 1795 |
'icon_font' => 'wpbc_icn_delete_outline', |
| 1796 |
'position' => 'right', |
| 1797 |
'icon_img' => '' |
| 1798 |
), |
| 1799 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1800 |
'style' => '', // Any CSS class here |
| 1801 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1802 |
'attr' => array( 'id' => $el_id ) |
| 1803 |
); |
| 1804 |
|
| 1805 |
wpbc_flex_button( $params ); |
| 1806 |
} |
| 1807 |
|
| 1808 |
function wpbc_ajx__ui__action_button__restore( $escaped_search_request_params ){ |
| 1809 |
|
| 1810 |
$booking_action = 'restore_booking_from_trash'; |
| 1811 |
|
| 1812 |
$el_id = 'ui_btn_' . $booking_action; |
| 1813 |
|
| 1814 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1815 |
return false; |
| 1816 |
} |
| 1817 |
|
| 1818 |
$params = array( |
| 1819 |
'type' => 'button' , |
| 1820 |
'title' => __( 'Restore', 'booking' ) . ' ', // Title of the button |
| 1821 |
'hint' => array( 'title' => __( 'Restore selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1822 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1823 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { |
| 1824 |
wpbc_ajx_booking_ajax_action_request( { |
| 1825 |
'booking_action' : '{$booking_action}', |
| 1826 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1827 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1828 |
'ui_clicked_element_id': '{$el_id}' |
| 1829 |
} ); |
| 1830 |
wpbc_button_enable_loading_icon( this ); |
| 1831 |
}" , |
| 1832 |
'icon' => array( |
| 1833 |
'icon_font' => 'wpbc_icn_rotate_left', |
| 1834 |
'position' => 'right', |
| 1835 |
'icon_img' => '' |
| 1836 |
), |
| 1837 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1838 |
'style' => '', // Any CSS class here |
| 1839 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1840 |
'attr' => array( 'id' => $el_id ) |
| 1841 |
); |
| 1842 |
|
| 1843 |
wpbc_flex_button( $params ); |
| 1844 |
} |
| 1845 |
|
| 1846 |
function wpbc_ajx__ui__action_button__delete( $escaped_search_request_params ){ |
| 1847 |
|
| 1848 |
$booking_action = 'delete_booking_completely'; |
| 1849 |
|
| 1850 |
$el_id = 'ui_btn_' . $booking_action; |
| 1851 |
|
| 1852 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1853 |
return false; |
| 1854 |
} |
| 1855 |
|
| 1856 |
$params = array( |
| 1857 |
'type' => 'button' , |
| 1858 |
'title' => __( 'Delete', 'booking' ) . ' ', // Title of the button |
| 1859 |
'hint' => array( 'title' => __( 'Delete selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1860 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1861 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to delete selected booking(s) ?', 'booking' ) ) . "') ) { |
| 1862 |
wpbc_ajx_booking_ajax_action_request( { |
| 1863 |
'booking_action' : '{$booking_action}', |
| 1864 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1865 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1866 |
'ui_clicked_element_id': '{$el_id}' |
| 1867 |
} ); |
| 1868 |
wpbc_button_enable_loading_icon( this ); |
| 1869 |
}" , |
| 1870 |
'icon' => array( |
| 1871 |
'icon_font' => 'wpbc_icn_close', |
| 1872 |
'position' => 'right', |
| 1873 |
'icon_img' => '' |
| 1874 |
), |
| 1875 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1876 |
'style' => '', // Any CSS class here |
| 1877 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1878 |
'attr' => array( 'id' => $el_id ) |
| 1879 |
); |
| 1880 |
|
| 1881 |
wpbc_flex_button( $params ); |
| 1882 |
} |
| 1883 |
|
| 1884 |
function wpbc_ajx__ui__action_text__delete_reason( $escaped_search_request_params ){ |
| 1885 |
|
| 1886 |
$params = array( |
| 1887 |
'type' => 'text' |
| 1888 |
, 'id' => 'reason_of_action' |
| 1889 |
, 'name' => 'reason_of_action' |
| 1890 |
, 'label' => '' |
| 1891 |
, 'disabled' => false |
| 1892 |
, 'class' => 'hide_button_if_no_selection' |
| 1893 |
, 'style' => '' |
| 1894 |
, 'placeholder' => __( 'Reason of action', 'booking' ) |
| 1895 |
, 'attr' => array() |
| 1896 |
, 'value' => '' |
| 1897 |
, 'onfocus' => '' |
| 1898 |
); |
| 1899 |
wpbc_flex_text( $params ); |
| 1900 |
} |
| 1901 |
|
| 1902 |
function wpbc_ajx__ui__action_button__readall( $escaped_search_request_params ){ |
| 1903 |
|
| 1904 |
$booking_action = 'set_booking_as_read'; |
| 1905 |
|
| 1906 |
$el_id = 'ui_btn_all_' . $booking_action; |
| 1907 |
|
| 1908 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1909 |
return false; |
| 1910 |
} |
| 1911 |
|
| 1912 |
$params = array( |
| 1913 |
'type' => 'button' , |
| 1914 |
'title' => __( 'Read All', 'booking' ) . ' ', // Title of the button |
| 1915 |
'hint' => array( 'title' => __( 'Mark as read all bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1916 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1917 |
'action' => "wpbc_ajx_booking_ajax_action_request( { |
| 1918 |
'booking_action' : '{$booking_action}', |
| 1919 |
'booking_id' : '-1', |
| 1920 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1921 |
'ui_clicked_element_id': '{$el_id}' |
| 1922 |
} ); |
| 1923 |
wpbc_button_enable_loading_icon( this ); " , |
| 1924 |
'icon' => array( |
| 1925 |
'icon_font' => 'wpbc_icn_disabled_visible', |
| 1926 |
'position' => 'right', |
| 1927 |
'icon_img' => '' |
| 1928 |
), |
| 1929 |
'class' => '', // '' | 'wpbc_ui_button_primary' |
| 1930 |
'style' => '', // Any CSS class here |
| 1931 |
'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1932 |
'attr' => array( 'id' => $el_id ) |
| 1933 |
); |
| 1934 |
|
| 1935 |
wpbc_flex_button( $params ); |
| 1936 |
} |
| 1937 |
|
| 1938 |
function wpbc_ajx__ui__action_button__read( $escaped_search_request_params ){ |
| 1939 |
|
| 1940 |
$booking_action = 'set_booking_as_read'; |
| 1941 |
|
| 1942 |
$el_id = 'ui_btn_' . $booking_action; |
| 1943 |
|
| 1944 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1945 |
return false; |
| 1946 |
} |
| 1947 |
|
| 1948 |
$params = array( |
| 1949 |
'type' => 'button' , |
| 1950 |
'title' => __( 'Read', 'booking' ) . ' ', // Title of the button |
| 1951 |
'hint' => array( 'title' => __( 'Mark as read selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1952 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1953 |
'action' => "wpbc_ajx_booking_ajax_action_request( { |
| 1954 |
'booking_action' : '{$booking_action}', |
| 1955 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1956 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1957 |
'ui_clicked_element_id': '{$el_id}' |
| 1958 |
} ); |
| 1959 |
wpbc_button_enable_loading_icon( this ); " , |
| 1960 |
'icon' => array( |
| 1961 |
'icon_font' => 'wpbc_icn_visibility_off', |
| 1962 |
'position' => 'right', |
| 1963 |
'icon_img' => '' |
| 1964 |
), |
| 1965 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1966 |
'style' => '', // Any CSS class here |
| 1967 |
'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1968 |
'attr' => array( 'id' => $el_id ) |
| 1969 |
); |
| 1970 |
|
| 1971 |
wpbc_flex_button( $params ); |
| 1972 |
} |
| 1973 |
|
| 1974 |
function wpbc_ajx__ui__action_button__unread( $escaped_search_request_params ){ |
| 1975 |
|
| 1976 |
$booking_action = 'set_booking_as_unread'; |
| 1977 |
|
| 1978 |
$el_id = 'ui_btn_' . $booking_action; |
| 1979 |
|
| 1980 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1981 |
return false; |
| 1982 |
} |
| 1983 |
|
| 1984 |
$params = array( |
| 1985 |
'type' => 'button' , |
| 1986 |
'title' => __( 'Unread', 'booking' ) . ' ', // Title of the button |
| 1987 |
'hint' => array( 'title' => __( 'Mark as Unread selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1988 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1989 |
'action' => "wpbc_ajx_booking_ajax_action_request( { |
| 1990 |
'booking_action' : '{$booking_action}', |
| 1991 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1992 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1993 |
'ui_clicked_element_id': '{$el_id}' |
| 1994 |
} ); |
| 1995 |
wpbc_button_enable_loading_icon( this ); " , |
| 1996 |
'icon' => array( |
| 1997 |
'icon_font' => 'wpbc_icn_visibility', |
| 1998 |
'position' => 'right', |
| 1999 |
'icon_img' => '' |
| 2000 |
), |
| 2001 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 2002 |
'style' => '', // Any CSS class here |
| 2003 |
'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 2004 |
'attr' => array( 'id' => $el_id ) |
| 2005 |
); |
| 2006 |
|
| 2007 |
wpbc_flex_button( $params ); |
| 2008 |
} |
| 2009 |
|
| 2010 |
function wpbc_ajx__ui__action_button__print( $escaped_search_request_params ){ |
| 2011 |
$user_bk_id = 1; |
| 2012 |
$params = array( |
| 2013 |
'type' => 'button', |
| 2014 |
'title' => __( 'Print', 'booking' ) . ' ', |
| 2015 |
'hint' => array( |
| 2016 |
'title' => __( 'Print bookings listing', 'booking' ), |
| 2017 |
'position' => 'top' |
| 2018 |
), |
| 2019 |
'link' => 'javascript:void(0)', |
| 2020 |
'action' => "wpbc_print_dialog__show();", |
| 2021 |
'icon' => array( |
| 2022 |
'icon_font' => 'wpbc_icn_print', |
| 2023 |
'position' => 'right', |
| 2024 |
'icon_img' => '' |
| 2025 |
), |
| 2026 |
'class' => '', |
| 2027 |
'style' => '', |
| 2028 |
'attr' => array(), |
| 2029 |
'mobile_show_text' => true |
| 2030 |
); |
| 2031 |
wpbc_flex_button( $params ); |
| 2032 |
} |
| 2033 |
|
| 2034 |
function wpbc_ajx__ui__action_button__import( $escaped_search_request_params ){ |
| 2035 |
|
| 2036 |
$booking_action = 'import_google_calendar'; |
| 2037 |
|
| 2038 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2039 |
return false; |
| 2040 |
} |
| 2041 |
|
| 2042 |
|
| 2043 |
$booking_gcal_feed = get_bk_option( 'booking_gcal_feed'); |
| 2044 |
|
| 2045 |
if ( ( ! class_exists( 'wpdev_bk_personal' ) ) && ( $booking_gcal_feed == '' ) ) { |
| 2046 |
$is_this_btn_disabled = true; |
| 2047 |
} else { |
| 2048 |
$is_this_btn_disabled = false; |
| 2049 |
} |
| 2050 |
|
| 2051 |
$params = array( |
| 2052 |
'type' => 'button', |
| 2053 |
'title' => __( 'Import', 'booking' ) . ' ', |
| 2054 |
'hint' => array( |
| 2055 |
'title' => __( 'Import Google Calendar Events', 'booking' ), |
| 2056 |
'position' => 'top' |
| 2057 |
), |
| 2058 |
'link' => 'javascript:void(0)', |
| 2059 |
'action' => " if ( 'function' === typeof( jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal ) ) { |
| 2060 |
jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal('show'); |
| 2061 |
} else { |
| 2062 |
alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.'); |
| 2063 |
}", |
| 2064 |
'icon' => array( |
| 2065 |
'icon_font' => 'wpbc_icn_event', |
| 2066 |
'position' => 'right', |
| 2067 |
'icon_img' => '' |
| 2068 |
), |
| 2069 |
'class' => '',//( $is_this_btn_disabled ? ' disabled' : '' ), |
| 2070 |
'style' => '', |
| 2071 |
'attr' => array(), |
| 2072 |
'mobile_show_text' => true |
| 2073 |
); |
| 2074 |
wpbc_flex_button( $params ); |
| 2075 |
} |
| 2076 |
|
| 2077 |
function wpbc_ajx__ui__action_button__export_csv( $escaped_search_request_params ){ |
| 2078 |
|
| 2079 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 2080 |
return false; |
| 2081 |
} |
| 2082 |
|
| 2083 |
$booking_action = 'export_csv'; |
| 2084 |
$el_id = 'ui_btn_' . $booking_action; |
| 2085 |
|
| 2086 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2087 |
return false; |
| 2088 |
} |
| 2089 |
|
| 2090 |
$params = array( |
| 2091 |
'type' => 'button', |
| 2092 |
'title' => __( 'Export to CSV', 'booking' ) . ' ', |
| 2093 |
'hint' => array( |
| 2094 |
'title' => __( 'Export bookings to CSV format', 'booking' ), |
| 2095 |
'position' => 'top' |
| 2096 |
), |
| 2097 |
'link' => 'javascript:void(0)', |
| 2098 |
//'action' => wpbc_csv_get_url_for_button( 'page' ), |
| 2099 |
'action' => "if ( 'function' === typeof( jQuery('#wpbc_modal__export_csv__section').wpbc_my_modal ) ) { |
| 2100 |
jQuery('#wpbc_modal__export_csv__section').wpbc_my_modal('show'); |
| 2101 |
} else { |
| 2102 |
alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.'); |
| 2103 |
}", |
| 2104 |
'icon' => array( |
| 2105 |
'icon_font' => 'wpbc_icn_file_upload', |
| 2106 |
'position' => 'right', |
| 2107 |
'icon_img' => '' |
| 2108 |
), |
| 2109 |
'class' => '', |
| 2110 |
'style' => '', |
| 2111 |
'attr' => array( 'id' => $el_id ), |
| 2112 |
'mobile_show_text' => true |
| 2113 |
); |
| 2114 |
wpbc_flex_button( $params ); |
| 2115 |
} |
| 2116 |
|
| 2117 |
function wpbc_ajx__ui__action_button__export_csv_page( $escaped_search_request_params ){ |
| 2118 |
|
| 2119 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 2120 |
return false; |
| 2121 |
} |
| 2122 |
|
| 2123 |
$booking_action = 'export_csv'; |
| 2124 |
$el_id = 'ui_btn_' . $booking_action; |
| 2125 |
|
| 2126 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2127 |
return false; |
| 2128 |
} |
| 2129 |
|
| 2130 |
$params = array( |
| 2131 |
'type' => 'button', |
| 2132 |
'title' => __( 'Export page to CSV', 'booking' ) . ' ', |
| 2133 |
'hint' => array( |
| 2134 |
'title' => __( 'Export only current page of bookings to CSV format', 'booking' ), |
| 2135 |
'position' => 'top' |
| 2136 |
), |
| 2137 |
'link' => 'javascript:void(0)', |
| 2138 |
//'action' => wpbc_csv_get_url_for_button( 'page' ), |
| 2139 |
'action' => "wpbc_ajx_booking__ui_click__export_csv( { |
| 2140 |
'booking_action' : '{$booking_action}', |
| 2141 |
'ui_clicked_element_id': '{$el_id}', |
| 2142 |
'export_type': 'csv_page' |
| 2143 |
} );", |
| 2144 |
'icon' => array( |
| 2145 |
'icon_font' => 'wpbc_icn_file_upload', |
| 2146 |
'position' => 'right', |
| 2147 |
'icon_img' => '' |
| 2148 |
), |
| 2149 |
'class' => '', |
| 2150 |
'style' => '', |
| 2151 |
'attr' => array( 'id' => $el_id ), |
| 2152 |
'mobile_show_text' => true |
| 2153 |
); |
| 2154 |
wpbc_flex_button( $params ); |
| 2155 |
} |
| 2156 |
|
| 2157 |
function wpbc_ajx__ui__action_button__export_csv_all( $escaped_search_request_params ){ |
| 2158 |
|
| 2159 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 2160 |
return false; |
| 2161 |
} |
| 2162 |
|
| 2163 |
$booking_action = 'export_csv'; |
| 2164 |
$el_id = 'ui_btn_' . $booking_action . '_all'; |
| 2165 |
|
| 2166 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2167 |
return false; |
| 2168 |
} |
| 2169 |
|
| 2170 |
$params = array( |
| 2171 |
'type' => 'button', |
| 2172 |
'title' => __( 'Export all pages to CSV', 'booking' ) . ' ', |
| 2173 |
'hint' => array( |
| 2174 |
'title' => __( 'Export All bookings to CSV format', 'booking' ), |
| 2175 |
'position' => 'top' |
| 2176 |
), |
| 2177 |
'link' => 'javascript:void(0)', |
| 2178 |
//'action' => wpbc_csv_get_url_for_button( 'all' ), |
| 2179 |
'action' => "wpbc_ajx_booking__ui_click__export_csv( { |
| 2180 |
'booking_action' : '{$booking_action}', |
| 2181 |
'ui_clicked_element_id': '{$el_id}', |
| 2182 |
'export_type': 'csv_all' |
| 2183 |
} );", |
| 2184 |
|
| 2185 |
'icon' => array( |
| 2186 |
'icon_font' => 'wpbc_icn_publish', |
| 2187 |
'position' => 'right', |
| 2188 |
'icon_img' => '' |
| 2189 |
), |
| 2190 |
'class' => '', |
| 2191 |
'style' => '', |
| 2192 |
'attr' => array( 'id' => $el_id ), |
| 2193 |
'mobile_show_text' => true |
| 2194 |
); |
| 2195 |
wpbc_flex_button( $params ); |
| 2196 |
} |
| 2197 |
|
| 2198 |
function wpbc_ajx__ui__action_button__empty_trash( $escaped_search_request_params ){ |
| 2199 |
|
| 2200 |
$booking_action = 'empty_trash'; |
| 2201 |
|
| 2202 |
$el_id = 'ui_btn_' . $booking_action; |
| 2203 |
|
| 2204 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2205 |
return false; |
| 2206 |
} |
| 2207 |
|
| 2208 |
$params = array( |
| 2209 |
'type' => 'button' , |
| 2210 |
'title' => __( 'Empty Trash', 'booking' ) . ' ', // Title of the button |
| 2211 |
'hint' => array( 'title' => __( 'Empty Trash', 'booking' ), 'position' => 'top' ), // Hint |
| 2212 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 2213 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { |
| 2214 |
wpbc_ajx_booking_ajax_action_request( { |
| 2215 |
'booking_action' : '{$booking_action}', |
| 2216 |
'ui_clicked_element_id': '{$el_id}' |
| 2217 |
} ); |
| 2218 |
wpbc_button_enable_loading_icon( this ); |
| 2219 |
}" , |
| 2220 |
'icon' => array( |
| 2221 |
'icon_font' => 'wpbc_icn_delete_forever', |
| 2222 |
'position' => 'right', |
| 2223 |
'icon_img' => '' |
| 2224 |
), |
| 2225 |
'class' => '', // '' | 'wpbc_ui_button_primary' |
| 2226 |
'style' => '', // Any CSS class here |
| 2227 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 2228 |
'attr' => array( 'id' => $el_id ) |
| 2229 |
); |
| 2230 |
|
| 2231 |
wpbc_flex_button( $params ); |
| 2232 |
} |
| 2233 |
// </editor-fold> |
| 2234 |
|
| 2235 |
|
| 2236 |
// <editor-fold defaultstate="collapsed" desc=" T o o l b a r O p t i o n s B u t t o n s " > |
| 2237 |
|
| 2238 |
|
| 2239 |
function wpbc_ajx__ui__options_checkbox__send_emails( $escaped_search_request_params, $defaults ){ |
| 2240 |
|
| 2241 |
$el_id = 'ui_usr__send_emails'; |
| 2242 |
|
| 2243 |
$el_value = isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]; |
| 2244 |
|
| 2245 |
$params_checkbox = array( |
| 2246 |
'id' => $el_id // HTML ID of element |
| 2247 |
, 'name' => $el_id |
| 2248 |
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) //FixIn: 9.6.1.5 |
| 2249 |
, 'style' => '' // CSS of select element |
| 2250 |
, 'class' => '' // CSS Class of select element |
| 2251 |
, 'disabled' => false |
| 2252 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2253 |
, 'legend' => '' // aria-label parameter |
| 2254 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 2255 |
, 'selected' => ( ( 'send' == $el_value ) ? true : false ) // Selected or not |
| 2256 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2257 |
, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code |
| 2258 |
//, 'hint' => array( 'title' => __('Filter bookings by booking status' ,'booking') , 'position' => 'top' ) |
| 2259 |
); |
| 2260 |
|
| 2261 |
wpbc_flex_toggle( $params_checkbox ); |
| 2262 |
} |
| 2263 |
|
| 2264 |
|
| 2265 |
function wpbc_ajx__ui__options_checkbox__is_expand_remarks( $escaped_search_request_params, $defaults ){ |
| 2266 |
|
| 2267 |
$el_id = 'ui_usr__is_expand_remarks'; |
| 2268 |
|
| 2269 |
$el_value = isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]; |
| 2270 |
|
| 2271 |
$params_checkbox = array( |
| 2272 |
'id' => $el_id // HTML ID of element |
| 2273 |
, 'name' => $el_id |
| 2274 |
, 'label' => array( 'title' => __( 'Show / hide notes', 'booking' ) , 'position' => 'left' ) |
| 2275 |
, 'legend' => __('Check this box if you want to open notes section by default in Booking Listing page.' ,'booking') |
| 2276 |
, 'style' => '' // CSS of select element |
| 2277 |
, 'class' => '' // CSS Class of select element |
| 2278 |
, 'disabled' => false |
| 2279 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2280 |
, 'legend' => '' // aria-label parameter |
| 2281 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 2282 |
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not |
| 2283 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2284 |
, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__is_expand_remarks': (jQuery( this ).is(':checked') ? 'On' : 'Off') } );" // JavaScript code |
| 2285 |
); |
| 2286 |
|
| 2287 |
wpbc_flex_toggle( $params_checkbox ); |
| 2288 |
} |
| 2289 |
// </editor-fold> |
| 2290 |
|
| 2291 |
//////////////////////////////////////////////////////////////////////////////// |
| 2292 |
// Complex elements |
| 2293 |
//////////////////////////////////////////////////////////////////////////////// |
| 2294 |
|
| 2295 |
/** |
| 2296 |
* Show FLEX Dropdown |
| 2297 |
* |
| 2298 |
* Dropdown always have value as array. For example: [ '0' ], [ '4', '10' ] or [ '6', '', '2022-05-24' ] |
| 2299 |
* |
| 2300 |
* @param array $args |
| 2301 |
* |
| 2302 |
* = Simple Example: ================================================================================================== |
| 2303 |
|
| 2304 |
$params = array( |
| 2305 |
'id' => 'wh_approved' |
| 2306 |
, 'default' => isset( $escaped_search_request_params['wh_approved'] ) ? $escaped_search_request_params['wh_approved'] : $defaults['wh_approved'] |
| 2307 |
, 'label' => ''//__('Status', 'booking') . ':' |
| 2308 |
, 'title' => __('Status', 'booking') |
| 2309 |
, 'hint' => array( 'title' => __('Filter bookings by booking status' ,'booking') , 'position' => 'top' ) |
| 2310 |
, 'li_options' => array ( |
| 2311 |
'0' => __( 'Pending', 'booking' ), |
| 2312 |
'1' => __( 'Approved', 'booking' ), |
| 2313 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 2314 |
// 'header1' => array( 'type' => 'header', 'title' => __( 'Default', 'booking' ) ), |
| 2315 |
'any' => array( |
| 2316 |
'type' => 'simple', |
| 2317 |
'value' => '', |
| 2318 |
// 'disabled' => true, |
| 2319 |
'title' => __( 'Any', 'booking' ) |
| 2320 |
), |
| 2321 |
) |
| 2322 |
); |
| 2323 |
|
| 2324 |
?><div class="ui_element ui_nowrap"><?php |
| 2325 |
|
| 2326 |
wpbc_flex_dropdown( $params ); |
| 2327 |
|
| 2328 |
?></div><?php |
| 2329 |
* |
| 2330 |
* |
| 2331 |
* = Complex Example: ================================================================================================= |
| 2332 |
* |
| 2333 |
|
| 2334 |
$params_addon = array( |
| 2335 |
'type' => 'span' |
| 2336 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 2337 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' ) |
| 2338 |
, 'class' => 'wpbc_ui_button inactive' |
| 2339 |
, 'style' => '' |
| 2340 |
, 'attr' => array() |
| 2341 |
); |
| 2342 |
|
| 2343 |
$dates_interval = array( |
| 2344 |
1 => '1' . ' ' . __('day' ,'booking') |
| 2345 |
, 2 => '2' . ' ' . __('days' ,'booking') |
| 2346 |
, 3 => '3' . ' ' . __('days' ,'booking') |
| 2347 |
, 4 => '4' . ' ' . __('days' ,'booking') |
| 2348 |
, 5 => '5' . ' ' . __('days' ,'booking') |
| 2349 |
, 6 => '6' . ' ' . __('days' ,'booking') |
| 2350 |
, 7 => '1' . ' ' . __('week' ,'booking') |
| 2351 |
, 14 => '2' . ' ' . __('weeks' ,'booking') |
| 2352 |
, 30 => '1' . ' ' . __('month' ,'booking') |
| 2353 |
, 60 => '2' . ' ' . __('months' ,'booking') |
| 2354 |
, 90 => '3' . ' ' . __('months' ,'booking') |
| 2355 |
, 183 => '6' . ' ' . __('months' ,'booking') |
| 2356 |
, 365 => '1' . ' ' . __('Year' ,'booking') |
| 2357 |
); |
| 2358 |
|
| 2359 |
$request_input_el_default = array( |
| 2360 |
'wh_booking_date' => isset( $escaped_search_request_params['wh_booking_date'] ) ? $escaped_search_request_params['wh_booking_date'] : $defaults['wh_booking_date'], |
| 2361 |
'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'], |
| 2362 |
'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'], |
| 2363 |
'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'], |
| 2364 |
'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'], |
| 2365 |
'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'] |
| 2366 |
); |
| 2367 |
|
| 2368 |
$options = array ( |
| 2369 |
// 'header2' => array( 'type' => 'header', 'title' => __( 'Complex Days', 'booking' ) ), |
| 2370 |
// 'disabled1' => array( 'type' => 'simple', 'value' => '19', 'title' => __( 'This is option was disabled', 'booking' ), 'disabled' => true ), |
| 2371 |
|
| 2372 |
'0' => __( 'Current dates', 'booking' ), |
| 2373 |
'1' => __( 'Today', 'booking' ), |
| 2374 |
'2' => __( 'Previous dates', 'booking' ), |
| 2375 |
'3' => __( 'All dates', 'booking' ), |
| 2376 |
|
| 2377 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 2378 |
|
| 2379 |
'9' => __( 'Today check in/out', 'booking' ), |
| 2380 |
'7' => __( 'Check In - Tomorrow', 'booking' ), |
| 2381 |
'8' => __( 'Check Out - Tomorrow', 'booking' ), |
| 2382 |
|
| 2383 |
'divider2' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 2384 |
|
| 2385 |
// Next [ '4', '10' ] - radio button (if selected) value '4' and select-box with selected value '10' |
| 2386 |
'next' => array( |
| 2387 |
'type' => 'complex', |
| 2388 |
'class' => 'ui_complex_option_element', |
| 2389 |
// recheck if LI selected: $options['next']['selected_options_value'] == $params['default], e.g. ~ [ '4', '10' ] |
| 2390 |
'selected_options_value' => array( |
| 2391 |
1 => array( 'value' ), // $options['next']['input_options'][ 1 ]['value'] '4' |
| 2392 |
4 => array( 'value' ) // $options['next']['input_options'][ 4 ]['value'] '10' |
| 2393 |
), |
| 2394 |
// Get selected Title, for dropdown if $options['next'] selected |
| 2395 |
'selected_options_title' => array( |
| 2396 |
1 => array( 'label', 'title' ), // $options['next']['input_options'][ 1 ]['label'][ 'title' ] 'Next' |
| 2397 |
'text1' => ': ', // if key 'text1' not exist in ['input_options'], then it text ': ' |
| 2398 |
4 => array( 'options', $request_input_el_default['ui_wh_booking_date_next'] ) // '10 days' |
| 2399 |
), |
| 2400 |
'input_options' => array( |
| 2401 |
array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 2402 |
, array( // Default options from simple input element, like: wpbc_flex_radio() |
| 2403 |
'type' => 'radio' |
| 2404 |
, 'id' => 'ui_wh_booking_date_radio_1' // HTML ID of element |
| 2405 |
, 'name' => 'ui_wh_booking_date_radio' |
| 2406 |
, 'label' => array( 'title' => __('Next' ,'booking') , 'position' => 'right' ) |
| 2407 |
, 'style' => '' // CSS of select element |
| 2408 |
, 'class' => '' // CSS Class of select element |
| 2409 |
, 'disabled' => false |
| 2410 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2411 |
, 'legend' => '' // aria-label parameter |
| 2412 |
, 'value' => '4' |
| 2413 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '4' ) ? true : false // Selected or not |
| 2414 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2415 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2416 |
) |
| 2417 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2418 |
, array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 2419 |
, array( |
| 2420 |
'type' => 'select' |
| 2421 |
, 'attr' => array() |
| 2422 |
, 'name' => 'ui_wh_booking_date_next' |
| 2423 |
, 'id' => 'ui_wh_booking_date_next' |
| 2424 |
, 'options' => $dates_interval |
| 2425 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_next'] |
| 2426 |
, 'onfocus' => "jQuery('#ui_wh_booking_date_radio_1').prop('checked', true);" // JavaScript code |
| 2427 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2428 |
) |
| 2429 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2430 |
) |
| 2431 |
), |
| 2432 |
|
| 2433 |
// Prior [ '5', '10' ] |
| 2434 |
'prior' => array( |
| 2435 |
'type' => 'complex', |
| 2436 |
'class' => 'ui_complex_option_element', |
| 2437 |
'style' => 'min-width: 244px;', |
| 2438 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 2439 |
'selected_options_title' => array( 1 => array( 'label', 'title' ) |
| 2440 |
, 'text1' => ': ' |
| 2441 |
, 4 => array( 'options' , $request_input_el_default[ 'ui_wh_booking_date_prior'] ) |
| 2442 |
), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ] |
| 2443 |
'input_options' => array( |
| 2444 |
array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 2445 |
, array( |
| 2446 |
'type' => 'radio' |
| 2447 |
|
| 2448 |
, 'id' => 'ui_wh_booking_date_radio_2' // HTML ID of element |
| 2449 |
, 'name' => 'ui_wh_booking_date_radio' |
| 2450 |
, 'label' => array( 'title' => __('Prior' ,'booking') , 'position' => 'right' ) |
| 2451 |
, 'style' => '' // CSS of select element |
| 2452 |
, 'class' => '' // CSS Class of select element |
| 2453 |
, 'disabled' => false |
| 2454 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2455 |
, 'legend' => '' // aria-label parameter |
| 2456 |
, 'value' => '5' // Some Value from optins array that selected by default |
| 2457 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '5' ) ? true : false // Selected or not |
| 2458 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2459 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2460 |
) |
| 2461 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2462 |
, array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 2463 |
, array( |
| 2464 |
'type' => 'select' |
| 2465 |
, 'attr' => array() |
| 2466 |
, 'name' => 'ui_wh_booking_date_prior' |
| 2467 |
, 'id' => 'ui_wh_booking_date_prior' |
| 2468 |
, 'options' => $dates_interval |
| 2469 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_prior'] |
| 2470 |
, 'onfocus' => "jQuery('#ui_wh_booking_date_radio_2').prop('checked', true);" // JavaScript code |
| 2471 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2472 |
) |
| 2473 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2474 |
) |
| 2475 |
), |
| 2476 |
|
| 2477 |
// Fixed [ '6', '', '2022-05-21'] |
| 2478 |
'fixed' => array( |
| 2479 |
'type' => 'complex', |
| 2480 |
'class' => 'ui_complex_option_element', |
| 2481 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 2482 |
'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' ] |
| 2483 |
'input_options' => array( |
| 2484 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' ) |
| 2485 |
, array( |
| 2486 |
'type' => 'radio' |
| 2487 |
|
| 2488 |
, 'id' => 'ui_wh_booking_date_radio_3' // HTML ID of element |
| 2489 |
, 'name' => 'ui_wh_booking_date_radio' |
| 2490 |
, 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' ) |
| 2491 |
, 'style' => '' // CSS of select element |
| 2492 |
, 'class' => '' // CSS Class of select element |
| 2493 |
, 'disabled' => false |
| 2494 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2495 |
, 'legend' => '' // aria-label parameter |
| 2496 |
, 'value' => '6' // Some Value from optins array that selected by default |
| 2497 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_booking_date_radio' ] == '6' ) ? true : false // Selected or not |
| 2498 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2499 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2500 |
) |
| 2501 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2502 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;">' ) |
| 2503 |
, array( |
| 2504 |
'type' => 'text' |
| 2505 |
, 'id' => 'ui_wh_booking_date_checkin' // HTML ID of element |
| 2506 |
, 'name' => 'ui_wh_booking_date_checkin' |
| 2507 |
, 'label' => ''//__('Check-in' ,'booking') |
| 2508 |
, 'style' => 'width:100%;' // CSS of select element |
| 2509 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 2510 |
, 'disabled' => false |
| 2511 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2512 |
, 'placeholder' => __('Check-in' ,'booking') |
| 2513 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkin'] // Some Value from optins array that selected by default |
| 2514 |
, 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code |
| 2515 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2516 |
) |
| 2517 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2518 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;">' ) |
| 2519 |
, array( |
| 2520 |
'type' => 'text' |
| 2521 |
, 'id' => 'ui_wh_booking_date_checkout' // HTML ID of element |
| 2522 |
, 'name' => 'ui_wh_booking_date_checkout' |
| 2523 |
, 'label' => ''//__('Check-out' ,'booking') |
| 2524 |
, 'style' => 'width:100%;' // CSS of select element |
| 2525 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 2526 |
, 'disabled' => false |
| 2527 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2528 |
, 'placeholder' => __('Check-out' ,'booking') |
| 2529 |
, 'value' => $request_input_el_default[ 'ui_wh_booking_date_checkout'] // Some Value from optins array that selected by default |
| 2530 |
, 'onfocus' => "jQuery('#ui_wh_booking_date_radio_3').prop('checked', true);" // JavaScript code |
| 2531 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2532 |
) |
| 2533 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2534 |
) |
| 2535 |
), |
| 2536 |
|
| 2537 |
'divider3' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 2538 |
|
| 2539 |
// Buttons |
| 2540 |
'buttons1' => array( |
| 2541 |
'type' => 'complex', |
| 2542 |
'class' => 'ui_complex_option_element', |
| 2543 |
'style' => 'justify-content: flex-end;', |
| 2544 |
'input_options' => array( |
| 2545 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' ) |
| 2546 |
, array( |
| 2547 |
'type' => 'button' |
| 2548 |
, 'title' => __( 'Apply', 'booking' ) // Title of the button |
| 2549 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 2550 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 2551 |
, 'action' => "wpbc_ui_dropdown_apply_click( { |
| 2552 |
'dropdown_id' : 'wh_booking_date', |
| 2553 |
'dropdown_radio_name': 'ui_wh_booking_date_radio' |
| 2554 |
} );" // JavaScript code |
| 2555 |
, 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary |
| 2556 |
, 'icon' => '' |
| 2557 |
, 'font_icon' => '' |
| 2558 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 2559 |
, 'style' => '' // Any CSS class here |
| 2560 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 2561 |
, 'attr' => array() |
| 2562 |
) |
| 2563 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2564 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' ) |
| 2565 |
, array( |
| 2566 |
'type' => 'button' |
| 2567 |
, 'title' => __( 'Close', 'booking' ) // Title of the button |
| 2568 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 2569 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 2570 |
, 'action' => "wpbc_ui_dropdown_close_click( 'wh_booking_date' );" // JavaScript code |
| 2571 |
, 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary |
| 2572 |
, 'icon' => '' |
| 2573 |
, 'font_icon' => '' |
| 2574 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 2575 |
, 'style' => '' // Any CSS class here |
| 2576 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 2577 |
, 'attr' => array() |
| 2578 |
) |
| 2579 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 2580 |
) |
| 2581 |
), |
| 2582 |
); |
| 2583 |
|
| 2584 |
$params = array( |
| 2585 |
'id' => 'wh_booking_date' |
| 2586 |
, 'default' => $request_input_el_default[ 'wh_booking_date' ] |
| 2587 |
, 'label' => ''//__('Approve 1', 'booking') . ':' |
| 2588 |
, 'title' => ''//__('Approve 2', 'booking') |
| 2589 |
, 'hint' => array( 'title' => __('Filter bookings by booking dates' ,'booking') , 'position' => 'top' ) |
| 2590 |
, 'align' => 'left' |
| 2591 |
, 'li_options' => $options |
| 2592 |
); |
| 2593 |
|
| 2594 |
?><div class="ui_element ui_nowrap"><?php |
| 2595 |
|
| 2596 |
wpbc_flex_addon( $params_addon ); |
| 2597 |
|
| 2598 |
wpbc_flex_dropdown( $params ); |
| 2599 |
|
| 2600 |
?></div><?php |
| 2601 |
|
| 2602 |
* |
| 2603 |
* ===================================================================================================================== |
| 2604 |
*/ |
| 2605 |
function wpbc_flex_dropdown( $args = array() ) { |
| 2606 |
|
| 2607 |
// $milliseconds = round( microtime( true ) * 1000 ); |
| 2608 |
|
| 2609 |
$defaults = array( |
| 2610 |
'id' => '' // HTML ID of element Example: 'wh_booking_date' |
| 2611 |
, 'default' => array() // Selected by default value(s) Example: 'default' => array( $defaults['wh_booking_date'] , $defaults['wh_booking_date2'] ) |
| 2612 |
, 'hint' => '' // Mouse over tooltip Example: 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 2613 |
, 'style' => '' // CSS style of dropdown element (optional) |
| 2614 |
, 'class' => '' // CSS class of dropdown element (optional) |
| 2615 |
, 'label' => '' // Label of element "at Top of element" |
| 2616 |
, 'title' => '' // Title of element "Inside of element" |
| 2617 |
, 'align' => 'left' // Align: left | right |
| 2618 |
, 'li_options' => array() // Options |
| 2619 |
, 'disabled' => array() // If some options disabled, then option values list here |
| 2620 |
, 'onfocus' => '' // JavaScript code |
| 2621 |
, 'onchange' => '' // JavaScript code |
| 2622 |
, 'is_use_for_template' => false // In case, if we are using it for template, then we skip JavaScript code for initial value. Need to define it manually. //FixIn: 9.4.3.5 |
| 2623 |
); |
| 2624 |
$params = wp_parse_args( $args, $defaults ); |
| 2625 |
|
| 2626 |
// If default value not array, then define it as single value in arr. |
| 2627 |
if ( ! is_array( $params['default'] ) ) { |
| 2628 |
$params['default'] = array( $params['default'] ); |
| 2629 |
} |
| 2630 |
|
| 2631 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2632 |
/** |
| 2633 |
* Recomposition of simple options configuration from |
| 2634 |
* 'any' => __( 'Any', 'booking' ) |
| 2635 |
* to |
| 2636 |
* 'any' => array( 'type' => 'simple', 'value' => 'any', 'title' => __( 'Any', 'booking' ) ); |
| 2637 |
*/ |
| 2638 |
$is_this_simple_list = true; |
| 2639 |
foreach ( $params['li_options'] as $key_value => $option_data ) { |
| 2640 |
|
| 2641 |
if ( ! is_array( $option_data ) ) { |
| 2642 |
|
| 2643 |
$params['li_options'][ $key_value ] = array( 'type' => 'simple', 'value' => (string) $key_value, 'title' => $option_data ); |
| 2644 |
|
| 2645 |
} else { |
| 2646 |
if ( ( isset( $option_data['type'] ) ) && ( 'complex' == $option_data['type'] ) ) { |
| 2647 |
$is_this_simple_list = false; |
| 2648 |
} |
| 2649 |
} |
| 2650 |
} |
| 2651 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2652 |
|
| 2653 |
|
| 2654 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2655 |
// Rechecking about selected LI option, based on $params['default'] like ['4','10'] and getting title of such option |
| 2656 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2657 |
$default_selected_title = array(); |
| 2658 |
foreach ( $params['li_options'] as $li_option ) { |
| 2659 |
|
| 2660 |
if ( 'simple' == $li_option['type'] ) { |
| 2661 |
if ( $li_option['value'] === $params['default'][0] ) { |
| 2662 |
$default_selected_title = $li_option['title'] ; |
| 2663 |
} |
| 2664 |
} |
| 2665 |
|
| 2666 |
if ( 'complex' == $li_option['type'] ) { |
| 2667 |
|
| 2668 |
// $option[ 'selected_options_value' ] => array( 1 => array( 'value' ), 4 => array( 'value' ) ), |
| 2669 |
// $option[ 'selected_options_title' ] => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ) ), |
| 2670 |
|
| 2671 |
// Get value of this LI |
| 2672 |
$li_this_value = array(); |
| 2673 |
if ( isset( $li_option['selected_options_value'] ) ) |
| 2674 |
foreach ( $li_option['selected_options_value'] as $li_key => $input_keys ) { |
| 2675 |
|
| 2676 |
if ( isset( $li_option['input_options'][ $li_key ] ) ) { // ['input_options'][4] |
| 2677 |
|
| 2678 |
$li_input_deep_value = $li_option['input_options'][ $li_key ]; |
| 2679 |
|
| 2680 |
foreach ( $input_keys as $input_key_value ) { |
| 2681 |
|
| 2682 |
if ( isset( $li_input_deep_value[$input_key_value] ) ) { // ['input_options'][4]['value'] |
| 2683 |
$li_input_deep_value = $li_input_deep_value[ $input_key_value ]; |
| 2684 |
} |
| 2685 |
} |
| 2686 |
$li_this_value[] = $li_input_deep_value; |
| 2687 |
} |
| 2688 |
} |
| 2689 |
|
| 2690 |
// Is this LI selected ? |
| 2691 |
$is_same_value = array_diff( $params['default'], $li_this_value ) == array(); |
| 2692 |
|
| 2693 |
if ( $is_same_value ) { |
| 2694 |
|
| 2695 |
// Get value of this LI |
| 2696 |
$li_this_value = array(); |
| 2697 |
foreach ( $li_option['selected_options_title'] as $li_key => $input_keys ) { |
| 2698 |
|
| 2699 |
if ( isset( $li_option['input_options'][ $li_key ] ) ) { // ['input_options'][4] |
| 2700 |
|
| 2701 |
$li_input_deep_value = $li_option['input_options'][ $li_key ]; |
| 2702 |
|
| 2703 |
foreach ( $input_keys as $input_key_value ) { |
| 2704 |
|
| 2705 |
if ( isset( $li_input_deep_value[$input_key_value] ) ) { // ['input_options'][4]['value'] |
| 2706 |
$li_input_deep_value = $li_input_deep_value[ $input_key_value ]; |
| 2707 |
} |
| 2708 |
} |
| 2709 |
$li_this_value[] = $li_input_deep_value; |
| 2710 |
} else { |
| 2711 |
$li_this_value[] = $input_keys; //some text |
| 2712 |
} |
| 2713 |
} |
| 2714 |
|
| 2715 |
$default_selected_title = implode( '', $li_this_value ); |
| 2716 |
} |
| 2717 |
} |
| 2718 |
|
| 2719 |
if ( ! empty( $default_selected_title ) ) { |
| 2720 |
break; |
| 2721 |
} |
| 2722 |
} |
| 2723 |
|
| 2724 |
if ( is_array( $default_selected_title ) ) { |
| 2725 |
$default_selected_title = implode( '', $default_selected_title ); // Error:: ? no values ? |
| 2726 |
} |
| 2727 |
|
| 2728 |
|
| 2729 |
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2730 |
// Show only, if $item_params['label'] ! EMPTY |
| 2731 |
wpbc_flex_label( |
| 2732 |
array( |
| 2733 |
'id' => $params['id'] |
| 2734 |
, 'label' => $params['label'] |
| 2735 |
, 'class' => 'wpbc_ui_dropdown__outside_label' |
| 2736 |
) |
| 2737 |
); |
| 2738 |
|
| 2739 |
?><div class="wpbc_ui_dropdown <?php echo esc_attr( $params['class'] ); ?>" |
| 2740 |
style="<?php echo esc_attr( $params['style'] ); ?>" |
| 2741 |
><?php |
| 2742 |
|
| 2743 |
?><a href="javascript:void(0)" |
| 2744 |
id="<?php echo esc_attr( $params['id'] ); ?>_selector" |
| 2745 |
data-toggle="wpbc_dropdown" |
| 2746 |
class="wpbc_ui_control wpbc_ui_button dropdown-toggle <?php |
| 2747 |
echo ( ! empty( $params['hint'] ) ) ? 'tooltip_' . $params['hint']['position'] . ' ' : '' ; |
| 2748 |
?>" |
| 2749 |
<?php if (! $is_this_simple_list ) { ?> |
| 2750 |
onclick="javascript:jQuery('#<?php echo $params['id']; ?>_container').show();" |
| 2751 |
<?php } ?> |
| 2752 |
<?php if ( ! empty( $params['hint'] ) ) { ?> |
| 2753 |
title="<?php echo esc_attr( $params['hint']['title'] ); ?>" |
| 2754 |
<?php } ?> |
| 2755 |
<?php echo wpbc_get_custom_attr( $params ); ?> |
| 2756 |
><?php |
| 2757 |
|
| 2758 |
?><label class="wpbc_ui_dropdown__inside_label" <?php if ( empty( $params['title'] ) ) { echo ' style="display:none;" '; } ?> ><?php |
| 2759 |
|
| 2760 |
echo html_entity_decode( |
| 2761 |
wp_kses_post( $params['title'] ) // Sanitizes content for allowed HTML tags for post content |
| 2762 |
, ENT_QUOTES // Convert " to " and ' |
| 2763 |
, get_bloginfo( 'charset' ) // 'UTF-8' or other |
| 2764 |
); // Convert &dash; to ‐ etc... |
| 2765 |
?>: <?php |
| 2766 |
?></label> <?php |
| 2767 |
|
| 2768 |
?><span class="wpbc_selected_in_dropdown" ><?php |
| 2769 |
echo html_entity_decode( |
| 2770 |
wp_kses_post( $default_selected_title ) // Sanitizes content for allowed HTML tags for post content |
| 2771 |
, ENT_QUOTES // Convert " to " and ' |
| 2772 |
, get_bloginfo( 'charset' ) // 'UTF-8' or other |
| 2773 |
); // Convert &dash; to ‐ etc... |
| 2774 |
?></span> <?php |
| 2775 |
|
| 2776 |
?><span class="wpbc_ui_dropdown__inside_caret"></span><?php |
| 2777 |
|
| 2778 |
?></a><?php |
| 2779 |
|
| 2780 |
?><ul id="<?php echo $params['id']; ?>_container" class="ui_dropdown_menu ui_dropdown_menu-<?php echo esc_attr( $params['align'] ); ?>" ><?php |
| 2781 |
|
| 2782 |
wpbc_flex_dropdown__options( $params, array( 'is_this_simple_list' => $is_this_simple_list ) ); |
| 2783 |
|
| 2784 |
?></ul><?php |
| 2785 |
|
| 2786 |
?><input type="hidden" |
| 2787 |
autocomplete="off" |
| 2788 |
value="" |
| 2789 |
id="<?php echo esc_attr( $params['id'] ); ?>" |
| 2790 |
name="<?php echo esc_attr( $params['id'] ); ?>" |
| 2791 |
/><?php |
| 2792 |
if( ! $params['is_use_for_template'] ){ //FixIn: 9.4.3.5 |
| 2793 |
?> |
| 2794 |
<script type="text/javascript"> |
| 2795 |
<?php /* document.getElementById("<?php echo $params['id']; ?>").value = "<?php echo wp_slash( json_encode($params['default'] ) ); ?>"; */ ?> |
| 2796 |
jQuery(document).ready(function(){ |
| 2797 |
|
| 2798 |
jQuery( '#<?php echo $params['id']; ?>').val( "<?php echo wp_slash( json_encode( $params['default'] ) ); ?>" ); |
| 2799 |
|
| 2800 |
<?php if (! empty( $params['onchange'] )) { ?> |
| 2801 |
|
| 2802 |
jQuery( '#<?php echo $params['id']; ?>' ).on( 'change', function( event ){ |
| 2803 |
|
| 2804 |
<?php echo $params['onchange']; ?> |
| 2805 |
}); |
| 2806 |
|
| 2807 |
<?php } ?> |
| 2808 |
|
| 2809 |
<?php if (! empty( $params['onfocus'] )) { ?> |
| 2810 |
|
| 2811 |
jQuery( '#<?php echo $params['id']; ?>_selector' ).on( 'focus', function( event ){ |
| 2812 |
|
| 2813 |
<?php echo $params['onfocus']; ?> |
| 2814 |
}); |
| 2815 |
|
| 2816 |
<?php } ?> |
| 2817 |
}) |
| 2818 |
</script> |
| 2819 |
<?php |
| 2820 |
} |
| 2821 |
?></div><?php |
| 2822 |
} |
| 2823 |
|
| 2824 |
/** |
| 2825 |
* Options list for Dropdown |
| 2826 |
* |
| 2827 |
* @param $params |
| 2828 |
* @param array $args |
| 2829 |
*/ |
| 2830 |
function wpbc_flex_dropdown__options( $params, $args = array() ) { |
| 2831 |
|
| 2832 |
$defaults = array( |
| 2833 |
// 'milliseconds' => round( microtime( true ) * 1000 ), |
| 2834 |
'is_this_simple_list' => true |
| 2835 |
); |
| 2836 |
$args = wp_parse_args( $args, $defaults ); |
| 2837 |
|
| 2838 |
|
| 2839 |
foreach ( $params['li_options'] as $option_name => $li_option ) { |
| 2840 |
|
| 2841 |
$default_option = array( |
| 2842 |
'type' => '' |
| 2843 |
, 'class' => '' |
| 2844 |
, 'style' => '' |
| 2845 |
, 'title' => '' |
| 2846 |
, 'disabled' => false |
| 2847 |
, 'attr' => array() |
| 2848 |
, 'value' => '' |
| 2849 |
, 'html' => '' |
| 2850 |
); |
| 2851 |
$li_option = wp_parse_args( $li_option, $default_option ); |
| 2852 |
|
| 2853 |
|
| 2854 |
// Is disabled ? |
| 2855 |
if ( true === in_array( $li_option['value'], $params['disabled'] ) ) { |
| 2856 |
$li_option['disabled'] = true; |
| 2857 |
} |
| 2858 |
if ( $li_option['disabled'] ) { |
| 2859 |
$li_option['class'] .= ' disabled'; |
| 2860 |
} |
| 2861 |
// Is header ? |
| 2862 |
if ( 'header' == $li_option['type'] ) { |
| 2863 |
$li_option['class'] .= ' dropdown-header'; |
| 2864 |
} |
| 2865 |
|
| 2866 |
|
| 2867 |
?><li role="presentation" |
| 2868 |
class="<?php echo esc_attr( $li_option['class'] ); ?>" |
| 2869 |
style="<?php echo esc_attr( $li_option['style'] ); ?>" |
| 2870 |
<?php echo wpbc_get_custom_attr( $li_option ); ?> |
| 2871 |
><?php |
| 2872 |
|
| 2873 |
switch ( $li_option['type'] ) { |
| 2874 |
|
| 2875 |
case 'simple': |
| 2876 |
|
| 2877 |
?><a role="menuitem" |
| 2878 |
tabindex="-1" |
| 2879 |
<?php if ( ! $li_option['disabled'] ) { |
| 2880 |
|
| 2881 |
if( false !== filter_var( $li_option['value'], FILTER_VALIDATE_URL ) ){ ?> |
| 2882 |
|
| 2883 |
href="<?php echo $li_option['value']; ?>" |
| 2884 |
|
| 2885 |
<?php } else { ?> |
| 2886 |
|
| 2887 |
href="javascript:void(0)" |
| 2888 |
onclick="javascript: wpbc_ui_dropdown_simple_click( { |
| 2889 |
'dropdown_id' : '<?php echo $params['id']; ?>' |
| 2890 |
, 'is_this_simple_list': <?php echo ( $args['is_this_simple_list'] ) ? 'true' : 'false'; ?> |
| 2891 |
, 'value' : '<?php echo $li_option['value']; ?>' |
| 2892 |
, '_this' : this |
| 2893 |
} );" |
| 2894 |
<?php } |
| 2895 |
|
| 2896 |
} ?> |
| 2897 |
><?php |
| 2898 |
echo $li_option['title']; |
| 2899 |
?></a><?php |
| 2900 |
|
| 2901 |
break; |
| 2902 |
|
| 2903 |
case 'html': |
| 2904 |
echo $li_option['html']; |
| 2905 |
break; |
| 2906 |
|
| 2907 |
case 'header': |
| 2908 |
echo $li_option['title']; |
| 2909 |
break; |
| 2910 |
|
| 2911 |
case 'complex' : |
| 2912 |
|
| 2913 |
foreach ( $li_option['input_options'] as $input_option ) { |
| 2914 |
|
| 2915 |
switch ( $input_option['type'] ) { |
| 2916 |
|
| 2917 |
case 'html': |
| 2918 |
echo $input_option['html']; |
| 2919 |
break; |
| 2920 |
|
| 2921 |
case 'button': |
| 2922 |
wpbc_flex_button( $input_option ); |
| 2923 |
break; |
| 2924 |
|
| 2925 |
case 'label': |
| 2926 |
wpbc_flex_label( $input_option ); |
| 2927 |
break; |
| 2928 |
|
| 2929 |
case 'text': |
| 2930 |
wpbc_flex_text( $input_option ); |
| 2931 |
break; |
| 2932 |
|
| 2933 |
case 'select': |
| 2934 |
wpbc_flex_select( $input_option ); |
| 2935 |
break; |
| 2936 |
|
| 2937 |
case 'checkbox': |
| 2938 |
wpbc_flex_checkbox( $input_option ); |
| 2939 |
break; |
| 2940 |
|
| 2941 |
case 'radio': |
| 2942 |
wpbc_flex_radio( $input_option ); |
| 2943 |
break; |
| 2944 |
|
| 2945 |
case 'addon': |
| 2946 |
wpbc_flex_addon( $input_option ); |
| 2947 |
break; |
| 2948 |
|
| 2949 |
default: // Default |
| 2950 |
} |
| 2951 |
} |
| 2952 |
break; |
| 2953 |
|
| 2954 |
default: // Default |
| 2955 |
} |
| 2956 |
|
| 2957 |
?></li><?php |
| 2958 |
} |
| 2959 |
} |
| 2960 |
|
| 2961 |
|
| 2962 |
//////////////////////////////////////////////////////////////////////////////// |
| 2963 |
// Simple elements |
| 2964 |
//////////////////////////////////////////////////////////////////////////////// |
| 2965 |
|
| 2966 |
/** |
| 2967 |
* Show FLEX Button |
| 2968 |
* |
| 2969 |
* @param array $item |
| 2970 |
array( |
| 2971 |
'type' => 'button' |
| 2972 |
, 'title' => '' // Title of the button |
| 2973 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 2974 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 2975 |
, 'action' => '' // Some JavaScript to execure, for example run the function |
| 2976 |
, 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary |
| 2977 |
, 'icon' => '' |
| 2978 |
, 'font_icon' => '' |
| 2979 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 2980 |
, 'style' => '' // Any CSS class here |
| 2981 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 2982 |
, 'attr' => array() |
| 2983 |
); |
| 2984 |
*/ |
| 2985 |
function wpbc_flex_button( $item ) { |
| 2986 |
|
| 2987 |
$default_item_params = array( |
| 2988 |
'type' => 'button' |
| 2989 |
, 'title' => '' // Title of the button |
| 2990 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 2991 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 2992 |
, 'action' => '' // Some JavaScript to execure, for example run the function |
| 2993 |
, 'id' => '' // '' | 'wpbc_ui_button_primary' |
| 2994 |
, 'class' => '' // '' | 'wpbc_ui_button_primary' |
| 2995 |
, 'icon' => false // array( 'icon_font' => 'wpbc_icn_check_circle_outline', 'position' => 'right', 'icon_img' => '' ) |
| 2996 |
, 'style' => '' // Any CSS class here |
| 2997 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 2998 |
, 'attr' => array() |
| 2999 |
, 'options' => array( 'link' => 'esc_attr' ) // array( 'link' => 'decode' ) |
| 3000 |
); |
| 3001 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3002 |
|
| 3003 |
$css_button_class = esc_attr( $item_params['class'] ); |
| 3004 |
|
| 3005 |
if ( 'wpbc_button_as_icon' !== $css_button_class ) { |
| 3006 |
$css_button_class = 'wpbc_ui_button ' . $css_button_class; |
| 3007 |
} |
| 3008 |
|
| 3009 |
?><a class="wpbc_ui_control <?php echo $css_button_class; |
| 3010 |
echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>" |
| 3011 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3012 |
href="<?php |
| 3013 |
if ( 'esc_attr' == $item_params['options']['link'] ) { |
| 3014 |
echo esc_attr( $item_params['link'] ); |
| 3015 |
} |
| 3016 |
if ( 'decode' == $item_params['options']['link'] ) { |
| 3017 |
echo str_replace( '"', '', htmlspecialchars_decode( esc_attr( $item_params['link'] ), ENT_QUOTES ) ); |
| 3018 |
} |
| 3019 |
if ( 'no_decode' == $item_params['options']['link'] ) { |
| 3020 |
echo str_replace( '"', '', $item_params['link'] ); |
| 3021 |
} |
| 3022 |
?>" |
| 3023 |
<?php if ( ! empty( $item_params['id'] ) ) { ?> |
| 3024 |
id="<?php echo $item_params['id']; ?>" |
| 3025 |
<?php } ?> |
| 3026 |
<?php if ( ! empty( $item_params['action'] ) ) { ?> |
| 3027 |
onclick="javascript:<?php echo wpbc_esc_js( $item_params['action'] ); ?>" |
| 3028 |
<?php } ?> |
| 3029 |
<?php if ( ! empty( $item_params['hint'] ) ) { ?> |
| 3030 |
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" |
| 3031 |
<?php } ?> |
| 3032 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3033 |
><?php |
| 3034 |
$btn_icon = ''; |
| 3035 |
|
| 3036 |
// Icon |
| 3037 |
if ( ( ! empty( $item_params['icon'] ) ) && ( is_array( $item_params['icon'] ) ) ) { |
| 3038 |
|
| 3039 |
// Icon IMG |
| 3040 |
if ( ! empty( $item_params['icon']['icon_img'] ) ) { |
| 3041 |
|
| 3042 |
if ( substr( $item_params['icon']['icon_img'], 0, 4 ) != 'http' ) { |
| 3043 |
$img_path = WPBC_PLUGIN_URL . '/assets/img/' . $item_params['icon']['icon_img']; |
| 3044 |
} else { |
| 3045 |
$img_path = $item_params['icon']['icon_img']; |
| 3046 |
} |
| 3047 |
$btn_icon = '<img class="menuicons" src="' . esc_url( $img_path ) . '" />'; // Img Icon |
| 3048 |
} |
| 3049 |
|
| 3050 |
// Icon Font |
| 3051 |
if ( ! empty( $item_params['icon']['icon_font'] ) ) { |
| 3052 |
$btn_icon = '<i class="menu_icon icon-1x ' . esc_attr( $item_params['icon']['icon_font'] ) . '"></i>'; // Font Icon |
| 3053 |
} |
| 3054 |
} |
| 3055 |
|
| 3056 |
if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon']['position'] == 'left' ) ) { |
| 3057 |
|
| 3058 |
echo $btn_icon; |
| 3059 |
|
| 3060 |
if ( ! empty( $item_params['title'] ) ) { |
| 3061 |
echo ' '; |
| 3062 |
} |
| 3063 |
} |
| 3064 |
|
| 3065 |
// Text |
| 3066 |
echo '<span' . ( ( ( ! empty( $btn_icon ) ) && ( ! $item_params['mobile_show_text'] ) )? ' class="in-button-text"' : '' ) . '>'; |
| 3067 |
|
| 3068 |
echo html_entity_decode( |
| 3069 |
wp_kses_post( $item_params['title'] ) // Sanitizes content for allowed HTML tags for post content |
| 3070 |
, ENT_QUOTES // Convert " to " and ' |
| 3071 |
, get_bloginfo( 'charset' ) // 'UTF-8' or other |
| 3072 |
); // Convert &dash; to ‐ etc... |
| 3073 |
|
| 3074 |
if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon']['position'] == 'right' ) ) { |
| 3075 |
echo ' '; |
| 3076 |
} |
| 3077 |
|
| 3078 |
echo '</span>'; |
| 3079 |
|
| 3080 |
if ( ( ! empty( $btn_icon ) ) && ( $item_params['icon']['position'] == 'right' ) ) { |
| 3081 |
echo $btn_icon; |
| 3082 |
} |
| 3083 |
?></a><?php |
| 3084 |
} |
| 3085 |
|
| 3086 |
/** |
| 3087 |
* Show FLEX Label |
| 3088 |
* |
| 3089 |
* @param array $item |
| 3090 |
array( |
| 3091 |
'id' => '' // HTML ID of INPUT element |
| 3092 |
, 'label' => __('Text..','booking') // Label text here |
| 3093 |
, 'style' => '' // CSS of select element |
| 3094 |
, 'class' => '' // CSS Class of select element |
| 3095 |
, 'disabled' => false |
| 3096 |
, 'attr' => array() // Any additional attributes |
| 3097 |
) |
| 3098 |
*/ |
| 3099 |
function wpbc_flex_label( $item ) { |
| 3100 |
|
| 3101 |
$default_item_params = array( |
| 3102 |
'id' => '' // HTML ID of element |
| 3103 |
, 'label' => '' // Label |
| 3104 |
, 'style' => '' // CSS of select element |
| 3105 |
, 'class' => '' // CSS Class of select element |
| 3106 |
, 'disabled' => false |
| 3107 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3108 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3109 |
); |
| 3110 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3111 |
|
| 3112 |
if ( ( ! empty( $item_params['label'] ) ) || ( ! empty( $btn_icon ) ) ) { |
| 3113 |
|
| 3114 |
?><label for="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 3115 |
class="wpbc_ui_control_label <?php echo esc_attr( $item_params['class'] ); |
| 3116 |
echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>" |
| 3117 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3118 |
<?php if ( ! empty( $item_params['hint'] ) ) { ?> |
| 3119 |
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" |
| 3120 |
<?php } ?> |
| 3121 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 3122 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3123 |
><?php |
| 3124 |
|
| 3125 |
echo html_entity_decode( |
| 3126 |
wp_kses_post( $item_params['label'] ) // Sanitizes content for allowed HTML tags for post content |
| 3127 |
, ENT_QUOTES // Convert " to " and ' |
| 3128 |
, get_bloginfo( 'charset' ) // 'UTF-8' or other |
| 3129 |
); // Convert &dash; to ‐ etc... |
| 3130 |
?></label><?php |
| 3131 |
} |
| 3132 |
|
| 3133 |
} |
| 3134 |
|
| 3135 |
/** |
| 3136 |
* Show FLEX text |
| 3137 |
* |
| 3138 |
* @param array $item |
| 3139 |
* |
| 3140 |
* Example: |
| 3141 |
$params_checkbox = array( |
| 3142 |
'id' => 'my_check_id' // HTML ID of element |
| 3143 |
, 'name' => 'my_check_id' |
| 3144 |
, 'label' => __('Approve' ,'booking') |
| 3145 |
, 'style' => '' // CSS of select element |
| 3146 |
, 'class' => '' // CSS Class of select element |
| 3147 |
, 'disabled' => false |
| 3148 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3149 |
, 'placeholder' => '' |
| 3150 |
, 'value' => 'CHECK_VAL_1' // Some Value from optins array that selected by default |
| 3151 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3152 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3153 |
); |
| 3154 |
?><div class="ui_element"><?php |
| 3155 |
|
| 3156 |
wpbc_flex_text( $params_select ); |
| 3157 |
|
| 3158 |
?></div><?php |
| 3159 |
* |
| 3160 |
*/ |
| 3161 |
function wpbc_flex_text( $item ) { |
| 3162 |
|
| 3163 |
$default_item_params = array( |
| 3164 |
'type' => 'text' |
| 3165 |
, 'id' => '' |
| 3166 |
, 'name' => '' |
| 3167 |
, 'label' => '' |
| 3168 |
, 'disabled' => false |
| 3169 |
, 'class' => '' |
| 3170 |
, 'style' => '' |
| 3171 |
, 'placeholder' => '' |
| 3172 |
, 'attr' => array() |
| 3173 |
, 'value' => '' |
| 3174 |
, 'is_escape_value' => true |
| 3175 |
, 'onfocus' => '' // JavaScript code |
| 3176 |
, 'onchange' => '' // JavaScript code |
| 3177 |
, 'onkeydown' => '' // JavaScript code |
| 3178 |
|
| 3179 |
); |
| 3180 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3181 |
|
| 3182 |
if ( ( empty( $item_params['name'] ) ) |
| 3183 |
&& ( ! empty( $item_params['id'] ) ) |
| 3184 |
) { |
| 3185 |
$item_params['name'] = $item_params['id']; |
| 3186 |
} |
| 3187 |
|
| 3188 |
// Show only, if $item_params['label'] ! EMPTY |
| 3189 |
wpbc_flex_label( |
| 3190 |
array( |
| 3191 |
'id' => $item_params['id'] |
| 3192 |
, 'label' => $item_params['label'] |
| 3193 |
) |
| 3194 |
); |
| 3195 |
|
| 3196 |
if ( $item_params['is_escape_value'] ) { |
| 3197 |
$escaped_value = esc_attr( $item_params['value'] ); |
| 3198 |
} else { |
| 3199 |
$escaped_value = $item_params['value']; |
| 3200 |
} |
| 3201 |
|
| 3202 |
?><input type="<?php echo esc_attr( $item_params['type'] ); ?>" |
| 3203 |
id="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 3204 |
name="<?php echo esc_attr( $item_params['name'] ); ?>" |
| 3205 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3206 |
class="wpbc_ui_control wpbc_ui_text <?php echo esc_attr( $item_params['class'] ); ?>" |
| 3207 |
placeholder="<?php echo esc_attr( $item_params['placeholder'] ); ?>" |
| 3208 |
value="<?php echo $escaped_value; ?>" |
| 3209 |
autocomplete="off" |
| 3210 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 3211 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3212 |
<?php |
| 3213 |
if ( ! empty( $item_params['onfocus'] ) ) { |
| 3214 |
?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php |
| 3215 |
} |
| 3216 |
if ( ! empty( $item_params['onchange'] ) ) { |
| 3217 |
?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php |
| 3218 |
} |
| 3219 |
if ( ! empty( $item_params['onkeydown'] ) ) { |
| 3220 |
?> onkeydown="javascript:<?php echo wpbc_esc_js( $item_params['onkeydown'] ); ?>" <?php |
| 3221 |
} |
| 3222 |
?> |
| 3223 |
/><?php |
| 3224 |
} |
| 3225 |
|
| 3226 |
/** |
| 3227 |
* Show FLEX textarea |
| 3228 |
* |
| 3229 |
* @param array $item |
| 3230 |
* |
| 3231 |
* Example: |
| 3232 |
$params_textarea = array( |
| 3233 |
'id' => 'my_check_id' // HTML ID of element |
| 3234 |
, 'name' => 'my_check_id' |
| 3235 |
, 'label' => __('Approve' ,'booking') |
| 3236 |
, 'style' => '' // CSS of select element |
| 3237 |
, 'class' => '' // CSS Class of select element |
| 3238 |
, 'disabled' => false |
| 3239 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3240 |
, 'rows' => '3' |
| 3241 |
, 'cols' => '50' |
| 3242 |
, 'placeholder' => '' |
| 3243 |
, 'value' => 'Test VAL 1' // Some Value from optins array that selected by default |
| 3244 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3245 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3246 |
); |
| 3247 |
?><div class="ui_element"><?php |
| 3248 |
|
| 3249 |
wpbc_flex_textarea( $params_textarea ); |
| 3250 |
|
| 3251 |
?></div><?php |
| 3252 |
* |
| 3253 |
*/ |
| 3254 |
function wpbc_flex_textarea( $item ) { |
| 3255 |
|
| 3256 |
$default_item_params = array( |
| 3257 |
'id' => '' |
| 3258 |
, 'name' => '' |
| 3259 |
, 'label' => '' |
| 3260 |
, 'disabled' => false |
| 3261 |
, 'class' => '' |
| 3262 |
, 'style' => '' |
| 3263 |
, 'placeholder' => '' |
| 3264 |
, 'attr' => array() |
| 3265 |
, 'rows' => '3' |
| 3266 |
, 'cols' => '50' |
| 3267 |
, 'value' => '' |
| 3268 |
, 'is_escape_value' => true |
| 3269 |
, 'onfocus' => '' // JavaScript code |
| 3270 |
, 'onchange' => '' // JavaScript code |
| 3271 |
); |
| 3272 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3273 |
|
| 3274 |
if ( ( empty( $item_params['name'] ) ) |
| 3275 |
&& ( ! empty( $item_params['id'] ) ) |
| 3276 |
) { |
| 3277 |
$item_params['name'] = $item_params['id']; |
| 3278 |
} |
| 3279 |
|
| 3280 |
// Show only, if $item_params['label'] ! EMPTY |
| 3281 |
wpbc_flex_label( |
| 3282 |
array( |
| 3283 |
'id' => $item_params['id'] |
| 3284 |
, 'label' => $item_params['label'] |
| 3285 |
) |
| 3286 |
); |
| 3287 |
|
| 3288 |
if ( $item_params['is_escape_value'] ) { |
| 3289 |
$escaped_value = esc_textarea( $item_params['value'] ); |
| 3290 |
} else { |
| 3291 |
$escaped_value = $item_params['value']; |
| 3292 |
} |
| 3293 |
|
| 3294 |
?><textarea id="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 3295 |
name="<?php echo esc_attr( $item_params['name'] ); ?>" |
| 3296 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3297 |
class="wpbc_ui_control wpbc_ui_textarea <?php echo esc_attr( $item_params['class'] ); ?>" |
| 3298 |
placeholder="<?php echo esc_attr( $item_params['placeholder'] ); ?>" |
| 3299 |
autocomplete="off" |
| 3300 |
rows="<?php echo esc_attr( $item_params['rows'] ); ?>" |
| 3301 |
cols="<?php echo esc_attr( $item_params['cols'] ); ?>" |
| 3302 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 3303 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3304 |
<?php |
| 3305 |
if ( ! empty( $item_params['onfocus'] ) ) { |
| 3306 |
?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php |
| 3307 |
} |
| 3308 |
if ( ! empty( $item_params['onchange'] ) ) { |
| 3309 |
?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php |
| 3310 |
} |
| 3311 |
?> |
| 3312 |
><?php echo $escaped_value; ?></textarea><?php |
| 3313 |
} |
| 3314 |
|
| 3315 |
/** |
| 3316 |
* Show FLEX selectbox |
| 3317 |
* |
| 3318 |
* @param array $item |
| 3319 |
array( |
| 3320 |
'id' => '' // HTML ID of element |
| 3321 |
, 'name' => '' |
| 3322 |
, 'style' => '' // CSS of select element |
| 3323 |
, 'class' => '' // CSS Class of select element |
| 3324 |
, 'multiple' => false |
| 3325 |
, 'disabled' => false |
| 3326 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3327 |
, 'options' => array() // Associated array of titles and values |
| 3328 |
, 'disabled_options' => array() // If some options disbaled, then its must list here |
| 3329 |
, 'value' => '' // Some Value from optins array that selected by default |
| 3330 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 3331 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 3332 |
) |
| 3333 |
* |
| 3334 |
* |
| 3335 |
* Simple Example : |
| 3336 |
* |
| 3337 |
$params_select = array( |
| 3338 |
'id' => 'next_days' // HTML ID of element |
| 3339 |
, 'name' => 'next_days' |
| 3340 |
, 'label' => '' // __( 'Next Days', 'booking' ) // Label (optional) |
| 3341 |
, 'style' => '' // CSS of select element |
| 3342 |
, 'class' => '' // CSS Class of select element |
| 3343 |
, 'multiple' => false |
| 3344 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3345 |
, 'disabled' => false |
| 3346 |
, 'disabled_options' => array( 2, 30 ) // If some options disabled, then it has to list here |
| 3347 |
, 'options' => array( // Associated array of titles and values |
| 3348 |
, 1 => '1' . ' ' . __('day' ,'booking') |
| 3349 |
, 2 => '2' . ' ' . __('days' ,'booking') |
| 3350 |
, 7 => '1' . ' ' . __('week' ,'booking') |
| 3351 |
, 30 => '1' . ' ' . __('month' ,'booking') |
| 3352 |
, 365 => '1' . ' ' . __('Year' ,'booking') |
| 3353 |
) |
| 3354 |
|
| 3355 |
, 'value' => ( isset( $escaped_search_request_params[ 'next_days' ] ) ) ? $escaped_search_request_params[ 'next_days' ] : '183' // Some Value from options array that selected by default |
| 3356 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 3357 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 3358 |
|
| 3359 |
); |
| 3360 |
|
| 3361 |
?><div class="ui_element"><?php |
| 3362 |
|
| 3363 |
wpbc_flex_select( $params_select ); |
| 3364 |
|
| 3365 |
?></div><?php |
| 3366 |
* |
| 3367 |
* |
| 3368 |
* |
| 3369 |
* Example complex: |
| 3370 |
* |
| 3371 |
* |
| 3372 |
* |
| 3373 |
|
| 3374 |
$params_select = array( |
| 3375 |
'id' => 'next_days' // HTML ID of element |
| 3376 |
, 'name' => 'next_days' |
| 3377 |
, 'label' => '<span class="" style="font-weight:600;">' . __( 'Cost', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>' |
| 3378 |
, 'style' => '' // CSS of select element |
| 3379 |
, 'class' => '' // CSS Class of select element |
| 3380 |
, 'multiple' => false |
| 3381 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3382 |
, 'disabled' => false |
| 3383 |
, 'disabled_options' => array( 2, 5 ) // If some options disabled, then it has to list here |
| 3384 |
, 'options' => array( // Associated array of titles and values: array( $option_value => $option_data, ... ) |
| 3385 |
'group_days' => array( 'optgroup' => true, 'close' => false, 'title' => __( 'days', 'booking' ) ) |
| 3386 |
, 1 => '1' . ' ' . __('day' ,'booking') |
| 3387 |
, 2 => '2' . ' ' . __('days' ,'booking') |
| 3388 |
, 3 => '3' . ' ' . __('days' ,'booking') |
| 3389 |
, 4 => '4' . ' ' . __('days' ,'booking') |
| 3390 |
, 5 => '5' . ' ' . __('days' ,'booking') |
| 3391 |
, 6 => '6' . ' ' . __('days' ,'booking') |
| 3392 |
, 'group_days_end' => array( 'optgroup' => true, 'close' => true ) |
| 3393 |
|
| 3394 |
, 'group_weeks' => array( 'optgroup' => true, 'close' => false, 'title' => __( 'weeks', 'booking' ) ) |
| 3395 |
, 7 => '1' . ' ' . __('week' ,'booking') |
| 3396 |
, 14 => '2' . ' ' . __('weeks' ,'booking') |
| 3397 |
, 'group_weeks_end' => array( 'optgroup' => true, 'close' => true ) |
| 3398 |
|
| 3399 |
, 'group_months' => array( 'optgroup' => true, 'close' => false, 'title' => __( 'months', 'booking' ) ) |
| 3400 |
, 30 => '1' . ' ' . __('month' ,'booking') |
| 3401 |
, 60 => '2' . ' ' . __('months' ,'booking') |
| 3402 |
, 90 => '3' . ' ' . __('months' ,'booking') |
| 3403 |
, 183 => '6' . ' ' . __('months' ,'booking') |
| 3404 |
, 365 => '1' . ' ' . __('Year' ,'booking') |
| 3405 |
, 'group_months_end' => array( 'optgroup' => true, 'close' => true ) |
| 3406 |
|
| 3407 |
, 'complex_value' => array( |
| 3408 |
'title' => 'Complex Option Here' // Text in selectbox option |
| 3409 |
, 'style' => '' // CSS of select element |
| 3410 |
, 'class' => '' // CSS Class of select element |
| 3411 |
, 'disabled' => false |
| 3412 |
, 'selected' => true |
| 3413 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3414 |
, 'optgroup' => false // Use only if you need to show OPTGROUP - Also need to use 'title' of start, end 'close' for END |
| 3415 |
, 'close' => false |
| 3416 |
) |
| 3417 |
) |
| 3418 |
|
| 3419 |
, 'value' => ( isset( $escaped_search_request_params[ 'next_days' ] ) ) ? $escaped_search_request_params[ 'next_days' ] : '183' // Some Value from options array that selected by default |
| 3420 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 3421 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 3422 |
|
| 3423 |
); |
| 3424 |
|
| 3425 |
?><div class="ui_element"><?php |
| 3426 |
|
| 3427 |
wpbc_flex_select( $params_select ); |
| 3428 |
|
| 3429 |
?></div><?php |
| 3430 |
|
| 3431 |
* |
| 3432 |
*/ |
| 3433 |
function wpbc_flex_select( $item ) { |
| 3434 |
|
| 3435 |
$default_item_params = array( |
| 3436 |
'id' => '' // HTML ID of element |
| 3437 |
, 'name' => '' |
| 3438 |
, 'label' => '' // Label |
| 3439 |
, 'style' => '' // CSS of select element |
| 3440 |
, 'class' => '' // CSS Class of select element |
| 3441 |
, 'multiple' => false |
| 3442 |
, 'disabled' => false |
| 3443 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3444 |
, 'options' => array() // Associated array of titles and values: array( $option_value => $option_data, ... ) |
| 3445 |
, 'disabled_options' => array() // If some options disabled, then it has to list here |
| 3446 |
, 'value' => '' // Some Value from options array that selected by default |
| 3447 |
, 'onfocus' => '' // JavaScript code |
| 3448 |
, 'onchange' => '' // JavaScript code |
| 3449 |
); |
| 3450 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3451 |
|
| 3452 |
// Show only, if $item_params['label'] ! EMPTY |
| 3453 |
wpbc_flex_label( |
| 3454 |
array( |
| 3455 |
'id' => $item_params['id'] |
| 3456 |
, 'label' => $item_params['label'] |
| 3457 |
) |
| 3458 |
); |
| 3459 |
|
| 3460 |
?><select |
| 3461 |
id="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 3462 |
name="<?php echo esc_attr( $item_params['name'] ); echo ( $item_params['multiple'] ? '[]' : '' ); ?>" |
| 3463 |
class="wpbc_ui_control wpbc_ui_select <?php echo esc_attr( $item_params['class'] ); ?>" |
| 3464 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3465 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 3466 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3467 |
<?php echo ( $item_params['multiple'] ? ' multiple="MULTIPLE"' : '' ); ?> |
| 3468 |
<?php |
| 3469 |
if ( ! empty( $item_params['onfocus'] ) ) { |
| 3470 |
?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php |
| 3471 |
} |
| 3472 |
if ( ! empty( $item_params['onchange'] ) ) { |
| 3473 |
?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php |
| 3474 |
} |
| 3475 |
?> |
| 3476 |
autocomplete="off" |
| 3477 |
><?php |
| 3478 |
foreach ( $item_params['options'] as $option_value => $option_data ) { |
| 3479 |
|
| 3480 |
if ( ! is_array( $option_data ) ) { |
| 3481 |
$option_data = array( 'title' => $option_data ); |
| 3482 |
$is_was_simple = true; |
| 3483 |
} else { |
| 3484 |
$is_was_simple = false; |
| 3485 |
} |
| 3486 |
|
| 3487 |
$default_option_params = array( |
| 3488 |
'title' => '' // Text in selectbox option |
| 3489 |
, 'style' => '' // CSS of select element |
| 3490 |
, 'class' => '' // CSS Class of select element |
| 3491 |
, 'disabled' => false |
| 3492 |
, 'selected' => false |
| 3493 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3494 |
|
| 3495 |
, 'optgroup' => false // Use only if you need to show OPTGROUP - Also need to use 'title' of start, end 'close' for END |
| 3496 |
, 'close' => false |
| 3497 |
|
| 3498 |
); |
| 3499 |
$option_data = wp_parse_args( $option_data, $default_option_params ); |
| 3500 |
|
| 3501 |
if ( $option_data['optgroup'] ) { // OPTGROUP |
| 3502 |
|
| 3503 |
if ( ! $option_data['close'] ) { |
| 3504 |
?><optgroup label="<?php echo esc_attr( $option_data['title'] ); ?>"><?php |
| 3505 |
} else { |
| 3506 |
?></optgroup><?php |
| 3507 |
} |
| 3508 |
|
| 3509 |
} else { // OPTION |
| 3510 |
|
| 3511 |
?><option |
| 3512 |
value="<?php echo esc_attr( $option_value ); ?>" |
| 3513 |
<?php |
| 3514 |
if ( $is_was_simple ) { |
| 3515 |
selected( $option_value, $item_params['value'] ); |
| 3516 |
disabled( in_array( $option_value, $item_params['disabled_options'] ), true ); |
| 3517 |
} |
| 3518 |
?> |
| 3519 |
class="<?php echo esc_attr( $option_data['class'] ); ?>" |
| 3520 |
style="<?php echo esc_attr( $option_data['style'] ); ?>" |
| 3521 |
<?php echo wpbc_get_custom_attr( $option_data ); ?> |
| 3522 |
<?php selected( $option_data['selected'], true ); ?> |
| 3523 |
<?php disabled( $option_data['disabled'], true ); ?> |
| 3524 |
|
| 3525 |
<?php |
| 3526 |
if ( ! empty( $item_params['value'] ) ) { |
| 3527 |
|
| 3528 |
if ( is_array( $item_params['value'] ) ) { |
| 3529 |
selected( in_array( esc_attr( $option_value ), $item_params['value'] ), true ); // SELECT multiple, have several items |
| 3530 |
} else { |
| 3531 |
selected( $item_params['value'], esc_attr( $option_value ) ); //Recheck global selected parameter |
| 3532 |
} |
| 3533 |
} |
| 3534 |
?> |
| 3535 |
|
| 3536 |
><?php |
| 3537 |
echo html_entity_decode( |
| 3538 |
wp_kses_post( $option_data['title'] ) // Sanitizes content for allowed HTML tags for post content |
| 3539 |
, ENT_QUOTES // Convert " to " and ' |
| 3540 |
, get_bloginfo( 'charset' ) // 'UTF-8' or other |
| 3541 |
); // Convert &dash; to ‐ etc... |
| 3542 |
|
| 3543 |
|
| 3544 |
?></option><?php |
| 3545 |
} |
| 3546 |
} |
| 3547 |
?></select><?php |
| 3548 |
} |
| 3549 |
|
| 3550 |
/** |
| 3551 |
* Show FLEX checkbox |
| 3552 |
* |
| 3553 |
* @param array $item |
| 3554 |
* |
| 3555 |
* Example: |
| 3556 |
$params_checkbox = array( |
| 3557 |
'id' => 'my_check_id' // HTML ID of element |
| 3558 |
, 'name' => 'my_check_id' |
| 3559 |
, 'label' => array( 'title' => __('Approve' ,'booking') , 'position' => 'right' ) |
| 3560 |
, 'style' => '' // CSS of select element |
| 3561 |
, 'class' => '' // CSS Class of select element |
| 3562 |
, 'disabled' => false |
| 3563 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3564 |
, 'legend' => '' // aria-label parameter |
| 3565 |
, 'value' => 'CHECK_VAL_1' // Some Value from optins array that selected by default |
| 3566 |
, 'selected' => !false // Selected or not |
| 3567 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3568 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3569 |
, 'is_use_toggle' => false // Show checkbox as toggle |
| 3570 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3571 |
); |
| 3572 |
?><div class="ui_element"><?php |
| 3573 |
|
| 3574 |
wpbc_flex_checkbox( $params_select ); |
| 3575 |
|
| 3576 |
?></div><?php |
| 3577 |
*/ |
| 3578 |
function wpbc_flex_checkbox( $item ) { |
| 3579 |
|
| 3580 |
$default_item_params = array( |
| 3581 |
'type' => 'checkbox' |
| 3582 |
, 'id' => '' // HTML ID of element |
| 3583 |
, 'name' => '' |
| 3584 |
, 'label' => '' // Label Example: 'label' => array( 'title' => __('Select status' ,'booking') , 'position' => 'left' ) |
| 3585 |
, 'style' => '' // CSS of select element |
| 3586 |
, 'class' => '' // CSS Class of select element |
| 3587 |
, 'disabled' => false |
| 3588 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3589 |
, 'legend' => '' // aria-label parameter |
| 3590 |
, 'value' => '' // Some Value from optins array that selected by default |
| 3591 |
, 'selected' => false // Selected or not |
| 3592 |
, 'onfocus' => '' // JavaScript code |
| 3593 |
, 'onchange' => '' // JavaScript code |
| 3594 |
, 'is_use_toggle' => false // Show checkbox as toggle |
| 3595 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3596 |
); |
| 3597 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3598 |
|
| 3599 |
|
| 3600 |
// Use toggle element, instead of checkbox. |
| 3601 |
if ( $item_params['is_use_toggle'] ) { |
| 3602 |
|
| 3603 |
wpbc_flex_toggle( $item ); |
| 3604 |
return; |
| 3605 |
} |
| 3606 |
|
| 3607 |
if ( ( ! empty( $item_params['label'] ) ) && ( 'left' == $item_params['label']['position'] ) ) { |
| 3608 |
wpbc_flex_label( array( 'id' => $item_params['id'], 'label' => $item_params['label']['title'] ) ); |
| 3609 |
} |
| 3610 |
|
| 3611 |
?><input type="<?php echo esc_attr( $item_params['type'] ); ?>" |
| 3612 |
id="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 3613 |
name="<?php echo esc_attr( $item_params['name'] ); ?>" |
| 3614 |
value="<?php echo esc_attr( $item_params['value'] ); ?>" |
| 3615 |
aria-label="<?php echo esc_attr( $item_params['legend'] ); ?>" |
| 3616 |
class="wpbc_ui_<?php echo esc_attr( $item_params['type'] ); ?> <?php echo esc_attr( $item_params['class'] ); ?> <?php echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>" |
| 3617 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3618 |
<?php |
| 3619 |
if ( ! empty( $item_params['hint'] ) ) { ?> |
| 3620 |
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" <?php |
| 3621 |
} |
| 3622 |
?> |
| 3623 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3624 |
<?php checked( $item_params['selected'], true ); ?> |
| 3625 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 3626 |
<?php |
| 3627 |
if ( ! empty( $item_params['onfocus'] ) ) { |
| 3628 |
?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php |
| 3629 |
} |
| 3630 |
if ( ! empty( $item_params['onchange'] ) ) { |
| 3631 |
?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php |
| 3632 |
} |
| 3633 |
?> |
| 3634 |
autocomplete="off" |
| 3635 |
/><?php |
| 3636 |
|
| 3637 |
if ( ( ! empty( $item_params['label'] ) ) && ( 'right' == $item_params['label']['position'] ) ) { |
| 3638 |
wpbc_flex_label( array( 'id' => $item_params['id'], 'label' => $item_params['label']['title'] ) ); |
| 3639 |
} |
| 3640 |
} |
| 3641 |
|
| 3642 |
|
| 3643 |
/** |
| 3644 |
* Show FLEX toggle instead of checkbox |
| 3645 |
* |
| 3646 |
* @param array $item |
| 3647 |
* |
| 3648 |
* Example: |
| 3649 |
$params_checkbox = array( |
| 3650 |
'id' => 'my_check_id' // HTML ID of element |
| 3651 |
, 'name' => 'my_check_id' |
| 3652 |
, 'label' => array( 'title' => __('Approve' ,'booking') , 'position' => 'right' ) |
| 3653 |
, 'style' => '' // CSS of select element |
| 3654 |
, 'toggle_style' => '' // Styles CSS of toggle container |
| 3655 |
, 'toggle_class' => '' // Class CSS of toggle container |
| 3656 |
, 'class' => '' // CSS Class of input element |
| 3657 |
, 'disabled' => false |
| 3658 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3659 |
, 'legend' => '' // aria-label parameter |
| 3660 |
, 'value' => 'CHECK_VAL_1' // Some Value from optins array that selected by default |
| 3661 |
, 'selected' => !false // Selected or not |
| 3662 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3663 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3664 |
); |
| 3665 |
?><div class="ui_element"><?php |
| 3666 |
|
| 3667 |
wpbc_flex_toggle( $params_select ); |
| 3668 |
|
| 3669 |
?></div><?php |
| 3670 |
*/ |
| 3671 |
function wpbc_flex_toggle( $item ){ |
| 3672 |
|
| 3673 |
$default_item_params = array( |
| 3674 |
'type' => 'checkbox' |
| 3675 |
, 'id' => '' // HTML ID of element |
| 3676 |
, 'name' => '' |
| 3677 |
, 'label' => '' // Label Example: 'label' => array( 'title' => __('Select status' ,'booking') , 'position' => 'left' ) |
| 3678 |
, 'style' => '' // CSS of select element |
| 3679 |
, 'toggle_style' => '' // Styles CSS of toggle container |
| 3680 |
, 'toggle_class' => '' // Class CSS of toggle container |
| 3681 |
, 'class' => '' // CSS Class of input element |
| 3682 |
, 'disabled' => false |
| 3683 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3684 |
, 'legend' => '' // aria-label parameter |
| 3685 |
, 'value' => '' // Some Value from optins array that selected by default |
| 3686 |
, 'selected' => false // Selected or not |
| 3687 |
, 'onfocus' => '' // JavaScript code |
| 3688 |
, 'onchange' => '' // JavaScript code |
| 3689 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3690 |
); |
| 3691 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3692 |
/** |
| 3693 |
* Structure: |
| 3694 |
?><span class="wpbc_ui__toggle"> |
| 3695 |
<input type="checkbox" name="field_name" id="wpbc_field_id" value="On" /> |
| 3696 |
<label class="wpbc_ui__toggle_icon" for="wpbc_field_id"></label> |
| 3697 |
<label class="wpbc_ui__toggle_label" for="wpbc_field_id">Some Text</label> |
| 3698 |
<i class="wpbc_help_tooltip"></i> |
| 3699 |
</span><?php |
| 3700 |
*/ |
| 3701 |
|
| 3702 |
?><span class="wpbc_ui__toggle <?php echo esc_attr( $item_params['toggle_class'] ); ?>" style="<?php echo esc_attr( $item_params['toggle_style'] ); ?>"><?php |
| 3703 |
|
| 3704 |
?><input type="<?php echo esc_attr( $item_params['type'] ); ?>" |
| 3705 |
id="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 3706 |
name="<?php echo esc_attr( $item_params['name'] ); ?>" |
| 3707 |
value="<?php echo esc_attr( $item_params['value'] ); ?>" |
| 3708 |
aria-label="<?php echo esc_attr( $item_params['legend'] ); ?>" |
| 3709 |
class="wpbc_ui_<?php echo esc_attr( $item_params['type'] ); ?> <?php echo esc_attr( $item_params['class'] ); ?>" |
| 3710 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3711 |
<?php checked( $item_params['selected'], true ); ?> |
| 3712 |
<?php disabled( $item_params['disabled'], true ); ?> |
| 3713 |
<?php |
| 3714 |
if ( ! empty( $item_params['onfocus'] ) ) { |
| 3715 |
?> onfocus="javascript:<?php echo wpbc_esc_js( $item_params['onfocus'] ); ?>" <?php |
| 3716 |
} |
| 3717 |
if ( ! empty( $item_params['onchange'] ) ) { |
| 3718 |
?> onchange="javascript:<?php echo wpbc_esc_js( $item_params['onchange'] ); ?>" <?php |
| 3719 |
} |
| 3720 |
?> |
| 3721 |
autocomplete="off" |
| 3722 |
/><?php |
| 3723 |
|
| 3724 |
?><label class="wpbc_ui__toggle_icon |
| 3725 |
<?php echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?> |
| 3726 |
" |
| 3727 |
for="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 3728 |
<?php |
| 3729 |
if ( ! empty( $item_params['hint'] ) ) { ?> |
| 3730 |
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" <?php |
| 3731 |
} |
| 3732 |
?> |
| 3733 |
></label><?php |
| 3734 |
|
| 3735 |
if ( ! empty( $item_params['label'] ) ) { |
| 3736 |
wpbc_flex_label( array( 'id' => $item_params['id'], 'class' => 'wpbc_ui__toggle_label', 'label' => $item_params['label']['title'] ) ); |
| 3737 |
} |
| 3738 |
|
| 3739 |
?><i class="wpbc_help_tooltip"></i><?php |
| 3740 |
|
| 3741 |
?></span><?php |
| 3742 |
|
| 3743 |
} |
| 3744 |
|
| 3745 |
|
| 3746 |
/** |
| 3747 |
* Show FLEX radio button |
| 3748 |
* |
| 3749 |
* @param array $item |
| 3750 |
* |
| 3751 |
* Example: |
| 3752 |
$params_checkbox = array( |
| 3753 |
'id' => 'my_check_id' // HTML ID of element |
| 3754 |
, 'name' => 'my_check_id' |
| 3755 |
, 'label' => array( 'title' => __('Approve' ,'booking') , 'position' => 'right' ) |
| 3756 |
, 'style' => '' // CSS of select element |
| 3757 |
, 'class' => '' // CSS Class of select element |
| 3758 |
, 'disabled' => false |
| 3759 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 3760 |
, 'legend' => '' // aria-label parameter |
| 3761 |
, 'value' => 'CHECK_VAL_1' // Some Value from optins array that selected by default |
| 3762 |
, 'selected' => !false // Selected or not |
| 3763 |
, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3764 |
, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 3765 |
); |
| 3766 |
?><div class="ui_element"><?php |
| 3767 |
|
| 3768 |
wpbc_flex_radio( $params_select ); |
| 3769 |
|
| 3770 |
$params_checkbox['id'] = 'my_check_id2'; |
| 3771 |
$params_checkbox['value'] = 'CHECK_VAL_2'; |
| 3772 |
|
| 3773 |
wpbc_flex_radio( $params_select ); |
| 3774 |
|
| 3775 |
?></div><?php |
| 3776 |
*/ |
| 3777 |
function wpbc_flex_radio( $item ) { |
| 3778 |
$item['type'] = 'radio'; |
| 3779 |
$item['is_use_toggle'] = false; |
| 3780 |
wpbc_flex_checkbox( $item ); |
| 3781 |
} |
| 3782 |
|
| 3783 |
/** |
| 3784 |
* Show FLEX addon (image or text can be here) |
| 3785 |
* |
| 3786 |
* @param array $item |
| 3787 |
array( |
| 3788 |
'type' => 'span' // HTML tag that will bound content |
| 3789 |
, 'html' => '' // Any other HTML content |
| 3790 |
, 'icon' => false // array( 'icon_font' => 'wpbc_icn_check_circle_outline', 'position' => 'right', 'icon_img' => '' ) |
| 3791 |
, 'style' => '' // CSS of select element |
| 3792 |
, 'class' => '' // CSS Class of select element // default included class is .wpbc_ui_addon |
| 3793 |
, 'attr' => array() // Any additional attributes |
| 3794 |
); |
| 3795 |
* Example 1: |
| 3796 |
` $params_span = array( |
| 3797 |
'type' => 'span' |
| 3798 |
, 'html' => '<i class="menu_icon icon-1x wpbc_icn_event"></i> Approve ' |
| 3799 |
, 'icon' => false // array( 'icon_font' => 'wpbc_icn_check_circle_outline', 'position' => 'right', 'icon_img' => '' ) |
| 3800 |
, 'class' => 'wpbc_ui_button inactive ui_nowrap' |
| 3801 |
, 'style' => '' |
| 3802 |
, 'attr' => array() |
| 3803 |
); |
| 3804 |
|
| 3805 |
?><div class="ui_element"><?php |
| 3806 |
|
| 3807 |
wpbc_flex_addon( $params_span ); |
| 3808 |
|
| 3809 |
wpbc_flex_text( $params_text ); |
| 3810 |
|
| 3811 |
wpbc_flex_addon( $params_span ); |
| 3812 |
|
| 3813 |
?></div><?php |
| 3814 |
* Example 2: |
| 3815 |
$params_addon = array( |
| 3816 |
'type' => 'span' |
| 3817 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . __( 'Dates', 'booking ' ) . '</strong>' |
| 3818 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_event', 'position' => 'right', 'icon_img' => '' ) |
| 3819 |
, 'class' => 'wpbc_ui_button inactive' |
| 3820 |
, 'style' => '' |
| 3821 |
, 'attr' => array() |
| 3822 |
); |
| 3823 |
?><div class="ui_element ui_nowrap"><?php |
| 3824 |
wpbc_flex_addon( $params_addon ); |
| 3825 |
?></div><?php |
| 3826 |
|
| 3827 |
*/ |
| 3828 |
function wpbc_flex_addon( $item ) { |
| 3829 |
|
| 3830 |
$default_item_params = array( |
| 3831 |
'type' => 'span' |
| 3832 |
, 'html' => '' |
| 3833 |
, 'icon' => false |
| 3834 |
, 'class' => '' |
| 3835 |
, 'style' => '' |
| 3836 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3837 |
, 'attr' => array() |
| 3838 |
); |
| 3839 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3840 |
|
| 3841 |
// Icon |
| 3842 |
$btn_icon = ''; |
| 3843 |
if ( ( ! empty( $item_params['icon'] ) ) && ( is_array( $item_params['icon'] ) ) ) { |
| 3844 |
|
| 3845 |
// Icon IMG |
| 3846 |
if ( ! empty( $item_params['icon']['icon_img'] ) ) { |
| 3847 |
|
| 3848 |
if ( substr( $item_params['icon']['icon_img'], 0, 4 ) != 'http' ) { |
| 3849 |
$img_path = WPBC_PLUGIN_URL . '/assets/img/' . $item_params['icon']['icon_img']; |
| 3850 |
} else { |
| 3851 |
$img_path = $item_params['icon']['icon_img']; |
| 3852 |
} |
| 3853 |
$btn_icon = '<img class="menuicons" src="' . esc_url( $img_path ) . '" />'; // Img Icon |
| 3854 |
} |
| 3855 |
|
| 3856 |
// Icon Font |
| 3857 |
if ( ! empty( $item_params['icon']['icon_font'] ) ) { |
| 3858 |
$btn_icon = '<i class="menu_icon icon-1x ' . esc_attr( $item_params['icon']['icon_font'] ) . '"></i>'; // Font Icon |
| 3859 |
} |
| 3860 |
} |
| 3861 |
|
| 3862 |
?><<?php echo esc_attr( $item_params['type'] ); ?> |
| 3863 |
class="wpbc_ui_control wpbc_ui_addon <?php echo esc_attr( $item_params['class'] ); |
| 3864 |
echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>" |
| 3865 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3866 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3867 |
<?php if ( ! empty( $item_params['hint'] ) ) { ?> |
| 3868 |
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" |
| 3869 |
<?php } ?> |
| 3870 |
|
| 3871 |
><?php |
| 3872 |
|
| 3873 |
if ( ( ! empty( $btn_icon ) ) && ( 'left' == $item_params['icon']['position'] ) ) { |
| 3874 |
echo $btn_icon; |
| 3875 |
} |
| 3876 |
|
| 3877 |
echo html_entity_decode( |
| 3878 |
wp_kses_post( $item_params['html'] ) // Sanitizes content for allowed HTML tags for post content |
| 3879 |
, ENT_QUOTES // Convert " to " and ' |
| 3880 |
, get_bloginfo( 'charset' ) // 'UTF-8' or other |
| 3881 |
); // Convert &dash; to ‐ etc... |
| 3882 |
|
| 3883 |
|
| 3884 |
if ( ( ! empty( $btn_icon ) ) && ( 'right' == $item_params['icon']['position'] ) ) { |
| 3885 |
echo $btn_icon; |
| 3886 |
} |
| 3887 |
|
| 3888 |
?></<?php echo esc_attr( $item_params['type'] ); ?>><?php |
| 3889 |
} |
| 3890 |
|
| 3891 |
function wpbc_flex_divider( $item = array() ){ |
| 3892 |
|
| 3893 |
$default_item_params = array( |
| 3894 |
'type' => 'span' |
| 3895 |
, 'html' => '' |
| 3896 |
, 'icon' => false |
| 3897 |
, 'class' => '' |
| 3898 |
, 'style' => '' |
| 3899 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3900 |
, 'attr' => array() |
| 3901 |
); |
| 3902 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3903 |
|
| 3904 |
?><div class="wpbc_ui_control ui_elements_divider <?php echo esc_attr( $item_params['class'] ); |
| 3905 |
echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>" |
| 3906 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3907 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3908 |
<?php if ( ! empty( $item_params['hint'] ) ) { ?> |
| 3909 |
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" |
| 3910 |
<?php } ?> |
| 3911 |
></div><?php |
| 3912 |
} |
| 3913 |
|
| 3914 |
/** |
| 3915 |
* Show FLEX Vertical line for "wpbc_ui_control" elements with vertical border color |
| 3916 |
* |
| 3917 |
* @param $item array |
| 3918 |
* |
| 3919 |
* @return void |
| 3920 |
* |
| 3921 |
* Example: |
| 3922 |
* ?><div class="ui_element ui_nowrap"><?php |
| 3923 |
wpbc_flex_vertical_color( array( |
| 3924 |
'vertical_line' => 'border-left: 4px solid #11be4c;' |
| 3925 |
) ); |
| 3926 |
* ?></div><?php |
| 3927 |
*/ |
| 3928 |
function wpbc_flex_vertical_color( $item = array() ){ |
| 3929 |
|
| 3930 |
$default_item_params = array( |
| 3931 |
'id' => '' |
| 3932 |
, 'html' => '<span></span>' |
| 3933 |
, 'icon' => false |
| 3934 |
, 'class' => '' |
| 3935 |
, 'style' => '' |
| 3936 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3937 |
, 'attr' => array() |
| 3938 |
, 'vertical_line' => 'border-left: 4px solid #11be4c;' |
| 3939 |
); |
| 3940 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 3941 |
|
| 3942 |
?><div |
| 3943 |
id="<?php echo esc_attr( $item_params['id'] ); ?>" |
| 3944 |
class="wpbc_ui_control wpbc_ui_button ui_elements_vertical_color <?php echo esc_attr( $item_params['class'] ); |
| 3945 |
echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>" |
| 3946 |
style="<?php echo esc_attr( $item_params['vertical_line'] ) . ';'; ?>padding: 0;<?php echo esc_attr( $item_params['style'] ); ?>" |
| 3947 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 3948 |
<?php if ( ! empty( $item_params['hint'] ) ) { ?> |
| 3949 |
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" |
| 3950 |
<?php } ?> |
| 3951 |
><?php echo $item_params['html']; ?></div><?php |
| 3952 |
|
| 3953 |
} |
| 3954 |
|
| 3955 |
|
| 3956 |
|
| 3957 |
|
| 3958 |
/** |
| 3959 |
* Show FLEX Horizontal Text Bar line for "wpbc_ui_control" elements with vertical border color |
| 3960 |
* |
| 3961 |
* @param $item array |
| 3962 |
* |
| 3963 |
* @return void |
| 3964 |
* |
| 3965 |
* Example: |
| 3966 |
* |
| 3967 |
$params_text_bar_1 = array( 'id' => '' |
| 3968 |
, 'html' => '1. ' . __( 'Calendar Skin', 'booking' ) |
| 3969 |
, 'option_class' => 'wpbc_option_step wpbc_passed_step' // 'wpbc_option_step', 'wpbc_option_separator', 'wpbc_option_step wpbc_selected_step', 'wpbc_option_separator wpbc_passed_step' |
| 3970 |
, 'class' => '' |
| 3971 |
, 'style' => 'height:auto;' |
| 3972 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3973 |
, 'attr' => array() |
| 3974 |
, 'tag' => 'span' |
| 3975 |
); |
| 3976 |
$params_text_bar_hr = array('id' => '' |
| 3977 |
, 'html' => '>' |
| 3978 |
, 'option_class' => 'wpbc_option_separator' // 'wpbc_option_step', 'wpbc_option_separator', 'wpbc_option_step wpbc_selected_step', 'wpbc_option_separator wpbc_passed_step' |
| 3979 |
, 'class' => '' |
| 3980 |
, 'style' => 'height:auto;' |
| 3981 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 3982 |
, 'attr' => array() |
| 3983 |
, 'tag' => 'span' |
| 3984 |
); |
| 3985 |
|
| 3986 |
$params_text_bar_2 = $params_text_bar_1; |
| 3987 |
$params_text_bar_2['html'] = '2. ' . __( 'Calendar size', 'booking' ); |
| 3988 |
$params_text_bar_2['option_class'] = 'wpbc_option_step wpbc_selected_step'; |
| 3989 |
|
| 3990 |
$params_text_bar_3 = $params_text_bar_1; |
| 3991 |
$params_text_bar_3['html'] = '3. ' . __( 'Dates selection', 'booking' ); |
| 3992 |
$params_text_bar_3['option_class'] = 'wpbc_option_step'; |
| 3993 |
|
| 3994 |
* ?><div class="ui_element ui_nowrap"><?php |
| 3995 |
* |
| 3996 |
wpbc_flex_horizontal_text_bar( $params_text_bar_1 ); |
| 3997 |
|
| 3998 |
wpbc_flex_horizontal_text_bar( $params_text_bar_hr ); |
| 3999 |
|
| 4000 |
wpbc_flex_horizontal_text_bar( $params_text_bar_2 ); |
| 4001 |
|
| 4002 |
* ?></div><?php |
| 4003 |
*/ |
| 4004 |
function wpbc_flex_horizontal_text_bar( $item = array() ){ |
| 4005 |
|
| 4006 |
$default_item_params = array( |
| 4007 |
'id' => '' |
| 4008 |
, 'html' => '<span></span>' |
| 4009 |
, 'class' => '' |
| 4010 |
, 'style' => '' |
| 4011 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 4012 |
, 'attr' => array() |
| 4013 |
, 'tag' => 'span' |
| 4014 |
, 'option_class' => 'wpbc_option_step' // 'wpbc_option_step', 'wpbc_option_separator', 'wpbc_option_step wpbc_selected_step', 'wpbc_option_separator wpbc_passed_step' |
| 4015 |
); |
| 4016 |
$item_params = wp_parse_args( $item, $default_item_params ); |
| 4017 |
|
| 4018 |
?><<?php echo esc_attr( $item_params['tag'] ); ?> |
| 4019 |
<?php if ( ! empty( $item_params['id'] ) ) { echo ' id="' . esc_attr( $item_params['id'] ) . '" '; } ?> |
| 4020 |
class="wpbc_ui_control wpbc_ui_addon wpbc_text_bar <?php echo esc_attr( $item_params['class'] ); |
| 4021 |
echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ; ?>" |
| 4022 |
style="<?php echo esc_attr( $item_params['style'] ); ?>" |
| 4023 |
<?php echo wpbc_get_custom_attr( $item_params ); ?> |
| 4024 |
<?php if ( ! empty( $item_params['hint'] ) ) { ?> |
| 4025 |
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>" |
| 4026 |
<?php } ?> |
| 4027 |
><span class="<?php echo esc_attr( $item_params['option_class'] ); ?>"><?php |
| 4028 |
echo $item_params['html']; |
| 4029 |
?></span></<?php echo esc_attr( $item_params['tag'] ); ?>><?php |
| 4030 |
|
| 4031 |
} |
| 4032 |
|
| 4033 |
|
| 4034 |
|
| 4035 |
//////////////////////////////////////////////////////////////////////////////// |
| 4036 |
// JS & CSS Loading |
| 4037 |
//////////////////////////////////////////////////////////////////////////////// |
| 4038 |
|
| 4039 |
/** |
| 4040 |
* CSS files loading |
| 4041 |
* |
| 4042 |
* @param string $where_to_load |
| 4043 |
*/ |
| 4044 |
function wpbc_ajx_toolbar_enqueue_css_files( $where_to_load ) { |
| 4045 |
|
| 4046 |
if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) { |
| 4047 |
|
| 4048 |
wp_enqueue_style( 'wpbc-flex-toolbar', wpbc_plugin_url( '/includes/_toolbar_ui/_src/toolbar_ui.css' ), array(), WP_BK_VERSION_NUM ); |
| 4049 |
} |
| 4050 |
} |
| 4051 |
add_action( 'wpbc_enqueue_css_files', 'wpbc_ajx_toolbar_enqueue_css_files', 50 ); |
| 4052 |
|
| 4053 |
|
| 4054 |
/** |
| 4055 |
* JS files loading |
| 4056 |
* |
| 4057 |
* @param string $where_to_load |
| 4058 |
*/ |
| 4059 |
function wpbc_ajx_toolbar_enqueue_js_files( $where_to_load ) { |
| 4060 |
|
| 4061 |
$in_footer = true; |
| 4062 |
|
| 4063 |
if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) { |
| 4064 |
|
| 4065 |
wp_enqueue_script( 'wpbc-flex-toolbar-ui', wpbc_plugin_url( '/includes/_toolbar_ui/_out/toolbar_ui.js' ), array( 'wpbc-global-vars' ), WP_BK_VERSION_NUM, $in_footer ); |
| 4066 |
|
| 4067 |
/** |
| 4068 |
* wp_localize_script( 'wpbc-global-vars', 'wpbc_live_request_obj' |
| 4069 |
, array( |
| 4070 |
'contacts' => '', |
| 4071 |
'reminders' => '' |
| 4072 |
) |
| 4073 |
); |
| 4074 |
*/ |
| 4075 |
} |
| 4076 |
} |
| 4077 |
add_action( 'wpbc_enqueue_js_files', 'wpbc_ajx_toolbar_enqueue_js_files', 50 ); |