PluginProbe
Booking Calendar / 11.2
Booking Calendar v11.2
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
booking / includes / ui_modal__shortcodes / sh_tpl_booking.php

sh_tpl_booking.php in Booking Calendar 11.2, at includes/ui_modal__shortcodes/sh_tpl_booking.php

1,822 lines 83.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @version 1.0
4 * @package Booking Calendar Shortcodes Config
5 * @subpackage Shortcodes Content - Booking Calendar Form e.g.: [booking resource_id=1 nummonths=3 options='{calendar months_num_in_row=3 width=100% cell_height=50px}']
6 * @category Shortcodes
7 *
8 * @author wpdevelop
9 * @link https://wpbookingcalendar.com/
10 * @email info@wpbookingcalendar.com
11 *
12 * @modified 2024-01-21
13 */
14
15 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly // FixIn: 9.9.0.15.
16
17 // =====================================================================================================================
18 // Left Navigation Panel
19 // =====================================================================================================================
20
21 /**
22 * Left Vertical Navigation panel
23 * @return void
24 */
25 function wpbc_shortcode_config__navigation_panel(){
26
27 $wpbm_version = wpbc_get_wpbm_version();
28 $wpbm_minimum_version = '2.1';
29
30 // If lower than 2, than show warning
31 if ( version_compare( $wpbm_version, $wpbm_minimum_version, '<') ) {
32 $is_bm_exist = false;
33 } else {
34 $is_bm_exist = true;
35 }
36
37 ?>
38 <div class="wpbc_settings_navigation_column wpbc_shortcode_config_navigation_column">
39 <div id="wpbc_shortcode_config__nav_tab__booking" class="wpbc_settings_navigation_item wpbc_settings_navigation_item_active">
40 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking', 'booking' );" href="javascript:void(0);">
41 <span><?php esc_html_e( 'Booking Form with Calendar', 'booking' ) ?></span>
42 </a>
43 </div>
44 <div id="wpbc_shortcode_config__nav_tab__bookingcalendar" class="wpbc_settings_navigation_item wpbc_navigation_sub_item">
45 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingcalendar', 'bookingcalendar' );" href="javascript:void(0);">
46 <span><?php esc_html_e( 'Availability Calendar / Days Not Selectable', 'booking' ); ?></span>
47 </a>
48 </div>
49 <div id="wpbc_shortcode_config__nav_tab__bookingselect" class="wpbc_settings_navigation_item wpbc_dismiss__booking_select <?php echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
50 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingselect', 'bookingselect' );" href="javascript:void(0);">
51 <span><?php esc_html_e( 'Resource Selection', 'booking' ); ?></span><?php
52 echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : '';
53 ?>
54 </a>
55 </div>
56 <div id="wpbc_shortcode_config__nav_tab__bookingform" class="wpbc_settings_navigation_item wpbc_dismiss__booking_form_only <?php echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
57 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingform', 'bookingform' );" href="javascript:void(0);">
58 <span><?php esc_html_e( 'Only Form', 'booking' ) ?></span><?php
59 if ( ! class_exists( 'wpdev_bk_personal' ) ){
60 echo '<span class="wpbc_pro_label">Pro</span>';
61 } else{
62 echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : '';
63 }
64 ?>
65 </a>
66 </div>
67 <div id="wpbc_shortcode_config__nav_tab__bookingtimeline" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
68 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingtimeline', 'bookingtimeline' );" href="javascript:void(0);">
69 <span><?php esc_html_e( 'TimeLine', 'booking' ); ?></span>
70 </a>
71 </div>
72 <div id="wpbc_shortcode_config__nav_tab__bookingsearch" class="wpbc_settings_navigation_item wpbc_dismiss__booking_search <?php echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? ' wpbc_settings_navigation_item_disabled ' : ''; ?>">
73 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingsearch', 'bookingsearch' );" href="javascript:void(0);">
74 <span><?php esc_html_e( 'Search Availability', 'booking' ) ?></span><?php
75 if ( ! class_exists( 'wpdev_bk_personal' ) ){
76 echo '<span class="wpbc_pro_label">Pro</span>';
77 } else{
78 echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : '';
79 }
80 ?>
81 </a>
82 </div>
83 <div id="wpbc_shortcode_config__nav_tab__bookingother" class="wpbc_settings_navigation_item">
84 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingother', 'bookingother' );" href="javascript:void(0);">
85 <span><?php esc_html_e( 'Other', 'booking' ); ?></span><?php
86 //echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : '';
87 ?>
88 </a>
89 </div>
90 <?php if ( $is_bm_exist ) { ?>
91 <div id="wpbc_shortcode_config__nav_tab__booking_import_ics" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
92 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_import_ics', 'booking_import_ics' );" href="javascript:void(0);">
93 <span><?php esc_html_e( 'Import Events (.ics feed)', 'booking' ) ?></span>
94 </a>
95 </div>
96 <div id="wpbc_shortcode_config__nav_tab__booking_listing_ics" class="wpbc_settings_navigation_item wpbc_navigation_sub_item">
97 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_listing_ics' , 'booking_listing_ics');" href="javascript:void(0);">
98 <span><?php esc_html_e( 'Show .ics Listing of Events', 'booking' ); ?></span>
99 </a>
100 </div>
101 <?php } ?>
102 </div>
103 <?php
104 }
105
106
107 // =====================================================================================================================
108 // Shortcode [booking ... ]
109 // =====================================================================================================================
110
111 /**
112 * Content of PopUp - for shortcode [booking ...]
113 *
114 * @return void
115 */
116 function wpbc_shortcode_config__content__booking() {
117
118 $shortcode_name = 'booking';
119
120 ?><div id="wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>" class="wpbc_sc_container__shortcode wpbc_sc_container__shortcode_<?php echo esc_attr( $shortcode_name ); ?>"><?php
121
122 wpbc_shortcode_config__booking__top_tabs();
123
124 // 'General' --------------------------------------------------------------------------------------------------
125 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general">
126 <table class="form-table"><tbody><?php
127
128 // Booking Resource
129 wpbc_shortcode_config_fields__select_resource( $shortcode_name . '_wpbc_resource_id', $shortcode_name );
130
131 // Custom form
132 wpbc_shortcode_config_fields__select_custom_form( $shortcode_name . '_wpbc_custom_form', $shortcode_name );
133
134 // Number of Months
135 wpbc_shortcode_config_fields__select_nummonths( $shortcode_name . '_wpbc_nummonths', $shortcode_name );
136
137 // Calendar Size
138 wpbc_shortcode_config_fields__calendar_size( $shortcode_name . '_wpbc_size', $shortcode_name );
139
140 // Open booking form in popup.
141 wpbc_shortcode_config_fields__booking_popup( $shortcode_name . '_wpbc_popup', $shortcode_name );
142
143 ?></tbody></table>
144 </div><?php
145
146 // 'Conditional Days Selection' --------------------------------------------------------------------------------
147 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__conditions"><?php
148
149 wpbc_shortcode_config_fields__dates_conditions_toolbar(); // TOOLBAR
150
151 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__weekdays_conditions">
152 <?php
153 wpbc_shortcode_config_fields__weekdays_conditions( $shortcode_name . 'wpbc_select_day_weekday', $shortcode_name );
154 ?>
155 </div><?php
156
157 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__seasons_conditions">
158 <?php
159 wpbc_shortcode_config_fields__season_conditions( $shortcode_name . 'wpbc_select_day_season', $shortcode_name );
160 ?>
161 </div><?php
162
163 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__startseason_conditions">
164 <?php
165 wpbc_shortcode_config_fields__season_start_day_conditions( $shortcode_name . 'wpbc_start_day_season', $shortcode_name )
166 ?>
167 </div><?php
168
169 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__dates_conditions">
170 <?php
171 wpbc_shortcode_config_fields__fordate_conditions( $shortcode_name . 'wpbc_select_day_fordate', $shortcode_name );
172 ?>
173 </div><?php
174
175 ?></div><?php
176
177 // 'AGGREGATE' -------------------------------------------------------------------------------------------------
178 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__aggregate"><?php
179
180 wpbc_shortcode_config_fields__aggregate( $shortcode_name . '_wpbc_aggregate', $shortcode_name );
181
182 ?></div><?php
183
184 // 'START MONTH' -----------------------------------------------------------------------------------------------
185 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__other"><?php
186 ?><table class="form-table"><tbody><?php
187
188 wpbc_shortcode_config_fields__calendar_dates_start( $shortcode_name . '_wpbc_calendar_dates_start', $shortcode_name );
189
190 wpbc_shortcode_config_fields__calendar_dates_end( $shortcode_name . '_wpbc_calendar_dates_end', $shortcode_name );
191
192 wpbc_shortcode_config_fields__start_month( $shortcode_name . '_wpbc_startmonth', $shortcode_name );
193
194 ?></tbody></table><?php
195 ?></div><?php
196
197
198
199 ?>
200 <div class="wpbc_shortcode_config_content_toolbar__next_prior">
201 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button">
202 <span class="in-button-text">&lsaquo;</span>
203 </a>
204 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button">
205 <span class="in-button-text">&rsaquo;</span>
206 </a>
207 </div>
208 <?php
209
210 ?></div><?php
211
212 wpbc_clear_div();
213 }
214
215
216 /**
217 * Top Tabs for shortcode [booking ...]
218 * @return void
219 */
220 function wpbc_shortcode_config__booking__top_tabs(){
221
222 $shortcode_name = 'booking';
223
224 wpbc_bs_toolbar_tabs_html_container_start();
225
226 $js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');"
227 . "jQuery(this).addClass('nav-tab-active');"
228 . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
229 . "jQuery('.nav-tab-active i').addClass('icon-white');"
230 . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();";
231
232 wpbc_bs_display_tab( array(
233 'title' => __('Booking Calendar Form', 'booking')
234 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
235 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();"
236 , 'font_icon' => 'wpbc-bi-calendar3-range'
237 , 'default' => true
238 ) );
239 wpbc_bs_display_tab( array(
240 'title' => __('Conditional Days Selection', 'booking')
241 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
242 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__conditions').show();"
243 , 'font_icon' => 'wpbc-bi-calendar2-week'
244 , 'default' => false
245 , 'css_classes' => 'wpbc_dismiss__conditional_days'
246 ) );
247 wpbc_bs_display_tab( array(
248 'title' => __('Aggregate', 'booking')
249 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
250 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__aggregate').show();"
251 , 'font_icon' => 'wpbc-bi-calendar2-plus'
252 , 'default' => false
253 , 'css_classes' => 'wpbc_dismiss__booking_param_aggregate'
254 ) );
255 wpbc_bs_display_tab( array(
256 'title' => __('Advanced', 'booking')
257 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
258 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();"
259 , 'font_icon' => 'wpbc_icn_tune'
260 , 'default' => false
261
262 ) );
263
264 wpbc_bs_toolbar_tabs_html_container_end();
265 }
266
267
268
269 // =====================================================================================================================
270 // Fields
271 // =====================================================================================================================
272
273 /**
274 * Shortcode Field: Select-box - "Booking Resource"
275 *
276 * @param $id
277 * @param $group_key
278 *
279 * @return void
280 */
281 function wpbc_shortcode_config_fields__select_resource( $id , $group_key ){
282
283 if ( class_exists( 'wpdev_bk_personal' ) ){
284
285 WPBC_Settings_API::field_select_row_static( $id
286 , array(
287 'type' => 'select'
288 , 'title' => __( 'Booking resource', 'booking')
289 , 'description' => __( 'Select booking resource', 'booking' )
290 , 'description_tag' => 'span'
291 , 'label' => ''
292 , 'multiple' => false
293 , 'group' => $group_key
294 , 'tr_class' => $group_key . '_standard_section'
295 , 'class' => ''
296 , 'css' => 'margin-right:10px;'
297 , 'only_field' => false
298 , 'attr' => array()
299 , 'value' => ''
300 , 'options' => wpbc_get_all_booking_resources_list()
301 ) );
302 }
303
304 }
305
306 /**
307 * Shortcode Field: Select-box - "Custom Booking Form"
308 *
309 * @param $id
310 * @param $group_key
311 *
312 * @return void
313 */
314 function wpbc_shortcode_config_fields__select_custom_form( $id , $group_key ){
315
316 $is_bfb_enabled = (bool) WPBC_Frontend_Settings::is_bfb_enabled( null );
317 if ( $is_bfb_enabled ) {
318 WPBC_FE_Custom_Form_Helper::wpbc_bfb__custom_booking_forms_list__selectbox_html__sh_modal(
319 array(
320 'name' => $id,
321 'title' => __( 'Booking Form', 'booking' ),
322 'description' => __( 'Select custom booking form', 'booking' ),
323 'group' => $group_key,
324 )
325 );
326 } else {
327 if ( class_exists( 'wpdev_bk_biz_m' ) ){
328 wpbc_in_settings__form_selection( array(
329 'name' => $id
330 , 'title' => __('Booking Form', 'booking')
331 , 'description' => __('Select custom booking form' ,'booking')
332 , 'group' => $group_key
333 )
334 );
335 }
336 }
337 }
338
339 /**
340 * Shortcode Field: Select-box - "Calendar Months Number"
341 *
342 * @param $id
343 * @param $group_key
344 *
345 * @return void
346 */
347 function wpbc_shortcode_config_fields__select_nummonths( $id , $group_key ){
348
349 WPBC_Settings_API::field_select_row_static( $id
350 , array(
351 'type' => 'select'
352 , 'title' => __('Visible months', 'booking')
353 , 'description' => __('Select number of month to show for calendar.' ,'booking')
354 , 'description_tag' => 'span'
355 , 'label' => ''
356 , 'multiple' => false
357 , 'group' => $group_key
358 , 'tr_class' => $group_key . '_standard_section'
359 , 'class' => ''
360 , 'css' => 'margin-right:10px;'
361 , 'only_field' => false
362 , 'attr' => array()
363 , 'value' => get_bk_option( 'booking_client_cal_count' )
364 , 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
365 )
366 );
367 }
368
369 /**
370 * Shortcode Fields: OPTION - "Define Calendar Size"
371 *
372 * @param $id
373 * @param $group_key
374 *
375 * @return void
376 */
377 function wpbc_shortcode_config_fields__calendar_size( $id , $group_key ){
378
379 // ---------------------------------------------------------------------------------------------------------
380 WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled'
381 , array(
382 'type' => 'checkbox'
383 , 'title' => __('Setup Size & Structure', 'booking')
384 , 'description' => __('Configure Calendar Size and Structure', 'booking')
385 , 'description_tag' => 'span'
386 , 'label' => ''
387 , 'class' => ''
388 , 'css' => ''
389 , 'tr_class' => ''
390 , 'attr' => array()
391 , 'group' => $group_key
392 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
393 , 'only_field' => !true
394 , 'is_new_line' => false
395 , 'value' => false
396 )
397 );
398
399 WPBC_Settings_API::field_select_row_static( $id . '_months_num_in_row'
400 , array(
401 'type' => 'select'
402 , 'title' => __('Number of months in a row', 'booking')
403 , 'description' => __('Select the number of months to show in one row on a wide screen.' ,'booking')
404 , 'description_tag' => 'span'
405 , 'label' => ''
406 , 'multiple' => false
407 , 'group' => $group_key
408 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_calendar_size'
409 , 'class' => ''
410 , 'css' => 'margin-right:10px;'
411 , 'only_field' => false
412 , 'attr' => array()
413 , 'value' => get_bk_option( 'booking_client_cal_count' )
414 , 'options' => array_combine( range( 1, 6 ), range( 1, 6 ) )
415 )
416 );
417
418 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed <?php echo esc_attr( $id ); ?>_wpbc_sc_calendar_size">
419 <th scope="row" style="vertical-align: middle;">
420 <label for="wpbc_booking_width" class="wpbc-form-text"><?php esc_html_e('Calendar width:', 'booking'); ?></label>
421 </th>
422 <td class=""><fieldset><?php
423
424 WPBC_Settings_API::field_text_row_static( $id . '_calendar_width'
425 , array(
426 'type' => 'text'
427 , 'placeholder' => '100'
428 , 'class' => ''
429 , 'css' => 'width:5em;'
430 , 'only_field' => true
431 , 'attr' => array()
432 , 'value' => '100'
433 )
434 );
435 WPBC_Settings_API::field_select_row_static( $id . '_calendar_width_px_pr'
436 , array(
437 'type' => 'select'
438 , 'multiple' => false
439 , 'class' => ''
440 , 'css' => 'width:4em;'
441 , 'only_field' => true
442 , 'attr' => array()
443 , 'value' => '%'
444 , 'options' => array( 'px' => 'px', '%' => '%' )
445 )
446 );
447 ?><span class="description"> <?php esc_html_e('Set width of calendar' ,'booking'); ?></span></fieldset></td>
448 </tr><?php
449
450 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?> wpbc_sub_settings_grayed <?php echo esc_attr( $id ); ?>_wpbc_sc_calendar_size">
451 <th scope="row" style="vertical-align: middle;"><label for="wpbc_booking_cell_height" class="wpbc-form-text"><?php esc_html_e('Calendar cell height:', 'booking'); ?></label></th>
452 <td class="">
453 <fieldset><?php
454
455 WPBC_Settings_API::field_text_row_static( $id . '_calendar_cell_height'
456 , array(
457 'type' => 'text'
458 , 'placeholder' => '50'
459 , 'class' => ''
460 , 'css' => 'width:5em;'
461 , 'only_field' => true
462 , 'attr' => array()
463 , 'value' => '50'
464 )
465 );
466 WPBC_Settings_API::field_select_row_static( $id . '_calendar_cell_height_px_pr'
467 , array(
468 'type' => 'select'
469 , 'multiple' => false
470 , 'class' => ''
471 , 'css' => 'width:4em;'
472 , 'only_field' => true
473 , 'attr' => array()
474 , 'value' => '%'
475 , 'options' => array( 'px' => 'px' )
476 )
477 );
478 ?><span class="description"> <?php esc_html_e('Set cell height for calendar' ,'booking'); ?></span>
479 </fieldset>
480 </td>
481 </tr><?php
482
483 }
484
485 /**
486 * Shortcode Fields: Open booking form in popup.
487 *
488 * @param string $id Field ID prefix.
489 * @param string $group_key Shortcode group key.
490 *
491 * @return void
492 */
493 function wpbc_shortcode_config_fields__booking_popup( $id, $group_key ) {
494
495 WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled'
496 , array(
497 'type' => 'checkbox'
498 , 'title' => __( 'Open in popup', 'booking' )
499 , 'description' => __( 'Show a button that opens the booking form in a popup window.', 'booking' )
500 , 'description_tag' => 'span'
501 , 'label' => ''
502 , 'class' => ''
503 , 'css' => ''
504 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
505 , 'attr' => array()
506 , 'group' => $group_key
507 , 'only_field' => false
508 , 'is_new_line' => false
509 , 'value' => false
510 )
511 );
512
513 WPBC_Settings_API::field_text_row_static( $id . '_button_title'
514 , array(
515 'type' => 'text'
516 , 'title' => __( 'Button title', 'booking' )
517 , 'description' => __( 'Text on the button that opens the booking form popup.', 'booking' )
518 , 'description_tag' => 'span'
519 , 'placeholder' => __( 'Book now', 'booking' )
520 , 'class' => ''
521 , 'css' => ''
522 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
523 , 'attr' => array()
524 , 'group' => $group_key
525 , 'only_field' => false
526 , 'value' => __( 'Book now', 'booking' )
527 )
528 );
529
530 WPBC_Settings_API::field_text_row_static( $id . '_title'
531 , array(
532 'type' => 'text'
533 , 'title' => __( 'Popup title', 'booking' )
534 , 'description' => __( 'Title displayed in the popup header.', 'booking' )
535 , 'description_tag' => 'span'
536 , 'placeholder' => __( 'Booking Form', 'booking' )
537 , 'class' => ''
538 , 'css' => ''
539 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
540 , 'attr' => array()
541 , 'group' => $group_key
542 , 'only_field' => false
543 , 'value' => __( 'Booking Form', 'booking' )
544 )
545 );
546
547 WPBC_Settings_API::field_text_row_static( $id . '_button_class'
548 , array(
549 'type' => 'text'
550 , 'title' => __( 'Button CSS class', 'booking' )
551 , 'description' => __( 'CSS class for the popup button.', 'booking' )
552 , 'description_tag' => 'span'
553 , 'placeholder' => 'wp-element-button'
554 , 'class' => ''
555 , 'css' => ''
556 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
557 , 'attr' => array()
558 , 'group' => $group_key
559 , 'only_field' => false
560 , 'value' => 'wp-element-button'
561 )
562 );
563
564 WPBC_Settings_API::field_text_row_static( $id . '_modal_class'
565 , array(
566 'type' => 'text'
567 , 'title' => __( 'Popup CSS class', 'booking' )
568 , 'description' => __( 'Optional CSS class for the popup modal.', 'booking' )
569 , 'description_tag' => 'span'
570 , 'placeholder' => ''
571 , 'class' => ''
572 , 'css' => ''
573 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
574 , 'attr' => array()
575 , 'group' => $group_key
576 , 'only_field' => false
577 , 'value' => ''
578 )
579 );
580
581 WPBC_Settings_API::field_select_row_static( $id . '_size'
582 , array(
583 'type' => 'select'
584 , 'title' => __( 'Popup size', 'booking' )
585 , 'description' => __( 'Select the popup window size.', 'booking' )
586 , 'description_tag' => 'span'
587 , 'label' => ''
588 , 'multiple' => false
589 , 'group' => $group_key
590 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
591 , 'class' => ''
592 , 'css' => 'margin-right:10px;'
593 , 'only_field' => false
594 , 'attr' => array()
595 , 'value' => 'lg'
596 , 'options' => array(
597 'lg' => __( 'Large', 'booking' ),
598 'default' => __( 'Default', 'booking' ),
599 'sm' => __( 'Small', 'booking' ),
600 )
601 )
602 );
603 }
604
605 /**
606 * Shortcode Fields: Start Month
607 *
608 * @param $id
609 * @param $group_key
610 *
611 * @return void
612 */
613 function wpbc_shortcode_config_fields__start_month( $id , $group_key ){
614
615 ////////////////////////////////////////////////////////////////////
616 // Start Month
617 ////////////////////////////////////////////////////////////////////
618 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
619 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php esc_html_e('Start month:', 'booking'); ?></label></th>
620 <td class=""><fieldset><?php
621
622 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
623 , array(
624 'type' => 'checkbox'
625 , 'title' => ''
626 , 'description' => ''
627 , 'description_tag' => 'span'
628 , 'label' => ''
629 , 'class' => ''
630 , 'css' => ''
631 , 'tr_class' => ''
632 , 'attr' => array()
633 , 'group' => $group_key
634 , 'only_field' => true
635 , 'is_new_line' => false
636 , 'value' => false
637 )
638 );
639
640 WPBC_Settings_API::field_select_row_static( $id . '_year'
641 , array(
642 'type' => 'select'
643 , 'title' => ''
644 , 'description' => ''
645 , 'description_tag' => 'span'
646 , 'label' => ''
647 , 'multiple' => false
648 , 'group' => $group_key
649 , 'class' => ''
650 , 'css' => 'width:5em;'
651 , 'only_field' => true
652 , 'attr' => array()
653 , 'value' => gmdate( 'Y' )
654 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
655 )
656 );
657 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
658
659 WPBC_Settings_API::field_select_row_static( $id . '_month'
660 , array(
661 'type' => 'select'
662 , 'title' => ''
663 , 'description' => ''
664 , 'description_tag' => 'span'
665 , 'label' => ''
666 , 'multiple' => false
667 , 'group' => $group_key
668 , 'class' => ''
669 , 'css' => 'width:4em;'
670 , 'only_field' => true
671 , 'attr' => array()
672 , 'value' => gmdate('n')
673 , 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
674 )
675 );
676
677 ?><span class="description"> <?php esc_html_e('Select start month of calendar' ,'booking'); ?></span></fieldset></td>
678 </tr><?php
679
680 }
681
682
683 /**
684 * Shortcode Fields: Start Dates
685 *
686 * @param $id
687 * @param $group_key
688 *
689 * @return void
690 */
691 function wpbc_shortcode_config_fields__calendar_dates_start( $id , $group_key ){
692
693 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
694 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php
695 esc_html_e('Start dates', 'booking'); ?></label></th>
696 <td class=""><fieldset><?php
697
698 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
699 , array(
700 'type' => 'checkbox'
701 , 'title' => ''
702 , 'description' => ''
703 , 'description_tag' => 'span'
704 , 'label' => ''
705 , 'class' => ''
706 , 'css' => ''
707 , 'tr_class' => ''
708 , 'attr' => array()
709 , 'group' => $group_key
710 , 'only_field' => true
711 , 'is_new_line' => false
712 , 'value' => false
713 )
714 );
715
716 WPBC_Settings_API::field_select_row_static( $id . '_year'
717 , array(
718 'type' => 'select'
719 , 'title' => ''
720 , 'description' => ''
721 , 'description_tag' => 'span'
722 , 'label' => ''
723 , 'multiple' => false
724 , 'group' => $group_key
725 , 'class' => ''
726 , 'css' => 'width:5em;'
727 , 'only_field' => true
728 , 'attr' => array()
729 , 'value' => gmdate( 'Y' )
730 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
731 )
732 );
733
734 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
735
736 WPBC_Settings_API::field_select_row_static( $id . '_month'
737 , array(
738 'type' => 'select'
739 , 'title' => ''
740 , 'description' => ''
741 , 'description_tag' => 'span'
742 , 'label' => ''
743 , 'multiple' => false
744 , 'group' => $group_key
745 , 'class' => ''
746 , 'css' => 'width:4em;'
747 , 'only_field' => true
748 , 'attr' => array()
749 , 'value' => gmdate('m')
750 , 'options' => array_combine(
751 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ),
752 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) )
753 )
754 )
755 );
756
757
758 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
759
760 WPBC_Settings_API::field_select_row_static( $id . '_date'
761 , array(
762 'type' => 'select'
763 , 'title' => ''
764 , 'description' => ''
765 , 'description_tag' => 'span'
766 , 'label' => ''
767 , 'multiple' => false
768 , 'group' => $group_key
769 , 'class' => ''
770 , 'css' => 'width:4em;'
771 , 'only_field' => true
772 , 'attr' => array()
773 , 'value' => gmdate('d')
774 , 'options' => array_combine(
775 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ),
776 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) )
777 )
778
779 )
780 );
781
782 ?><span class="description"> <?php esc_html_e('Earliest date visible/selectable in the calendar.' ,'booking'); ?></span></fieldset></td>
783 </tr><?php
784 }
785
786
787 /**
788 * Shortcode Fields: End Dates
789 *
790 * @param $id
791 * @param $group_key
792 *
793 * @return void
794 */
795 function wpbc_shortcode_config_fields__calendar_dates_end( $id , $group_key ){
796
797 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
798 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php
799 esc_html_e('End dates', 'booking'); ?></label></th>
800 <td class=""><fieldset><?php
801
802 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
803 , array(
804 'type' => 'checkbox'
805 , 'title' => ''
806 , 'description' => ''
807 , 'description_tag' => 'span'
808 , 'label' => ''
809 , 'class' => ''
810 , 'css' => ''
811 , 'tr_class' => ''
812 , 'attr' => array()
813 , 'group' => $group_key
814 , 'only_field' => true
815 , 'is_new_line' => false
816 , 'value' => false
817 )
818 );
819
820 WPBC_Settings_API::field_select_row_static( $id . '_year'
821 , array(
822 'type' => 'select'
823 , 'title' => ''
824 , 'description' => ''
825 , 'description_tag' => 'span'
826 , 'label' => ''
827 , 'multiple' => false
828 , 'group' => $group_key
829 , 'class' => ''
830 , 'css' => 'width:5em;'
831 , 'only_field' => true
832 , 'attr' => array()
833 , 'value' => intval( gmdate( 'Y' ) ) + 2
834 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
835 )
836 );
837
838 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
839
840 WPBC_Settings_API::field_select_row_static( $id . '_month'
841 , array(
842 'type' => 'select'
843 , 'title' => ''
844 , 'description' => ''
845 , 'description_tag' => 'span'
846 , 'label' => ''
847 , 'multiple' => false
848 , 'group' => $group_key
849 , 'class' => ''
850 , 'css' => 'width:4em;'
851 , 'only_field' => true
852 , 'attr' => array()
853 , 'value' => gmdate('m')
854 , 'options' => array_combine(
855 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ),
856 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) )
857 )
858
859 )
860 );
861
862
863 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
864
865 WPBC_Settings_API::field_select_row_static( $id . '_date'
866 , array(
867 'type' => 'select'
868 , 'title' => ''
869 , 'description' => ''
870 , 'description_tag' => 'span'
871 , 'label' => ''
872 , 'multiple' => false
873 , 'group' => $group_key
874 , 'class' => ''
875 , 'css' => 'width:4em;'
876 , 'only_field' => true
877 , 'attr' => array()
878 , 'value' => gmdate('d')
879 , 'options' => array_combine(
880 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ),
881 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) )
882 )
883
884 )
885 );
886
887 ?><span class="description"> <?php esc_html_e('Latest date visible/selectable in the calendar.' ,'booking'); ?></span></fieldset></td>
888 </tr><?php
889 }
890
891
892
893 /**
894 * Shortcode Fields: AGGREGATE
895 *
896 * @param $id
897 * @param $group_key
898 *
899 * @return void
900 */
901 function wpbc_shortcode_config_fields__aggregate( $id , $group_key ){
902
903 //--------------------------------------------------------------------------------------------------------------
904 // 'Upgrade to Pro' widget
905 //--------------------------------------------------------------------------------------------------------------
906 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
907 'id' => 'widget_wpbc_dismiss__booking_param_aggregate',
908 'dismiss_css_class' => '.wpbc_dismiss__booking_param_aggregate',
909 'blured_in_versions' => array( 'free' ),
910 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#booking-resources' ),
911 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
912 'versions' => 'paid versions',
913 'css' => 'transform: translate(0) translateY(180px);'
914 ) );
915 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
916 echo $upgrade_content_arr['content'];
917
918 //--------------------------------------------------------------------------------------------------------------
919 // Real Content
920 //--------------------------------------------------------------------------------------------------------------
921
922 $resources_list = array();
923 if ( class_exists( 'wpdev_bk_personal' ) ){
924 $resources_list_orig = wpbc_get_all_booking_resources_list();
925
926 $resources_list[0] = array( 'title' => __('None', 'booking' ), 'attr' => array ( 'class' => 'wpbc_single_resource', 'style' => 'border-bottom:1px dashed #ddd;') );
927 foreach ($resources_list_orig as $res_id => $res_val) {
928 $resources_list[$res_id] = $res_val;
929 }
930 }
931
932 ?>
933 <div class="clear"></div>
934 <div class="wpbc-settings-notice0 notice-info notice-header" style="font-size: 15px;font-weight: 600;margin: 15px 0 15px 15px;">
935 <label for="<?php echo esc_attr($id); ?>"><?php esc_html_e( 'Aggregate booking dates from other resources', 'booking' ); ?></label>
936 </div>
937
938 <div class="wpbc_shortcode_config__rules_container wpbc_dismiss__booking_param_aggregate <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
939 <div class="wpbc_shortcode_config__rules__params_section wpbc_aggregate">
940
941 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
942 <div class="ui_container ui_container_mini">
943 <div class="ui_group">
944 <div class="ui_element wpdevelop"><?php
945
946 WPBC_Settings_API::field_select_row_static( $id //. '__aggregate'
947 , array(
948 'type' => 'select'
949 , 'title' => __('Aggregate booking dates from other resources', 'booking')
950 , 'description' => ''//__( 'Select booking resources, for getting booking dates from them and set such dates as unavailable in destination calendar.', 'booking' )
951 , 'description_tag' => 'span'
952 , 'label' => ''
953 , 'multiple' => true
954 , 'group' => $group_key
955 , 'tr_class' => ''//$group_key . '_advanced_section'
956 , 'class' => 'wpbc_ui_control wpbc_ui_select'
957 , 'css' => 'margin-right:10px;height:20em;min-width:15em;'
958 , 'only_field' => true
959 , 'attr' => array()
960 , 'value' => '0'
961 , 'options' => $resources_list
962 )
963 );
964
965
966
967 ?></div>
968 </div>
969 </div>
970 </div>
971 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
972 <div class="ui_container ui_container_mini ui_container_weekdays">
973 <div class="ui_group ui_group_weekdays_checkboxes">
974 <div class="ui_element"><?php
975
976 WPBC_Settings_API::field_checkbox_row_static( $id . '__bookings_only'
977 , array(
978 'type' => 'checkbox'
979 , 'title' => ''
980 , 'description' => ''
981 , 'description_tag' => 'span'
982 , 'label' => __( 'Aggregate only bookings', 'booking' )
983 , 'class' => ''
984 , 'css' => ''
985 , 'tr_class' => ''
986 , 'attr' => array()
987 , 'group' => $group_key
988 , 'only_field' => true
989 , 'is_new_line' => false
990 , 'value' => false //// FixIn: 10.0.0.6.
991 )
992 );
993 ?></div>
994 </div>
995 </div>
996 </div>
997 </div>
998 <div class="wpbc_shortcode_config__rules__help_section" style="margin-top: 8px;">
999 <div class="wpbc-settings-notice notice-info notice-list">
1000 <ol>
1001 <li>
1002 <?php esc_html_e( "Show dates as booked in the current calendar if such dates are unavailable in one of the selected resources.", 'booking' ); ?>
1003 </li>
1004 <li>
1005 <?php
1006 echo esc_html__( 'To set this up, select one or multiple booking resources in the multi-select box.', 'booking' )
1007 . '<br>'
1008 . esc_html__( 'Hold down the Ctrl button to make multiple selections.', 'booking' );
1009
1010 echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1011 . '<code>[booking resource_id=1 aggregate=\'3;5;9\']</code>';
1012 ?>
1013
1014 </li>
1015
1016 <li>
1017 <?php
1018 /* translators: 1: ... */
1019 echo wp_kses_post( sprintf( __( 'Enable %1$sAggregate only bookings%2$s option to aggregate only bookings without including unavailable dates from the %3$s page.', 'booking' )
1020 , '<strong>', '</strong>'
1021 , '<strong>Booking > Availability > Days Availability</strong>'
1022 ) );
1023 ?>
1024
1025 <?php
1026 echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1027 , '<code>[booking resource_id=1 aggregate=\'3;5;9\' options=\'{aggregate type=bookings_only}\']</code>';
1028
1029 ?>
1030 </li>
1031 <li>
1032 <?php
1033 /* translators: 1: ... */
1034 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1035 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1036 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) );
1037 ?>
1038 </li>
1039 </ol>
1040 </div>
1041 </div>
1042 </div><?php
1043
1044
1045 }
1046
1047
1048
1049 // -----------------------------------------------------------------------------------------------------------------
1050
1051
1052 function wpbc_shortcode_config_fields__dates_conditions_toolbar(){
1053
1054 ?><div class="clear"></div><?php
1055 ?><div class="wpdevelop wpdvlp-nav-tabs-container wpbc_shortcode_config_fields__dates_conditions_toolbar"><?php
1056
1057 $js = "jQuery(this).parents( '.wpbc_shortcode_config_fields__dates_conditions_toolbar' ).find( '.nav-tab' ).removeClass('wpdevelop-submenu-tab-selected');
1058 jQuery(this).addClass('wpdevelop-submenu-tab-selected');
1059 jQuery('.nav-tab i.icon-white').removeClass('icon-white');
1060 jQuery('.nav-tab-active i').addClass('icon-white');
1061 jQuery(this).parents('.wpbc_sc_container__shortcode_section').find('.wpbc_sc_container__shortcode_subsection').hide();
1062 jQuery(this).parents('.wpbc_sc_container__shortcode_section')";
1063
1064 wpbc_bs_toolbar_sub_html_container_start();
1065
1066 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpdevelop-submenu-tab-selected wpbc_dismiss__conditional_days"
1067 onclick="javascript:<?php
1068 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1069 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__weekdays_conditions').show();" href="javascript:void(0)"
1070 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-week"></i>&nbsp;&nbsp;<?php
1071 esc_html_e( 'Weekdays Conditions', 'booking' );
1072 ?></span></a><?php
1073
1074 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1075 onclick="javascript:<?php
1076 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1077 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__seasons_conditions').show();" href="javascript:void(0)"
1078 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-month"></i>&nbsp;&nbsp;<?php
1079 esc_html_e( 'Seasons Conditions', 'booking' );
1080 ?></span></a><?php
1081
1082 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1083 onclick="javascript:<?php
1084 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1085 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__startseason_conditions').show();" href="javascript:void(0)"
1086 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-day"></i>&nbsp;&nbsp;<?php
1087 esc_html_e( 'Start selection at Seasons', 'booking' );
1088 ?></span></a><?php
1089
1090 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1091 onclick="javascript:<?php
1092 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1093 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__dates_conditions').show();" href="javascript:void(0)"
1094 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-date"></i>&nbsp;&nbsp;<?php
1095 esc_html_e( 'Dates selection Conditions', 'booking' );
1096 ?></span></a><?php
1097
1098 wpbc_bs_toolbar_sub_html_container_end();
1099
1100 ?>
1101 </div><?php
1102 }
1103
1104
1105 /**
1106 * Week Days - Condition fields for 'option' parameter.
1107 *
1108 * @param $id
1109 * @param $group_key
1110 *
1111 * @return void
1112 */
1113 function wpbc_shortcode_config_fields__weekdays_conditions( $id , $group_key ){
1114
1115 //--------------------------------------------------------------------------------------------------------------
1116 // 'Upgrade to Pro' widget
1117 //--------------------------------------------------------------------------------------------------------------
1118 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1119 'id' => $id . '_' . 'conditional_days_weekdays',
1120 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1121 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1122 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1123 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1124 'versions' => 'Business Medium / Large, MultiUser versions',
1125 'css' => 'transform: translate(0) translateY(120px);'
1126 ) );
1127 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1128 echo $upgrade_content_arr['content'];
1129
1130 //--------------------------------------------------------------------------------------------------------------
1131 // Conditions for Weekdays selection
1132 //--------------------------------------------------------------------------------------------------------------
1133 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1134
1135 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_weekday">
1136
1137 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1138 <div class="ui_container ui_container_mini ui_container_weekdays">
1139 <?php
1140
1141 $week_days_arr = array(
1142 1 => __( 'Mo', 'booking' )
1143 , 2 => __( 'Tu', 'booking' )
1144 , 3 => __( 'We', 'booking' )
1145 , 4 => __( 'Th', 'booking' )
1146 , 5 => __( 'Fr', 'booking' )
1147 , 6 => __( 'Sa', 'booking' )
1148 , 0 => __( 'Su', 'booking' )
1149 );
1150 foreach ( $week_days_arr as $weekday_key => $weekday_title ) {
1151
1152 ?><div class="ui_group ui_group_weekdays_checkboxes"><?php
1153
1154 ?><div class="ui_element"><?php
1155
1156 WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key
1157 , array(
1158 'type' => 'checkbox'
1159 , 'title' => ''
1160 , 'description' => ''
1161 , 'description_tag' => 'span'
1162 , 'label' => $weekday_title
1163 , 'class' => ''
1164 , 'css' => ''
1165 , 'tr_class' => ''
1166 , 'attr' => array()
1167 , 'group' => $group_key
1168 , 'only_field' => true
1169 , 'is_new_line' => false
1170 , 'value' => false
1171 )
1172 );
1173
1174 ?></div>
1175 <div class="ui_element"><?php
1176
1177 $placeholder = '';
1178 switch ( $weekday_key ) {
1179 case 0: $placeholder = '1-7'; break;
1180 case 1: $placeholder = '5,7'; break;
1181 case 2: $placeholder = '3,4'; break;
1182 case 3: $placeholder = '5'; break;
1183 case 4: $placeholder = '4'; break;
1184 case 5: $placeholder = '3'; break;
1185 case 6: $placeholder = '2-7'; break;
1186 }
1187
1188 WPBC_Settings_API::field_text_row_static( $id . '__days_number_' . $weekday_key
1189 , array(
1190 'type' => 'text'
1191 , 'placeholder' => $placeholder
1192 , 'class' => 'wpbc_dates_conditions_value_weekday'
1193 , 'css' => ''
1194 , 'only_field' => true
1195 , 'attr' => array()
1196 , 'value' => ''
1197 )
1198 );
1199
1200 ?></div>
1201 <div class="ui_element"><?php
1202 ?><div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days to select' ,'booking'); ?></div><?php
1203 ?></div><?php
1204
1205 ?></div><?php
1206 }
1207
1208 ?>
1209 </div>
1210 </div>
1211
1212 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1213 <div class="ui_container ui_container_mini">
1214 <div class="ui_group"><?php
1215
1216 ?><div class="ui_element">
1217 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_weekday__add('<?php echo esc_attr( $id ); ?>');" class="button button-primary"><?php esc_html_e( 'Set Rule', 'booking' ); ?></a>
1218 </div><?php
1219 ?><div class="ui_element">
1220 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_weekday__reset('<?php echo esc_attr( $id ); ?>');"
1221 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1222 </div><?php
1223
1224 ?>
1225 </div>
1226 </div>
1227 </div>
1228
1229 </div>
1230
1231 <div class="wpbc_shortcode_config__rules__help_section">
1232 <div class="wpbc-settings-notice notice-info notice-header">
1233 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific weekday.', 'booking' ); ?></span>
1234 </div>
1235 <div class="wpbc-settings-notice notice-info notice-list">
1236 <ol>
1237 <li>
1238 <?php esc_html_e( "For example, a visitor can choose to book only 5 or 7 days starting on Monday, or any number from 2 to 7 days starting on Saturday, and so forth. To configure this, check the 'Monday' box and set the number of days to select as '5,7'. Then, check the 'Saturday' box and set the number of days to select as '2-7'. Finally, click the 'Set Rule' button.", 'booking' ); ?>
1239 </li>
1240 <li>
1241 <?php
1242 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1243 . '<code>{select-day condition="weekday" for="1" value="5,7"},{select-day condition="weekday" for="6" value="2-7"}</code>';
1244 ?>
1245 </li>
1246 <li>
1247 <?php
1248 /* translators: 1: ... */
1249 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1250 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1251 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition" target="_blank">', '</a></strong>' ) );
1252 ?>
1253 </li>
1254 <li>
1255 <?php
1256 /* translators: 1: ... */
1257 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1258 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1259 ?>
1260 </li>
1261 </ol>
1262 </div>
1263 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin-top:15px;"></textarea>
1264 </div>
1265 </div><?php
1266
1267 }
1268
1269
1270 /**
1271 * Season Days Selection - Condition fields for 'option' parameter.
1272 *
1273 * @param $id
1274 * @param $group_key
1275 *
1276 * @return void
1277 */
1278 function wpbc_shortcode_config_fields__season_conditions( $id, $group_key ) {
1279
1280 //--------------------------------------------------------------------------------------------------------------
1281 // 'Upgrade to Pro' widget
1282 //--------------------------------------------------------------------------------------------------------------
1283 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1284 'id' => $id . '_' . 'conditional_days_seasons',
1285 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1286 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1287 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1288 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1289 'versions' => 'Business Medium / Large, MultiUser versions',
1290 'css' => 'transform: translate(0) translateY(120px);'
1291 ) );
1292 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1293 echo $upgrade_content_arr['content'];
1294
1295 //--------------------------------------------------------------------------------------------------------------
1296 // Conditions for Seasons days selection
1297 //--------------------------------------------------------------------------------------------------------------
1298
1299 $options = wpbc_shortcode_config_fields__get_options_for_seasons();
1300
1301 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1302 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_season">
1303
1304 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1305 <div class="ui_container ui_container_mini">
1306 <div class="ui_group">
1307
1308 <div class="ui_element">
1309 <div class="wpbc_ui_control" style="line-height: 2;">
1310 <span><?php esc_html_e('In season' ,'booking'); ?></span>
1311 </div>
1312 </div>
1313
1314 <div class="ui_element wpdevelop"><?php
1315 WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name'
1316 , array(
1317 'type' => 'select'
1318 , 'title' => ''
1319 , 'label' => ''
1320 , 'disabled' => false
1321 , 'disabled_options' => array()
1322 , 'multiple' => false
1323 , 'description' => ''
1324 , 'description_tag' => 'span'
1325 , 'group' => $group_key
1326 , 'tr_class' => ''
1327 , 'class' => 'wpbc_ui_control wpbc_ui_select'
1328 , 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;'
1329 , 'only_field' => true
1330 , 'attr' => array()
1331 , 'value' => '0'
1332 , 'options' => $options
1333 )
1334 );
1335 ?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>"
1336 title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>"
1337 class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php
1338 ?></div>
1339
1340 </div>
1341 </div>
1342
1343 <div class="ui_container ui_container_mini">
1344 <div class="ui_group">
1345
1346 <div class="ui_element">
1347 <div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div>
1348 </div>
1349
1350 <div class="ui_element"><?php
1351 WPBC_Settings_API::field_text_row_static( $id . '__days_number'
1352 , array(
1353 'type' => 'text'
1354 , 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7'
1355 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1356 , 'css' => 'width:9em;border-radius:3px;'
1357 , 'only_field' => true
1358 , 'attr' => array()
1359 , 'value' => ''
1360 )
1361 );
1362 ?></div>
1363
1364 <div class="ui_element">
1365 <div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div>
1366 </div>
1367 </div>
1368 </div>
1369
1370 <div class="ui_container ui_container_mini">
1371 <div class="ui_group">
1372
1373 <div class="ui_element">
1374 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__add('<?php echo esc_attr( $id ); ?>');"
1375 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1376 </div>
1377 <div class="ui_element">
1378 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__reset('<?php echo esc_attr( $id ); ?>');"
1379 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1380 </div>
1381 </div>
1382 </div>
1383
1384 </div>
1385 </div>
1386 <div class="wpbc_shortcode_config__rules__help_section">
1387 <div class="wpbc-settings-notice notice-info notice-header">
1388 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection in a specific season.', 'booking' ); ?></span>
1389 </div>
1390 <div class="wpbc-settings-notice notice-info notice-list">
1391 <ol>
1392 <li>
1393 <?php esc_html_e( "For example, a visitor can choose to book any number from 7 to 14 days or 21 days starting on 'High season', or any number from 2 to 5 days starting on 'Low season', and so forth. To configure this, select the 'High season' option in the dropdown menu and set the number of days to select as '7-14,21'. Click the 'Add Rule' button. Next, select the 'Low season' option in the dropdown menu and set the number of days to select as '2-5'. Click the 'Add Rule' button again.", 'booking' ); ?>
1394 </li>
1395 <li>
1396 <?php
1397 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1398 . '<code>{select-day condition="season" for="High season" value="7-14,21"},{select-day condition="season" for="Low season" value="2-5"}</code>';
1399 ?>
1400 </li>
1401 <li>
1402 <?php
1403 /* translators: 1: ... */
1404 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1405 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1406 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition-seasons" target="_blank">', '</a></strong>' ) );
1407 ?>
1408 </li>
1409 <li>
1410 <?php
1411 /* translators: 1: ... */
1412 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1413 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1414 ?>
1415 </li>
1416 </ol>
1417 </div>
1418 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1419 </div>
1420 </div><?php
1421
1422 }
1423
1424
1425 /**
1426 * Get Season Filters options - for selectbox in PopUp shortcode config
1427 *
1428 * @return array|array[]
1429 */
1430 function wpbc_shortcode_config_fields__get_options_for_seasons(){
1431
1432 if (function_exists('wpbc_sf_cache')) {
1433 // -----------------------------------------------------------------------------------------------------------------
1434 // Get Season Filters data:
1435 // -----------------------------------------------------------------------------------------------------------------
1436 $wpbc_sf_cache = wpbc_sf_cache();
1437 /**
1438 * $wpbc_sf_cache->get_data() = [
1439 * 1 => [
1440 * booking_filter_id = "1"
1441 * title = "Weekend"
1442 * filter = "a:4:{s:8:"weekdays";a:7..."
1443 * users = "1"
1444 * id = "1"
1445 */
1446 $season_filter_arr = $wpbc_sf_cache->get_data();
1447 } else {
1448 $season_filter_arr = array();
1449 }
1450 // $wpbc_br_cache = wpbc_br_cache();
1451 /*
1452 $wpbc_br_cache->get_resources() = [
1453 1 = [
1454 booking_type_id = "1"
1455 title = "Standard"
1456 users = "1"
1457 import = null
1458 export = "/ics/wpbm.ics"
1459 cost = "25"
1460 default_form = "standard"
1461 prioritet = "1"
1462 parent = "0"
1463 visitors = "2"
1464 id = "1"
1465 count = {int} 5
1466 7 = [...
1467 */
1468 $current_user_id = wpbc_get_current_user_id();
1469
1470 $options = array(
1471 0 => array(
1472 'title' => ' - ' . __( 'Please Select', 'booking' ) . ' - ',
1473 'attr' => array( 'style' => 'color:#999;font-weight: 400;' )
1474 )
1475 );
1476 foreach ( $season_filter_arr as $filter_id => $filter_arr ) {
1477
1478 $options[ $filter_arr['id'] ] = $filter_arr;
1479
1480 // MultiUser functionality for regular users showing season filters.
1481 if ( ( class_exists( 'wpdev_bk_multiuser' ) ) && ( ! empty( $filter_arr['users'] ) ) ) {
1482
1483 // Is current user suer booking admin and if this user was simulated log in
1484 $season_user_id = intval( $filter_arr['users'] );
1485 $is_user_super_admin = apply_bk_filter( 'is_user_super_admin', $season_user_id );
1486
1487 if ( ( ! $is_user_super_admin ) && ( $current_user_id != $season_user_id ) ) {
1488 $options[ $filter_arr['id'] ]['attr'] = array( 'style' => 'color:#a43232;font-weight: 400;font-style: italic;' );
1489 $user_name = get_userdata( $season_user_id );
1490 $user_name = $user_name->display_name;
1491 $options[ $filter_arr['id'] ]['title'] .= ' &nbsp; (' . __( 'Regular User', 'booking' ) . ': ' . $user_name . ')';
1492 }
1493 }
1494 }
1495
1496 return $options;
1497
1498 }
1499
1500
1501 /**
1502 * Season Days Start Day - Condition fields for 'option' parameter.
1503 *
1504 * @param $id
1505 * @param $group_key
1506 *
1507 * @return void
1508 */
1509 function wpbc_shortcode_config_fields__season_start_day_conditions( $id, $group_key ) {
1510
1511 //--------------------------------------------------------------------------------------------------------------
1512 // 'Upgrade to Pro' widget
1513 //--------------------------------------------------------------------------------------------------------------
1514 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1515 'id' => $id . '_' . 'conditional_days_startday',
1516 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1517 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1518 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1519 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1520 'versions' => 'Business Medium / Large, MultiUser versions',
1521 'css' => 'transform: translate(0) translateY(120px);'
1522 ) );
1523 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1524 echo $upgrade_content_arr['content'];
1525
1526 //--------------------------------------------------------------------------------------------------------------
1527 // Conditions for Seasons days START selection
1528 //--------------------------------------------------------------------------------------------------------------
1529
1530 $options = wpbc_shortcode_config_fields__get_options_for_seasons();
1531
1532 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1533 <div class="wpbc_shortcode_config__rules__params_section wpbc_start_day_season">
1534
1535 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1536 <div class="ui_container ui_container_mini">
1537 <div class="ui_group">
1538 <div class="ui_element">
1539 <div class="wpbc_ui_control" style="line-height: 2;">
1540 <span><?php esc_html_e('In season' ,'booking'); ?></span>
1541 </div>
1542 </div>
1543 <div class="ui_element wpdevelop"><?php
1544
1545 WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name'
1546 , array(
1547 'type' => 'select'
1548 , 'title' => ''
1549 , 'label' => ''
1550 , 'disabled' => false
1551 , 'disabled_options' => array()
1552 , 'multiple' => false
1553 , 'description' => ''
1554 , 'description_tag' => 'span'
1555 , 'group' => $group_key
1556 , 'tr_class' => ''
1557 , 'class' => 'wpbc_ui_control wpbc_ui_select'
1558 , 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;'
1559 , 'only_field' => true
1560 , 'attr' => array()
1561 , 'value' => '0'
1562 , 'options' => $options
1563 )
1564 );
1565
1566 ?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>"
1567 title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>"
1568 class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php
1569
1570 ?></div>
1571 </div>
1572 </div>
1573 </div>
1574 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1575 <div class="ui_container ui_container_mini ui_container_weekdays">
1576 <div class="ui_group">
1577 <div class="ui_element">
1578 <div class="wpbc_ui_control " style="line-height: 2;"><?php
1579 esc_html_e('allow to start days selection only for these weekdays' ,'booking');
1580 ?></div>
1581 </div>
1582 </div>
1583 <div class="ui_group ui_group_weekdays_checkboxes"><?php
1584
1585 $week_days_arr = array(
1586 1 => __( 'Mo', 'booking' )
1587 , 2 => __( 'Tu', 'booking' )
1588 , 3 => __( 'We', 'booking' )
1589 , 4 => __( 'Th', 'booking' )
1590 , 5 => __( 'Fr', 'booking' )
1591 , 6 => __( 'Sa', 'booking' )
1592 , 0 => __( 'Su', 'booking' )
1593 );
1594 foreach ( $week_days_arr as $weekday_key => $weekday_title ) {
1595
1596 ?><div class="ui_element"><?php
1597
1598 WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key
1599 , array(
1600 'type' => 'checkbox'
1601 , 'title' => ''
1602 , 'description' => ''
1603 , 'description_tag' => 'span'
1604 , 'label' => $weekday_title
1605 , 'class' => ''
1606 , 'css' => ''
1607 , 'tr_class' => ''
1608 , 'attr' => array()
1609 , 'group' => $group_key
1610 , 'only_field' => true
1611 , 'is_new_line' => false
1612 , 'value' => false
1613 )
1614 );
1615 ?></div><?php
1616
1617 }
1618
1619 ?></div>
1620 </div>
1621 </div>
1622 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1623 <div class="ui_container ui_container_mini">
1624 <div class="ui_group"><?php
1625
1626 ?><div class="ui_element">
1627 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__add('<?php echo esc_attr( $id ); ?>');"
1628 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1629 </div><?php
1630 ?><div class="ui_element">
1631 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__reset('<?php echo esc_attr( $id ); ?>');"
1632 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1633 </div><?php
1634
1635 ?>
1636 </div>
1637 </div>
1638 </div>
1639 </div>
1640 <div class="wpbc_shortcode_config__rules__help_section">
1641 <div class="wpbc-settings-notice notice-info notice-header">
1642 <span><?php esc_html_e( 'Specify the weekdays as start days for selection when starting the selection in a specific season.', 'booking' ); ?></span>
1643 </div>
1644 <div class="wpbc-settings-notice notice-info notice-list">
1645 <ol>
1646 <li>
1647 <?php esc_html_e( "For example, a visitor can starting days selection only on 'Sunday' or 'Friday' if select days on 'Low season'. To configure this, select the 'Low season' option in the dropdown menu and enable 'Sunday' and 'Friday' boxes. Click the 'Add Rule' button.", 'booking' ); ?>
1648 </li>
1649 <li>
1650 <?php
1651 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1652 . '<code>{start-day condition="season" for="Low season" value="0,5"}</code>';
1653 ?>
1654 </li>
1655 <li>
1656 <?php
1657 /* translators: 1: ... */
1658 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1659 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1660 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) );
1661 ?>
1662 </li>
1663 <li>
1664 <?php
1665 /* translators: 1: ... */
1666 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1667 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1668 ?>
1669 </li>
1670 </ol>
1671 </div>
1672 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1673 </div>
1674 </div><?php
1675
1676 }
1677
1678
1679
1680 /**
1681 * Dates Condition - Set Number of Days to Select, if start selection on specific date '2024-02-14'
1682 *
1683 * Config dialog for Booking Calendar shortcode
1684 *
1685 * @param $id
1686 * @param $group_key
1687 *
1688 * @return void
1689 */
1690 function wpbc_shortcode_config_fields__fordate_conditions( $id, $group_key ) {
1691
1692 //--------------------------------------------------------------------------------------------------------------
1693 // 'Upgrade to Pro' widget
1694 //--------------------------------------------------------------------------------------------------------------
1695 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1696 'id' => $id . '_' . 'conditional_days_fordate',
1697 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1698 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1699 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1700 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1701 'versions' => 'Business Medium / Large, MultiUser versions',
1702 'css' => 'transform: translate(0) translateY(120px);'
1703 ) );
1704 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1705 echo $upgrade_content_arr['content'];
1706
1707 //--------------------------------------------------------------------------------------------------------------
1708 // Conditions for DATE selection
1709 //--------------------------------------------------------------------------------------------------------------
1710
1711 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1712 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_fordate">
1713
1714 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1715 <div class="ui_container ui_container_mini">
1716 <div class="ui_group">
1717
1718 <div class="ui_element">
1719 <div class="wpbc_ui_control" style="line-height: 2;">
1720 <span><?php esc_html_e('For date' ,'booking'); ?></span>
1721 </div>
1722 </div>
1723
1724 <div class="ui_element wpdevelop"><?php
1725 WPBC_Settings_API::field_text_row_static( $id . '__date'
1726 , array(
1727 'type' => 'text'
1728 , 'placeholder' => '2024-02-14'
1729 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1730 , 'css' => 'width:9em;border-radius:3px;'
1731 , 'only_field' => true
1732 , 'attr' => array()
1733 , 'value' => ''
1734 )
1735 );
1736 ?></div>
1737
1738 </div>
1739 </div>
1740
1741 <div class="ui_container ui_container_mini">
1742 <div class="ui_group">
1743
1744 <div class="ui_element">
1745 <div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div>
1746 </div>
1747
1748 <div class="ui_element"><?php
1749 WPBC_Settings_API::field_text_row_static( $id . '__days_number'
1750 , array(
1751 'type' => 'text'
1752 , 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7'
1753 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1754 , 'css' => 'width:9em;border-radius:3px;'
1755 , 'only_field' => true
1756 , 'attr' => array()
1757 , 'value' => ''
1758 )
1759 );
1760 ?></div>
1761
1762 <div class="ui_element">
1763 <div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div>
1764 </div>
1765 </div>
1766 </div>
1767
1768 <div class="ui_container ui_container_mini">
1769 <div class="ui_group">
1770
1771 <div class="ui_element">
1772 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__add('<?php echo esc_attr( $id ); ?>');"
1773 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1774 </div>
1775 <div class="ui_element">
1776 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__reset('<?php echo esc_attr( $id ); ?>');"
1777 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1778 </div>
1779 </div>
1780 </div>
1781
1782 </div>
1783 </div>
1784 <div class="wpbc_shortcode_config__rules__help_section">
1785 <div class="wpbc-settings-notice notice-info notice-header">
1786 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific date.', 'booking' ); ?></span>
1787 </div>
1788 <div class="wpbc-settings-notice notice-info notice-list">
1789 <ol>
1790 <li>
1791 <?php esc_html_e( "For example, a visitor can choose to book 7 or 14 days or 21 days starting on '2027-02-15'. To configure this, enter date in format 'YYYY-MM-DD' such as '2027-02-15' and set the number of days to select as '7,14,21'. Click the 'Add Rule' button.", 'booking' ); ?>
1792 </li>
1793 <li>
1794 <?php
1795 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1796 . '<code>{select-day condition="date" for="2027-02-15" value="7,14,21"}</code>';
1797 ?>
1798 </li>
1799 <li>
1800 <?php
1801 /* translators: 1: ... */
1802 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1803 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1804 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#aggregate" target="_blank">', '</a></strong>' ) );
1805 ?>
1806 </li>
1807 <li>
1808 <?php
1809 /* translators: 1: ... */
1810 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1811 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1812 ?>
1813 </li>
1814 </ol>
1815 </div>
1816 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1817 </div>
1818 </div><?php
1819
1820 }
1821
1822