| 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>' . esc_html__( '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>' . esc_html__( '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>' . esc_html__( '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 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 813 |
if ( ! empty( $_REQUEST['wh_booking_id'] ) ) { |
| 814 |
$wh_booking_id = intval( $_REQUEST['wh_booking_id'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 815 |
if ( $wh_booking_id > 0 ) { |
| 816 |
$_REQUEST['overwrite'] = 1; |
| 817 |
$_REQUEST['keyword'] = 'id:' . $wh_booking_id; |
| 818 |
} |
| 819 |
} |
| 820 |
|
| 821 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 822 |
if ( ( ! empty( $_REQUEST['overwrite'] ) ) && ( ! empty( $_REQUEST['keyword'] ) ) ) { |
| 823 |
|
| 824 |
// Searching for booking(s) from URL: http://beta/wp-admin/admin.php?page=wpbc&view_mode=vm_booking_listing&keyword=id:2&overwrite=1 . |
| 825 |
|
| 826 |
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 827 |
$default_value = wpbc_sanitize_text( $_REQUEST['keyword'] ); |
| 828 |
|
| 829 |
?><script type="text/javascript"> |
| 830 |
jQuery( document ).ready( function (){ |
| 831 |
// setTimeout( function () { |
| 832 |
// wpbc_ajx_booking_listing.search_set_param( 'wh_booking_type', [0] ); |
| 833 |
// }, 950 ); |
| 834 |
wpbc_ajx_booking_searching_after_few_seconds( '#<?php echo esc_attr( $el_id ); ?>', 1000 ); // Immediate search after 0.5 second |
| 835 |
} ); |
| 836 |
</script><?php |
| 837 |
} |
| 838 |
|
| 839 |
$params = array( |
| 840 |
'type' => 'text', |
| 841 |
'id' => $el_id, |
| 842 |
'name' => $el_id, |
| 843 |
'label' => '', |
| 844 |
'disabled' => false, |
| 845 |
'class' => '', |
| 846 |
'style' => '', |
| 847 |
'placeholder' => __( 'Enter keyword to search...', 'booking' ), |
| 848 |
'attr' => array(), |
| 849 |
'value' => $default_value, |
| 850 |
'onfocus' => '', |
| 851 |
); |
| 852 |
?><div class="ui_element"><?php |
| 853 |
wpbc_flex_text( $params ); |
| 854 |
?></div><?php |
| 855 |
} |
| 856 |
|
| 857 |
|
| 858 |
// FixIn: 9.7.2.3. |
| 859 |
function wpbc_ajx_toolbar_clear_keyword_search( $escaped_search_request_params, $defaults ){ |
| 860 |
|
| 861 |
$params = array( |
| 862 |
'type' => 'button' , |
| 863 |
'title' => '',//__( 'Reset', 'booking' ) . ' ', // Title of the button |
| 864 |
'hint' => array( 'title' => __( 'Reset keyword text field', 'booking' ), 'position' => 'top' ), // Hint |
| 865 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 866 |
'action' => "jQuery( '#wpbc_search_field').val(''); |
| 867 |
wpbc_ajx_booking_send_search_request_with_params( { |
| 868 |
'keyword' : '', |
| 869 |
'page_num': 1 |
| 870 |
} ); |
| 871 |
", // JavaScript |
| 872 |
'icon' => array( |
| 873 |
'icon_font' => 'wpbc_icn_close', //'wpbc_icn_rotate_left', |
| 874 |
'position' => 'left', |
| 875 |
'icon_img' => '' |
| 876 |
), |
| 877 |
'class' => 'wpbc_button_as_icon', // '' | 'wpbc_ui_button_primary' |
| 878 |
'style' => '', // Any CSS class here |
| 879 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 880 |
'attr' => array() |
| 881 |
); |
| 882 |
|
| 883 |
?><div class="ui_element" style="flex: 0 1 auto;margin-left: -50px;z-index: 1;"><?php |
| 884 |
wpbc_flex_button( $params ); |
| 885 |
?></div><?php |
| 886 |
} |
| 887 |
|
| 888 |
/** |
| 889 |
* Reset button - init default filter options |
| 890 |
* |
| 891 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 892 |
* @param $defaults - default parameters values |
| 893 |
*/ |
| 894 |
function wpbc_ajx_toolbar_reset_button( $escaped_search_request_params, $defaults ){ |
| 895 |
|
| 896 |
$params = array( |
| 897 |
'type' => 'button' , |
| 898 |
'title' => __( 'Reset', 'booking' ) . ' ', // Title of the button |
| 899 |
'hint' => array( 'title' => __( 'Reset search filter and user options to default values', 'booking' ) . '. ' . __( 'Show all bookings.', 'booking' ), 'position' => 'top' ), // Hint |
| 900 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 901 |
'action' => "wpbc_ajx_booking_send_search_request_with_params( { |
| 902 |
'ui_reset': 'make_reset', |
| 903 |
'page_num': 1 |
| 904 |
} );", // JavaScript |
| 905 |
'icon' => array( |
| 906 |
'icon_font' => 'wpbc_icn_settings_backup_restore', //'wpbc_icn_rotate_left', |
| 907 |
'position' => 'left', |
| 908 |
'icon_img' => '' |
| 909 |
), |
| 910 |
'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary' |
| 911 |
'style' => '',// 'color: #ef6500;', //FixIn: 9.7.2.1 // Any CSS class here |
| 912 |
'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 913 |
'attr' => array() |
| 914 |
); |
| 915 |
|
| 916 |
?><div class="ui_element" style="margin-left: auto;"><?php |
| 917 |
wpbc_flex_button( $params ); |
| 918 |
?></div><?php |
| 919 |
} |
| 920 |
|
| 921 |
// --------------------------------------------------------------------------------------------------------------------- |
| 922 |
/// 2nd row |
| 923 |
// --------------------------------------------------------------------------------------------------------------------- |
| 924 |
|
| 925 |
/** |
| 926 |
* Booking resources |
| 927 |
* |
| 928 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 929 |
* @param $defaults - default parameters values |
| 930 |
*/ |
| 931 |
function wpbc_ajx__ui__booking_resources( $escaped_search_request_params, $defaults ){ |
| 932 |
|
| 933 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 934 |
return false; |
| 935 |
} |
| 936 |
|
| 937 |
$params_button = array( |
| 938 |
'type' => 'button' , |
| 939 |
'title' => '',//__( 'Reset', 'booking' ) . ' ', // Title of the button |
| 940 |
'hint' => array( 'title' => __( 'Remove all booking resources', 'booking' ), 'position' => 'top' ), // Hint |
| 941 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 942 |
'action' => "remove_all_options_from_choozen('#wh_booking_type');", // JavaScript |
| 943 |
'icon' => array( |
| 944 |
'icon_font' => 'wpbc_icn_close', |
| 945 |
'position' => 'left', |
| 946 |
'icon_img' => '' |
| 947 |
), |
| 948 |
'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary' |
| 949 |
'style' => '', // Any CSS class here |
| 950 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 951 |
'attr' => array( 'id' => 'wpbc_booking_listing_reload_button') |
| 952 |
); |
| 953 |
|
| 954 |
/** |
| 955 |
* result = {array} [12] |
| 956 |
1 = {array} [10] |
| 957 |
booking_type_id = "1" |
| 958 |
title = "Standard" |
| 959 |
users = "3" |
| 960 |
import = null |
| 961 |
export = null |
| 962 |
cost = "25" |
| 963 |
default_form = "owner-custom-form-1" |
| 964 |
prioritet = "2" |
| 965 |
parent = "0" |
| 966 |
visitors = "2" |
| 967 |
2 = {array} [10] |
| 968 |
booking_type_id = "2" |
| 969 |
title = "Apartment#1" ... |
| 970 |
*/ |
| 971 |
$resources_sql_arr = wpbc_ajx_get_all_booking_resources_arr(); |
| 972 |
|
| 973 |
/** |
| 974 |
* $resources_arr = array( linear_resources = {array} [12] single_or_parent = {array} [5] child = {array} [2] ) |
| 975 |
* |
| 976 |
$resources_arr = {array} [3] |
| 977 |
linear_resources = {array} [12] |
| 978 |
1 = {array} [12] |
| 979 |
booking_type_id = "1" |
| 980 |
title = "Standard" |
| 981 |
users = "3" |
| 982 |
import = null |
| 983 |
export = null |
| 984 |
cost = "25" |
| 985 |
default_form = "owner-custom-form-1" |
| 986 |
prioritet = "2" |
| 987 |
parent = "0" |
| 988 |
visitors = "2" |
| 989 |
id = "1" |
| 990 |
count = {int} 5 |
| 991 |
5 = {array} [12] |
| 992 |
booking_type_id = "5" |
| 993 |
title = "Standard-1" |
| 994 |
users = "1" |
| 995 |
import = null |
| 996 |
*/ |
| 997 |
$resources_arr = wpbc_ajx_arrange_booking_resources_arr( $resources_sql_arr ); |
| 998 |
$style = ''; |
| 999 |
$select_box_options = array(); // FixIn: 4.3.2.1. |
| 1000 |
if ( ! empty( $resources_arr ) ) { |
| 1001 |
|
| 1002 |
$linear_resources_arr = $resources_arr['linear_resources']; |
| 1003 |
|
| 1004 |
|
| 1005 |
|
| 1006 |
if ( count( $linear_resources_arr ) > 1 ) { |
| 1007 |
|
| 1008 |
$resources_id_arr = array(); |
| 1009 |
foreach ( $linear_resources_arr as $bkr ) { |
| 1010 |
$resources_id_arr[] = $bkr['id']; |
| 1011 |
} |
| 1012 |
|
| 1013 |
$select_box_options[ /*implode( ',', $resources_id_arr )*/0 ] = array( |
| 1014 |
'title' => __( 'All resources', 'booking' ) |
| 1015 |
, 'attr' => array( 'title' => '<strong>' . esc_html__( 'All resources', 'booking' ) . '</strong>' ) |
| 1016 |
, 'style' => 'font-weight:600;' |
| 1017 |
); |
| 1018 |
} |
| 1019 |
|
| 1020 |
foreach ( $linear_resources_arr as $bkr ) { |
| 1021 |
|
| 1022 |
$option_title = wpbc_lang( $bkr['title'] ); |
| 1023 |
|
| 1024 |
if ( isset( $bkr['parent'] ) ) { |
| 1025 |
if ( $bkr ['parent'] == 0 ) { |
| 1026 |
$option_title = $option_title; |
| 1027 |
$style = 'font-weight:600;'; |
| 1028 |
} else { |
| 1029 |
$option_title = ' ' . $option_title; |
| 1030 |
$style = 'font-weight:400;'; |
| 1031 |
} |
| 1032 |
} |
| 1033 |
$select_box_options[ $bkr ['id'] ] = array( |
| 1034 |
'title' => $option_title |
| 1035 |
, 'attr' => array( 'title' => $option_title ) |
| 1036 |
, 'style' => $style |
| 1037 |
); |
| 1038 |
} |
| 1039 |
} |
| 1040 |
|
| 1041 |
|
| 1042 |
|
| 1043 |
$el_id = 'wh_booking_type'; |
| 1044 |
$params_select = array( |
| 1045 |
'id' => $el_id // HTML ID of element |
| 1046 |
, 'name' => $el_id |
| 1047 |
, 'label' => '' // __( 'Next Days', 'booking' ) // Label (optional) |
| 1048 |
, 'style' => 'display:none;' // CSS of select element |
| 1049 |
, 'class' => 'chzn-select' // CSS Class of select element |
| 1050 |
, 'multiple' => true |
| 1051 |
, 'attr' => array( 'data-placeholder' => __( 'Select booking resources', 'booking' ) ) // Any additional attributes, if this radio | checkbox element |
| 1052 |
, 'disabled' => false |
| 1053 |
, 'disabled_options' => array() // If some options disabled, then it has to list here |
| 1054 |
, 'options' => $select_box_options |
| 1055 |
|
| 1056 |
, '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 |
| 1057 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 1058 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code |
| 1059 |
|
| 1060 |
); |
| 1061 |
|
| 1062 |
// Booking resources |
| 1063 |
?><div class="ui_element ui_nowrap"><?php |
| 1064 |
|
| 1065 |
wpbc_flex_select( $params_select ); |
| 1066 |
|
| 1067 |
wpbc_flex_button( $params_button ); |
| 1068 |
|
| 1069 |
?></div><?php |
| 1070 |
|
| 1071 |
?><script type="text/javascript"> |
| 1072 |
function remove_all_options_from_choozen( selectbox_id ){ |
| 1073 |
jQuery( selectbox_id + ' option' ).prop( 'selected', false ); // Disable selection in the real selectbox |
| 1074 |
jQuery( selectbox_id ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field // FixIn: 8.7.9.9. |
| 1075 |
jQuery( selectbox_id ).trigger( 'change' ); |
| 1076 |
} |
| 1077 |
<?php |
| 1078 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1079 |
echo wpbc_jq_ready_start(); |
| 1080 |
?> |
| 1081 |
if ( 'function' === typeof( jQuery("#<?php echo esc_attr( $el_id ); ?>").chosen ) ) { |
| 1082 |
|
| 1083 |
jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).chosen( {no_results_text: "No results matched"} ); |
| 1084 |
|
| 1085 |
jQuery("#<?php echo esc_attr( $el_id ); ?>").chosen().on('change', function(va){ // Catch any selections in the Choozen |
| 1086 |
|
| 1087 |
if ( jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).val() != null ){ |
| 1088 |
//So we are having aready values |
| 1089 |
jQuery.each( jQuery( "#<?php echo esc_attr( $el_id ); ?>" ).val(), function ( index, value ){ |
| 1090 |
|
| 1091 |
if ( (value.indexOf( ',' ) > 0) || ('0' === value) ){ // Ok we are have array with all booking resources ID |
| 1092 |
|
| 1093 |
// Disable selection in the real selectbox |
| 1094 |
jQuery( '#<?php echo esc_attr( $el_id ); ?>' + ' option' ).removeAttr( 'selected' ); |
| 1095 |
|
| 1096 |
// Select "All resources" option in real selectbox |
| 1097 |
jQuery( '#<?php echo esc_attr( $el_id ); ?>' + ' option:first-child' ).prop( "selected", true ); |
| 1098 |
|
| 1099 |
//Highlight options in chosen, before removing |
| 1100 |
jQuery('#<?php echo esc_attr( $el_id ); ?>_chosen li.search-choice:not(:contains(' + '<?php |
| 1101 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1102 |
echo html_entity_decode( esc_js( __( 'All resources', 'booking' ) ) ); ?>' + '))') |
| 1103 |
.fadeOut(350).fadeIn(300) |
| 1104 |
.fadeOut(350).fadeIn(400) |
| 1105 |
.fadeOut(350).fadeIn(300) |
| 1106 |
.fadeOut(350).fadeIn(400) |
| 1107 |
.animate({opacity: 1}, 4000); |
| 1108 |
|
| 1109 |
// Update chosen LI choices, relative selected options in selectbox |
| 1110 |
var all_resources_timer = setTimeout( function (){ |
| 1111 |
|
| 1112 |
jQuery( '#<?php echo esc_attr( $el_id ); ?>' ).trigger( 'chosen:updated' ); // Remove all fields from the Choozen field |
| 1113 |
}, 2000 ); |
| 1114 |
|
| 1115 |
var my_message = '<?php echo esc_js( __( 'Please note, its not possible to add new resources, if "All resources" option is selected. Please clear the selection, then add new resources.', 'booking' ) ); ?>'; |
| 1116 |
wpbc_admin_show_message( my_message, 'warning', 10000 ); |
| 1117 |
} |
| 1118 |
} ); |
| 1119 |
} |
| 1120 |
}); |
| 1121 |
|
| 1122 |
} else { |
| 1123 |
alert( 'WPBC Error. JavaScript library "chosen" was not defined.' ); |
| 1124 |
} |
| 1125 |
<?php |
| 1126 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 1127 |
echo wpbc_jq_ready_end(); |
| 1128 |
?> |
| 1129 |
</script><?php |
| 1130 |
} |
| 1131 |
|
| 1132 |
/** |
| 1133 |
* Existing | Trash | Any |
| 1134 |
* |
| 1135 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1136 |
* @param $defaults - default parameters values |
| 1137 |
*/ |
| 1138 |
function wpbc_ajx__ui__existing_or_trash( $escaped_search_request_params, $defaults ){ |
| 1139 |
|
| 1140 |
$params_addon = array( |
| 1141 |
'type' => 'span' |
| 1142 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>' |
| 1143 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_delete_outline', 'position' => 'right', 'icon_img' => '' ) |
| 1144 |
, 'class' => 'wpbc_ui_button inactive' |
| 1145 |
, 'style' => '' |
| 1146 |
, 'attr' => array() |
| 1147 |
, 'hint' => array( 'title' => __('Show trashed or existing bookings' ,'booking') , 'position' => 'top' ) |
| 1148 |
); |
| 1149 |
|
| 1150 |
$el_id = 'wh_trash'; |
| 1151 |
$params = array( |
| 1152 |
'id' => $el_id |
| 1153 |
, 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1154 |
, 'label' => '' |
| 1155 |
, 'title' => '' //__('Bookings', 'booking') |
| 1156 |
, 'hint' => array( 'title' => __('Show trashed or existing bookings' ,'booking') , 'position' => 'top' ) |
| 1157 |
, 'li_options' => array( |
| 1158 |
'0' => __( 'Existing', 'booking' ), |
| 1159 |
'trash' => __( 'In Trash / Rejected', 'booking' ), |
| 1160 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1161 |
'any' => __( 'Any', 'booking' ) |
| 1162 |
) |
| 1163 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1164 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1165 |
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() )[0], 'page_num': 1 } );" |
| 1166 |
); |
| 1167 |
|
| 1168 |
?><div class="ui_element ui_nowrap"><?php |
| 1169 |
|
| 1170 |
wpbc_flex_addon( $params_addon ); |
| 1171 |
|
| 1172 |
wpbc_flex_dropdown( $params ); |
| 1173 |
|
| 1174 |
?></div><?php |
| 1175 |
} |
| 1176 |
|
| 1177 |
/** |
| 1178 |
* All bookings | New bookings | Imported bookings | Plugin bookings |
| 1179 |
* |
| 1180 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1181 |
* @param $defaults - default parameters values |
| 1182 |
*/ |
| 1183 |
function wpbc_ajx__ui__all_or_new( $escaped_search_request_params, $defaults ){ |
| 1184 |
|
| 1185 |
$params_addon = array( |
| 1186 |
'type' => 'span' |
| 1187 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>' |
| 1188 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_visibility', 'position' => 'right', 'icon_img' => '' ) |
| 1189 |
, 'class' => 'wpbc_ui_button inactive' |
| 1190 |
, 'style' => '' |
| 1191 |
, 'attr' => array() |
| 1192 |
, 'hint' => array( 'title' => __('Filter bookings by additional criteria' ,'booking') , 'position' => 'top' ) |
| 1193 |
); |
| 1194 |
|
| 1195 |
$el_id = 'wh_what_bookings'; |
| 1196 |
$params = array( |
| 1197 |
'id' => $el_id |
| 1198 |
, 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1199 |
, 'label' => '' |
| 1200 |
, 'title' => '' //__('Show', 'booking') |
| 1201 |
, 'hint' => array( 'title' => __('Filter bookings by additional criteria' ,'booking') , 'position' => 'top' ) |
| 1202 |
, 'li_options' => array( |
| 1203 |
'all' => array( |
| 1204 |
'type' => 'simple', |
| 1205 |
'value' => 'any', |
| 1206 |
'title' => __( 'Any', 'booking' ) |
| 1207 |
), |
| 1208 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1209 |
'new' => __( 'New', 'booking' ), |
| 1210 |
'imported' => __( 'Imported', 'booking' ), |
| 1211 |
'in_plugin' => __( 'Plugin bookings', 'booking' ) |
| 1212 |
) |
| 1213 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1214 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1215 |
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() )[0], 'page_num': 1 } );" |
| 1216 |
); |
| 1217 |
|
| 1218 |
|
| 1219 |
?><div class="ui_element ui_nowrap"><?php |
| 1220 |
|
| 1221 |
wpbc_flex_addon( $params_addon ); |
| 1222 |
|
| 1223 |
wpbc_flex_dropdown( $params ); |
| 1224 |
|
| 1225 |
?></div><?php |
| 1226 |
} |
| 1227 |
|
| 1228 |
/** |
| 1229 |
* "Creation Date" of bookings |
| 1230 |
* |
| 1231 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1232 |
* @param $defaults - default parameters values |
| 1233 |
*/ |
| 1234 |
function wpbc_ajx__ui__creation_date( $escaped_search_request_params, $defaults ){ |
| 1235 |
|
| 1236 |
$params_addon = array( |
| 1237 |
'type' => 'span' |
| 1238 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>' |
| 1239 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_edit_calendar', 'position' => 'right', 'icon_img' => '' ) |
| 1240 |
, 'class' => 'wpbc_ui_button inactive' |
| 1241 |
, 'style' => '' |
| 1242 |
, 'attr' => array() |
| 1243 |
, 'hint' => array( 'title' => __('Filter bookings by creation booking date' ,'booking') , 'position' => 'top' ) |
| 1244 |
); |
| 1245 |
|
| 1246 |
$dates_interval = array( |
| 1247 |
1 => '1' . ' ' . __('day' ,'booking') |
| 1248 |
, 2 => '2' . ' ' . __('days' ,'booking') |
| 1249 |
, 3 => '3' . ' ' . __('days' ,'booking') |
| 1250 |
, 4 => '4' . ' ' . __('days' ,'booking') |
| 1251 |
, 5 => '5' . ' ' . __('days' ,'booking') |
| 1252 |
, 6 => '6' . ' ' . __('days' ,'booking') |
| 1253 |
, 7 => '1' . ' ' . __('week' ,'booking') |
| 1254 |
, 14 => '2' . ' ' . __('weeks' ,'booking') |
| 1255 |
, 30 => '1' . ' ' . __('month' ,'booking') |
| 1256 |
, 60 => '2' . ' ' . __('months' ,'booking') |
| 1257 |
, 90 => '3' . ' ' . __('months' ,'booking') |
| 1258 |
, 183 => '6' . ' ' . __('months' ,'booking') |
| 1259 |
, 365 => '1' . ' ' . __('Year' ,'booking') |
| 1260 |
); |
| 1261 |
|
| 1262 |
$el_id = 'wh_modification_date'; |
| 1263 |
|
| 1264 |
$request_input_el_default = array( |
| 1265 |
$el_id => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ], |
| 1266 |
'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'], |
| 1267 |
'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'], |
| 1268 |
'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'], |
| 1269 |
'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'] |
| 1270 |
); |
| 1271 |
|
| 1272 |
$options = array ( |
| 1273 |
'1' => __( 'Today', 'booking' ), |
| 1274 |
'3' => __( 'All dates', 'booking' ), |
| 1275 |
|
| 1276 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1277 |
|
| 1278 |
// Prior [ '5', '10' ] |
| 1279 |
'prior' => array( |
| 1280 |
'type' => 'complex', |
| 1281 |
'class' => 'ui_complex_option_element', |
| 1282 |
'style' => 'min-width: 244px;', |
| 1283 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 1284 |
'selected_options_title' => array( 1 => array( 'label', 'title' ) |
| 1285 |
, 'text1' => ': ' |
| 1286 |
, 4 => array( 'options' , $request_input_el_default[ 'ui_wh_modification_date_prior'] ) |
| 1287 |
), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ] |
| 1288 |
'input_options' => array( |
| 1289 |
array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 1290 |
, array( |
| 1291 |
'type' => 'radio' |
| 1292 |
|
| 1293 |
, 'id' => 'ui_wh_modification_date_radio_2' // HTML ID of element |
| 1294 |
, 'name' => 'ui_wh_modification_date_radio' |
| 1295 |
, 'label' => array( 'title' => __('Prior' ,'booking') , 'position' => 'right' ) |
| 1296 |
, 'style' => '' // CSS of select element |
| 1297 |
, 'class' => '' // CSS Class of select element |
| 1298 |
, 'disabled' => false |
| 1299 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1300 |
, 'legend' => '' // aria-label parameter |
| 1301 |
, 'value' => '5' // Some Value from optins array that selected by default |
| 1302 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_modification_date_radio' ] == '5' ) ? true : false // Selected or not |
| 1303 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // 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 |
, array( 'type' => 'html', 'html' => '<div class="ui_element">' ) |
| 1308 |
, array( |
| 1309 |
'type' => 'select' |
| 1310 |
, 'attr' => array() |
| 1311 |
, 'name' => 'ui_wh_modification_date_prior' |
| 1312 |
, 'id' => 'ui_wh_modification_date_prior' |
| 1313 |
, 'options' => $dates_interval |
| 1314 |
, 'value' => $request_input_el_default[ 'ui_wh_modification_date_prior'] |
| 1315 |
, 'onfocus' => "jQuery('#ui_wh_modification_date_radio_2').prop('checked', true);" // JavaScript code |
| 1316 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1317 |
) |
| 1318 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1319 |
) |
| 1320 |
), |
| 1321 |
|
| 1322 |
// Fixed [ '6', '', '2022-05-21'] |
| 1323 |
'fixed' => array( |
| 1324 |
'type' => 'complex', |
| 1325 |
'class' => 'ui_complex_option_element', |
| 1326 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ), 7 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 1327 |
'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' ] |
| 1328 |
'input_options' => array( |
| 1329 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' ) |
| 1330 |
, array( |
| 1331 |
'type' => 'radio' |
| 1332 |
|
| 1333 |
, 'id' => 'ui_wh_modification_date_radio_3' // HTML ID of element |
| 1334 |
, 'name' => 'ui_wh_modification_date_radio' |
| 1335 |
, 'label' => array( 'title' => __('Dates' ,'booking') , 'position' => 'right' ) |
| 1336 |
, 'style' => '' // CSS of select element |
| 1337 |
, 'class' => '' // CSS Class of select element |
| 1338 |
, 'disabled' => false |
| 1339 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1340 |
, 'legend' => '' // aria-label parameter |
| 1341 |
, 'value' => '6' // Some Value from optins array that selected by default |
| 1342 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_modification_date_radio' ] == '6' ) ? true : false // Selected or not |
| 1343 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1344 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1345 |
) |
| 1346 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1347 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 4px 4px 0;">' ) |
| 1348 |
, array( |
| 1349 |
'type' => 'text' |
| 1350 |
, 'id' => 'ui_wh_modification_date_checkin' // HTML ID of element |
| 1351 |
, 'name' => 'ui_wh_modification_date_checkin' |
| 1352 |
, 'label' => ''//__('Check-in' ,'booking') |
| 1353 |
, 'style' => 'width:100%;' // CSS of select element |
| 1354 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 1355 |
, 'disabled' => false |
| 1356 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1357 |
, 'placeholder' => __('From' ,'booking') // gmdate( 'Y-m-d' ) |
| 1358 |
, 'value' => $request_input_el_default[ 'ui_wh_modification_date_checkin'] // Some Value from optins array that selected by default |
| 1359 |
, 'onfocus' => "jQuery('#ui_wh_modification_date_radio_3').prop('checked', true);" // JavaScript code |
| 1360 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1361 |
) |
| 1362 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1363 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex-flow: row wrap;padding: 4px 0 4px 4px;">' ) |
| 1364 |
, array( |
| 1365 |
'type' => 'text' |
| 1366 |
, 'id' => 'ui_wh_modification_date_checkout' // HTML ID of element |
| 1367 |
, 'name' => 'ui_wh_modification_date_checkout' |
| 1368 |
, 'label' => ''//__('Check-out' ,'booking') |
| 1369 |
, 'style' => 'width:100%;' // CSS of select element |
| 1370 |
, 'class' => 'wpdevbk-filters-section-calendar' // CSS Class of select element |
| 1371 |
, 'disabled' => false |
| 1372 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1373 |
, 'placeholder' => __('To' ,'booking') // gmdate( 'Y-m-d' ) |
| 1374 |
, 'value' => $request_input_el_default[ 'ui_wh_modification_date_checkout'] // Some Value from optins array that selected by default |
| 1375 |
, 'onfocus' => "jQuery('#ui_wh_modification_date_radio_3').prop('checked', true);" // JavaScript code |
| 1376 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1377 |
) |
| 1378 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1379 |
) |
| 1380 |
), |
| 1381 |
|
| 1382 |
'divider3' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1383 |
|
| 1384 |
// Buttons |
| 1385 |
'buttons1' => array( |
| 1386 |
'type' => 'complex', |
| 1387 |
'class' => 'ui_complex_option_element', |
| 1388 |
'style' => 'justify-content: flex-end;', |
| 1389 |
'input_options' => array( |
| 1390 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' ) |
| 1391 |
, array( |
| 1392 |
'type' => 'button' |
| 1393 |
, 'title' => __( 'Apply', 'booking' ) // Title of the button |
| 1394 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1395 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1396 |
, 'action' => "wpbc_ui_dropdown_apply_click( { |
| 1397 |
'dropdown_id' : 'wh_modification_date', |
| 1398 |
'dropdown_radio_name': 'ui_wh_modification_date_radio' |
| 1399 |
} );" // JavaScript code |
| 1400 |
, 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary |
| 1401 |
, 'icon' => '' |
| 1402 |
, 'font_icon' => '' |
| 1403 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1404 |
, 'style' => '' // Any CSS class here |
| 1405 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1406 |
, 'attr' => array() |
| 1407 |
) |
| 1408 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1409 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' ) |
| 1410 |
, array( |
| 1411 |
'type' => 'button' |
| 1412 |
, 'title' => __( 'Close', 'booking' ) // Title of the button |
| 1413 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1414 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1415 |
, 'action' => "wpbc_ui_dropdown_close_click( 'wh_modification_date' );" // JavaScript code |
| 1416 |
, 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary |
| 1417 |
, 'icon' => '' |
| 1418 |
, 'font_icon' => '' |
| 1419 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1420 |
, 'style' => '' // Any CSS class here |
| 1421 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1422 |
, 'attr' => array() |
| 1423 |
) |
| 1424 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1425 |
) |
| 1426 |
), |
| 1427 |
); |
| 1428 |
|
| 1429 |
$params = array( |
| 1430 |
'id' => $el_id |
| 1431 |
, 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1432 |
, 'label' => '' |
| 1433 |
, 'title' => ''//__('Creation', 'booking') |
| 1434 |
, 'hint' => array( 'title' => __('Filter bookings by creation booking date' ,'booking') , 'position' => 'top' ) |
| 1435 |
, 'li_options' => $options |
| 1436 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1437 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1438 |
//, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() ), 'page_num': 1 " |
| 1439 |
// // Frontend selected elements (saving for future use, after F5) |
| 1440 |
// . " ,'ui_wh_modification_date_radio' : jQuery( 'input[name=\"ui_wh_modification_date_radio\"]:checked' ).val()" |
| 1441 |
// . " ,'ui_wh_modification_date_prior' : jQuery( '#ui_wh_modification_date_prior' ).val()" |
| 1442 |
// . " ,'ui_wh_modification_date_checkin' : jQuery( '#ui_wh_modification_date_checkin' ).val()" |
| 1443 |
// . " ,'ui_wh_modification_date_checkout': jQuery( '#ui_wh_modification_date_checkout' ).val()" |
| 1444 |
// ."} );" |
| 1445 |
); |
| 1446 |
|
| 1447 |
?><div class="ui_element ui_nowrap"><?php |
| 1448 |
|
| 1449 |
wpbc_flex_addon( $params_addon ); |
| 1450 |
|
| 1451 |
wpbc_flex_dropdown( $params ); |
| 1452 |
|
| 1453 |
?></div><?php |
| 1454 |
} |
| 1455 |
|
| 1456 |
/** |
| 1457 |
* Payment Status |
| 1458 |
* |
| 1459 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1460 |
* @param $defaults - default parameters values |
| 1461 |
*/ |
| 1462 |
function wpbc_ajx__ui__payment_status( $escaped_search_request_params, $defaults ){ |
| 1463 |
|
| 1464 |
if ( ! class_exists( 'wpdev_bk_biz_s' ) ) { |
| 1465 |
return false; |
| 1466 |
} |
| 1467 |
|
| 1468 |
$params_addon = array( |
| 1469 |
'type' => 'span' |
| 1470 |
, 'html' => ''// '<i class="menu_icon icon-1x wpbc_icn_event"></i>' //'<strong>' . esc_html__( 'Dates', 'booking ' ) . '</strong>' |
| 1471 |
, 'icon' => array( 'icon_font' => 'wpbc_icn_payments', 'position' => 'right', 'icon_img' => '' ) |
| 1472 |
, 'class' => 'wpbc_ui_button inactive' |
| 1473 |
, 'style' => '' |
| 1474 |
, 'attr' => array() |
| 1475 |
, 'hint' => array( 'title' => __('Filter bookings by payment status' ,'booking') , 'position' => 'top' ) |
| 1476 |
); |
| 1477 |
|
| 1478 |
$el_id = 'wh_pay_status'; |
| 1479 |
|
| 1480 |
$request_input_el_default = array( |
| 1481 |
$el_id => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ], |
| 1482 |
'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'], |
| 1483 |
'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'] |
| 1484 |
); |
| 1485 |
|
| 1486 |
$options = array ( |
| 1487 |
'all' => __( 'Any Status', 'booking' ), |
| 1488 |
'divider0' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1489 |
'group_ok' => __( 'Paid OK', 'booking' ), |
| 1490 |
'group_unknown' => __( 'Unknown Status', 'booking' ), |
| 1491 |
'group_pending' => __( 'Not Completed', 'booking' ), |
| 1492 |
'group_failed' => __( 'Failed', 'booking' ), |
| 1493 |
|
| 1494 |
'divider1' => array( 'type' => 'html', 'html' => '<hr/>' ), |
| 1495 |
|
| 1496 |
// Fixed [ '6', '', '2022-05-21'] |
| 1497 |
'custom' => array( |
| 1498 |
'type' => 'complex', |
| 1499 |
'class' => 'ui_complex_option_element', |
| 1500 |
'selected_options_value' => array( 1 => array( 'value' ), 4 => array( 'value' ) ), // 4 => array( 'value' ) --> $complex_option['input_options'][4]['value'] |
| 1501 |
'selected_options_title' => array( 1 => array( 'label', 'title' ), 'text1' => ': ', 4 => array( 'value' ) ), // 1 => array( 'label', 'title' ) --> $complex_option['input_options'][1]['label'][ 'title' ] |
| 1502 |
'input_options' => array( |
| 1503 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;margin-top:5px;">' ) |
| 1504 |
, array( |
| 1505 |
'type' => 'radio' |
| 1506 |
|
| 1507 |
, 'id' => 'ui_wh_pay_status_radio_1' // HTML ID of element |
| 1508 |
, 'name' => 'ui_wh_pay_status_radio' |
| 1509 |
, 'label' => array( 'title' => __('Custom' ,'booking') , 'position' => 'right' ) |
| 1510 |
, 'style' => '' // CSS of select element |
| 1511 |
, 'class' => '' // CSS Class of select element |
| 1512 |
, 'disabled' => false |
| 1513 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1514 |
, 'legend' => '' // aria-label parameter |
| 1515 |
, 'value' => 'user_entered' // Some Value from optins array that selected by default |
| 1516 |
, 'selected' => ( $request_input_el_default[ 'ui_wh_pay_status_radio' ] == 'user_entered' ) ? true : false // Selected or not |
| 1517 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1518 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1519 |
) |
| 1520 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1521 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex:1 1 100%;">' ) |
| 1522 |
, array( |
| 1523 |
'type' => 'text' |
| 1524 |
, 'id' => 'ui_wh_pay_status_custom' // HTML ID of element |
| 1525 |
, 'name' => 'ui_wh_pay_status_custom' |
| 1526 |
, 'label' => ''//__('Check-out' ,'booking') |
| 1527 |
, 'style' => 'max-width:100%;width:100%;' // CSS of select element |
| 1528 |
, 'class' => '' // CSS Class of select element |
| 1529 |
, 'disabled' => false |
| 1530 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1531 |
, 'placeholder' => __('Payment status' ,'booking') // gmdate( 'Y-m-d' ) |
| 1532 |
, 'value' => $request_input_el_default[ 'ui_wh_pay_status_custom'] // Some Value from optins array that selected by default |
| 1533 |
, 'onfocus' => "jQuery('#ui_wh_pay_status_radio_1').prop('checked', true);" // JavaScript code |
| 1534 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1535 |
) |
| 1536 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1537 |
) |
| 1538 |
), |
| 1539 |
|
| 1540 |
|
| 1541 |
// Buttons |
| 1542 |
'buttons1' => array( |
| 1543 |
'type' => 'complex', |
| 1544 |
'class' => 'ui_complex_option_element', |
| 1545 |
'style' => 'justify-content: flex-end;', |
| 1546 |
'input_options' => array( |
| 1547 |
array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0;">' ) |
| 1548 |
, array( |
| 1549 |
'type' => 'button' |
| 1550 |
, 'title' => __( 'Apply', 'booking' ) // Title of the button |
| 1551 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1552 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1553 |
, 'action' => "wpbc_ui_dropdown_apply_click( { |
| 1554 |
'dropdown_id' : 'wh_pay_status', |
| 1555 |
'dropdown_radio_name': 'ui_wh_pay_status_radio' |
| 1556 |
} );" // JavaScript code |
| 1557 |
, 'class' => 'wpbc_ui_button_primary' // wpbc_ui_button | wpbc_ui_button_primary |
| 1558 |
, 'icon' => '' |
| 1559 |
, 'font_icon' => '' |
| 1560 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1561 |
, 'style' => '' // Any CSS class here |
| 1562 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1563 |
, 'attr' => array() |
| 1564 |
) |
| 1565 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1566 |
, array( 'type' => 'html', 'html' => '<div class="ui_element" style="flex: 0 1 auto;margin: 0 0 0 1em;">' ) |
| 1567 |
, array( |
| 1568 |
'type' => 'button' |
| 1569 |
, 'title' => __( 'Close', 'booking' ) // Title of the button |
| 1570 |
, 'hint' => '' // , 'hint' => array( 'title' => __('Select status' ,'booking') , 'position' => 'bottom' ) |
| 1571 |
, 'link' => 'javascript:void(0)' // Direct link or skip it |
| 1572 |
, 'action' => "wpbc_ui_dropdown_close_click( 'wh_pay_status' );" // JavaScript code |
| 1573 |
, 'class' => '' // wpbc_ui_button | wpbc_ui_button_primary |
| 1574 |
, 'icon' => '' |
| 1575 |
, 'font_icon' => '' |
| 1576 |
, 'icon_position' => 'left' // Position of icon relative to Text: left | right |
| 1577 |
, 'style' => '' // Any CSS class here |
| 1578 |
, 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size). |
| 1579 |
, 'attr' => array() |
| 1580 |
) |
| 1581 |
, array( 'type' => 'html', 'html' => '</div>' ) |
| 1582 |
) |
| 1583 |
), |
| 1584 |
); |
| 1585 |
|
| 1586 |
$params = array( |
| 1587 |
'id' => $el_id |
| 1588 |
, 'default' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1589 |
, 'label' => '' |
| 1590 |
, 'title' => ''//__('Payment', 'booking') |
| 1591 |
, 'hint' => array( 'title' => __('Filter bookings by payment status' ,'booking') , 'position' => 'top' ) |
| 1592 |
, 'li_options' => $options |
| 1593 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( '#{$el_id}' ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1594 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1595 |
///*, 'onchange' =>*/. "wpbc_ajx_booking_send_search_request_with_params( { '{$el_id}': JSON.parse( jQuery( this ).val() ), 'page_num': 1 " |
| 1596 |
// // Frontend selected elements (saving for future use, after F5) |
| 1597 |
// . " ,'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()" |
| 1598 |
// . " ,'ui_wh_pay_status_custom' : jQuery( '#ui_wh_pay_status_custom' ).val()" |
| 1599 |
// ."} );" |
| 1600 |
); |
| 1601 |
|
| 1602 |
|
| 1603 |
?><div class="ui_element ui_nowrap"><?php |
| 1604 |
|
| 1605 |
wpbc_flex_addon( $params_addon ); |
| 1606 |
|
| 1607 |
wpbc_flex_dropdown( $params ); |
| 1608 |
|
| 1609 |
?></div><?php |
| 1610 |
} |
| 1611 |
|
| 1612 |
/** |
| 1613 |
* Costs Min - Max |
| 1614 |
* |
| 1615 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1616 |
* @param $defaults - default parameters values |
| 1617 |
*/ |
| 1618 |
function wpbc_ajx__ui__cost_min_max( $escaped_search_request_params, $defaults ){ |
| 1619 |
|
| 1620 |
if ( ! class_exists( 'wpdev_bk_biz_s' ) ) { |
| 1621 |
return false; |
| 1622 |
} |
| 1623 |
|
| 1624 |
$el_id = 'wh_cost'; |
| 1625 |
|
| 1626 |
$params = array( |
| 1627 |
'id' => $el_id // HTML ID of element |
| 1628 |
, 'name' => $el_id |
| 1629 |
, 'label' => '<span class="" style="font-weight:600;">' . esc_html__( 'Cost', 'booking' ) . ' <em style="color:#888;">(' . esc_html__( 'min-max', 'booking' ) . '):</em></span>' |
| 1630 |
, 'style' => 'max-width: 69px;' // CSS of select element |
| 1631 |
, 'class' => '' // CSS Class of select element |
| 1632 |
, 'disabled' => false |
| 1633 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1634 |
, 'placeholder' => '0' |
| 1635 |
, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1636 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1637 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1638 |
); |
| 1639 |
?><div class="ui_element" style="margin-right: 5px;"><?php |
| 1640 |
|
| 1641 |
wpbc_flex_text( $params ); |
| 1642 |
|
| 1643 |
?></div><?php |
| 1644 |
|
| 1645 |
|
| 1646 |
$el_id = 'wh_cost2'; |
| 1647 |
|
| 1648 |
$params = array( |
| 1649 |
'id' => $el_id // HTML ID of element |
| 1650 |
, 'name' => $el_id |
| 1651 |
, 'label' => '<span class="" style="font-weight:600;"> ‐ </span>' |
| 1652 |
, 'style' => 'max-width: 69px;' // CSS of select element |
| 1653 |
, 'class' => '' // CSS Class of select element |
| 1654 |
, 'disabled' => false |
| 1655 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 1656 |
, 'placeholder' => '10000' |
| 1657 |
, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] |
| 1658 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1659 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code |
| 1660 |
); |
| 1661 |
?><div class="ui_element"><?php |
| 1662 |
|
| 1663 |
wpbc_flex_text( $params ); |
| 1664 |
|
| 1665 |
?></div><?php |
| 1666 |
|
| 1667 |
} |
| 1668 |
|
| 1669 |
/** |
| 1670 |
* Reload button - force loading of ajax data |
| 1671 |
* |
| 1672 |
* @param $escaped_search_request_params - escaped search request parameters array |
| 1673 |
* @param $defaults - default parameters values |
| 1674 |
*/ |
| 1675 |
function wpbc_ajx_toolbar_force_reload_button( $escaped_search_request_params, $defaults ){ |
| 1676 |
|
| 1677 |
$params = array( |
| 1678 |
'type' => 'button' , |
| 1679 |
'title' => '',//__( 'Reset', 'booking' ) . ' ', // Title of the button |
| 1680 |
'hint' => array( 'title' => __( 'Reload bookings listing', 'booking' ), 'position' => 'top' ), // Hint |
| 1681 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1682 |
'action' => "wpbc_ajx_booking_send_search_request_with_params( { } );", // Some JavaScript |
| 1683 |
'icon' => array( |
| 1684 |
'icon_font' => 'wpbc_icn_rotate_right wpbc_spin', //'wpbc_icn_rotate_left', |
| 1685 |
'position' => 'left', |
| 1686 |
'icon_img' => '' |
| 1687 |
), |
| 1688 |
'class' => 'wpbc_ui_button wpbc_ui_button_primary', // '' | 'wpbc_ui_button_primary' |
| 1689 |
'style' => '', // Any CSS class here |
| 1690 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1691 |
'attr' => array( 'id' => 'wpbc_booking_listing_reload_button') |
| 1692 |
); |
| 1693 |
|
| 1694 |
?><div class="ui_element" style="flex: 0 1 auto;"><?php |
| 1695 |
wpbc_flex_button( $params ); |
| 1696 |
?></div><?php |
| 1697 |
} |
| 1698 |
|
| 1699 |
// </editor-fold> |
| 1700 |
|
| 1701 |
|
| 1702 |
// <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 " > |
| 1703 |
|
| 1704 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1705 |
// T o o l b a r A C T I O N S UI elements |
| 1706 |
// --------------------------------------------------------------------------------------------------------------------- |
| 1707 |
|
| 1708 |
function wpbc_ajx__ui__action_button__approve( $escaped_search_request_params ){ |
| 1709 |
|
| 1710 |
$booking_action = 'set_booking_approved'; |
| 1711 |
|
| 1712 |
$el_id = 'ui_btn_' . $booking_action; |
| 1713 |
|
| 1714 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1715 |
return false; |
| 1716 |
} |
| 1717 |
|
| 1718 |
$params = array( |
| 1719 |
'type' => 'button' , |
| 1720 |
'title' => __( 'Approve', 'booking' ) . ' ', // Title of the button |
| 1721 |
'hint' => array( 'title' => __( 'Approve selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1722 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1723 |
'action' => "wpbc_ajx_booking_ajax_action_request( { |
| 1724 |
'booking_action' : '{$booking_action}', |
| 1725 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1726 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1727 |
'ui_clicked_element_id': '{$el_id}' |
| 1728 |
} ); |
| 1729 |
wpbc_button_enable_loading_icon( this ); " , |
| 1730 |
'icon' => array( |
| 1731 |
'icon_font' => 'wpbc_icn_check_circle_outline', |
| 1732 |
'position' => 'right', |
| 1733 |
'icon_img' => '' |
| 1734 |
), |
| 1735 |
'class' => 'wpbc_ui_button_primary hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1736 |
'style' => '', // Any CSS class here |
| 1737 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1738 |
'attr' => array( 'id' => $el_id ) |
| 1739 |
); |
| 1740 |
|
| 1741 |
wpbc_flex_button( $params ); |
| 1742 |
} |
| 1743 |
|
| 1744 |
function wpbc_ajx__ui__action_button__pending( $escaped_search_request_params ){ |
| 1745 |
|
| 1746 |
$booking_action = 'set_booking_pending'; |
| 1747 |
|
| 1748 |
$el_id = 'ui_btn_' . $booking_action; |
| 1749 |
|
| 1750 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1751 |
return false; |
| 1752 |
} |
| 1753 |
|
| 1754 |
$params = array( |
| 1755 |
'type' => 'button' , |
| 1756 |
'title' => __( 'Pending', 'booking' ) . ' ', // Title of the button |
| 1757 |
'hint' => array( 'title' => __( 'Set selected bookings as pending', 'booking' ), 'position' => 'top' ), // Hint |
| 1758 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1759 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to set booking as pending ?', 'booking' ) ) . "') ) { |
| 1760 |
wpbc_ajx_booking_ajax_action_request( { |
| 1761 |
'booking_action' : '{$booking_action}', |
| 1762 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1763 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1764 |
'ui_clicked_element_id': '{$el_id}' |
| 1765 |
} ); |
| 1766 |
wpbc_button_enable_loading_icon( this ); |
| 1767 |
}" , |
| 1768 |
'icon' => array( |
| 1769 |
'icon_font' => 'wpbc_icn_block', |
| 1770 |
'position' => 'right', |
| 1771 |
'icon_img' => '' |
| 1772 |
), |
| 1773 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1774 |
'style' => '', // Any CSS class here |
| 1775 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1776 |
'attr' => array( 'id' => $el_id ) |
| 1777 |
); |
| 1778 |
|
| 1779 |
wpbc_flex_button( $params ); |
| 1780 |
} |
| 1781 |
|
| 1782 |
function wpbc_ajx__ui__action_button__trash( $escaped_search_request_params ){ |
| 1783 |
|
| 1784 |
$booking_action = 'move_booking_to_trash'; |
| 1785 |
|
| 1786 |
$el_id = 'ui_btn_' . $booking_action; |
| 1787 |
|
| 1788 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1789 |
return false; |
| 1790 |
} |
| 1791 |
|
| 1792 |
$params = array( |
| 1793 |
'type' => 'button' , |
| 1794 |
'title' => __( 'Trash / Reject', 'booking' ) . ' ', // Title of the button |
| 1795 |
'hint' => array( 'title' => __( 'Reject booking - move selected bookings to trash', 'booking' ), 'position' => 'top' ), // Hint |
| 1796 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1797 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { |
| 1798 |
wpbc_ajx_booking_ajax_action_request( { |
| 1799 |
'booking_action' : '{$booking_action}', |
| 1800 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1801 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1802 |
'ui_clicked_element_id': '{$el_id}' |
| 1803 |
} ); |
| 1804 |
wpbc_button_enable_loading_icon( this ); |
| 1805 |
}" , |
| 1806 |
'icon' => array( |
| 1807 |
'icon_font' => 'wpbc_icn_delete_outline', |
| 1808 |
'position' => 'right', |
| 1809 |
'icon_img' => '' |
| 1810 |
), |
| 1811 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1812 |
'style' => '', // Any CSS class here |
| 1813 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1814 |
'attr' => array( 'id' => $el_id ) |
| 1815 |
); |
| 1816 |
|
| 1817 |
wpbc_flex_button( $params ); |
| 1818 |
} |
| 1819 |
|
| 1820 |
function wpbc_ajx__ui__action_button__restore( $escaped_search_request_params ){ |
| 1821 |
|
| 1822 |
$booking_action = 'restore_booking_from_trash'; |
| 1823 |
|
| 1824 |
$el_id = 'ui_btn_' . $booking_action; |
| 1825 |
|
| 1826 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1827 |
return false; |
| 1828 |
} |
| 1829 |
|
| 1830 |
$params = array( |
| 1831 |
'type' => 'button' , |
| 1832 |
'title' => __( 'Restore', 'booking' ) . ' ', // Title of the button |
| 1833 |
'hint' => array( 'title' => __( 'Restore selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1834 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1835 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { |
| 1836 |
wpbc_ajx_booking_ajax_action_request( { |
| 1837 |
'booking_action' : '{$booking_action}', |
| 1838 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1839 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1840 |
'ui_clicked_element_id': '{$el_id}' |
| 1841 |
} ); |
| 1842 |
wpbc_button_enable_loading_icon( this ); |
| 1843 |
}" , |
| 1844 |
'icon' => array( |
| 1845 |
'icon_font' => 'wpbc_icn_rotate_left', |
| 1846 |
'position' => 'right', |
| 1847 |
'icon_img' => '' |
| 1848 |
), |
| 1849 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1850 |
'style' => '', // Any CSS class here |
| 1851 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1852 |
'attr' => array( 'id' => $el_id ) |
| 1853 |
); |
| 1854 |
|
| 1855 |
wpbc_flex_button( $params ); |
| 1856 |
} |
| 1857 |
|
| 1858 |
function wpbc_ajx__ui__action_button__delete( $escaped_search_request_params ){ |
| 1859 |
|
| 1860 |
$booking_action = 'delete_booking_completely'; |
| 1861 |
|
| 1862 |
$el_id = 'ui_btn_' . $booking_action; |
| 1863 |
|
| 1864 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1865 |
return false; |
| 1866 |
} |
| 1867 |
|
| 1868 |
$params = array( |
| 1869 |
'type' => 'button' , |
| 1870 |
'title' => __( 'Delete', 'booking' ) . ' ', // Title of the button |
| 1871 |
'hint' => array( 'title' => __( 'Delete selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1872 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1873 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to delete selected booking(s) ?', 'booking' ) ) . "') ) { |
| 1874 |
wpbc_ajx_booking_ajax_action_request( { |
| 1875 |
'booking_action' : '{$booking_action}', |
| 1876 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1877 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1878 |
'ui_clicked_element_id': '{$el_id}' |
| 1879 |
} ); |
| 1880 |
wpbc_button_enable_loading_icon( this ); |
| 1881 |
}" , |
| 1882 |
'icon' => array( |
| 1883 |
'icon_font' => 'wpbc_icn_close', |
| 1884 |
'position' => 'right', |
| 1885 |
'icon_img' => '' |
| 1886 |
), |
| 1887 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1888 |
'style' => '', // Any CSS class here |
| 1889 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1890 |
'attr' => array( 'id' => $el_id ) |
| 1891 |
); |
| 1892 |
|
| 1893 |
wpbc_flex_button( $params ); |
| 1894 |
} |
| 1895 |
|
| 1896 |
function wpbc_ajx__ui__action_text__delete_reason( $escaped_search_request_params ){ |
| 1897 |
|
| 1898 |
$params = array( |
| 1899 |
'type' => 'text' |
| 1900 |
, 'id' => 'reason_of_action' |
| 1901 |
, 'name' => 'reason_of_action' |
| 1902 |
, 'label' => '' |
| 1903 |
, 'disabled' => false |
| 1904 |
, 'class' => 'hide_button_if_no_selection' |
| 1905 |
, 'style' => '' |
| 1906 |
, 'placeholder' => __( 'Reason of action', 'booking' ) |
| 1907 |
, 'attr' => array() |
| 1908 |
, 'value' => '' |
| 1909 |
, 'onfocus' => '' |
| 1910 |
); |
| 1911 |
wpbc_flex_text( $params ); |
| 1912 |
} |
| 1913 |
|
| 1914 |
function wpbc_ajx__ui__action_button__readall( $escaped_search_request_params ){ |
| 1915 |
|
| 1916 |
$booking_action = 'set_booking_as_read'; |
| 1917 |
|
| 1918 |
$el_id = 'ui_btn_all_' . $booking_action; |
| 1919 |
|
| 1920 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1921 |
return false; |
| 1922 |
} |
| 1923 |
|
| 1924 |
$params = array( |
| 1925 |
'type' => 'button' , |
| 1926 |
'title' => __( 'Read All', 'booking' ) . ' ', // Title of the button |
| 1927 |
'hint' => array( 'title' => __( 'Mark as read all bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1928 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1929 |
'action' => "wpbc_ajx_booking_ajax_action_request( { |
| 1930 |
'booking_action' : '{$booking_action}', |
| 1931 |
'booking_id' : '-1', |
| 1932 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1933 |
'ui_clicked_element_id': '{$el_id}' |
| 1934 |
} ); |
| 1935 |
wpbc_button_enable_loading_icon( this ); " , |
| 1936 |
'icon' => array( |
| 1937 |
'icon_font' => 'wpbc_icn_disabled_visible', |
| 1938 |
'position' => 'right', |
| 1939 |
'icon_img' => '' |
| 1940 |
), |
| 1941 |
'class' => '', // '' | 'wpbc_ui_button_primary' |
| 1942 |
'style' => '', // Any CSS class here |
| 1943 |
'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1944 |
'attr' => array( 'id' => $el_id ) |
| 1945 |
); |
| 1946 |
|
| 1947 |
wpbc_flex_button( $params ); |
| 1948 |
} |
| 1949 |
|
| 1950 |
function wpbc_ajx__ui__action_button__read( $escaped_search_request_params ){ |
| 1951 |
|
| 1952 |
$booking_action = 'set_booking_as_read'; |
| 1953 |
|
| 1954 |
$el_id = 'ui_btn_' . $booking_action; |
| 1955 |
|
| 1956 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1957 |
return false; |
| 1958 |
} |
| 1959 |
|
| 1960 |
$params = array( |
| 1961 |
'type' => 'button' , |
| 1962 |
'title' => __( 'Read', 'booking' ) . ' ', // Title of the button |
| 1963 |
'hint' => array( 'title' => __( 'Mark as read selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 1964 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 1965 |
'action' => "wpbc_ajx_booking_ajax_action_request( { |
| 1966 |
'booking_action' : '{$booking_action}', |
| 1967 |
'booking_id' : wpbc_get_selected_row_id(), |
| 1968 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 1969 |
'ui_clicked_element_id': '{$el_id}' |
| 1970 |
} ); |
| 1971 |
wpbc_button_enable_loading_icon( this ); " , |
| 1972 |
'icon' => array( |
| 1973 |
'icon_font' => 'wpbc_icn_visibility_off', |
| 1974 |
'position' => 'right', |
| 1975 |
'icon_img' => '' |
| 1976 |
), |
| 1977 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 1978 |
'style' => '', // Any CSS class here |
| 1979 |
'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 1980 |
'attr' => array( 'id' => $el_id ) |
| 1981 |
); |
| 1982 |
|
| 1983 |
wpbc_flex_button( $params ); |
| 1984 |
} |
| 1985 |
|
| 1986 |
function wpbc_ajx__ui__action_button__unread( $escaped_search_request_params ){ |
| 1987 |
|
| 1988 |
$booking_action = 'set_booking_as_unread'; |
| 1989 |
|
| 1990 |
$el_id = 'ui_btn_' . $booking_action; |
| 1991 |
|
| 1992 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 1993 |
return false; |
| 1994 |
} |
| 1995 |
|
| 1996 |
$params = array( |
| 1997 |
'type' => 'button' , |
| 1998 |
'title' => __( 'Unread', 'booking' ) . ' ', // Title of the button |
| 1999 |
'hint' => array( 'title' => __( 'Mark as Unread selected bookings', 'booking' ), 'position' => 'top' ), // Hint |
| 2000 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 2001 |
'action' => "wpbc_ajx_booking_ajax_action_request( { |
| 2002 |
'booking_action' : '{$booking_action}', |
| 2003 |
'booking_id' : wpbc_get_selected_row_id(), |
| 2004 |
'reason_of_action' : jQuery( '#reason_of_action' ).val(), |
| 2005 |
'ui_clicked_element_id': '{$el_id}' |
| 2006 |
} ); |
| 2007 |
wpbc_button_enable_loading_icon( this ); " , |
| 2008 |
'icon' => array( |
| 2009 |
'icon_font' => 'wpbc_icn_visibility', |
| 2010 |
'position' => 'right', |
| 2011 |
'icon_img' => '' |
| 2012 |
), |
| 2013 |
'class' => 'hide_button_if_no_selection', // '' | 'wpbc_ui_button_primary' |
| 2014 |
'style' => '', // Any CSS class here |
| 2015 |
'mobile_show_text' => !true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 2016 |
'attr' => array( 'id' => $el_id ) |
| 2017 |
); |
| 2018 |
|
| 2019 |
wpbc_flex_button( $params ); |
| 2020 |
} |
| 2021 |
|
| 2022 |
function wpbc_ajx__ui__action_button__print( $escaped_search_request_params ){ |
| 2023 |
$user_bk_id = 1; |
| 2024 |
$params = array( |
| 2025 |
'type' => 'button', |
| 2026 |
'title' => __( 'Print', 'booking' ) . ' ', |
| 2027 |
'hint' => array( |
| 2028 |
'title' => __( 'Print bookings listing', 'booking' ), |
| 2029 |
'position' => 'top' |
| 2030 |
), |
| 2031 |
'link' => 'javascript:void(0)', |
| 2032 |
'action' => "wpbc_print_dialog__show();", |
| 2033 |
'icon' => array( |
| 2034 |
'icon_font' => 'wpbc_icn_print', |
| 2035 |
'position' => 'right', |
| 2036 |
'icon_img' => '' |
| 2037 |
), |
| 2038 |
'class' => '', |
| 2039 |
'style' => '', |
| 2040 |
'attr' => array(), |
| 2041 |
'mobile_show_text' => true |
| 2042 |
); |
| 2043 |
wpbc_flex_button( $params ); |
| 2044 |
} |
| 2045 |
|
| 2046 |
function wpbc_ajx__ui__action_button__import( $escaped_search_request_params ){ |
| 2047 |
|
| 2048 |
$booking_action = 'import_google_calendar'; |
| 2049 |
|
| 2050 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2051 |
return false; |
| 2052 |
} |
| 2053 |
|
| 2054 |
|
| 2055 |
$booking_gcal_feed = get_bk_option( 'booking_gcal_feed'); |
| 2056 |
|
| 2057 |
if ( ( ! class_exists( 'wpdev_bk_personal' ) ) && ( $booking_gcal_feed == '' ) ) { |
| 2058 |
$is_this_btn_disabled = true; |
| 2059 |
} else { |
| 2060 |
$is_this_btn_disabled = false; |
| 2061 |
} |
| 2062 |
|
| 2063 |
$params = array( |
| 2064 |
'type' => 'button', |
| 2065 |
'title' => __( 'Import', 'booking' ) . ' ', |
| 2066 |
'hint' => array( |
| 2067 |
'title' => __( 'Import Google Calendar Events', 'booking' ), |
| 2068 |
'position' => 'top' |
| 2069 |
), |
| 2070 |
'link' => 'javascript:void(0)', |
| 2071 |
'action' => " if ( 'function' === typeof( jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal ) ) { |
| 2072 |
jQuery('#wpbc_modal__import_google_calendar__section').wpbc_my_modal('show'); |
| 2073 |
} else { |
| 2074 |
alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.'); |
| 2075 |
}", |
| 2076 |
'icon' => array( |
| 2077 |
'icon_font' => 'wpbc_icn_event', |
| 2078 |
'position' => 'right', |
| 2079 |
'icon_img' => '' |
| 2080 |
), |
| 2081 |
'class' => '',//( $is_this_btn_disabled ? ' disabled' : '' ), |
| 2082 |
'style' => '', |
| 2083 |
'attr' => array(), |
| 2084 |
'mobile_show_text' => true |
| 2085 |
); |
| 2086 |
wpbc_flex_button( $params ); |
| 2087 |
} |
| 2088 |
|
| 2089 |
function wpbc_ajx__ui__action_button__export_csv( $escaped_search_request_params ){ |
| 2090 |
|
| 2091 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 2092 |
return false; |
| 2093 |
} |
| 2094 |
|
| 2095 |
$booking_action = 'export_csv'; |
| 2096 |
$el_id = 'ui_btn_' . $booking_action; |
| 2097 |
|
| 2098 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2099 |
return false; |
| 2100 |
} |
| 2101 |
|
| 2102 |
$params = array( |
| 2103 |
'type' => 'button', |
| 2104 |
'title' => __( 'Export to CSV', 'booking' ) . ' ', |
| 2105 |
'hint' => array( |
| 2106 |
'title' => __( 'Export bookings to CSV format', 'booking' ), |
| 2107 |
'position' => 'top' |
| 2108 |
), |
| 2109 |
'link' => 'javascript:void(0)', |
| 2110 |
//'action' => wpbc_csv_get_url_for_button( 'page' ), |
| 2111 |
'action' => "if ( 'function' === typeof( jQuery('#wpbc_modal__export_csv__section').wpbc_my_modal ) ) { |
| 2112 |
jQuery('#wpbc_modal__export_csv__section').wpbc_my_modal('show'); |
| 2113 |
} else { |
| 2114 |
alert( 'Warning! wpbc_my_modal module has not found. Please, recheck about any conflicts by deactivating other plugins.'); |
| 2115 |
}", |
| 2116 |
'icon' => array( |
| 2117 |
'icon_font' => 'wpbc_icn_file_upload', |
| 2118 |
'position' => 'right', |
| 2119 |
'icon_img' => '' |
| 2120 |
), |
| 2121 |
'class' => '', |
| 2122 |
'style' => '', |
| 2123 |
'attr' => array( 'id' => $el_id ), |
| 2124 |
'mobile_show_text' => true |
| 2125 |
); |
| 2126 |
wpbc_flex_button( $params ); |
| 2127 |
} |
| 2128 |
|
| 2129 |
function wpbc_ajx__ui__action_button__export_csv_page( $escaped_search_request_params ){ |
| 2130 |
|
| 2131 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 2132 |
return false; |
| 2133 |
} |
| 2134 |
|
| 2135 |
$booking_action = 'export_csv'; |
| 2136 |
$el_id = 'ui_btn_' . $booking_action; |
| 2137 |
|
| 2138 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2139 |
return false; |
| 2140 |
} |
| 2141 |
|
| 2142 |
$params = array( |
| 2143 |
'type' => 'button', |
| 2144 |
'title' => __( 'Export page to CSV', 'booking' ) . ' ', |
| 2145 |
'hint' => array( |
| 2146 |
'title' => __( 'Export only current page of bookings to CSV format', 'booking' ), |
| 2147 |
'position' => 'top' |
| 2148 |
), |
| 2149 |
'link' => 'javascript:void(0)', |
| 2150 |
//'action' => wpbc_csv_get_url_for_button( 'page' ), |
| 2151 |
'action' => "wpbc_ajx_booking__ui_click__export_csv( { |
| 2152 |
'booking_action' : '{$booking_action}', |
| 2153 |
'ui_clicked_element_id': '{$el_id}', |
| 2154 |
'export_type': 'csv_page' |
| 2155 |
} );", |
| 2156 |
'icon' => array( |
| 2157 |
'icon_font' => 'wpbc_icn_file_upload', |
| 2158 |
'position' => 'right', |
| 2159 |
'icon_img' => '' |
| 2160 |
), |
| 2161 |
'class' => '', |
| 2162 |
'style' => '', |
| 2163 |
'attr' => array( 'id' => $el_id ), |
| 2164 |
'mobile_show_text' => true |
| 2165 |
); |
| 2166 |
wpbc_flex_button( $params ); |
| 2167 |
} |
| 2168 |
|
| 2169 |
function wpbc_ajx__ui__action_button__export_csv_all( $escaped_search_request_params ){ |
| 2170 |
|
| 2171 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 2172 |
return false; |
| 2173 |
} |
| 2174 |
|
| 2175 |
$booking_action = 'export_csv'; |
| 2176 |
$el_id = 'ui_btn_' . $booking_action . '_all'; |
| 2177 |
|
| 2178 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2179 |
return false; |
| 2180 |
} |
| 2181 |
|
| 2182 |
$params = array( |
| 2183 |
'type' => 'button', |
| 2184 |
'title' => __( 'Export all pages to CSV', 'booking' ) . ' ', |
| 2185 |
'hint' => array( |
| 2186 |
'title' => __( 'Export All bookings to CSV format', 'booking' ), |
| 2187 |
'position' => 'top' |
| 2188 |
), |
| 2189 |
'link' => 'javascript:void(0)', |
| 2190 |
//'action' => wpbc_csv_get_url_for_button( 'all' ), |
| 2191 |
'action' => "wpbc_ajx_booking__ui_click__export_csv( { |
| 2192 |
'booking_action' : '{$booking_action}', |
| 2193 |
'ui_clicked_element_id': '{$el_id}', |
| 2194 |
'export_type': 'csv_all' |
| 2195 |
} );", |
| 2196 |
|
| 2197 |
'icon' => array( |
| 2198 |
'icon_font' => 'wpbc_icn_publish', |
| 2199 |
'position' => 'right', |
| 2200 |
'icon_img' => '' |
| 2201 |
), |
| 2202 |
'class' => '', |
| 2203 |
'style' => '', |
| 2204 |
'attr' => array( 'id' => $el_id ), |
| 2205 |
'mobile_show_text' => true |
| 2206 |
); |
| 2207 |
wpbc_flex_button( $params ); |
| 2208 |
} |
| 2209 |
|
| 2210 |
function wpbc_ajx__ui__action_button__empty_trash( $escaped_search_request_params ){ |
| 2211 |
|
| 2212 |
$booking_action = 'empty_trash'; |
| 2213 |
|
| 2214 |
$el_id = 'ui_btn_' . $booking_action; |
| 2215 |
|
| 2216 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 2217 |
return false; |
| 2218 |
} |
| 2219 |
|
| 2220 |
$params = array( |
| 2221 |
'type' => 'button' , |
| 2222 |
'title' => __( 'Empty Trash', 'booking' ) . ' ', // Title of the button |
| 2223 |
'hint' => array( 'title' => __( 'Empty Trash', 'booking' ), 'position' => 'top' ), // Hint |
| 2224 |
'link' => 'javascript:void(0)', // Direct link or skip it |
| 2225 |
'action' => "if ( wpbc_are_you_sure('" . esc_attr( __( 'Do you really want to do this ?', 'booking' ) ) . "') ) { |
| 2226 |
wpbc_ajx_booking_ajax_action_request( { |
| 2227 |
'booking_action' : '{$booking_action}', |
| 2228 |
'ui_clicked_element_id': '{$el_id}' |
| 2229 |
} ); |
| 2230 |
wpbc_button_enable_loading_icon( this ); |
| 2231 |
}" , |
| 2232 |
'icon' => array( |
| 2233 |
'icon_font' => 'wpbc_icn_delete_forever', |
| 2234 |
'position' => 'right', |
| 2235 |
'icon_img' => '' |
| 2236 |
), |
| 2237 |
'class' => '', // '' | 'wpbc_ui_button_primary' |
| 2238 |
'style' => '', // Any CSS class here |
| 2239 |
'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size). |
| 2240 |
'attr' => array( 'id' => $el_id ) |
| 2241 |
); |
| 2242 |
|
| 2243 |
wpbc_flex_button( $params ); |
| 2244 |
} |
| 2245 |
// </editor-fold> |
| 2246 |
|
| 2247 |
|
| 2248 |
// <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 " > |
| 2249 |
|
| 2250 |
|
| 2251 |
function wpbc_ajx__ui__options_checkbox__send_emails( $escaped_search_request_params, $defaults ){ |
| 2252 |
|
| 2253 |
$el_id = 'ui_usr__send_emails'; |
| 2254 |
|
| 2255 |
$el_value = isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]; |
| 2256 |
|
| 2257 |
$params_checkbox = array( |
| 2258 |
'id' => $el_id // HTML ID of element |
| 2259 |
, 'name' => $el_id |
| 2260 |
, 'label' => array( 'title' => __( 'Emails sending', 'booking' ) , 'position' => 'right' ) // FixIn: 9.6.1.5. |
| 2261 |
, 'style' => '' // CSS of select element |
| 2262 |
, 'class' => '' // CSS Class of select element |
| 2263 |
, 'disabled' => false |
| 2264 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2265 |
, 'legend' => '' // aria-label parameter |
| 2266 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 2267 |
, 'selected' => ( ( 'send' == $el_value ) ? true : false ) // Selected or not |
| 2268 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2269 |
, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code |
| 2270 |
//, 'hint' => array( 'title' => __('Filter bookings by booking status' ,'booking') , 'position' => 'top' ) |
| 2271 |
); |
| 2272 |
|
| 2273 |
wpbc_flex_toggle( $params_checkbox ); |
| 2274 |
} |
| 2275 |
|
| 2276 |
|
| 2277 |
function wpbc_ajx__ui__options_checkbox__is_expand_remarks( $escaped_search_request_params, $defaults ){ |
| 2278 |
|
| 2279 |
$el_id = 'ui_usr__is_expand_remarks'; |
| 2280 |
|
| 2281 |
$el_value = isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ]; |
| 2282 |
|
| 2283 |
$params_checkbox = array( |
| 2284 |
'id' => $el_id // HTML ID of element |
| 2285 |
, 'name' => $el_id |
| 2286 |
, 'label' => array( 'title' => __( 'Show / hide notes', 'booking' ) , 'position' => 'left' ) |
| 2287 |
, 'legend' => __('Check this box if you want to open notes section by default in Booking Listing page.' ,'booking') |
| 2288 |
, 'style' => '' // CSS of select element |
| 2289 |
, 'class' => '' // CSS Class of select element |
| 2290 |
, 'disabled' => false |
| 2291 |
, 'attr' => array() // Any additional attributes, if this radio | checkbox element |
| 2292 |
, 'legend' => '' // aria-label parameter |
| 2293 |
, 'value' => $el_value // Some Value from optins array that selected by default |
| 2294 |
, 'selected' => ( ( 'On' == $el_value ) ? true : false ) // Selected or not |
| 2295 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code |
| 2296 |
, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__is_expand_remarks': (jQuery( this ).is(':checked') ? 'On' : 'Off') } );" // JavaScript code |
| 2297 |
); |
| 2298 |
|
| 2299 |
wpbc_flex_toggle( $params_checkbox ); |
| 2300 |
} |
| 2301 |
// </editor-fold> |
| 2302 |
|
| 2303 |
|
| 2304 |
|
| 2305 |
// --------------------------------------------------------------------------------------------------------------------- |
| 2306 |
// JS & CSS Loading |
| 2307 |
// --------------------------------------------------------------------------------------------------------------------- |
| 2308 |
|
| 2309 |
/** |
| 2310 |
* CSS files loading |
| 2311 |
* |
| 2312 |
* @param string $where_to_load |
| 2313 |
*/ |
| 2314 |
function wpbc_ajx_toolbar_enqueue_css_files( $where_to_load ) { |
| 2315 |
|
| 2316 |
if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) { |
| 2317 |
|
| 2318 |
wp_enqueue_style( 'wpbc-flex-toolbar', wpbc_plugin_url( '/includes/_toolbar_ui/_src/toolbar_ui.css' ), array(), WP_BK_VERSION_NUM ); |
| 2319 |
} |
| 2320 |
} |
| 2321 |
add_action( 'wpbc_enqueue_css_files', 'wpbc_ajx_toolbar_enqueue_css_files', 50 ); |
| 2322 |
|
| 2323 |
|
| 2324 |
/** |
| 2325 |
* JS files loading |
| 2326 |
* |
| 2327 |
* @param string $where_to_load |
| 2328 |
*/ |
| 2329 |
function wpbc_ajx_toolbar_enqueue_js_files( $where_to_load ) { |
| 2330 |
|
| 2331 |
$in_footer = true; |
| 2332 |
|
| 2333 |
if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) { |
| 2334 |
|
| 2335 |
wp_enqueue_script( 'wpbc-flex-toolbar-ui', wpbc_plugin_url( '/includes/_toolbar_ui/_out/toolbar_ui.js' ), array( 'wpbc_all' ), WP_BK_VERSION_NUM, $in_footer ); |
| 2336 |
|
| 2337 |
/** |
| 2338 |
* wp_localize_script( 'wpbc_all', 'wpbc_live_request_obj' |
| 2339 |
, array( |
| 2340 |
'contacts' => '', |
| 2341 |
'reminders' => '' |
| 2342 |
) |
| 2343 |
); |
| 2344 |
*/ |
| 2345 |
} |
| 2346 |
} |
| 2347 |
add_action( 'wpbc_enqueue_js_files', 'wpbc_ajx_toolbar_enqueue_js_files', 50 ); |
| 2348 |
|
| 2349 |
|
| 2350 |
// 2024-08-13 |