PluginProbe
Booking Calendar / 11.5
Booking Calendar v11.5
11.8.4 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 All 204 releases
booking / includes / ui_modal__shortcodes / sh_tpl_booking.php

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

2,441 lines 111.6 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 <?php if ( wpbc_is_11_5_features_enabled() ) : ?>
50 <div id="wpbc_shortcode_config__nav_tab__booking_appointment" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
51 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_appointment', 'booking_appointment' );" href="javascript:void(0);">
52 <span><?php esc_html_e( 'Appointment Booking', 'booking' ); ?></span>
53 </a>
54 </div>
55 <div id="wpbc_shortcode_config__nav_tab__booking_resource_selector" class="wpbc_settings_navigation_item wpbc_navigation_sub_item">
56 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_resource_selector', 'booking_resource_selector' );" href="javascript:void(0);">
57 <span><?php esc_html_e( 'Booking Resource Selector', 'booking' ); ?></span>
58 </a>
59 </div>
60 <?php endif; ?>
61 <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 ' : ''; ?>">
62 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingselect', 'bookingselect' );" href="javascript:void(0);">
63 <span><?php esc_html_e( 'Resource Selection', 'booking' ); ?></span><?php
64 echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : '';
65 ?>
66 </a>
67 </div>
68 <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 ' : ''; ?>">
69 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingform', 'bookingform' );" href="javascript:void(0);">
70 <span><?php esc_html_e( 'Only Form', 'booking' ) ?></span><?php
71 if ( ! class_exists( 'wpdev_bk_personal' ) ){
72 echo '<span class="wpbc_pro_label">Pro</span>';
73 } else{
74 echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : '';
75 }
76 ?>
77 </a>
78 </div>
79 <div id="wpbc_shortcode_config__nav_tab__bookingtimeline" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
80 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingtimeline', 'bookingtimeline' );" href="javascript:void(0);">
81 <span><?php esc_html_e( 'TimeLine', 'booking' ); ?></span>
82 </a>
83 </div>
84 <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 ' : ''; ?>">
85 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingsearch', 'bookingsearch' );" href="javascript:void(0);">
86 <span><?php esc_html_e( 'Search Availability', 'booking' ) ?></span><?php
87 if ( ! class_exists( 'wpdev_bk_personal' ) ){
88 echo '<span class="wpbc_pro_label">Pro</span>';
89 } else{
90 echo ( ! class_exists( 'wpdev_bk_biz_l' ) ) ? '<span class="wpbc_pro_label">BL</span>' : '';
91 }
92 ?>
93 </a>
94 </div>
95 <div id="wpbc_shortcode_config__nav_tab__bookingother" class="wpbc_settings_navigation_item">
96 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_bookingother', 'bookingother' );" href="javascript:void(0);">
97 <span><?php esc_html_e( 'Other', 'booking' ); ?></span><?php
98 //echo ( ! class_exists( 'wpdev_bk_personal' ) ) ? '<span class="wpbc_pro_label">Pro</span>' : '';
99 ?>
100 </a>
101 </div>
102 <?php if ( $is_bm_exist ) { ?>
103 <div id="wpbc_shortcode_config__nav_tab__booking_import_ics" class="wpbc_settings_navigation_item wpbc_navigation_top_border">
104 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_import_ics', 'booking_import_ics' );" href="javascript:void(0);">
105 <span><?php esc_html_e( 'Import Events (.ics feed)', 'booking' ) ?></span>
106 </a>
107 </div>
108 <div id="wpbc_shortcode_config__nav_tab__booking_listing_ics" class="wpbc_settings_navigation_item wpbc_navigation_sub_item">
109 <a onclick="javascript:wpbc_shortcode_config_click_show_section(this,'#wpbc_sc_container__shortcode_booking_listing_ics' , 'booking_listing_ics');" href="javascript:void(0);">
110 <span><?php esc_html_e( 'Show .ics Listing of Events', 'booking' ); ?></span>
111 </a>
112 </div>
113 <?php } ?>
114 </div>
115 <?php
116 }
117
118
119 // =====================================================================================================================
120 // Shortcode [booking ... ]
121 // =====================================================================================================================
122
123 /**
124 * Content of PopUp - for shortcode [booking ...]
125 *
126 * @return void
127 */
128 function wpbc_shortcode_config__content__booking() {
129
130 $shortcode_name = 'booking';
131
132 ?><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 ); ?> wpbc_sc_container__shortcode_is_active"><?php
133
134 wpbc_shortcode_config__booking__top_tabs();
135
136 // 'General' --------------------------------------------------------------------------------------------------
137 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__general">
138 <table class="form-table"><tbody><?php
139
140 // Booking Resource
141 wpbc_shortcode_config_fields__select_resource( $shortcode_name . '_wpbc_resource_id', $shortcode_name );
142
143 // Custom form
144 wpbc_shortcode_config_fields__select_custom_form( $shortcode_name . '_wpbc_custom_form', $shortcode_name );
145
146 // Number of Months
147 wpbc_shortcode_config_fields__select_nummonths( $shortcode_name . '_wpbc_nummonths', $shortcode_name );
148
149 // Calendar Size
150 wpbc_shortcode_config_fields__calendar_size( $shortcode_name . '_wpbc_size', $shortcode_name );
151
152 // Open booking form in popup.
153 wpbc_shortcode_config_fields__booking_popup( $shortcode_name . '_wpbc_popup', $shortcode_name );
154
155 ?></tbody></table>
156 </div><?php
157
158 // 'Conditional Days Selection' --------------------------------------------------------------------------------
159 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__conditions"><?php
160
161 wpbc_shortcode_config_fields__dates_conditions_toolbar(); // TOOLBAR
162
163 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__weekdays_conditions">
164 <?php
165 wpbc_shortcode_config_fields__weekdays_conditions( $shortcode_name . 'wpbc_select_day_weekday', $shortcode_name );
166 ?>
167 </div><?php
168
169 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__seasons_conditions">
170 <?php
171 wpbc_shortcode_config_fields__season_conditions( $shortcode_name . 'wpbc_select_day_season', $shortcode_name );
172 ?>
173 </div><?php
174
175 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__startseason_conditions">
176 <?php
177 wpbc_shortcode_config_fields__season_start_day_conditions( $shortcode_name . 'wpbc_start_day_season', $shortcode_name )
178 ?>
179 </div><?php
180
181 ?><div class="wpbc_sc_container__shortcode_subsection wpbc_sc_container__shortcode_subsection__dates_conditions">
182 <?php
183 wpbc_shortcode_config_fields__fordate_conditions( $shortcode_name . 'wpbc_select_day_fordate', $shortcode_name );
184 ?>
185 </div><?php
186
187 ?></div><?php
188
189 // 'AGGREGATE' -------------------------------------------------------------------------------------------------
190 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__aggregate"><?php
191
192 wpbc_shortcode_config_fields__aggregate( $shortcode_name . '_wpbc_aggregate', $shortcode_name );
193
194 ?></div><?php
195
196 // 'START MONTH' -----------------------------------------------------------------------------------------------
197 ?><div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__other"><?php
198 ?><table class="form-table"><tbody><?php
199
200 wpbc_shortcode_config_fields__calendar_dates_start( $shortcode_name . '_wpbc_calendar_dates_start', $shortcode_name );
201
202 wpbc_shortcode_config_fields__calendar_dates_end( $shortcode_name . '_wpbc_calendar_dates_end', $shortcode_name );
203
204 wpbc_shortcode_config_fields__start_month( $shortcode_name . '_wpbc_startmonth', $shortcode_name );
205
206 ?></tbody></table><?php
207 ?></div><?php
208
209
210
211 ?>
212 <div class="wpbc_shortcode_config_content_toolbar__next_prior">
213 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button">
214 <span class="in-button-text">&lsaquo;</span>
215 </a>
216 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button">
217 <span class="in-button-text">&rsaquo;</span>
218 </a>
219 </div>
220 <?php
221
222 ?></div><?php
223
224 wpbc_clear_div();
225 }
226
227
228 /**
229 * Top Tabs for shortcode [booking ...]
230 * @return void
231 */
232 function wpbc_shortcode_config__booking__top_tabs(){
233
234 $shortcode_name = 'booking';
235
236 wpbc_bs_toolbar_tabs_html_container_start();
237
238 $js = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');"
239 . "jQuery(this).addClass('nav-tab-active');"
240 . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
241 . "jQuery('.nav-tab-active i').addClass('icon-white');"
242 . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();";
243
244 wpbc_bs_display_tab( array(
245 'title' => __('Booking Calendar Form', 'booking')
246 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
247 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__general').show();"
248 , 'font_icon' => 'wpbc-bi-calendar3-range'
249 , 'default' => true
250 ) );
251 wpbc_bs_display_tab( array(
252 'title' => __('Conditional Days Selection', 'booking')
253 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
254 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__conditions').show();"
255 , 'font_icon' => 'wpbc-bi-calendar2-week'
256 , 'default' => false
257 , 'css_classes' => 'wpbc_dismiss__conditional_days'
258 ) );
259 wpbc_bs_display_tab( array(
260 'title' => __('Aggregate', 'booking')
261 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
262 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__aggregate').show();"
263 , 'font_icon' => 'wpbc-bi-calendar2-plus'
264 , 'default' => false
265 , 'css_classes' => 'wpbc_dismiss__booking_param_aggregate'
266 ) );
267 wpbc_bs_display_tab( array(
268 'title' => __('Advanced', 'booking')
269 // , 'hint' => array( 'title' => __('Manage bookings' ,'booking') , 'position' => 'top' )
270 , 'onclick' => $js . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section__other').show();"
271 , 'font_icon' => 'wpbc_icn_tune'
272 , 'default' => false
273
274 ) );
275
276 wpbc_bs_toolbar_tabs_html_container_end();
277 }
278
279
280
281 // =====================================================================================================================
282 // Fields
283 // =====================================================================================================================
284
285 /**
286 * Shortcode Field: Select-box - "Booking Resource"
287 *
288 * @param $id
289 * @param $group_key
290 *
291 * @return void
292 */
293 function wpbc_shortcode_config_fields__select_resource( $id , $group_key ){
294
295 if ( class_exists( 'wpdev_bk_personal' ) ){
296
297 WPBC_Settings_API::field_select_row_static( $id
298 , array(
299 'type' => 'select'
300 , 'title' => __( 'Booking resource', 'booking')
301 , 'description' => __( 'Select booking resource', 'booking' )
302 , 'description_tag' => 'span'
303 , 'label' => ''
304 , 'multiple' => false
305 , 'group' => $group_key
306 , 'tr_class' => $group_key . '_standard_section'
307 , 'class' => ''
308 , 'css' => 'margin-right:10px;'
309 , 'only_field' => false
310 , 'attr' => array()
311 , 'value' => ''
312 , 'options' => wpbc_get_all_booking_resources_list()
313 ) );
314 }
315
316 }
317
318 /**
319 * Shortcode Field: Select-box - "Custom Booking Form"
320 *
321 * @param $id
322 * @param $group_key
323 *
324 * @return void
325 */
326 function wpbc_shortcode_config_fields__select_custom_form( $id , $group_key ){
327
328 WPBC_FE_Custom_Form_Helper::wpbc_bfb__custom_booking_forms_list__selectbox_html__sh_modal(
329 array(
330 'name' => $id,
331 'title' => __( 'Booking Form', 'booking' ),
332 'description' => __( 'Select custom booking form', 'booking' ),
333 'group' => $group_key,
334 )
335 );
336 }
337
338 /**
339 * Shortcode Field: Select-box - "Calendar Months Number"
340 *
341 * @param $id
342 * @param $group_key
343 *
344 * @return void
345 */
346 function wpbc_shortcode_config_fields__select_nummonths( $id , $group_key ){
347
348 WPBC_Settings_API::field_select_row_static( $id
349 , array(
350 'type' => 'select'
351 , 'title' => __('Visible months', 'booking')
352 , 'description' => __('Select number of month to show for calendar.' ,'booking')
353 , 'description_tag' => 'span'
354 , 'label' => ''
355 , 'multiple' => false
356 , 'group' => $group_key
357 , 'tr_class' => $group_key . '_standard_section'
358 , 'class' => ''
359 , 'css' => 'margin-right:10px;'
360 , 'only_field' => false
361 , 'attr' => array()
362 , 'value' => get_bk_option( 'booking_client_cal_count' )
363 , 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
364 )
365 );
366 }
367
368 /**
369 * Shortcode Fields: OPTION - "Define Calendar Size"
370 *
371 * @param $id
372 * @param $group_key
373 *
374 * @return void
375 */
376 function wpbc_shortcode_config_fields__calendar_size( $id , $group_key ){
377
378 // ---------------------------------------------------------------------------------------------------------
379 WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled'
380 , array(
381 'type' => 'checkbox'
382 , 'title' => __('Setup Size & Structure', 'booking')
383 , 'description' => __('Configure Calendar Size and Structure', 'booking')
384 , 'description_tag' => 'span'
385 , 'label' => ''
386 , 'class' => ''
387 , 'css' => ''
388 , 'tr_class' => ''
389 , 'attr' => array()
390 , 'group' => $group_key
391 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
392 , 'only_field' => !true
393 , 'is_new_line' => false
394 , 'value' => false
395 )
396 );
397
398 WPBC_Settings_API::field_select_row_static( $id . '_months_num_in_row'
399 , array(
400 'type' => 'select'
401 , 'title' => __('Number of months in a row', 'booking')
402 , 'description' => __('Select the number of months to show in one row on a wide screen.' ,'booking')
403 , 'description_tag' => 'span'
404 , 'label' => ''
405 , 'multiple' => false
406 , 'group' => $group_key
407 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_calendar_size'
408 , 'class' => ''
409 , 'css' => 'margin-right:10px;'
410 , 'only_field' => false
411 , 'attr' => array()
412 , 'value' => get_bk_option( 'booking_client_cal_count' )
413 , 'options' => array_combine( range( 1, 6 ), range( 1, 6 ) )
414 )
415 );
416
417 ?><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">
418 <th scope="row" style="vertical-align: middle;">
419 <label for="wpbc_booking_width" class="wpbc-form-text"><?php esc_html_e('Calendar width:', 'booking'); ?></label>
420 </th>
421 <td class=""><fieldset><?php
422
423 WPBC_Settings_API::field_text_row_static( $id . '_calendar_width'
424 , array(
425 'type' => 'text'
426 , 'placeholder' => '100'
427 , 'class' => ''
428 , 'css' => 'width:5em;'
429 , 'only_field' => true
430 , 'attr' => array()
431 , 'value' => '100'
432 )
433 );
434 WPBC_Settings_API::field_select_row_static( $id . '_calendar_width_px_pr'
435 , array(
436 'type' => 'select'
437 , 'multiple' => false
438 , 'class' => ''
439 , 'css' => 'width:4em;'
440 , 'only_field' => true
441 , 'attr' => array()
442 , 'value' => '%'
443 , 'options' => array( 'px' => 'px', '%' => '%' )
444 )
445 );
446 ?><span class="description"> <?php esc_html_e('Set width of calendar' ,'booking'); ?></span></fieldset></td>
447 </tr><?php
448
449 ?><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">
450 <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>
451 <td class="">
452 <fieldset><?php
453
454 WPBC_Settings_API::field_text_row_static( $id . '_calendar_cell_height'
455 , array(
456 'type' => 'text'
457 , 'placeholder' => '50'
458 , 'class' => ''
459 , 'css' => 'width:5em;'
460 , 'only_field' => true
461 , 'attr' => array()
462 , 'value' => '50'
463 )
464 );
465 WPBC_Settings_API::field_select_row_static( $id . '_calendar_cell_height_px_pr'
466 , array(
467 'type' => 'select'
468 , 'multiple' => false
469 , 'class' => ''
470 , 'css' => 'width:4em;'
471 , 'only_field' => true
472 , 'attr' => array()
473 , 'value' => '%'
474 , 'options' => array( 'px' => 'px' )
475 )
476 );
477 ?><span class="description"> <?php esc_html_e('Set cell height for calendar' ,'booking'); ?></span>
478 </fieldset>
479 </td>
480 </tr><?php
481
482 }
483
484 /**
485 * Shortcode Fields: Open booking form in popup.
486 *
487 * @param string $id Field ID prefix.
488 * @param string $group_key Shortcode group key.
489 *
490 * @return void
491 */
492 function wpbc_shortcode_config_fields__booking_popup( $id, $group_key ) {
493
494 WPBC_Settings_API::field_checkbox_row_static( $id . '_enabled'
495 , array(
496 'type' => 'checkbox'
497 , 'title' => __( 'Open in popup', 'booking' )
498 , 'description' => __( 'Show a button that opens the booking form in a popup window.', 'booking' )
499 , 'description_tag' => 'span'
500 , 'label' => ''
501 , 'class' => ''
502 , 'css' => ''
503 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed'
504 , 'attr' => array()
505 , 'group' => $group_key
506 , 'only_field' => false
507 , 'is_new_line' => false
508 , 'value' => false
509 )
510 );
511
512 WPBC_Settings_API::field_text_row_static( $id . '_button_title'
513 , array(
514 'type' => 'text'
515 , 'title' => __( 'Button title', 'booking' )
516 , 'description' => __( 'Text on the button that opens the booking form popup.', 'booking' )
517 , 'description_tag' => 'span'
518 , 'placeholder' => __( 'Book now', 'booking' )
519 , 'class' => ''
520 , 'css' => ''
521 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
522 , 'attr' => array()
523 , 'group' => $group_key
524 , 'only_field' => false
525 , 'value' => __( 'Book now', 'booking' )
526 )
527 );
528
529 WPBC_Settings_API::field_text_row_static( $id . '_title'
530 , array(
531 'type' => 'text'
532 , 'title' => __( 'Popup title', 'booking' )
533 , 'description' => __( 'Title displayed in the popup header.', 'booking' )
534 , 'description_tag' => 'span'
535 , 'placeholder' => __( 'Booking Form', 'booking' )
536 , 'class' => ''
537 , 'css' => ''
538 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
539 , 'attr' => array()
540 , 'group' => $group_key
541 , 'only_field' => false
542 , 'value' => __( 'Booking Form', 'booking' )
543 )
544 );
545
546 WPBC_Settings_API::field_text_row_static( $id . '_button_class'
547 , array(
548 'type' => 'text'
549 , 'title' => __( 'Button CSS class', 'booking' )
550 , 'description' => __( 'CSS class for the popup button.', 'booking' )
551 , 'description_tag' => 'span'
552 , 'placeholder' => 'wp-element-button'
553 , 'class' => ''
554 , 'css' => ''
555 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
556 , 'attr' => array()
557 , 'group' => $group_key
558 , 'only_field' => false
559 , 'value' => 'wp-element-button'
560 )
561 );
562
563 WPBC_Settings_API::field_text_row_static( $id . '_modal_class'
564 , array(
565 'type' => 'text'
566 , 'title' => __( 'Popup CSS class', 'booking' )
567 , 'description' => __( 'Optional CSS class for the popup modal.', 'booking' )
568 , 'description_tag' => 'span'
569 , 'placeholder' => ''
570 , 'class' => ''
571 , 'css' => ''
572 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
573 , 'attr' => array()
574 , 'group' => $group_key
575 , 'only_field' => false
576 , 'value' => ''
577 )
578 );
579
580 WPBC_Settings_API::field_select_row_static( $id . '_size'
581 , array(
582 'type' => 'select'
583 , 'title' => __( 'Popup size', 'booking' )
584 , 'description' => __( 'Select the popup window size.', 'booking' )
585 , 'description_tag' => 'span'
586 , 'label' => ''
587 , 'multiple' => false
588 , 'group' => $group_key
589 , 'tr_class' => $group_key . '_standard_section wpbc_sub_settings_grayed ' . $id . '_wpbc_sc_booking_popup'
590 , 'class' => ''
591 , 'css' => 'margin-right:10px;'
592 , 'only_field' => false
593 , 'attr' => array()
594 , 'value' => 'lg'
595 , 'options' => array(
596 'lg' => __( 'Large', 'booking' ),
597 'default' => __( 'Default', 'booking' ),
598 'sm' => __( 'Small', 'booking' ),
599 )
600 )
601 );
602 }
603
604 /**
605 * Shortcode Fields: Start Month
606 *
607 * @param $id
608 * @param $group_key
609 *
610 * @return void
611 */
612 function wpbc_shortcode_config_fields__start_month( $id , $group_key ){
613
614 ////////////////////////////////////////////////////////////////////
615 // Start Month
616 ////////////////////////////////////////////////////////////////////
617 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
618 <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>
619 <td class=""><fieldset><?php
620
621 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
622 , array(
623 'type' => 'checkbox'
624 , 'title' => ''
625 , 'description' => ''
626 , 'description_tag' => 'span'
627 , 'label' => ''
628 , 'class' => ''
629 , 'css' => ''
630 , 'tr_class' => ''
631 , 'attr' => array()
632 , 'group' => $group_key
633 , 'only_field' => true
634 , 'is_new_line' => false
635 , 'value' => false
636 )
637 );
638
639 WPBC_Settings_API::field_select_row_static( $id . '_year'
640 , array(
641 'type' => 'select'
642 , 'title' => ''
643 , 'description' => ''
644 , 'description_tag' => 'span'
645 , 'label' => ''
646 , 'multiple' => false
647 , 'group' => $group_key
648 , 'class' => ''
649 , 'css' => 'width:5em;'
650 , 'only_field' => true
651 , 'attr' => array()
652 , 'value' => gmdate( 'Y' )
653 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
654 )
655 );
656 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
657
658 WPBC_Settings_API::field_select_row_static( $id . '_month'
659 , array(
660 'type' => 'select'
661 , 'title' => ''
662 , 'description' => ''
663 , 'description_tag' => 'span'
664 , 'label' => ''
665 , 'multiple' => false
666 , 'group' => $group_key
667 , 'class' => ''
668 , 'css' => 'width:4em;'
669 , 'only_field' => true
670 , 'attr' => array()
671 , 'value' => gmdate('n')
672 , 'options' => array_combine( range( 1, 12 ), range( 1, 12 ) )
673 )
674 );
675
676 ?><span class="description"> <?php esc_html_e('Select start month of calendar' ,'booking'); ?></span></fieldset></td>
677 </tr><?php
678
679 }
680
681
682 /**
683 * Shortcode Fields: Start Dates
684 *
685 * @param $id
686 * @param $group_key
687 *
688 * @return void
689 */
690 function wpbc_shortcode_config_fields__calendar_dates_start( $id , $group_key ){
691
692 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
693 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php
694 esc_html_e('Start dates', 'booking'); ?></label></th>
695 <td class=""><fieldset><?php
696
697 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
698 , array(
699 'type' => 'checkbox'
700 , 'title' => ''
701 , 'description' => ''
702 , 'description_tag' => 'span'
703 , 'label' => ''
704 , 'class' => ''
705 , 'css' => ''
706 , 'tr_class' => ''
707 , 'attr' => array()
708 , 'group' => $group_key
709 , 'only_field' => true
710 , 'is_new_line' => false
711 , 'value' => false
712 )
713 );
714
715 WPBC_Settings_API::field_select_row_static( $id . '_year'
716 , array(
717 'type' => 'select'
718 , 'title' => ''
719 , 'description' => ''
720 , 'description_tag' => 'span'
721 , 'label' => ''
722 , 'multiple' => false
723 , 'group' => $group_key
724 , 'class' => ''
725 , 'css' => 'width:5em;'
726 , 'only_field' => true
727 , 'attr' => array()
728 , 'value' => gmdate( 'Y' )
729 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
730 )
731 );
732
733 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
734
735 WPBC_Settings_API::field_select_row_static( $id . '_month'
736 , array(
737 'type' => 'select'
738 , 'title' => ''
739 , 'description' => ''
740 , 'description_tag' => 'span'
741 , 'label' => ''
742 , 'multiple' => false
743 , 'group' => $group_key
744 , 'class' => ''
745 , 'css' => 'width:4em;'
746 , 'only_field' => true
747 , 'attr' => array()
748 , 'value' => gmdate('m')
749 , 'options' => array_combine(
750 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ),
751 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) )
752 )
753 )
754 );
755
756
757 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
758
759 WPBC_Settings_API::field_select_row_static( $id . '_date'
760 , array(
761 'type' => 'select'
762 , 'title' => ''
763 , 'description' => ''
764 , 'description_tag' => 'span'
765 , 'label' => ''
766 , 'multiple' => false
767 , 'group' => $group_key
768 , 'class' => ''
769 , 'css' => 'width:4em;'
770 , 'only_field' => true
771 , 'attr' => array()
772 , 'value' => gmdate('d')
773 , 'options' => array_combine(
774 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ),
775 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) )
776 )
777
778 )
779 );
780
781 ?><span class="description"> <?php esc_html_e('Earliest date visible/selectable in the calendar.' ,'booking'); ?></span></fieldset></td>
782 </tr><?php
783 }
784
785
786 /**
787 * Shortcode Fields: End Dates
788 *
789 * @param $id
790 * @param $group_key
791 *
792 * @return void
793 */
794 function wpbc_shortcode_config_fields__calendar_dates_end( $id , $group_key ){
795
796 ?><tr valign="top" class="<?php echo esc_attr( $group_key . '_standard_section' ); ?>">
797 <th scope="row" style="vertical-align: middle;"><label for="<?php echo esc_attr( $id ); ?>_active" class="wpbc-form-text"><?php
798 esc_html_e('End dates', 'booking'); ?></label></th>
799 <td class=""><fieldset><?php
800
801 WPBC_Settings_API::field_checkbox_row_static( $id . '_active'
802 , array(
803 'type' => 'checkbox'
804 , 'title' => ''
805 , 'description' => ''
806 , 'description_tag' => 'span'
807 , 'label' => ''
808 , 'class' => ''
809 , 'css' => ''
810 , 'tr_class' => ''
811 , 'attr' => array()
812 , 'group' => $group_key
813 , 'only_field' => true
814 , 'is_new_line' => false
815 , 'value' => false
816 )
817 );
818
819 WPBC_Settings_API::field_select_row_static( $id . '_year'
820 , array(
821 'type' => 'select'
822 , 'title' => ''
823 , 'description' => ''
824 , 'description_tag' => 'span'
825 , 'label' => ''
826 , 'multiple' => false
827 , 'group' => $group_key
828 , 'class' => ''
829 , 'css' => 'width:5em;'
830 , 'only_field' => true
831 , 'attr' => array()
832 , 'value' => intval( gmdate( 'Y' ) ) + 2
833 , 'options' => array_combine( range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ), range( ( gmdate('Y') - 1 ), ( gmdate('Y') + 10 ) ) )
834 )
835 );
836
837 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
838
839 WPBC_Settings_API::field_select_row_static( $id . '_month'
840 , array(
841 'type' => 'select'
842 , 'title' => ''
843 , 'description' => ''
844 , 'description_tag' => 'span'
845 , 'label' => ''
846 , 'multiple' => false
847 , 'group' => $group_key
848 , 'class' => ''
849 , 'css' => 'width:4em;'
850 , 'only_field' => true
851 , 'attr' => array()
852 , 'value' => gmdate('m')
853 , 'options' => array_combine(
854 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) ),
855 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 12 ) )
856 )
857
858 )
859 );
860
861
862 ?><span class="description" style="font-weight:600;flex:0;margin: 3px 0.5em 0.5em 0;"> / </span><?php
863
864 WPBC_Settings_API::field_select_row_static( $id . '_date'
865 , array(
866 'type' => 'select'
867 , 'title' => ''
868 , 'description' => ''
869 , 'description_tag' => 'span'
870 , 'label' => ''
871 , 'multiple' => false
872 , 'group' => $group_key
873 , 'class' => ''
874 , 'css' => 'width:4em;'
875 , 'only_field' => true
876 , 'attr' => array()
877 , 'value' => gmdate('d')
878 , 'options' => array_combine(
879 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) ),
880 array_map( function ( $v ) { return str_pad( $v, 2, '0', STR_PAD_LEFT ); }, range( 1, 31 ) )
881 )
882
883 )
884 );
885
886 ?><span class="description"> <?php esc_html_e('Latest date visible/selectable in the calendar.' ,'booking'); ?></span></fieldset></td>
887 </tr><?php
888 }
889
890
891
892 /**
893 * Shortcode Fields: AGGREGATE
894 *
895 * @param $id
896 * @param $group_key
897 *
898 * @return void
899 */
900 function wpbc_shortcode_config_fields__aggregate( $id , $group_key ){
901
902 //--------------------------------------------------------------------------------------------------------------
903 // 'Upgrade to Pro' widget
904 //--------------------------------------------------------------------------------------------------------------
905 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
906 'id' => 'widget_wpbc_dismiss__booking_param_aggregate',
907 'dismiss_css_class' => '.wpbc_dismiss__booking_param_aggregate',
908 'blured_in_versions' => array( 'free' ),
909 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#booking-resources' ),
910 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
911 'versions' => 'paid versions',
912 'css' => 'transform: translate(0) translateY(180px);'
913 ) );
914 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
915 echo $upgrade_content_arr['content'];
916
917 //--------------------------------------------------------------------------------------------------------------
918 // Real Content
919 //--------------------------------------------------------------------------------------------------------------
920
921 $resources_list = array();
922 if ( class_exists( 'wpdev_bk_personal' ) ){
923 $resources_list_orig = wpbc_get_all_booking_resources_list();
924
925 $resources_list[0] = array( 'title' => __('None', 'booking' ), 'attr' => array ( 'class' => 'wpbc_single_resource', 'style' => 'border-bottom:1px dashed #ddd;') );
926 foreach ($resources_list_orig as $res_id => $res_val) {
927 $resources_list[$res_id] = $res_val;
928 }
929 }
930
931 ?>
932 <div class="clear"></div>
933 <div class="wpbc-settings-notice0 notice-info notice-header" style="font-size: 15px;font-weight: 600;margin: 15px 0 15px 15px;">
934 <label for="<?php echo esc_attr($id); ?>"><?php esc_html_e( 'Aggregate booking dates from other resources', 'booking' ); ?></label>
935 </div>
936
937 <div class="wpbc_shortcode_config__rules_container wpbc_dismiss__booking_param_aggregate <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
938 <div class="wpbc_shortcode_config__rules__params_section wpbc_aggregate">
939
940 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
941 <div class="ui_container ui_container_mini">
942 <div class="ui_group">
943 <div class="ui_element wpdevelop"><?php
944
945 WPBC_Settings_API::field_select_row_static( $id //. '__aggregate'
946 , array(
947 'type' => 'select'
948 , 'title' => __('Aggregate booking dates from other resources', 'booking')
949 , 'description' => ''//__( 'Select booking resources, for getting booking dates from them and set such dates as unavailable in destination calendar.', 'booking' )
950 , 'description_tag' => 'span'
951 , 'label' => ''
952 , 'multiple' => true
953 , 'group' => $group_key
954 , 'tr_class' => ''//$group_key . '_advanced_section'
955 , 'class' => 'wpbc_ui_control wpbc_ui_select'
956 , 'css' => 'margin-right:10px;height:20em;min-width:15em;'
957 , 'only_field' => true
958 , 'attr' => array()
959 , 'value' => '0'
960 , 'options' => $resources_list
961 )
962 );
963
964
965
966 ?></div>
967 </div>
968 </div>
969 </div>
970 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
971 <div class="ui_container ui_container_mini ui_container_weekdays">
972 <div class="ui_group ui_group_weekdays_checkboxes">
973 <div class="ui_element"><?php
974
975 WPBC_Settings_API::field_checkbox_row_static( $id . '__bookings_only'
976 , array(
977 'type' => 'checkbox'
978 , 'title' => ''
979 , 'description' => ''
980 , 'description_tag' => 'span'
981 , 'label' => __( 'Aggregate only bookings', 'booking' )
982 , 'class' => ''
983 , 'css' => ''
984 , 'tr_class' => ''
985 , 'attr' => array()
986 , 'group' => $group_key
987 , 'only_field' => true
988 , 'is_new_line' => false
989 , 'value' => false //// FixIn: 10.0.0.6.
990 )
991 );
992 ?></div>
993 </div>
994 </div>
995 </div>
996 </div>
997 <div class="wpbc_shortcode_config__rules__help_section" style="margin-top: 8px;">
998 <div class="wpbc-settings-notice notice-info notice-list">
999 <ol>
1000 <li>
1001 <?php esc_html_e( "Show dates as booked in the current calendar if such dates are unavailable in one of the selected resources.", 'booking' ); ?>
1002 </li>
1003 <li>
1004 <?php
1005 echo esc_html__( 'To set this up, select one or multiple booking resources in the multi-select box.', 'booking' )
1006 . '<br>'
1007 . esc_html__( 'Hold down the Ctrl button to make multiple selections.', 'booking' );
1008
1009 echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1010 . '<code>[booking resource_id=1 aggregate=\'3;5;9\']</code>';
1011 ?>
1012
1013 </li>
1014
1015 <li>
1016 <?php
1017 /* translators: 1: ... */
1018 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' )
1019 , '<strong>', '</strong>'
1020 , '<strong>Booking > Availability > Days Availability</strong>'
1021 ) );
1022 ?>
1023
1024 <?php
1025 echo ' <strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1026 , '<code>[booking resource_id=1 aggregate=\'3;5;9\' options=\'{aggregate type=bookings_only}\']</code>';
1027
1028 ?>
1029 </li>
1030 <li>
1031 <?php
1032 /* translators: 1: ... */
1033 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1034 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1035 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) );
1036 ?>
1037 </li>
1038 </ol>
1039 </div>
1040 </div>
1041 </div><?php
1042
1043
1044 }
1045
1046
1047
1048 // -----------------------------------------------------------------------------------------------------------------
1049
1050
1051 function wpbc_shortcode_config_fields__dates_conditions_toolbar(){
1052
1053 ?><div class="clear"></div><?php
1054 ?><div class="wpdevelop wpdvlp-nav-tabs-container wpbc_shortcode_config_fields__dates_conditions_toolbar"><?php
1055
1056 $js = "jQuery(this).parents( '.wpbc_shortcode_config_fields__dates_conditions_toolbar' ).find( '.nav-tab' ).removeClass('wpdevelop-submenu-tab-selected');
1057 jQuery(this).addClass('wpdevelop-submenu-tab-selected');
1058 jQuery('.nav-tab i.icon-white').removeClass('icon-white');
1059 jQuery('.nav-tab-active i').addClass('icon-white');
1060 jQuery(this).parents('.wpbc_sc_container__shortcode_section').find('.wpbc_sc_container__shortcode_subsection').hide();
1061 jQuery(this).parents('.wpbc_sc_container__shortcode_section')";
1062
1063 wpbc_bs_toolbar_sub_html_container_start();
1064
1065 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpdevelop-submenu-tab-selected wpbc_dismiss__conditional_days"
1066 onclick="javascript:<?php
1067 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1068 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__weekdays_conditions').show();" href="javascript:void(0)"
1069 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-week"></i>&nbsp;&nbsp;<?php
1070 esc_html_e( 'Weekdays Conditions', 'booking' );
1071 ?></span></a><?php
1072
1073 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1074 onclick="javascript:<?php
1075 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1076 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__seasons_conditions').show();" href="javascript:void(0)"
1077 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-month"></i>&nbsp;&nbsp;<?php
1078 esc_html_e( 'Seasons Conditions', 'booking' );
1079 ?></span></a><?php
1080
1081 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1082 onclick="javascript:<?php
1083 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1084 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__startseason_conditions').show();" href="javascript:void(0)"
1085 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-day"></i>&nbsp;&nbsp;<?php
1086 esc_html_e( 'Start selection at Seasons', 'booking' );
1087 ?></span></a><?php
1088
1089 ?><a class="nav-tab wpdevelop-submenu-tab tooltip_top wpbc_dismiss__conditional_days"
1090 onclick="javascript:<?php
1091 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1092 echo $js; ?>.find('.wpbc_sc_container__shortcode_subsection__dates_conditions').show();" href="javascript:void(0)"
1093 ><span class="nav-tab-text"><i class="menu_icon icon-1x wpbc-bi-calendar2-date"></i>&nbsp;&nbsp;<?php
1094 esc_html_e( 'Dates selection Conditions', 'booking' );
1095 ?></span></a><?php
1096
1097 wpbc_bs_toolbar_sub_html_container_end();
1098
1099 ?>
1100 </div><?php
1101 }
1102
1103
1104 /**
1105 * Week Days - Condition fields for 'option' parameter.
1106 *
1107 * @param $id
1108 * @param $group_key
1109 *
1110 * @return void
1111 */
1112 function wpbc_shortcode_config_fields__weekdays_conditions( $id , $group_key ){
1113
1114 //--------------------------------------------------------------------------------------------------------------
1115 // 'Upgrade to Pro' widget
1116 //--------------------------------------------------------------------------------------------------------------
1117 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1118 'id' => $id . '_' . 'conditional_days_weekdays',
1119 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1120 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1121 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1122 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1123 'versions' => 'Business Medium / Large, MultiUser versions',
1124 'css' => 'transform: translate(0) translateY(120px);'
1125 ) );
1126 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1127 echo $upgrade_content_arr['content'];
1128
1129 //--------------------------------------------------------------------------------------------------------------
1130 // Conditions for Weekdays selection
1131 //--------------------------------------------------------------------------------------------------------------
1132 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1133
1134 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_weekday">
1135
1136 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1137 <div class="ui_container ui_container_mini ui_container_weekdays">
1138 <?php
1139
1140 $week_days_arr = array(
1141 1 => __( 'Mo', 'booking' )
1142 , 2 => __( 'Tu', 'booking' )
1143 , 3 => __( 'We', 'booking' )
1144 , 4 => __( 'Th', 'booking' )
1145 , 5 => __( 'Fr', 'booking' )
1146 , 6 => __( 'Sa', 'booking' )
1147 , 0 => __( 'Su', 'booking' )
1148 );
1149 foreach ( $week_days_arr as $weekday_key => $weekday_title ) {
1150
1151 ?><div class="ui_group ui_group_weekdays_checkboxes"><?php
1152
1153 ?><div class="ui_element"><?php
1154
1155 WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key
1156 , array(
1157 'type' => 'checkbox'
1158 , 'title' => ''
1159 , 'description' => ''
1160 , 'description_tag' => 'span'
1161 , 'label' => $weekday_title
1162 , 'class' => ''
1163 , 'css' => ''
1164 , 'tr_class' => ''
1165 , 'attr' => array()
1166 , 'group' => $group_key
1167 , 'only_field' => true
1168 , 'is_new_line' => false
1169 , 'value' => false
1170 )
1171 );
1172
1173 ?></div>
1174 <div class="ui_element"><?php
1175
1176 $placeholder = '';
1177 switch ( $weekday_key ) {
1178 case 0: $placeholder = '1-7'; break;
1179 case 1: $placeholder = '5,7'; break;
1180 case 2: $placeholder = '3,4'; break;
1181 case 3: $placeholder = '5'; break;
1182 case 4: $placeholder = '4'; break;
1183 case 5: $placeholder = '3'; break;
1184 case 6: $placeholder = '2-7'; break;
1185 }
1186
1187 WPBC_Settings_API::field_text_row_static( $id . '__days_number_' . $weekday_key
1188 , array(
1189 'type' => 'text'
1190 , 'placeholder' => $placeholder
1191 , 'class' => 'wpbc_dates_conditions_value_weekday'
1192 , 'css' => ''
1193 , 'only_field' => true
1194 , 'attr' => array()
1195 , 'value' => ''
1196 )
1197 );
1198
1199 ?></div>
1200 <div class="ui_element"><?php
1201 ?><div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days to select' ,'booking'); ?></div><?php
1202 ?></div><?php
1203
1204 ?></div><?php
1205 }
1206
1207 ?>
1208 </div>
1209 </div>
1210
1211 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1212 <div class="ui_container ui_container_mini">
1213 <div class="ui_group"><?php
1214
1215 ?><div class="ui_element">
1216 <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>
1217 </div><?php
1218 ?><div class="ui_element">
1219 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_weekday__reset('<?php echo esc_attr( $id ); ?>');"
1220 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1221 </div><?php
1222
1223 ?>
1224 </div>
1225 </div>
1226 </div>
1227
1228 </div>
1229
1230 <div class="wpbc_shortcode_config__rules__help_section">
1231 <div class="wpbc-settings-notice notice-info notice-header">
1232 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific weekday.', 'booking' ); ?></span>
1233 </div>
1234 <div class="wpbc-settings-notice notice-info notice-list">
1235 <ol>
1236 <li>
1237 <?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' ); ?>
1238 </li>
1239 <li>
1240 <?php
1241 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1242 . '<code>{select-day condition="weekday" for="1" value="5,7"},{select-day condition="weekday" for="6" value="2-7"}</code>';
1243 ?>
1244 </li>
1245 <li>
1246 <?php
1247 /* translators: 1: ... */
1248 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1249 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1250 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition" target="_blank">', '</a></strong>' ) );
1251 ?>
1252 </li>
1253 <li>
1254 <?php
1255 /* translators: 1: ... */
1256 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1257 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1258 ?>
1259 </li>
1260 </ol>
1261 </div>
1262 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin-top:15px;"></textarea>
1263 </div>
1264 </div><?php
1265
1266 }
1267
1268
1269 /**
1270 * Season Days Selection - Condition fields for 'option' parameter.
1271 *
1272 * @param $id
1273 * @param $group_key
1274 *
1275 * @return void
1276 */
1277 function wpbc_shortcode_config_fields__season_conditions( $id, $group_key ) {
1278
1279 //--------------------------------------------------------------------------------------------------------------
1280 // 'Upgrade to Pro' widget
1281 //--------------------------------------------------------------------------------------------------------------
1282 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1283 'id' => $id . '_' . 'conditional_days_seasons',
1284 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1285 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1286 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1287 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1288 'versions' => 'Business Medium / Large, MultiUser versions',
1289 'css' => 'transform: translate(0) translateY(120px);'
1290 ) );
1291 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1292 echo $upgrade_content_arr['content'];
1293
1294 //--------------------------------------------------------------------------------------------------------------
1295 // Conditions for Seasons days selection
1296 //--------------------------------------------------------------------------------------------------------------
1297
1298 $options = wpbc_shortcode_config_fields__get_options_for_seasons();
1299
1300 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1301 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_day_season">
1302
1303 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1304 <div class="ui_container ui_container_mini">
1305 <div class="ui_group">
1306
1307 <div class="ui_element">
1308 <div class="wpbc_ui_control" style="line-height: 2;">
1309 <span><?php esc_html_e('In season' ,'booking'); ?></span>
1310 </div>
1311 </div>
1312
1313 <div class="ui_element wpdevelop"><?php
1314 WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name'
1315 , array(
1316 'type' => 'select'
1317 , 'title' => ''
1318 , 'label' => ''
1319 , 'disabled' => false
1320 , 'disabled_options' => array()
1321 , 'multiple' => false
1322 , 'description' => ''
1323 , 'description_tag' => 'span'
1324 , 'group' => $group_key
1325 , 'tr_class' => ''
1326 , 'class' => 'wpbc_ui_control wpbc_ui_select'
1327 , 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;'
1328 , 'only_field' => true
1329 , 'attr' => array()
1330 , 'value' => '0'
1331 , 'options' => $options
1332 )
1333 );
1334 ?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>"
1335 title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>"
1336 class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php
1337 ?></div>
1338
1339 </div>
1340 </div>
1341
1342 <div class="ui_container ui_container_mini">
1343 <div class="ui_group">
1344
1345 <div class="ui_element">
1346 <div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div>
1347 </div>
1348
1349 <div class="ui_element"><?php
1350 WPBC_Settings_API::field_text_row_static( $id . '__days_number'
1351 , array(
1352 'type' => 'text'
1353 , 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7'
1354 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1355 , 'css' => 'width:9em;border-radius:3px;'
1356 , 'only_field' => true
1357 , 'attr' => array()
1358 , 'value' => ''
1359 )
1360 );
1361 ?></div>
1362
1363 <div class="ui_element">
1364 <div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div>
1365 </div>
1366 </div>
1367 </div>
1368
1369 <div class="ui_container ui_container_mini">
1370 <div class="ui_group">
1371
1372 <div class="ui_element">
1373 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__add('<?php echo esc_attr( $id ); ?>');"
1374 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1375 </div>
1376 <div class="ui_element">
1377 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_season__reset('<?php echo esc_attr( $id ); ?>');"
1378 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1379 </div>
1380 </div>
1381 </div>
1382
1383 </div>
1384 </div>
1385 <div class="wpbc_shortcode_config__rules__help_section">
1386 <div class="wpbc-settings-notice notice-info notice-header">
1387 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection in a specific season.', 'booking' ); ?></span>
1388 </div>
1389 <div class="wpbc-settings-notice notice-info notice-list">
1390 <ol>
1391 <li>
1392 <?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' ); ?>
1393 </li>
1394 <li>
1395 <?php
1396 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1397 . '<code>{select-day condition="season" for="High season" value="7-14,21"},{select-day condition="season" for="Low season" value="2-5"}</code>';
1398 ?>
1399 </li>
1400 <li>
1401 <?php
1402 /* translators: 1: ... */
1403 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1404 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1405 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-condition-seasons" target="_blank">', '</a></strong>' ) );
1406 ?>
1407 </li>
1408 <li>
1409 <?php
1410 /* translators: 1: ... */
1411 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1412 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1413 ?>
1414 </li>
1415 </ol>
1416 </div>
1417 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1418 </div>
1419 </div><?php
1420
1421 }
1422
1423
1424 /**
1425 * Get Season Filters options - for selectbox in PopUp shortcode config
1426 *
1427 * @return array|array[]
1428 */
1429 function wpbc_shortcode_config_fields__get_options_for_seasons(){
1430
1431 if (function_exists('wpbc_sf_cache')) {
1432 // -----------------------------------------------------------------------------------------------------------------
1433 // Get Season Filters data:
1434 // -----------------------------------------------------------------------------------------------------------------
1435 $wpbc_sf_cache = wpbc_sf_cache();
1436 /**
1437 * $wpbc_sf_cache->get_data() = [
1438 * 1 => [
1439 * booking_filter_id = "1"
1440 * title = "Weekend"
1441 * filter = "a:4:{s:8:"weekdays";a:7..."
1442 * users = "1"
1443 * id = "1"
1444 */
1445 $season_filter_arr = $wpbc_sf_cache->get_data();
1446 } else {
1447 $season_filter_arr = array();
1448 }
1449 // $wpbc_br_cache = wpbc_br_cache();
1450 /*
1451 $wpbc_br_cache->get_resources() = [
1452 1 = [
1453 booking_type_id = "1"
1454 title = "Standard"
1455 users = "1"
1456 import = null
1457 export = "/ics/wpbm.ics"
1458 cost = "25"
1459 default_form = "standard"
1460 prioritet = "1"
1461 parent = "0"
1462 visitors = "2"
1463 id = "1"
1464 count = {int} 5
1465 7 = [...
1466 */
1467 $current_user_id = wpbc_get_current_user_id();
1468
1469 $options = array(
1470 0 => array(
1471 'title' => ' - ' . __( 'Please Select', 'booking' ) . ' - ',
1472 'attr' => array( 'style' => 'color:#999;font-weight: 400;' )
1473 )
1474 );
1475 foreach ( $season_filter_arr as $filter_id => $filter_arr ) {
1476
1477 $options[ $filter_arr['id'] ] = $filter_arr;
1478
1479 // MultiUser functionality for regular users showing season filters.
1480 if ( ( class_exists( 'wpdev_bk_multiuser' ) ) && ( ! empty( $filter_arr['users'] ) ) ) {
1481
1482 // Is current user suer booking admin and if this user was simulated log in
1483 $season_user_id = intval( $filter_arr['users'] );
1484 $is_user_super_admin = apply_bk_filter( 'is_user_super_admin', $season_user_id );
1485
1486 if ( ( ! $is_user_super_admin ) && ( $current_user_id != $season_user_id ) ) {
1487 $options[ $filter_arr['id'] ]['attr'] = array( 'style' => 'color:#a43232;font-weight: 400;font-style: italic;' );
1488 $user_name = get_userdata( $season_user_id );
1489 $user_name = $user_name->display_name;
1490 $options[ $filter_arr['id'] ]['title'] .= ' &nbsp; (' . __( 'Regular User', 'booking' ) . ': ' . $user_name . ')';
1491 }
1492 }
1493 }
1494
1495 return $options;
1496
1497 }
1498
1499
1500 /**
1501 * Season Days Start Day - Condition fields for 'option' parameter.
1502 *
1503 * @param $id
1504 * @param $group_key
1505 *
1506 * @return void
1507 */
1508 function wpbc_shortcode_config_fields__season_start_day_conditions( $id, $group_key ) {
1509
1510 //--------------------------------------------------------------------------------------------------------------
1511 // 'Upgrade to Pro' widget
1512 //--------------------------------------------------------------------------------------------------------------
1513 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1514 'id' => $id . '_' . 'conditional_days_startday',
1515 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1516 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1517 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1518 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1519 'versions' => 'Business Medium / Large, MultiUser versions',
1520 'css' => 'transform: translate(0) translateY(120px);'
1521 ) );
1522 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1523 echo $upgrade_content_arr['content'];
1524
1525 //--------------------------------------------------------------------------------------------------------------
1526 // Conditions for Seasons days START selection
1527 //--------------------------------------------------------------------------------------------------------------
1528
1529 $options = wpbc_shortcode_config_fields__get_options_for_seasons();
1530
1531 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1532 <div class="wpbc_shortcode_config__rules__params_section wpbc_start_day_season">
1533
1534 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1535 <div class="ui_container ui_container_mini">
1536 <div class="ui_group">
1537 <div class="ui_element">
1538 <div class="wpbc_ui_control" style="line-height: 2;">
1539 <span><?php esc_html_e('In season' ,'booking'); ?></span>
1540 </div>
1541 </div>
1542 <div class="ui_element wpdevelop"><?php
1543
1544 WPBC_Settings_API::field_select_row_static( $id . '__season_filter_name'
1545 , array(
1546 'type' => 'select'
1547 , 'title' => ''
1548 , 'label' => ''
1549 , 'disabled' => false
1550 , 'disabled_options' => array()
1551 , 'multiple' => false
1552 , 'description' => ''
1553 , 'description_tag' => 'span'
1554 , 'group' => $group_key
1555 , 'tr_class' => ''
1556 , 'class' => 'wpbc_ui_control wpbc_ui_select'
1557 , 'css' => 'max-width: Min(14em, 100%);flex: 0 1 auto;width: 14em;border-radius:3px 0 0 3px;'
1558 , 'only_field' => true
1559 , 'attr' => array()
1560 , 'value' => '0'
1561 , 'options' => $options
1562 )
1563 );
1564
1565 ?><a href="<?php echo esc_url( wpbc_get_availability_url() . '' ); ?>"
1566 title="<?php echo esc_attr( __( 'Add new season', 'booking' ) ); ?>"
1567 class="wpbc_ui_control wpbc_ui_button tooltip_top" ><i class="menu_icon icon-1x wpbc_icn_add _circle_outline"></i></a><?php
1568
1569 ?></div>
1570 </div>
1571 </div>
1572 </div>
1573 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1574 <div class="ui_container ui_container_mini ui_container_weekdays">
1575 <div class="ui_group">
1576 <div class="ui_element">
1577 <div class="wpbc_ui_control " style="line-height: 2;"><?php
1578 esc_html_e('allow to start days selection only for these weekdays' ,'booking');
1579 ?></div>
1580 </div>
1581 </div>
1582 <div class="ui_group ui_group_weekdays_checkboxes"><?php
1583
1584 $week_days_arr = array(
1585 1 => __( 'Mo', 'booking' )
1586 , 2 => __( 'Tu', 'booking' )
1587 , 3 => __( 'We', 'booking' )
1588 , 4 => __( 'Th', 'booking' )
1589 , 5 => __( 'Fr', 'booking' )
1590 , 6 => __( 'Sa', 'booking' )
1591 , 0 => __( 'Su', 'booking' )
1592 );
1593 foreach ( $week_days_arr as $weekday_key => $weekday_title ) {
1594
1595 ?><div class="ui_element"><?php
1596
1597 WPBC_Settings_API::field_checkbox_row_static( $id . '__weekday_' . $weekday_key
1598 , array(
1599 'type' => 'checkbox'
1600 , 'title' => ''
1601 , 'description' => ''
1602 , 'description_tag' => 'span'
1603 , 'label' => $weekday_title
1604 , 'class' => ''
1605 , 'css' => ''
1606 , 'tr_class' => ''
1607 , 'attr' => array()
1608 , 'group' => $group_key
1609 , 'only_field' => true
1610 , 'is_new_line' => false
1611 , 'value' => false
1612 )
1613 );
1614 ?></div><?php
1615
1616 }
1617
1618 ?></div>
1619 </div>
1620 </div>
1621 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1622 <div class="ui_container ui_container_mini">
1623 <div class="ui_group"><?php
1624
1625 ?><div class="ui_element">
1626 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__add('<?php echo esc_attr( $id ); ?>');"
1627 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1628 </div><?php
1629 ?><div class="ui_element">
1630 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__start_day_season__reset('<?php echo esc_attr( $id ); ?>');"
1631 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1632 </div><?php
1633
1634 ?>
1635 </div>
1636 </div>
1637 </div>
1638 </div>
1639 <div class="wpbc_shortcode_config__rules__help_section">
1640 <div class="wpbc-settings-notice notice-info notice-header">
1641 <span><?php esc_html_e( 'Specify the weekdays as start days for selection when starting the selection in a specific season.', 'booking' ); ?></span>
1642 </div>
1643 <div class="wpbc-settings-notice notice-info notice-list">
1644 <ol>
1645 <li>
1646 <?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' ); ?>
1647 </li>
1648 <li>
1649 <?php
1650 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1651 . '<code>{start-day condition="season" for="Low season" value="0,5"}</code>';
1652 ?>
1653 </li>
1654 <li>
1655 <?php
1656 /* translators: 1: ... */
1657 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1658 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1659 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#booking-options-start-day-condition" target="_blank">', '</a></strong>' ) );
1660 ?>
1661 </li>
1662 <li>
1663 <?php
1664 /* translators: 1: ... */
1665 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1666 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1667 ?>
1668 </li>
1669 </ol>
1670 </div>
1671 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1672 </div>
1673 </div><?php
1674
1675 }
1676
1677
1678
1679 /**
1680 * Dates Condition - Set Number of Days to Select, if start selection on specific date '2024-02-14'
1681 *
1682 * Config dialog for Booking Calendar shortcode
1683 *
1684 * @param $id
1685 * @param $group_key
1686 *
1687 * @return void
1688 */
1689 function wpbc_shortcode_config_fields__fordate_conditions( $id, $group_key ) {
1690
1691 //--------------------------------------------------------------------------------------------------------------
1692 // 'Upgrade to Pro' widget
1693 //--------------------------------------------------------------------------------------------------------------
1694 $upgrade_content_arr = wpbc_get_upgrade_widget( array(
1695 'id' => $id . '_' . 'conditional_days_fordate',
1696 'dismiss_css_class' => '.wpbc_dismiss__conditional_days',
1697 'blured_in_versions' => array( 'free', 'ps', 'bs' ),
1698 'feature_link' => array( 'title' => 'feature', 'relative_url' => 'overview/#advanced-days-selection' ),
1699 'upgrade_link' => array( 'title' => 'Upgrade to Pro', 'relative_url' => 'features/#bk_news_section' ),
1700 'versions' => 'Business Medium / Large, MultiUser versions',
1701 'css' => 'transform: translate(0) translateY(120px);'
1702 ) );
1703 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1704 echo $upgrade_content_arr['content'];
1705
1706 //--------------------------------------------------------------------------------------------------------------
1707 // Conditions for DATE selection
1708 //--------------------------------------------------------------------------------------------------------------
1709
1710 ?><div class="wpbc_shortcode_config__rules_container wpbc_dismiss__conditional_days <?php echo esc_attr( $upgrade_content_arr['maybe_blur_css_class'] ); ?>">
1711 <div class="wpbc_shortcode_config__rules__params_section wpbc_select_fordate">
1712
1713 <div class="wpbc_ajx_toolbar wpbc_no_background wpbc_buttons_row">
1714 <div class="ui_container ui_container_mini">
1715 <div class="ui_group">
1716
1717 <div class="ui_element">
1718 <div class="wpbc_ui_control" style="line-height: 2;">
1719 <span><?php esc_html_e('For date' ,'booking'); ?></span>
1720 </div>
1721 </div>
1722
1723 <div class="ui_element wpdevelop"><?php
1724 WPBC_Settings_API::field_text_row_static( $id . '__date'
1725 , array(
1726 'type' => 'text'
1727 , 'placeholder' => '2024-02-14'
1728 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1729 , 'css' => 'width:9em;border-radius:3px;'
1730 , 'only_field' => true
1731 , 'attr' => array()
1732 , 'value' => ''
1733 )
1734 );
1735 ?></div>
1736
1737 </div>
1738 </div>
1739
1740 <div class="ui_container ui_container_mini">
1741 <div class="ui_group">
1742
1743 <div class="ui_element">
1744 <div class="wpbc_ui_control " style="line-height: 2;"><?php esc_html_e('allow to select' ,'booking'); ?></div>
1745 </div>
1746
1747 <div class="ui_element"><?php
1748 WPBC_Settings_API::field_text_row_static( $id . '__days_number'
1749 , array(
1750 'type' => 'text'
1751 , 'placeholder' => '5 ' . __( 'or', 'booking' ) . ' 1-7 ' . __( 'or', 'booking' ) . ' 1,5,7'
1752 , 'class' => 'wpbc_ui_control wpbc_ui_text'
1753 , 'css' => 'width:9em;border-radius:3px;'
1754 , 'only_field' => true
1755 , 'attr' => array()
1756 , 'value' => ''
1757 )
1758 );
1759 ?></div>
1760
1761 <div class="ui_element">
1762 <div class="wpbc_ui_control" style="line-height: 2;"><?php esc_html_e('days' ,'booking'); ?></div>
1763 </div>
1764 </div>
1765 </div>
1766
1767 <div class="ui_container ui_container_mini">
1768 <div class="ui_group">
1769
1770 <div class="ui_element">
1771 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__add('<?php echo esc_attr( $id ); ?>');"
1772 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_primary" ><?php esc_html_e('Add Rule','booking'); ?></a>
1773 </div>
1774 <div class="ui_element">
1775 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config__select_day_fordate__reset('<?php echo esc_attr( $id ); ?>');"
1776 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button_danger" ><?php esc_html_e('Reset','booking'); ?></a>
1777 </div>
1778 </div>
1779 </div>
1780
1781 </div>
1782 </div>
1783 <div class="wpbc_shortcode_config__rules__help_section">
1784 <div class="wpbc-settings-notice notice-info notice-header">
1785 <span><?php esc_html_e( 'Specify the number of days to select when starting the selection on a specific date.', 'booking' ); ?></span>
1786 </div>
1787 <div class="wpbc-settings-notice notice-info notice-list">
1788 <ol>
1789 <li>
1790 <?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' ); ?>
1791 </li>
1792 <li>
1793 <?php
1794 echo '<strong>' . esc_html__( 'Code Example', 'booking' ) . ': </strong>'
1795 . '<code>{select-day condition="date" for="2027-02-15" value="7,14,21"}</code>';
1796 ?>
1797 </li>
1798 <li>
1799 <?php
1800 /* translators: 1: ... */
1801 echo wp_kses_post( sprintf( __( 'Check the FAQ for details on %1$sshortcode configuration%2$s, especially this %3$soption%4$s.' , 'booking' )
1802 , '<a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/" target="_blank">', '</a>'
1803 , '<strong><a href="https://wpbookingcalendar.com/faq/shortcode-booking-form/#aggregate" target="_blank">', '</a></strong>' ) );
1804 ?>
1805 </li>
1806 <li>
1807 <?php
1808 /* translators: 1: ... */
1809 echo wp_kses_post( sprintf( __( 'Explore %1$sJavaScript customization%2$s for advanced different day selection in different calendars.', 'booking' )
1810 , '<a href="https://wpbookingcalendar.com/faq/advanced-javascript-for-the-booking-shortcodes/" target="_blank">','</a>') );
1811 ?>
1812 </li>
1813 </ol>
1814 </div>
1815 <textarea id="<?php echo esc_attr( $id ); ?>_textarea" name="<?php echo esc_attr( $id ); ?>_textarea" style="width:100%;margin:10px 0;"></textarea>
1816 </div>
1817 </div><?php
1818
1819 }
1820
1821
1822 // =====================================================================================================================
1823 // Shared fields for modern workflow shortcodes.
1824 // =====================================================================================================================
1825
1826 /**
1827 * Return Booking Resources in the established shortcode-popup option format.
1828 *
1829 * Personal and higher editions already expose the hierarchy-aware resource
1830 * list used by the legacy shortcode controls. The fallback keeps the default
1831 * resource selectable in editions where that list is intentionally empty.
1832 *
1833 * @param bool $include_empty Whether to prepend an empty automatic choice.
1834 * @param string $empty_title Label for the empty choice.
1835 *
1836 * @return array<int|string,array<string,mixed>|string> Booking Resource options.
1837 */
1838 function wpbc_shortcode_config__workflow_resource_options( $include_empty = false, $empty_title = '' ) {
1839 $options = array();
1840 if ( $include_empty ) {
1841 $options[''] = array(
1842 'title' => $empty_title ? $empty_title : __( 'No preselection', 'booking' ),
1843 'attr' => array( 'class' => 'wpbc_single_resource' ),
1844 );
1845 }
1846
1847 $resource_options = function_exists( 'wpbc_get_all_booking_resources_list' )
1848 ? (array) wpbc_get_all_booking_resources_list()
1849 : array();
1850 if ( empty( $resource_options ) && function_exists( 'wpbc_booking_resource_selector_get_catalog' ) ) {
1851 foreach ( (array) wpbc_booking_resource_selector_get_catalog( array() ) as $resource_id => $resource ) {
1852 $resource_options[ absint( $resource_id ) ] = array(
1853 'title' => ! empty( $resource['title'] ) ? $resource['title'] : sprintf( __( 'Booking Resource #%d', 'booking' ), absint( $resource_id ) ),
1854 'attr' => array( 'class' => 'wpbc_single_resource' ),
1855 );
1856 }
1857 }
1858 if ( empty( $resource_options ) && function_exists( 'wpbc_appointment_services_get_provider_options' ) ) {
1859 foreach ( (array) wpbc_appointment_services_get_provider_options() as $resource_id => $resource_title ) {
1860 $resource_options[ absint( $resource_id ) ] = array(
1861 'title' => $resource_title,
1862 'attr' => array( 'class' => 'wpbc_single_resource' ),
1863 );
1864 }
1865 }
1866
1867 return $options + $resource_options;
1868 }
1869
1870 /**
1871 * Return the automatic, standard, and published Booking Form choices.
1872 *
1873 * The empty option is important for both workflow shortcodes: it preserves
1874 * their automatic Service/Resource form resolution instead of silently
1875 * forcing the Standard form merely by opening the popup.
1876 *
1877 * @return array<string,array<string,mixed>> Booking Form options keyed by public form slug.
1878 */
1879 function wpbc_shortcode_config__workflow_form_options() {
1880 $options = array(
1881 '' => array( 'title' => __( 'Automatic (Service or Resource default)', 'booking' ), 'attr' => array() ),
1882 'standard' => array( 'title' => __( 'Standard', 'booking' ), 'attr' => array() ),
1883 );
1884
1885 if ( ! class_exists( 'WPBC_FE_Custom_Form_Helper' ) ) {
1886 return $options;
1887 }
1888
1889 $is_allowed = apply_bk_filter( 'multiuser_is_user_can_be_here', true, 'only_super_admin' );
1890 if ( ! $is_allowed && 'On' !== get_bk_option( 'booking_is_custom_forms_for_regular_users' ) ) {
1891 return $options;
1892 }
1893
1894 $owner_user_id = WPBC_FE_Custom_Form_Helper::wpbc_mu__get_current__owner_user_id();
1895 $custom_forms = WPBC_FE_Custom_Form_Helper::get_custom_booking_forms_list(
1896 array(
1897 'include_standard' => false,
1898 'owner_user_id' => $owner_user_id,
1899 'statuses' => array( 'published' ),
1900 'list_mode' => 'auto',
1901 )
1902 );
1903 if ( empty( $custom_forms ) ) {
1904 return $options;
1905 }
1906
1907 $options['wpbc_workflow_forms_start'] = array(
1908 'optgroup' => true,
1909 'close' => false,
1910 'title' => '&nbsp;' . __( 'Custom Forms', 'booking' ),
1911 );
1912 foreach ( $custom_forms as $form_key => $custom_form ) {
1913 $form_slug = ! empty( $custom_form['name'] ) ? (string) $custom_form['name'] : (string) $form_key;
1914 if ( '' === $form_slug ) {
1915 continue;
1916 }
1917 $options[ $form_slug ] = array(
1918 'title' => ! empty( $custom_form['title'] ) ? wpbc_lang( $custom_form['title'] ) : wpbc_lang( $form_slug ),
1919 'attr' => array(),
1920 );
1921 }
1922 $options['wpbc_workflow_forms_end'] = array( 'optgroup' => true, 'close' => true );
1923
1924 return $options;
1925 }
1926
1927 /**
1928 * Render one modern workflow shortcode parameter using the established settings-row controls.
1929 *
1930 * Data attributes on the control provide one serializer contract. Display-text
1931 * defaults are placed in the input so clearing a value intentionally generates
1932 * an empty attribute instead of silently restoring the frontend default.
1933 *
1934 * @param string $shortcode_name Shortcode name without brackets.
1935 * @param string $parameter_name Public shortcode parameter name.
1936 * @param array<string,mixed> $field Field label, description, type, default, and validation metadata.
1937 *
1938 * @return void
1939 */
1940 function wpbc_shortcode_config__workflow_field( $shortcode_name, $parameter_name, $field ) {
1941 $field = wp_parse_args(
1942 $field,
1943 array(
1944 'title' => $parameter_name,
1945 'description' => '',
1946 'type' => 'text',
1947 'value_type' => 'text',
1948 'default' => '',
1949 'placeholder' => '',
1950 'options' => array(),
1951 'attr' => array(),
1952 'css' => 'width:100%;max-width:32em;',
1953 'class' => '',
1954 )
1955 );
1956
1957 $field_id = $shortcode_name . '_wpbc_' . $parameter_name;
1958 $field_attr = array_merge(
1959 (array) $field['attr'],
1960 array(
1961 'data-wpbc-shortcode-parameter' => $parameter_name,
1962 'data-wpbc-shortcode-default' => is_bool( $field['default'] ) ? ( $field['default'] ? 'on' : 'off' ) : (string) $field['default'],
1963 'data-wpbc-shortcode-value-type' => $field['value_type'],
1964 )
1965 );
1966 $description = sprintf(
1967 /* translators: %s: Shortcode parameter name. */
1968 __( 'Shortcode parameter: %s', 'booking' ),
1969 '<code>' . esc_html( $parameter_name ) . '</code>'
1970 );
1971 if ( '' !== $field['description'] ) {
1972 $description .= '<br>' . $field['description'];
1973 }
1974
1975 $common_args = array(
1976 'title' => $field['title'],
1977 'description' => $description,
1978 'description_tag' => 'span',
1979 'group' => $shortcode_name,
1980 'tr_class' => $shortcode_name . '_standard_section',
1981 'class' => trim( 'wpbc_shortcode_config__workflow_parameter ' . $field['class'] ),
1982 'css' => $field['css'],
1983 'only_field' => false,
1984 'attr' => $field_attr,
1985 );
1986
1987 if ( 'checkbox' === $field['type'] ) {
1988 WPBC_Settings_API::field_checkbox_row_static(
1989 $field_id,
1990 array_merge(
1991 $common_args,
1992 array(
1993 'label' => $field['title'],
1994 'value' => $field['default'] ? 'On' : 'Off',
1995 'css' => '',
1996 )
1997 )
1998 );
1999 return;
2000 }
2001
2002 if ( in_array( $field['type'], array( 'select', 'multiselect' ), true ) ) {
2003 WPBC_Settings_API::field_select_row_static(
2004 $field_id,
2005 array_merge(
2006 $common_args,
2007 array(
2008 'value' => (string) $field['default'],
2009 'options' => (array) $field['options'],
2010 'multiple' => 'multiselect' === $field['type'],
2011 )
2012 )
2013 );
2014 return;
2015 }
2016
2017 WPBC_Settings_API::field_text_row_static(
2018 $field_id,
2019 array_merge(
2020 $common_args,
2021 array(
2022 'type' => 'number' === $field['type'] ? 'number' : 'text',
2023 'value' => (string) $field['default'],
2024 'placeholder' => $field['placeholder'],
2025 )
2026 )
2027 );
2028 }
2029
2030 /**
2031 * Render top tabs for one modern workflow shortcode configuration.
2032 *
2033 * @param string $shortcode_name Shortcode name without brackets.
2034 * @param array<string,array<string,string|bool>> $tabs Tab definitions keyed by section ID.
2035 *
2036 * @return void
2037 */
2038 function wpbc_shortcode_config__workflow_tabs( $shortcode_name, $tabs ) {
2039 wpbc_bs_toolbar_tabs_html_container_start();
2040
2041 $tab_script = "jQuery(this).parents( '.wpbc_sc_container__shortcode' ).find( '.nav-tab' ).removeClass('nav-tab-active');"
2042 . "jQuery(this).addClass('nav-tab-active');"
2043 . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
2044 . "jQuery('.nav-tab-active i').addClass('icon-white');"
2045 . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . " .wpbc_sc_container__shortcode_section').hide();";
2046
2047 foreach ( $tabs as $section_id => $tab ) {
2048 wpbc_bs_display_tab(
2049 array(
2050 'title' => $tab['title'],
2051 'onclick' => $tab_script . "jQuery('.wpbc_sc_container__shortcode_" . $shortcode_name . ' .wpbc_sc_container__shortcode_section__' . $section_id . "').show();",
2052 'font_icon' => $tab['icon'],
2053 'default' => ! empty( $tab['default'] ),
2054 )
2055 );
2056 }
2057
2058 wpbc_bs_toolbar_tabs_html_container_end();
2059 }
2060
2061 /**
2062 * Render the standard previous/next controls used by shortcode popup sections.
2063 *
2064 * @return void
2065 */
2066 function wpbc_shortcode_config__workflow_pager() {
2067 ?>
2068 <div class="wpbc_shortcode_config_content_toolbar__next_prior">
2069 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'prior');" class="button">
2070 <span class="in-button-text">&lsaquo;</span>
2071 </a>
2072 <a href="javascript:void(0)" onclick="javascript:wpbc_shortcode_config_content_toolbar__next_prior(this,'next');" class="button">
2073 <span class="in-button-text">&rsaquo;</span>
2074 </a>
2075 </div>
2076 <?php
2077 }
2078
2079 /**
2080 * Render a complete parameter reference including compatibility-only aliases.
2081 *
2082 * @param array<string,string> $parameters Parameter descriptions keyed by accepted shortcode name.
2083 *
2084 * @return void
2085 */
2086 function wpbc_shortcode_config__workflow_parameter_reference( $parameters ) {
2087 ?>
2088 <table class="widefat striped wpbc_shortcode_config__parameter_reference">
2089 <thead>
2090 <tr>
2091 <th scope="col"><?php esc_html_e( 'Parameter', 'booking' ); ?></th>
2092 <th scope="col"><?php esc_html_e( 'Accepted value and behavior', 'booking' ); ?></th>
2093 </tr>
2094 </thead>
2095 <tbody>
2096 <?php foreach ( $parameters as $parameter_name => $description ) : ?>
2097 <tr>
2098 <th scope="row"><code><?php echo esc_html( $parameter_name ); ?></code></th>
2099 <td><?php echo wp_kses_post( $description ); ?></td>
2100 </tr>
2101 <?php endforeach; ?>
2102 </tbody>
2103 </table>
2104 <?php
2105 }
2106
2107
2108 // =====================================================================================================================
2109 // Shortcode [booking_appointment ...].
2110 // =====================================================================================================================
2111
2112 /**
2113 * Get the popup field contract for the Appointment shortcode.
2114 *
2115 * The keys intentionally match the public parser-backed attribute names. The
2116 * compatibility aliases are reference-only so newly generated shortcodes use
2117 * the normalized progress_item_N_* form.
2118 *
2119 * @return array<string,array<string,mixed>> Appointment parameter fields.
2120 */
2121 function wpbc_shortcode_config__booking_appointment_parameters() {
2122 $month_options = array_combine( range( 1, 24 ), range( 1, 24 ) );
2123
2124 return array(
2125 'service_id' => array(
2126 'section' => 'general', 'title' => __( 'Preselected Service', 'booking' ), 'type' => 'number', 'value_type' => 'positive_integer', 'default' => '',
2127 'description' => __( 'Preselect and restrict the flow to one positive Service ID.', 'booking' ), 'attr' => array( 'min' => 1, 'step' => 1 ),
2128 ),
2129 'provider_id' => array(
2130 'section' => 'general', 'title' => __( 'Preselected Provider', 'booking' ), 'type' => 'select', 'value_type' => 'positive_integer', 'default' => '',
2131 'options' => wpbc_shortcode_config__workflow_resource_options( true, __( 'No Provider preselected', 'booking' ) ),
2132 'description' => __( 'Preselect and restrict the flow to one Provider Booking Resource.', 'booking' ),
2133 ),
2134 'services' => array(
2135 'section' => 'general', 'title' => __( 'Allowed Services', 'booking' ), 'value_type' => 'id_list', 'default' => '', 'placeholder' => '12,15',
2136 'description' => __( 'Comma-, semicolon-, or whitespace-separated positive Service IDs, retained in the requested order.', 'booking' ),
2137 ),
2138 'providers' => array(
2139 'section' => 'general', 'title' => __( 'Allowed Providers', 'booking' ), 'type' => 'multiselect', 'value_type' => 'id_list', 'default' => '',
2140 'options' => wpbc_shortcode_config__workflow_resource_options(), 'css' => 'width:100%;max-width:32em;height:12em;',
2141 'description' => __( 'Select the Provider Booking Resources allowed in this Appointment flow. Leave every option unselected to allow all compatible Providers.', 'booking' ),
2142 ),
2143 'auto_select_provider' => array(
2144 'section' => 'general', 'title' => __( 'Auto-select the only Provider', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false,
2145 'description' => __( 'Skip Provider selection only when exactly one compatible Provider exists.', 'booking' ),
2146 ),
2147 'nummonths' => array(
2148 'section' => 'calendar', 'title' => __( 'Visible months', 'booking' ), 'type' => 'select', 'value_type' => 'positive_integer', 'default' => 1, 'options' => $month_options,
2149 'description' => __( 'Number of calendar months from 1 through 24.', 'booking' ),
2150 ),
2151 'startmonth' => array(
2152 'section' => 'calendar', 'title' => __( 'Start month', 'booking' ), 'value_type' => 'month', 'default' => '', 'placeholder' => '2026-08',
2153 'description' => __( 'Initial calendar month in YYYY-MM, YYYY/MM, or YYYYMM format.', 'booking' ),
2154 ),
2155 'calendar_dates_start' => array(
2156 'section' => 'calendar', 'title' => __( 'First calendar date', 'booking' ), 'value_type' => 'date', 'default' => '', 'placeholder' => '2026-08-01',
2157 'description' => __( 'Inclusive first displayed date in YYYY-MM-DD format.', 'booking' ),
2158 ),
2159 'calendar_dates_end' => array(
2160 'section' => 'calendar', 'title' => __( 'Last calendar date', 'booking' ), 'value_type' => 'date', 'default' => '', 'placeholder' => '2026-12-31',
2161 'description' => __( 'Inclusive last displayed date in YYYY-MM-DD format.', 'booking' ),
2162 ),
2163 'options' => array(
2164 'section' => 'calendar', 'title' => __( 'Calendar options', 'booking' ), 'value_type' => 'text', 'default' => '',
2165 'description' => __( 'Native Booking Calendar options string passed to the resolved calendar and form.', 'booking' ),
2166 ),
2167 'form_type' => array(
2168 'section' => 'calendar', 'title' => __( 'Booking Form', 'booking' ), 'type' => 'select', 'value_type' => 'text', 'default' => '',
2169 'options' => wpbc_shortcode_config__workflow_form_options(),
2170 'description' => __( 'Select a published Booking Form override. Automatic uses the Service form and then the Standard form.', 'booking' ),
2171 ),
2172 'allow_past' => array(
2173 'section' => 'calendar', 'title' => __( 'Allow past bookings', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false,
2174 'description' => __( 'Permit any visitor to select and submit past dates inside the signed shortcode range.', 'booking' ),
2175 ),
2176 'show_progress' => array(
2177 'section' => 'progress', 'title' => __( 'Show progress', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true,
2178 'description' => __( 'Show the complete numbered Appointment progress line.', 'booking' ),
2179 ),
2180 'progress_item_1_title' => array(
2181 'section' => 'progress', 'title' => __( 'First progress title', 'booking' ), 'default' => __( 'Service', 'booking' ),
2182 'description' => __( 'Title below the first progress number. Clear it to hide the title.', 'booking' ),
2183 ),
2184 'progress_item_1_number' => array(
2185 'section' => 'progress', 'title' => __( 'First progress number', 'booking' ), 'default' => '1',
2186 'description' => __( 'First displayed progress number. Clear it to hide the number.', 'booking' ),
2187 ),
2188 'progress_item_2_title' => array(
2189 'section' => 'progress', 'title' => __( 'Second progress title', 'booking' ), 'default' => __( 'Provider', 'booking' ),
2190 'description' => __( 'Title below the second progress number. Clear it to hide the title.', 'booking' ),
2191 ),
2192 'progress_item_2_number' => array(
2193 'section' => 'progress', 'title' => __( 'Second progress number', 'booking' ), 'default' => '2',
2194 'description' => __( 'Second displayed progress number. Clear it to hide the number.', 'booking' ),
2195 ),
2196 'progress_item_3_title' => array(
2197 'section' => 'progress', 'title' => __( 'Third progress title', 'booking' ), 'default' => __( 'Date & Details', 'booking' ),
2198 'description' => __( 'Title below the third progress number. Clear it to hide the title.', 'booking' ),
2199 ),
2200 'progress_item_3_number' => array(
2201 'section' => 'progress', 'title' => __( 'Third progress number', 'booking' ), 'default' => '3',
2202 'description' => __( 'Third displayed progress number. Clear it to hide the number.', 'booking' ),
2203 ),
2204 'screen_1_title' => array(
2205 'section' => 'text', 'title' => __( 'Service screen title', 'booking' ), 'default' => __( 'Choose a Service', 'booking' ),
2206 'description' => __( 'Heading on the Service selection screen. Clear it to hide the heading.', 'booking' ),
2207 ),
2208 'screen_1_description' => array(
2209 'section' => 'text', 'title' => __( 'Service screen description', 'booking' ), 'default' => __( 'Select what you would like to book.', 'booking' ),
2210 'description' => __( 'Description on the Service selection screen. Clear it to hide the description.', 'booking' ),
2211 ),
2212 'screen_2_title' => array(
2213 'section' => 'text', 'title' => __( 'Provider screen title', 'booking' ), 'default' => __( 'Choose a Provider', 'booking' ),
2214 'description' => __( 'Heading on the Provider selection screen. Clear it to hide the heading.', 'booking' ),
2215 ),
2216 'screen_2_description' => array(
2217 'section' => 'text', 'title' => __( 'Provider screen description', 'booking' ), 'default' => __( 'Select who will provide this Service.', 'booking' ),
2218 'description' => __( 'Description on the Provider selection screen. Clear it to hide the description.', 'booking' ),
2219 ),
2220 );
2221 }
2222
2223 /**
2224 * Get every accepted public Appointment shortcode parameter for the reference tab.
2225 *
2226 * @return array<string,string> Parameter descriptions keyed by public attribute.
2227 */
2228 function wpbc_shortcode_config__booking_appointment_parameter_reference() {
2229 $reference = array();
2230 foreach ( wpbc_shortcode_config__booking_appointment_parameters() as $parameter_name => $field ) {
2231 $reference[ $parameter_name ] = $field['description'];
2232 }
2233
2234 $reference['progress_service_title'] = __( 'Compatibility alias for progress_item_1_title.', 'booking' );
2235 $reference['progress_service_number'] = __( 'Compatibility alias for progress_item_1_number.', 'booking' );
2236 $reference['progress_provider_title'] = __( 'Compatibility alias for progress_item_2_title.', 'booking' );
2237 $reference['progress_provider_number'] = __( 'Compatibility alias for progress_item_2_number.', 'booking' );
2238 $reference['progress_details_title'] = __( 'Compatibility alias for progress_item_3_title.', 'booking' );
2239 $reference['progress_details_number'] = __( 'Compatibility alias for progress_item_3_number.', 'booking' );
2240
2241 return $reference;
2242 }
2243
2244 /**
2245 * Render the [booking_appointment] configuration section in the shortcode popup.
2246 *
2247 * @return void
2248 */
2249 function wpbc_shortcode_config__content__booking_appointment() {
2250 $shortcode_name = 'booking_appointment';
2251 $tabs = array(
2252 'general' => array( 'title' => __( 'Service & Provider', 'booking' ), 'icon' => 'wpbc-bi-person-check', 'default' => true ),
2253 'calendar' => array( 'title' => __( 'Calendar & Form', 'booking' ), 'icon' => 'wpbc-bi-calendar3', 'default' => false ),
2254 'progress' => array( 'title' => __( 'Progress', 'booking' ), 'icon' => 'wpbc-bi-list-ol', 'default' => false ),
2255 'text' => array( 'title' => __( 'Screen Text', 'booking' ), 'icon' => 'wpbc-bi-card-text', 'default' => false ),
2256 'reference' => array( 'title' => __( 'Parameters', 'booking' ), 'icon' => 'wpbc-bi-code-square', 'default' => false ),
2257 );
2258 $parameters = wpbc_shortcode_config__booking_appointment_parameters();
2259 ?>
2260 <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 ); ?>">
2261 <?php wpbc_shortcode_config__workflow_tabs( $shortcode_name, $tabs ); ?>
2262 <?php foreach ( array_keys( $tabs ) as $section_id ) : ?>
2263 <div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__<?php echo esc_attr( $section_id ); ?>">
2264 <?php if ( 'reference' === $section_id ) : ?>
2265 <?php wpbc_shortcode_config__workflow_parameter_reference( wpbc_shortcode_config__booking_appointment_parameter_reference() ); ?>
2266 <?php else : ?>
2267 <table class="form-table"><tbody>
2268 <?php foreach ( $parameters as $parameter_name => $field ) : ?>
2269 <?php if ( $section_id === $field['section'] ) : ?>
2270 <?php wpbc_shortcode_config__workflow_field( $shortcode_name, $parameter_name, $field ); ?>
2271 <?php endif; ?>
2272 <?php endforeach; ?>
2273 </tbody></table>
2274 <?php endif; ?>
2275 </div>
2276 <?php endforeach; ?>
2277 <?php wpbc_shortcode_config__workflow_pager(); ?>
2278 </div>
2279 <?php
2280 wpbc_clear_div();
2281 }
2282
2283
2284 // =====================================================================================================================
2285 // Shortcode [booking_resource_selector ...].
2286 // =====================================================================================================================
2287
2288 /**
2289 * Get the popup field contract for the Booking Resource Selector shortcode.
2290 *
2291 * Compatibility aliases remain visible in the reference tab, while newly
2292 * generated shortcodes use the normalized public parameter names.
2293 *
2294 * @return array<string,array<string,mixed>> Resource Selector parameter fields.
2295 */
2296 function wpbc_shortcode_config__booking_resource_selector_parameters() {
2297 $month_options = array_combine( range( 1, 24 ), range( 1, 24 ) );
2298
2299 return array(
2300 'resource_id' => array(
2301 'section' => 'general', 'title' => __( 'Preselected Booking Resource', 'booking' ), 'type' => 'select', 'value_type' => 'positive_integer', 'default' => '',
2302 'options' => wpbc_shortcode_config__workflow_resource_options( true, __( 'No Booking Resource preselected', 'booking' ) ),
2303 'description' => __( 'Check one Booking Resource by default without skipping the selection stage.', 'booking' ),
2304 ),
2305 'resources' => array(
2306 'section' => 'general', 'title' => __( 'Allowed Booking Resources', 'booking' ), 'type' => 'multiselect', 'value_type' => 'id_list', 'default' => '',
2307 'options' => wpbc_shortcode_config__workflow_resource_options(), 'css' => 'width:100%;max-width:32em;height:12em;',
2308 'description' => __( 'Select the Booking Resources shown by this workflow. Leave every option unselected to allow all available Resources.', 'booking' ),
2309 ),
2310 'aggregate' => array(
2311 'section' => 'general', 'title' => __( 'Aggregate Booking Resources', 'booking' ), 'type' => 'multiselect', 'value_type' => 'id_list', 'default' => '',
2312 'options' => wpbc_shortcode_config__workflow_resource_options(), 'css' => 'width:100%;max-width:32em;height:12em;',
2313 'description' => __( 'Select Booking Resources whose bookings should also block availability in the selected primary Resource.', 'booking' ),
2314 ),
2315 'auto_select_resource' => array(
2316 'section' => 'general', 'title' => __( 'Auto-select Booking Resource', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false,
2317 'description' => __( 'Open the preselected Resource immediately, or skip selection when exactly one Resource is available.', 'booking' ),
2318 ),
2319 'nummonths' => array(
2320 'section' => 'calendar', 'title' => __( 'Visible months', 'booking' ), 'type' => 'select', 'value_type' => 'positive_integer', 'default' => 1, 'options' => $month_options,
2321 'description' => __( 'Number of calendar months from 1 through 24.', 'booking' ),
2322 ),
2323 'startmonth' => array(
2324 'section' => 'calendar', 'title' => __( 'Start month', 'booking' ), 'value_type' => 'month', 'default' => '', 'placeholder' => '2026-08',
2325 'description' => __( 'Initial calendar month in YYYY-MM, YYYY/MM, or YYYYMM format.', 'booking' ),
2326 ),
2327 'calendar_dates_start' => array(
2328 'section' => 'calendar', 'title' => __( 'First calendar date', 'booking' ), 'value_type' => 'date', 'default' => '', 'placeholder' => '2026-08-01',
2329 'description' => __( 'Inclusive first displayed date in YYYY-MM-DD format.', 'booking' ),
2330 ),
2331 'calendar_dates_end' => array(
2332 'section' => 'calendar', 'title' => __( 'Last calendar date', 'booking' ), 'value_type' => 'date', 'default' => '', 'placeholder' => '2026-12-31',
2333 'description' => __( 'Inclusive last displayed date in YYYY-MM-DD format.', 'booking' ),
2334 ),
2335 'selected_dates' => array(
2336 'section' => 'calendar', 'title' => __( 'Preselected dates', 'booking' ), 'value_type' => 'text', 'default' => '', 'placeholder' => '01.08.2026',
2337 'description' => __( 'Native Booking Calendar preselected-date expression.', 'booking' ),
2338 ),
2339 'options' => array(
2340 'section' => 'calendar', 'title' => __( 'Calendar options', 'booking' ), 'value_type' => 'text', 'default' => '',
2341 'description' => __( 'Native Booking Calendar options string passed to the selected calendar and form.', 'booking' ),
2342 ),
2343 'form_type' => array(
2344 'section' => 'calendar', 'title' => __( 'Booking Form', 'booking' ), 'type' => 'select', 'value_type' => 'text', 'default' => '',
2345 'options' => wpbc_shortcode_config__workflow_form_options(),
2346 'description' => __( 'Select a published Booking Form override. Automatic uses the Resource form and then the Standard form.', 'booking' ),
2347 ),
2348 'allow_past' => array(
2349 'section' => 'calendar', 'title' => __( 'Allow past bookings', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => false,
2350 'description' => __( 'Permit any visitor to select and submit past dates inside the signed shortcode range.', 'booking' ),
2351 ),
2352 'show_progress' => array(
2353 'section' => 'progress', 'title' => __( 'Show progress', 'booking' ), 'type' => 'checkbox', 'value_type' => 'boolean', 'default' => true,
2354 'description' => __( 'Show the complete two-step Resource selection progress line.', 'booking' ),
2355 ),
2356 'progress_item_1_title' => array(
2357 'section' => 'progress', 'title' => __( 'First progress title', 'booking' ), 'default' => __( 'Resource', 'booking' ),
2358 'description' => __( 'Title below the first progress number. Clear it to hide the title.', 'booking' ),
2359 ),
2360 'progress_item_1_number' => array(
2361 'section' => 'progress', 'title' => __( 'First progress number', 'booking' ), 'default' => '1',
2362 'description' => __( 'First displayed progress number. Clear it to hide the number.', 'booking' ),
2363 ),
2364 'progress_item_2_title' => array(
2365 'section' => 'progress', 'title' => __( 'Second progress title', 'booking' ), 'default' => __( 'Date & Details', 'booking' ),
2366 'description' => __( 'Title below the second progress number. Clear it to hide the title.', 'booking' ),
2367 ),
2368 'progress_item_2_number' => array(
2369 'section' => 'progress', 'title' => __( 'Second progress number', 'booking' ), 'default' => '2',
2370 'description' => __( 'Second displayed progress number. Clear it to hide the number.', 'booking' ),
2371 ),
2372 'screen_1_title' => array(
2373 'section' => 'text', 'title' => __( 'Resource screen title', 'booking' ), 'default' => __( 'Choose a Booking Resource', 'booking' ),
2374 'description' => __( 'Heading on the Booking Resource selection screen. Clear it to hide the heading.', 'booking' ),
2375 ),
2376 'screen_1_description' => array(
2377 'section' => 'text', 'title' => __( 'Resource screen description', 'booking' ), 'default' => __( 'Select what you would like to book.', 'booking' ),
2378 'description' => __( 'Description on the Booking Resource selection screen. Clear it to hide the description.', 'booking' ),
2379 ),
2380 );
2381 }
2382
2383 /**
2384 * Get every accepted public Resource Selector shortcode parameter for the reference tab.
2385 *
2386 * @return array<string,string> Parameter descriptions keyed by public attribute.
2387 */
2388 function wpbc_shortcode_config__booking_resource_selector_parameter_reference() {
2389 $parameters = wpbc_shortcode_config__booking_resource_selector_parameters();
2390 $reference = array();
2391 foreach ( $parameters as $parameter_name => $field ) {
2392 $reference[ $parameter_name ] = $field['description'];
2393 }
2394
2395 $reference['type'] = __( 'Compatibility alias for resources. The resources parameter wins when both are present.', 'booking' );
2396 $reference['selected_resource_id'] = __( 'Compatibility fallback that checks one Resource without skipping selection. resource_id wins when both are present.', 'booking' );
2397 $reference['selected_type'] = __( 'Compatibility alias for selected_resource_id.', 'booking' );
2398 $reference['label'] = __( 'Compatibility alias for screen_1_title.', 'booking' );
2399
2400 return $reference;
2401 }
2402
2403 /**
2404 * Render the [booking_resource_selector] configuration section in the shortcode popup.
2405 *
2406 * @return void
2407 */
2408 function wpbc_shortcode_config__content__booking_resource_selector() {
2409 $shortcode_name = 'booking_resource_selector';
2410 $tabs = array(
2411 'general' => array( 'title' => __( 'Resource Selection', 'booking' ), 'icon' => 'wpbc-bi-card-checklist', 'default' => true ),
2412 'calendar' => array( 'title' => __( 'Calendar & Form', 'booking' ), 'icon' => 'wpbc-bi-calendar3', 'default' => false ),
2413 'progress' => array( 'title' => __( 'Progress', 'booking' ), 'icon' => 'wpbc-bi-list-ol', 'default' => false ),
2414 'text' => array( 'title' => __( 'Screen Text', 'booking' ), 'icon' => 'wpbc-bi-card-text', 'default' => false ),
2415 'reference' => array( 'title' => __( 'Parameters', 'booking' ), 'icon' => 'wpbc-bi-code-square', 'default' => false ),
2416 );
2417 $parameters = wpbc_shortcode_config__booking_resource_selector_parameters();
2418 ?>
2419 <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 ); ?>">
2420 <?php wpbc_shortcode_config__workflow_tabs( $shortcode_name, $tabs ); ?>
2421 <?php foreach ( array_keys( $tabs ) as $section_id ) : ?>
2422 <div class="wpbc_sc_container__shortcode_section wpbc_sc_container__shortcode_section__<?php echo esc_attr( $section_id ); ?>">
2423 <?php if ( 'reference' === $section_id ) : ?>
2424 <?php wpbc_shortcode_config__workflow_parameter_reference( wpbc_shortcode_config__booking_resource_selector_parameter_reference() ); ?>
2425 <?php else : ?>
2426 <table class="form-table"><tbody>
2427 <?php foreach ( $parameters as $parameter_name => $field ) : ?>
2428 <?php if ( $section_id === $field['section'] ) : ?>
2429 <?php wpbc_shortcode_config__workflow_field( $shortcode_name, $parameter_name, $field ); ?>
2430 <?php endif; ?>
2431 <?php endforeach; ?>
2432 </tbody></table>
2433 <?php endif; ?>
2434 </div>
2435 <?php endforeach; ?>
2436 <?php wpbc_shortcode_config__workflow_pager(); ?>
2437 </div>
2438 <?php
2439 wpbc_clear_div();
2440 }
2441