PluginProbe
Booking Calendar / 10.1.3
Booking Calendar v10.1.3
11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 10.11.2 All 203 releases
booking / includes / page-customize / customize__templates.php

customize__templates.php in Booking Calendar 10.1.3, at includes/page-customize/customize__templates.php

2,779 lines 120.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php /**
2 * @version 1.0
3 * @description Templates for customize plugin pages
4 * @category Customize_Plugin
5 * @author wpdevelop
6 *
7 * @web-site http://oplugins.com/
8 * @email info@oplugins.com
9 *
10 * @modified 2023-06-23
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15
16 class WPBC_AJX__Customize_Plugin__Templates {
17
18 // <editor-fold defaultstate="collapsed" desc=" /// JS | CSS files | Tpl loading /// " >
19
20 /**
21 * Define HOOKs for loading CSS and JavaScript files
22 */
23 public function init_load_css_js_tpl() {
24
25 // Load only at specific Page
26 if ( strpos( $_SERVER['REQUEST_URI'], 'page=wpbc-customize_plugin' ) !== false ) {
27
28 add_action( 'wpbc_enqueue_js_files', array( $this, 'js_load_files' ), 50 );
29 add_action( 'wpbc_enqueue_css_files', array( $this, 'enqueue_css_files' ), 50 );
30
31 add_action( 'wpbc_hook_settings_page_footer', array( $this, 'hook__load_templates_at_footer' ) );
32 }
33 }
34
35
36 /** JS */
37 public function js_load_files( $where_to_load ) {
38
39 $in_footer = true;
40
41 if ( wpbc_is_customize_plugin_page() )
42 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
43
44 wp_enqueue_script( 'wpbc-ajx_inline_calendar'
45 , trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/customize__inline_calendar.js'
46 , array( 'wpbc-global-vars' ), WP_BK_VERSION_NUM, $in_footer );
47
48 wp_enqueue_script( 'wpbc-ajx_customize_plugin_page'
49 , trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/customize_plugin_page.js' /* wpbc_plugin_url( '/_out/js/codemirror.js' ) */
50 , array( 'wpbc-global-vars' ), WP_BK_VERSION_NUM, $in_footer );
51
52 wp_enqueue_script( 'wpbc-general_ui_js_css'
53 , wpbc_plugin_url( '/includes/_general_ui_js_css/_out/wpbc_main_ui_funcs.js' )
54 , array( 'wpbc-global-vars' ), WP_BK_VERSION_NUM, $in_footer );
55
56 wp_enqueue_script( 'wpbc_all', wpbc_plugin_url( '/_dist/all/_out/wpbc_all.js' ), array( 'wpbc-datepick' ), WP_BK_VERSION_NUM ); //FixIn: 9.8.6.1
57 wp_enqueue_script( 'wpbc-main-client', wpbc_plugin_url( '/js/client.js' ), array( 'wpbc-datepick' ), WP_BK_VERSION_NUM );
58 wp_enqueue_script( 'wpbc-times', wpbc_plugin_url( '/js/wpbc_times.js' ), array( 'wpbc-main-client' ), WP_BK_VERSION_NUM );
59 /**
60 *
61 * wp_localize_script( 'wpbc-global-vars', 'wpbc_live_request_obj'
62 * , array(
63 * 'ajx_booking' => '',
64 * 'reminders' => ''
65 * )
66 * );
67 */
68 }
69 }
70
71
72 /** CSS */
73 public function enqueue_css_files( $where_to_load ) {
74
75 if ( ( is_admin() ) && ( in_array( $where_to_load, array( 'admin', 'both' ) ) ) ) {
76
77 wp_enqueue_style( 'wpbc-ajx_customize_plugin_page'
78 , trailingslashit( plugins_url( '', __FILE__ ) ) . '_out/customize_plugin_page.css' //, wpbc_plugin_url( '/includes/listing_ajx_booking/o-ajx_booking-listing.css' )
79 , array(), WP_BK_VERSION_NUM );
80 }
81 }
82
83 // </editor-fold>
84
85
86 // <editor-fold defaultstate="collapsed" desc=" /// Templates /// " >
87
88
89 /**
90 * Load Templates at footer of page
91 *
92 * @param $page string
93 */
94 public function hook__load_templates_at_footer( $page ){
95
96 // page=wpbc&view_mode=vm_booking_listing
97 if ( 'wpbc-ajx_booking_customize_plugin' === $page ) { // from >> do_action( 'wpbc_hook_settings_page_footer', 'wpbc-ajx_booking_customize_plugin' ); as customize_page.php in bottom of content method
98
99 $this->template__main_page_content();
100
101 $this->template__inline_calendar();
102
103 $this->template__toolbar();
104 $this->template__toolbar__select_booking_resource();
105 $this->template__toolbar__horizontal_text_bar();
106 $this->template__toolbar__buttons_prior_next();
107
108 $this->template__status_bar__footer();
109
110 $this->template__widget__change_calendar_skin();
111 $this->template__widget__calendar_size();
112 $this->template__widget__plugin_shortcode();
113
114 $this->template__widget__calendar_dates_selection();
115 $this->template__widget__calendar_weekdays_availability();
116 $this->template__widget__calendar_additional();
117 }
118 }
119
120
121 // Templates ===================================================================================================
122
123 /**
124 * Template - Main
125 *
126 * Help Tips:
127 *
128 * <script type="text/html" id="tmpl-template_name_a">
129 * Escaped: {{data.test_key}}
130 * HTML: {{{data.test_key}}}
131 * JS: <# if (true) { alert( 1 ); } #>
132 * </script>
133 *
134 * var template__var = wp.template( 'template_name_a' );
135 *
136 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
137 *
138 * @return void
139 */
140 private function template__main_page_content() {
141 ?><script type="text/html" id="tmpl-wpbc_ajx_customize_plugin_main_page_content">
142 <div class="wpbc_ajx_cstm__container">
143 <div class="wpbc_ajx_cstm__section_left">
144 </div>
145 <div class="wpbc_ajx_cstm__section_right">
146 <div class="wpbc_widgets"></div>
147 </div>
148 </div><#
149 var template__customize_plugin__status_bar__footer = wp.template( 'wpbc_ajx_customize_plugin__status_bar__footer' );
150 #>{{{
151
152 template__customize_plugin__status_bar__footer( {
153 'ajx_data' : data.ajx_data,
154 'ajx_search_params' : data.ajx_search_params,
155 'ajx_cleaned_params' : data.ajx_cleaned_params
156 } )
157 }}}
158 </script><?php
159 }
160
161 /**
162 * Template - Inline Calendar
163 *
164 * Help Tips:
165 *
166 * <script type="text/html" id="tmpl-template_name_a">
167 * Escaped: {{data.test_key}}
168 * HTML: {{{data.test_key}}}
169 * JS: <# if (true) { alert( 1 ); } #>
170 * </script>
171 *
172 * var template__var = wp.template( 'template_name_a' );
173 *
174 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
175 *
176 * @return void
177 */
178 private function template__inline_calendar(){
179 ?><script type="text/html" id="tmpl-wpbc_ajx_customize_plugin__inline_calendar">
180
181 <div class="wpbc_ajx_cstm__calendar <# if ('On' == data.ajx_data.calendar_settings.booking_change_over_days_triangles ){ #>wpbc_change_over_triangle<# } #>"><?php
182 _e( 'Calendar is loading...', 'booking' );
183 ?></div><?php
184
185 echo '<div style="margin-top:15px;">'
186 . wpbc_replace_shortcodes_in_booking_form__legend_items(
187 '[legend_items '
188 . ' items="unavailable,available,pending,approved,partially"'
189 . ' titles="'
190 //.' unavailable={' . htmlspecialchars( __( "Unavailable", 'booking' ), ENT_QUOTES ) . '}'
191 //.' pending={' . htmlspecialchars( __( "Pending", 'booking' ), ENT_QUOTES ) . '}'
192 .'"'
193 . ' text_for_day_cell="' . date( 'd' ) . '"'
194 . ' unavailable_day_cell_tag="span"'
195 .']'
196 )
197 . '</div>';
198
199 ?></script><?php
200 }
201
202 // Top ========================================================================================================
203
204 /**
205 * Tpl - top Toolbar
206 *
207 * Help Tips:
208 *
209 * <script type="text/html" id="tmpl-template_name_a">
210 * Escaped: {{data.test_key}}
211 * HTML: {{{data.test_key}}}
212 * JS: <# if (true) { alert( 1 ); } #>
213 * </script>
214 *
215 * var template__var = wp.template( 'template_name_a' );
216 *
217 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
218 *
219 * @return void
220 */
221 private function template__toolbar() {
222 ?><script type="text/html" id="tmpl-wpbc_ajx_customize_plugin_toolbar_page_content"><?php
223
224 ?><div class="ui_container ui_container_toolbar ui_container_mini ui_container_calendar_skin ui_container_filter_row_1" ><?php
225
226 // Here will be composed template with real HTML
227 ?><div class="ui_group" id="wpbc_hidden_template__select_booking_resource" ><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
228 // Resource select-box here. Defined as template at: private function template_toolbar_select_booking_resource(){
229 ?></div><?php
230
231 ?><#
232 var toolbar__horizontal_text_bar = wp.template( 'wpbc_ajx_customize_plugin__toolbar__horizontal_text_bar' );
233 #><?php
234 ?><div class="ui_group" id="wpbc_toolbar_dates_hint"><div class="ui_element">{{{toolbar__horizontal_text_bar( data.ajx_data )}}}</div></div><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
235
236
237 ?><div class="ui_group"><?php
238 ?><#
239 var toolbar__buttons_prior_next = wp.template( 'wpbc_ajx_customize_plugin__toolbar__buttons_prior_next' );
240 #>{{{toolbar__buttons_prior_next( data.ajx_data )}}}<?php
241
242 /* ?>
243 ?><div class="ui_element"><?php
244 wpbc_ajx_cstm__ui__button_step_prior( array(
245 'do_action' => 'save_calendar_skin',
246 'current_step' => 'calendar_skin',
247 'ui_clicked_element_id' => 'btn_' . 'calendar_skin'
248 ) );
249
250 ?></div><?php
251
252 ?><div class="ui_element"><?php
253 wpbc_ajx_cstm__ui__button_step_next( array(
254 'do_action' => 'save_calendar_skin',
255 'current_step' => 'form_structure',
256 'ui_clicked_element_id' => 'btn_' . 'form_structure'
257 ) );
258 ?></div><?php
259 <?php */
260 ?></div><?php
261
262 ?></div><?php
263
264 ?></script><?php
265 }
266
267 /**
268 * Tpl - sub Steps Bar
269 * @return void
270 */
271 private function template__toolbar__horizontal_text_bar(){
272 ?><script type="text/html" id="tmpl-wpbc_ajx_customize_plugin__toolbar__horizontal_text_bar"><?php
273 //wpbc_ui_control wpbc_ui_addon wpbc_text_bar // wpbc_option_step wpbc_passed_step
274 ?><#
275 var item_num = 0;
276 var total_num = _.size( data['customize_steps']['steps_arr'] );
277 var is_passed_step = 'wpbc_passed_step';
278
279 _.each( data['customize_steps']['steps_arr'], function ( p_val_arr, p_key_id, p_data ) {
280
281 if ( p_key_id == data['customize_steps']['current'] ) {
282 is_passed_step = '';
283 }
284 item_num++;
285
286 #><span class="wpbc_ui_control wpbc_ui_addon wpbc_text_bar">
287 <span class="{{p_val_arr.class}} {{is_passed_step}} <# if ( p_key_id == data['customize_steps']['current'] ){ #>wpbc_selected_step<# } #>">
288 <# if ( ( false ) || ( '' !== is_passed_step ) ) { <?php /* if first "false" then show links only for PASSED sub tabs. */ ?> #>
289 <a href="javascript:void(0)"
290 onclick="javascript:wpbc_ajx_customize_plugin__send_request_with_params( { 'current_step': '{{p_key_id}}' });"
291 > {{item_num}}. {{{p_val_arr.html}}} </a>
292 <# } else { #>
293 {{item_num}}. {{{p_val_arr.html}}}
294 <# } #>
295 </span></span><#
296
297 if ( item_num < total_num ) {
298
299 #><span class="wpbc_ui_control wpbc_ui_addon wpbc_text_bar">
300 <span class="wpbc_option_separator {{is_passed_step}} ">
301 &gt;
302 </span>
303 </span><#
304
305 }
306 });
307 #><?php
308
309 ?></script><?php
310 }
311
312 /**
313 * Tpl - "Previous" | "Next" buttons in sub Steps Bar
314 * @return void
315 */
316 private function template__toolbar__buttons_prior_next(){
317 ?><script type="text/html" id="tmpl-wpbc_ajx_customize_plugin__toolbar__buttons_prior_next"><?php
318 //wpbc_ui_control wpbc_ui_addon wpbc_text_bar // wpbc_option_step wpbc_passed_step
319 ?>
320 <# if ( '' != data.customize_steps.prior ) { #>
321 <div class="ui_element">
322 <a id="btn__toolbar__buttons_prior"
323 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button tooltip_top "
324 style=""
325 href="javascript:void(0)"
326 onclick="javascript:wpbc_ajx_customize_plugin__send_request_with_params( {
327 'do_action': 'none',
328 'current_step': '{{data.customize_steps.prior}}',
329 'ui_clicked_element_id': 'btn__toolbar__buttons_prior'
330 } );
331 wpbc_button_enable_loading_icon( this );
332 wpbc_admin_show_message_processing( '' );
333 "
334 title="Go to previous step">
335 <i class="menu_icon icon-1x wpbc_icn_arrow_back_ios"></i>&nbsp;
336 <span><?php _e('Back','booking') ?>&nbsp;&nbsp;</span>
337 </a>
338 </div>
339 <# } #>
340 <# if ( '' != data.customize_steps.next ) { #>
341 <div class="ui_element">
342 <a id="btn__toolbar__buttons_next"
343 class="wpbc_ui_control wpbc_ui_button wpbc_ui_button wpbc_ui_button_primary tooltip_top "
344 style=""
345 href="javascript:void(0)"
346 onclick="javascript:wpbc_ajx_customize_plugin__send_request_with_params( {
347 'do_action': '{{data.customize_steps.action}}',
348 'current_step': '{{data.customize_steps.next}}',
349 'ui_clicked_element_id': 'btn__toolbar__buttons_next'
350 } );
351 wpbc_button_enable_loading_icon( this );
352 wpbc_admin_show_message_processing( '' );
353 "
354 title="Go to next step">
355 <span><?php _e('Save and continue','booking') ?>&nbsp;&nbsp;&nbsp;</span>
356 <i class="menu_icon icon-1x wpbc_icn_arrow_forward_ios"></i>
357 </a>
358 </div>
359 <# } #>
360 <?php
361 ?></script><?php
362 }
363
364 // Support =====================================================================================================
365
366 /**
367 * Tpl - Shortcode widget
368 *
369 * @return void
370 */
371 private function template__widget__plugin_shortcode(){
372
373 ?><script type="text/html" id="tmpl-wpbc_ajx_widget_plugin_shortcode">
374 <div class="wpbc_widget wpbc_widget_plugin_shortcode">
375 <div class="wpbc_widget_header">
376 <span class="wpbc_widget_header_text"><?php _e('Shortcodes', 'booking'); ?></span>
377 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
378 </div>
379 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
380 <div class="ui_container" >
381 <div class="ui_group ui_group__change_plugin_shortcode"><?php
382
383 // Calendar Visible Months
384 wpbc_ajx_cstm__ui__template__shortcode_booking_form();
385 ?>
386 </div>
387 </div>
388 </div>
389 </div>
390 </script><?php
391 }
392
393
394 /**
395 * Tpl - "Booking Resources" selectbox
396 *
397 * Help Tips:
398 *
399 * <script type="text/html" id="tmpl-template_name_a">
400 * Escaped: {{data.test_key}}
401 * HTML: {{{data.test_key}}}
402 * JS: <# if (true) { alert( 1 ); } #>
403 * </script>
404 *
405 * var template__var = wp.template( 'template_name_a' );
406 *
407 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
408 *
409 * @return void
410 */
411 private function template__toolbar__select_booking_resource(){
412
413 // Template
414 ?><script type="text/html" id="tmpl-wpbc_ajx_select_booking_resource"><?php
415
416 if ( ! class_exists('wpdev_bk_personal') ) {
417 echo '</script>';
418 return false;
419 }
420 /*
421 ?><# console.log( ' == TEMPLATE PARAMS "wpbc_ajx_change_booking_resource" == ', data ); #><?php
422 */
423 $booking_action = 'select_booking_resource';
424
425 $el_id = 'ui_btn_' . $booking_action;
426
427 if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) {
428 echo '</script>';
429 return false;
430 }
431
432
433 ?><div class="ui_element"><?php
434
435 wpbc_flex_label(
436 array(
437 'id' => $el_id
438 , 'label' => '<span class="" style="font-weight:600;">' . __( 'Booking resource', 'booking' ) . ':</span>'
439 )
440 );
441
442 ?><select class="wpbc_ui_control wpbc_ui_select change_booking_resource_selectbox"
443 id="<?php echo $el_id; ?>" name="<?php echo $el_id; ?>"
444
445 <?php /* ?>onfocus="javascript:console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );"<?php /**/ ?>
446
447 onchange="javascript:wpbc_admin_show_message_processing( '' );wpbc_ajx_customize_plugin__send_request_with_params( {
448 'resource_id': jQuery( this ).val()
449 , 'dates_customize_plugin': jQuery( '.wpbc_radio__set_days_customize_plugin:checked' ).val()
450 , 'dates_selection': ''
451 , 'do_action': 'change_booking_resource'
452 } );"
453 ><#
454 _.each( data.ajx_data.ajx_booking_resources, function ( p_resource, p_resource_id, p_data ){
455 #><option value="{{p_resource.booking_type_id}}"
456 <#
457 if ( data.ajx_cleaned_params.resource_id == p_resource.booking_type_id ) {
458 #> selected="SELECTED" <#
459 }
460 #>
461 style="<#
462 if( undefined != p_resource.parent ) {
463 if( '0' == p_resource.parent ) {
464 #>font-weight:600;<#
465 } else {
466 #>font-size:0.95em;padding-left:20px;<#
467 }
468 }
469 #>"
470 ><#
471 if( undefined != p_resource.parent ) {
472 if( '0' != p_resource.parent ) {
473 #>&nbsp;&nbsp;&nbsp;<#
474 }
475 }
476 #>{{p_resource.title}}</option><#
477 });
478 #>
479 </select><?php
480
481 ?></div>
482
483 <div class="ui_element"><?php
484
485 ?><div class="wpbc_ui_separtor" style="margin-left: 8px;"></div><?php
486
487 ?></div><?php
488
489 ?></script><?php
490 }
491
492 /**
493 * Tpl - Footer - Skip | Reset buttons
494 *
495 * Help Tips:
496 *
497 * <script type="text/html" id="tmpl-template_name_a">
498 * Escaped: {{data.test_key}}
499 * HTML: {{{data.test_key}}}
500 * JS: <# if (true) { alert( 1 ); } #>
501 * </script>
502 *
503 * var template__var = wp.template( 'template_name_a' );
504 *
505 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
506 *
507 * @return void
508 */
509 private function template__status_bar__footer() {
510 ?><script type="text/html" id="tmpl-wpbc_ajx_customize_plugin__status_bar__footer"><?php
511
512 ?><div class="wpbc_ajx_cstm__status_bar__footer wpbc_ajx_toolbar" style="margin: 10px 0 0;border-top: 1px solid #ccc;"><?php
513
514 ?><div class="ui_container ui_container_toolbar ui_container_mini ui_container_calendar_skin ui_container_filter_row_1"
515 style="border: none;background: transparent;"
516 ><?php
517
518 ?><div class="ui_group" style="flex:1 1 auto;"><?php
519
520 ?><div class="ui_element"><?php
521 wpbc_ajx_cstm__ui__reset_to_default__btn(); // Reset Button
522 ?></div><?php
523
524
525 ?><div class="ui_element"><?php
526 wpbc_ajx_cstm__ui__skip_wizard__btn(); // Skip Wizard button
527 ?></div><?php
528
529 ?></div><?php
530
531 /**
532 * We do not need the sub tabs here
533 ?><#
534 var toolbar__horizontal_text_bar = wp.template( 'wpbc_ajx_customize_plugin__toolbar__horizontal_text_bar' );
535 #><?php
536 ?><div class="ui_group" id="wpbc_toolbar_dates_hint"><div class="ui_element">{{{toolbar__horizontal_text_bar( data.ajx_data )}}}</div></div><?php // array( 'class' => 'group_nowrap' ) // Elements at Several or One Line
537 */
538
539 ?><div class="ui_group"><?php
540 ?><#
541 var toolbar__buttons_prior_next = wp.template( 'wpbc_ajx_customize_plugin__toolbar__buttons_prior_next' );
542 #>{{{toolbar__buttons_prior_next( data.ajx_data )}}}<?php
543
544 ?></div><?php
545
546 ?></div><?php // ui_container
547
548 ?></div><?php // wpbc_ajx_toolbar
549
550 ?></script><?php
551 }
552
553 // Widgets =====================================================================================================
554
555 /**
556 * Tpl - Calendar - Skin
557 *
558 * Help Tips:
559 *
560 * <script type="text/html" id="tmpl-template_name_a">
561 * Escaped: {{data.test_key}}
562 * HTML: {{{data.test_key}}}
563 * JS: <# if (true) { alert( 1 ); } #>
564 * </script>
565 *
566 * var template__var = wp.template( 'template_name_a' );
567 *
568 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
569 *
570 * @return void
571 */
572 private function template__widget__change_calendar_skin(){
573
574 ?><script type="text/html" id="tmpl-wpbc_ajx_widget_change_calendar_skin">
575 <div class="wpbc_widget wpbc_widget_change_calendar_skin">
576 <div class="wpbc_widget_header">
577 <span class="wpbc_widget_header_text"><?php _e('Calendar Skin', 'booking'); ?></span>
578 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
579 </div>
580 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
581 <div class="ui_container" >
582 <div class="ui_group ui_group__change_calendar_skin"><?php
583
584 // Calendar skin
585 ?><div class="ui_element ui_nowrap0"><?php
586 $booking_action = 'set_calendar_skin';
587
588 $el_id = 'ui_btn_cstm__' . $booking_action ;
589
590 wpbc_flex_label(
591 array(
592 'id' => $el_id
593 , 'label' => '<span class="" style="font-weight:600;">' . __( 'Select the skin of the booking calendar', 'booking' ) . ':</span>'
594 )
595 );
596 ?></div><?php
597 ?><div class="ui_element ui_nowrap"><?php
598 wpbc_ajx_cstm__ui__calendar_skin_dropdown();
599 $is_apply_rotating_icon = false;
600 wpbc_ajx_cstm__ui__selectbox_prior_btn( $el_id, $is_apply_rotating_icon );
601 wpbc_ajx_cstm__ui__selectbox_next_btn( $el_id, $is_apply_rotating_icon );
602 ?></div><?php
603
604 // Set checked specific OPTION depends on last action from user
605 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
606
607 jQuery( document ).ready( function (){
608 // Set selected option in dropdown list based on data. value
609 jQuery( '#ui_btn_cstm__set_calendar_skin option[value="<?php echo WPBC_PLUGIN_URL; ?>' + data.ajx_cleaned_params.customize_plugin__booking_skin + '"]' ).prop( 'selected', true );
610 wpbc__calendar__change_skin( '<?php echo WPBC_PLUGIN_URL; ?>' + data.ajx_cleaned_params.customize_plugin__booking_skin );
611 } );
612
613 <?php if (0) { ?></script><?php } ?> #><?php
614
615
616 // Calendar Visible Months
617 wpbc_ajx_cstm__ui__template__visible_months();
618 ?>
619 </div>
620 </div>
621 </div>
622 </div>
623 </script><?php
624 }
625
626
627 /**
628 * Tpl - Calendar - Size
629 * @return void
630 */
631 private function template__widget__calendar_size(){
632
633 ?><script type="text/html" id="tmpl-wpbc_ajx_widget_calendar_size">
634 <div class="wpbc_widget wpbc_widget_calendar_size">
635 <div class="wpbc_widget_header">
636 <span class="wpbc_widget_header_text"><?php _e('Calendar size', 'booking'); ?></span>
637 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
638 </div>
639 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
640 <div class="ui_container" >
641 <div class="ui_group ui_group__change_calendar_size"><?php
642
643 // Calendar Visible Months
644 wpbc_ajx_cstm__ui__template__visible_months();
645
646 // Calendar Months Number in a Row
647 wpbc_ajx_cstm__ui__template__months_in_row();
648
649 // Calendar - Width
650 wpbc_ajx_cstm__ui__template__calendar_width();
651
652 // Calendar - Cell Height
653 wpbc_ajx_cstm__ui__template__calendar_cell_height();
654 ?>
655 </div>
656 </div>
657 <div class="ui_container ui_container_toolbar ui_container_small">
658 <div class="ui_group ui_group__change_calendar_size" style="flex: 1 1 auto;"><?php
659
660 ?><div class="ui_element ui_nowrap0"><?php
661 wpbc_ajx_cstm__ui__calendar_size_reset__btn();
662 ?></div><?php
663
664 ?><div class="ui_element ui_nowrap0" style="margin-left:auto;"><?php
665 wpbc_ajx_cstm__ui__calendar_size_apply__btn();
666 ?></div><?php
667
668 ?>
669 </div>
670 </div>
671 </div>
672 </div>
673 </script><?php
674 }
675
676
677 /**
678 * Tpl - Calendar - Dates Selection
679 *
680 * Help Tips:
681 *
682 * <script type="text/html" id="tmpl-template_name_a">
683 * Escaped: {{data.test_key}}
684 * HTML: {{{data.test_key}}}
685 * JS: <# if (true) { alert( 1 ); } #>
686 * </script>
687 *
688 * var template__var = wp.template( 'template_name_a' );
689 *
690 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
691 *
692 * @return void
693 */
694 private function template__widget__calendar_dates_selection(){
695
696 ?><script type="text/html" id="tmpl-wpbc_ajx_widget_calendar_dates_selection">
697 <div class="wpbc_widget wpbc_widget_calendar_dates_selection">
698 <div class="wpbc_widget_header">
699 <span class="wpbc_widget_header_text"><?php _e('Dates selection', 'booking'); ?></span>
700 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
701 </div>
702 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
703 <div class="ui_container" >
704 <div class="ui_group ui_group__change_calendar_dates_selection"><?php
705
706 // Calendar Visible Months
707 wpbc_ajx_cstm__ui__template__calendar_dates_selection();
708 ?>
709 </div>
710 </div>
711
712
713 </div>
714 </div>
715 <?php
716
717
718
719 ?>
720 <div class="wpbc_widget wpbc_widget_calendar_dates_selection_range">
721 <div class="wpbc_widget_header">
722 <span class="wpbc_widget_header_text"><?php _e('Range days selection', 'booking'); ?></span>
723 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
724 </div>
725 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
726
727 <div class="ui_container ui_container_toolbar ui_container_small">
728 <?php
729 $is_blur = ( ! class_exists( 'wpdev_bk_biz_s' ) ) ? 'wpbc_blur' : '';
730 if ( ! empty( $is_blur ) ) {
731 wpbc_ajx_cstm__ui__upgrade_note( 'biz_s', 'https://wpbookingcalendar.com/features/#range-days-selection' );
732 }
733 ?>
734 <div class="ui_group ui_group__change_calendar_dates_selection <?php echo $is_blur; ?>">
735 <?php
736
737 wpbc_ajx_cstm__ui__template__calendar_dates_selection_range();
738 ?>
739 </div>
740 </div>
741 </div>
742 </div>
743 </script><?php
744 }
745
746
747 /**
748 * Tpl - Calendar - Weekdays Availability
749 *
750 * Help Tips:
751 *
752 * <script type="text/html" id="tmpl-template_name_a">
753 * Escaped: {{data.test_key}}
754 * HTML: {{{data.test_key}}}
755 * JS: <# if (true) { alert( 1 ); } #>
756 * </script>
757 *
758 * var template__var = wp.template( 'template_name_a' );
759 *
760 * jQuery( '.content' ).html( template__var( { 'test_key' => '<strong>Data</strong>' } ) );
761 *
762 * @return void
763 */
764 private function template__widget__calendar_weekdays_availability(){
765
766 ?><script type="text/html" id="tmpl-wpbc_ajx_widget_calendar_weekdays_availability">
767 <div class="wpbc_widget wpbc_widget_calendar_weekdays_availability">
768 <div class="wpbc_widget_header">
769 <span class="wpbc_widget_header_text"><?php _e('Unavailable week days', 'booking'); ?></span>
770 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
771 </div>
772 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
773 <div class="ui_container" >
774 <div class="ui_group ui_group__change_calendar_weekdays_availability"><?php
775
776 // Calendar unavailable weekdays
777 wpbc_ajx_cstm__ui__template__calendar_weekdays_availability();
778
779 ?>
780 </div>
781 </div>
782 </div>
783 </div>
784 <?php
785
786 ?>
787 <div class="wpbc_widget wpbc_widget_calendar_weekdays_availability_pro">
788 <div class="wpbc_widget_header">
789 <span class="wpbc_widget_header_text"><?php _e('Advanced availability', 'booking'); ?></span>
790 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
791 </div>
792 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
793
794 <div class="ui_container ui_container_toolbar ui_container_small0">
795 <div class="ui_group ui_group__change_calendar_today_availability">
796 <?php
797 wpbc_ajx_cstm__ui__template__calendar_unavailable_from_today();
798 ?>
799 </div>
800 <?php
801 $is_blur = ( ! class_exists( 'wpdev_bk_biz_m' ) ) ? 'wpbc_blur' : '';
802 if ( ! empty( $is_blur ) ) {
803 ?><div class="clear" style="width:101%;height:50px;"></div><?php
804 wpbc_ajx_cstm__ui__upgrade_note( 'biz_m', 'https://wpbookingcalendar.com/features/#availability-from-today' );
805 }
806 ?>
807 <div class="ui_group ui_group__change_calendar_weekdays_availability <?php echo $is_blur; ?>">
808 <?php
809 wpbc_ajx_cstm__ui__template__calendar_limit_available_from_today();
810
811 wpbc_ajx_cstm__ui__template__calendar_unavailable_before_after_bookings();
812 ?>
813 </div>
814 </div>
815
816 <div class="ui_container ui_container_toolbar ui_container_small">
817 <div class="ui_group ui_group__change_calendar_size" style="flex: 1 1 auto;"><?php
818
819 ?><div class="ui_element ui_nowrap0" style="margin-left: auto;"><?php
820 wpbc_ajx_cstm__ui__calendar_weekdays_availability_reset__btn();
821 ?></div><?php
822
823 ?>
824 </div>
825 </div>
826
827 </div>
828 </div>
829 </script><?php
830 }
831
832
833
834 /**
835 * Tpl - Calendar - Size
836 * @return void
837 */
838 private function template__widget__calendar_additional(){
839
840 ?><script type="text/html" id="tmpl-wpbc_ajx_widget_calendar_additional">
841 <div class="wpbc_widget wpbc_widget_calendar_size">
842 <div class="wpbc_widget_header">
843 <span class="wpbc_widget_header_text"><?php _e( 'Additional Settings', 'booking' ); ?></span>
844 <a href="/" class="wpbc_widget_header_settings_link"><i class="menu_icon icon-1x wpbc_icn_settings"></i></a>
845 </div>
846 <div class="wpbc_widget_content wpbc_ajx_toolbar" style="margin:0 0 20px;">
847 <div class="ui_container" >
848 <div class="ui_group ui_group__change_calendar_size"><?php
849
850 // Calendar months_to_scroll
851 wpbc_ajx_cstm__ui__template__months_to_scroll();
852
853 wpbc_ajx_cstm__ui__template__start_day_weeek();
854 ?>
855 </div>
856 </div>
857
858 </div>
859 </div>
860 </script><?php
861 }
862
863
864
865 // </editor-fold>
866
867 }
868
869
870 /**
871 * Just for loading CSS and JavaScript files
872 */
873 if ( true ) {
874 $ajx_customize_plugin_loading = new WPBC_AJX__Customize_Plugin__Templates;
875 $ajx_customize_plugin_loading->init_load_css_js_tpl();
876 }
877
878
879
880 ////////////////////////////////////////////////////////////////////////////////
881 // T e m p l a t e s UI
882 ////////////////////////////////////////////////////////////////////////////////
883
884 /**
885 * Show Upgrade Note with link to specific feature.
886 *
887 * @param $version - 'free' | 'personal' | 'biz_s' | 'biz_m' | 'biz_l' | 'multiuser'; it's from wpbc_get_version_type__and_mu();
888
889 * @param $url - full URL
890 *
891 * @return void
892 *
893 * Example: wpbc_ajx_cstm__ui__upgrade_note( 'biz_s', 'https://wpbookingcalendar.com/features/#range-days-selection' );
894 */
895 function wpbc_ajx_cstm__ui__upgrade_note( $version, $url ){
896
897 $ver_title = $version; // wpbc_get_plugin_version_type();
898 $ver_title = str_replace( '_m', ' Medium', $ver_title );
899 $ver_title = str_replace( '_l', ' Large', $ver_title );
900 $ver_title = str_replace( '_s', ' Small', $ver_title );
901 $ver_title = str_replace( 'biz', 'Business', $ver_title );
902 $ver_title = ucwords( $ver_title );
903
904 ?>
905 <div class="ui_group ui_group__upgrade">
906 <div class="wpbc_upgrade_note">
907 This <a target="_blank" href="<?php echo $url; ?>">feature</a> requires the
908 <a target="_blank" href="<?php echo $url; ?>"><?php echo $ver_title; ?></a>
909 <?php if ( 'multiuser' !== $version ) { ?>
910 or higher versions
911 <?php } ?>
912 </div>
913 </div>
914 <?php
915 }
916
917 /**
918 * Button - Skip Wizard
919 * @return void
920 */
921 function wpbc_ajx_cstm__ui__skip_wizard__btn(){
922
923 $params = array(
924 'type' => 'button' ,
925 'title' => __( 'Skip Wizard', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
926 'hint' => array( 'title' => __( 'Reset selected options to default values', 'booking' ), 'position' => 'top' ), // Hint
927 'link' => 'javascript:void(0)', // Direct link or skip it
928 'action' => "wpbc_ajx_customize_plugin__send_request_with_params( {
929 'do_action': 'make_finish',
930 'ui_clicked_element_id': 'btn__status_bar__skip_wizard'
931 } );
932 wpbc_button_enable_loading_icon( this );
933 wpbc_admin_show_message_processing( '' );", // JavaScript
934 'icon' => array(
935 'icon_font' => 'wpbc_icn_rotate_left', //'wpbc_icn_rotate_left', wpbc_icn_close
936 'position' => 'left',
937 'icon_img' => ''
938 ),
939 'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary'
940 'style' => '', // Any CSS class here
941 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
942 'attr' => array( 'id' => 'btn__status_bar__skip_wizard' )
943 );
944
945 wpbc_flex_button( $params );
946 }
947
948
949 /**
950 * Button - Reset Wizard to default values
951 * @return void
952 */
953 function wpbc_ajx_cstm__ui__reset_to_default__btn(){
954
955 $params = array(
956 'type' => 'button' ,
957 'title' => __( 'Reset Wizard', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
958 'hint' => array( 'title' => __( 'Reset selected options to default values', 'booking' ), 'position' => 'top' ), // Hint
959 'link' => 'javascript:void(0)', // Direct link or skip it
960 'action' => "wpbc_ajx_customize_plugin__send_request_with_params( {
961 'do_action': 'make_reset',
962 'ui_clicked_element_id': 'btn__status_bar__reset'
963 } );
964 wpbc_button_enable_loading_icon( this );
965 wpbc_admin_show_message_processing( '' );", // JavaScript
966 'icon' => array(
967 'icon_font' => 'wpbc_icn_settings_backup_restore', //'wpbc_icn_rotate_left',
968 'position' => 'left',
969 'icon_img' => ''
970 ),
971 'class' => 'wpbc_ui_button_danger', // '' | 'wpbc_ui_button_primary'
972 'style' => '', // Any CSS class here
973 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
974 'attr' => array( 'id' => 'btn__status_bar__reset' )
975 );
976
977 wpbc_flex_button( $params );
978 }
979
980
981 /**
982 * Button - Select Prior Skin in select-box
983 * @return void
984 */
985 function wpbc_ajx_cstm__ui__selectbox_prior_btn( $dropdown_id, $is_apply_rotating_icon = true ){
986
987 $params_button = array(
988 'type' => 'button'
989 , 'title' => '' // Title of the button
990 // , 'hint' => array( 'title' => __('Previous' ,'booking') , 'position' => 'top' )
991 , 'link' => 'javascript:void(0)' // Direct link or skip it
992 , 'action' => // "console.log( 'ON CLICK:', jQuery( '[name=\"set_days_customize_plugin\"]:checked' ).val() , jQuery( 'textarea[id^=\"date_booking\"]' ).val() );" // Some JavaScript to execure, for example run the function
993 " var is_selected = jQuery( '#" . $dropdown_id . " option:selected' ).prop('selected', false).prev(); "
994 . " if ( is_selected.length == 0 ){ "
995 . " is_selected = jQuery( '#" . $dropdown_id . " option' ).last(); "
996 . " } "
997 . " if ( is_selected.length > 0 ){ "
998 . " is_selected.prop('selected', true).trigger('change'); "
999 . ( ( $is_apply_rotating_icon ) ? " wpbc_button_enable_loading_icon( this ); " : "" )
1000 . " } else { "
1001 . " jQuery( this ).addClass( 'disabled' ); "
1002 . " } "
1003 , 'class' => 'wpbc_ui_button' // wpbc_ui_button | wpbc_ui_button_primary
1004 //, 'icon_position' => 'left' // Position of icon relative to Text: left | right
1005 , 'icon' => array(
1006 'icon_font' => 'wpbc_icn_arrow_back_ios', // 'wpbc_icn_check_circle_outline',
1007 'position' => 'left',
1008 'icon_img' => ''
1009 )
1010 , 'style' => '' // Any CSS class here
1011 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
1012 , 'attr' => array()
1013 );
1014
1015 wpbc_flex_button( $params_button );
1016 }
1017
1018 /**
1019 * Button - Select Next Skin in select-box
1020 * @return void
1021 */
1022 function wpbc_ajx_cstm__ui__selectbox_next_btn( $dropdown_id, $is_apply_rotating_icon = true ){
1023
1024 $params_button = array(
1025 'type' => 'button'
1026 , 'title' => '' // Title of the button
1027 // , 'hint' => array( 'title' => __('Next' ,'booking') , 'position' => 'top' )
1028 , 'link' => 'javascript:void(0)' // Direct link or skip it
1029 , 'action' => //"console.log( 'ON CLICK:', jQuery( '[name=\"set_days_customize_plugin\"]:checked' ).val() , jQuery( 'textarea[id^=\"date_booking\"]' ).val() );" // Some JavaScript to execure, for example run the function
1030 " var is_selected = jQuery( '#" . $dropdown_id . " option:selected' ).prop('selected', false).next(); "
1031 . " if ( is_selected.length == 0 ){ "
1032 . " is_selected = jQuery( '#" . $dropdown_id . " option' ).first(); "
1033 . " } "
1034 . " if ( is_selected.length > 0 ){ "
1035 . " is_selected.prop('selected', true).trigger('change'); "
1036 . ( ( $is_apply_rotating_icon ) ? " wpbc_button_enable_loading_icon( this ); " : "" )
1037 . " } else { "
1038 . " jQuery( this ).addClass( 'disabled' ); "
1039 . " } "
1040 , 'class' => 'wpbc_ui_button' // wpbc_ui_button | wpbc_ui_button_primary
1041 //, 'icon_position' => 'left' // Position of icon relative to Text: left | right
1042 , 'icon' => array(
1043 'icon_font' => 'wpbc_icn_arrow_forward_ios', // 'wpbc_icn_check_circle_outline',
1044 'position' => 'right',
1045 'icon_img' => ''
1046 )
1047 , 'style' => '' // Any CSS class here
1048 , 'mobile_show_text' => false // Show or hide text, when viewing on Mobile devices (small window size).
1049 , 'attr' => array()
1050 );
1051
1052 wpbc_flex_button( $params_button );
1053 }
1054
1055
1056 /**
1057 * Textarea that show shortcode for booking form
1058 * @return void
1059 */
1060 function wpbc_ajx_cstm__ui__template__shortcode_booking_form(){
1061
1062 $booking_action = 'set_shortcode_booking_form';
1063
1064 $el_id = 'ui_btn_cstm__' . $booking_action ;
1065
1066 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
1067
1068 ?><div class="ui_element ui_nowrap0"><?php
1069
1070 wpbc_flex_label( array( 'id' => $el_id
1071 , 'label' => '<span class="" style="font-weight:600;">' . __('Booking form shortcode' ,'booking') . ':</span>'
1072 ) );
1073 ?></div><?php
1074 ?><div class="ui_element ui_nowrap" style="flex: 1 1 100%;"><?php
1075
1076 $param_text = array(
1077 'type' => 'text'
1078 , 'id' => $el_id
1079 , 'name' => $el_id
1080 , 'label' => ''
1081 , 'disabled' => false
1082 , 'class' => 'put-in'
1083 , 'style' => 'width:100%;height:auto;font-weight:600;'
1084 , 'placeholder' => '0'
1085 , 'attr' => array()
1086 , 'is_escape_value' => false
1087 , 'value' => "{{ data.ajx_data.calendar_settings.shortcode__booking_form }}"
1088 , 'onfocus' => 'this.select()'
1089 //, 'onkeydown' => "jQuery('.ui__set_booking_cost__section_in_booking_{{data['parsed_fields']['booking_id']}}').show();" // JavaScript code
1090 //, 'onchange' => ""
1091 , 'rows' => '4'
1092 , 'cols' => '50'
1093 , 'attr' => array( 'readonly' => 'readonly' )
1094 );
1095 wpbc_flex_textarea( $param_text );
1096 //wpbc_flex_text( $param_text );
1097 ?></div><?php
1098
1099 }
1100
1101
1102 // <editor-fold defaultstate="collapsed" desc=" == Calendar Skin UI == " >
1103
1104 /**
1105 * Select-box - Calendar skins
1106 *
1107 * @return void
1108 */
1109 function wpbc_ajx_cstm__ui__calendar_skin_dropdown(){
1110
1111 $booking_action = 'set_calendar_skin';
1112
1113 $el_id = 'ui_btn_cstm__' . $booking_action ;
1114
1115 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
1116
1117
1118 // Calendar Skin /////////////////////////////////////////////////////
1119 $calendar_skins_options = array();
1120
1121 // Skins in the Custom User folder (need to create it manually): http://example.com/wp-content/uploads/wpbc_skins/ ( This folder do not owerwrited during update of plugin )
1122 $upload_dir = wp_upload_dir();
1123 //FixIn: 8.9.4.8
1124 $files_in_folder = wpbc_dir_list( array( WPBC_PLUGIN_DIR . '/css/skins/', $upload_dir['basedir'].'/wpbc_skins/' ) ); // Folders where to look about calendar skins
1125 foreach ( $files_in_folder as $skin_file ) { // Example: $skin_file['/css/skins/standard.css'] => 'Standard';
1126
1127 //FixIn: 8.9.4.8 //FixIn: 9.1.2.10
1128 $skin_file[1] = str_replace( array( WPBC_PLUGIN_DIR, WPBC_PLUGIN_URL , $upload_dir['basedir'] ), '', $skin_file[1] ); // Get relative path for calendar skin
1129 $calendar_skins_options[ WPBC_PLUGIN_URL . $skin_file[1] ] = $skin_file[2];
1130 }
1131
1132 $params_select = array(
1133 'id' => $el_id // HTML ID of element
1134 , 'name' => $booking_action
1135 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
1136 , 'style' => '' // CSS of select element
1137 , 'class' => 'wpbc_radio__set_days_customize_plugin' // CSS Class of select element
1138 //, 'multiple' => true
1139 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
1140 , 'disabled' => false
1141 , 'disabled_options' => array() // If some options disabled, then it has to list here
1142 , 'options' => $calendar_skins_options
1143 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
1144 , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
1145 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param('customize_plugin__booking_skin', jQuery(this).val().replace( '" . WPBC_PLUGIN_URL . "', '') );"
1146 // , 'onchange' => "jQuery(this).hide();
1147 // var jButton = jQuery('#button_locale_for_booking{{data[\'parsed_fields\'][\'booking_id\']}}');
1148 // jButton.show();
1149 // wpbc_button_enable_loading_icon( jButton.get(0) ); "
1150 // . " wpbc_ajx_booking_ajax_action_request( {
1151 // 'booking_action' : '{$booking_action}',
1152 // 'booking_id' : {{data[\'parsed_fields\'][\'booking_id\']}},
1153 // 'booking_meta_locale' : jQuery('#locale_for_booking{{data[\'parsed_fields\'][\'booking_id\']}} option:selected').val()
1154 // } );"
1155
1156 );
1157
1158
1159 wpbc_flex_select( $params_select );
1160 }
1161
1162 // </editor-fold>
1163
1164
1165 // <editor-fold defaultstate="collapsed" desc=" == Calendar Size UI == " >
1166
1167 /**
1168 * Select-box - Number of Visible Months
1169 *
1170 * @return void
1171 */
1172 function wpbc_ajx_cstm__ui__template__visible_months(){
1173
1174 $booking_action = 'set_calendar_visible_months';
1175
1176 $el_id = 'ui_btn_cstm__' . $booking_action ;
1177
1178 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
1179
1180
1181 ?><div class="ui_element ui_nowrap0"><?php
1182
1183 wpbc_flex_label( array( 'id' => $el_id
1184 , 'label' => '<span class="" style="font-weight:600;">' . __('Number of visible months' ,'booking') . ':</span>'
1185 ) );
1186 ?></div><?php
1187 ?><div class="ui_element ui_nowrap"><?php
1188
1189 // Options
1190 $dropdown_options = array( 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12 );
1191
1192 $params_select = array(
1193 'id' => $el_id // HTML ID of element
1194 , 'name' => $booking_action
1195 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
1196 , 'style' => '' // CSS of select element
1197 , 'class' => '' // CSS Class of select element
1198 //, 'multiple' => true
1199 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
1200 , 'disabled' => false
1201 , 'disabled_options' => array() // If some options disabled, then it has to list here
1202 , 'options' => $dropdown_options
1203 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
1204 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
1205 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__visible_months', jQuery(this).val() );
1206 var t_visible_months = parseInt( wpbc_ajx_customize_plugin.search_get_param( 'calendar__view__visible_months' ) );
1207 /* var t_months_in_row = ( 3 > t_visible_months ) ? '' : 2 ;
1208 wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__months_in_row', t_months_in_row );
1209 */
1210 wpbc_ajx_customize_plugin__send_request_with_params( {} );
1211 wpbc_admin_show_message_processing( '' );
1212 "
1213 );
1214 wpbc_flex_select( $params_select );
1215
1216
1217 wpbc_ajx_cstm__ui__selectbox_prior_btn( $el_id );
1218 wpbc_ajx_cstm__ui__selectbox_next_btn( $el_id );
1219 ?></div><?php
1220
1221 // Set checked specific OPTION depends on last action from user
1222 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
1223 jQuery( document ).ready( function (){
1224 // Set selected option in dropdown list based on data. value
1225 jQuery( '#<?php echo $el_id; ?> option[value="' + data.ajx_data.calendar_settings.calendar__view__visible_months + '"]' ).prop( 'selected', true );
1226 } );
1227
1228 <?php if (0) { ?></script><?php } ?> #><?php
1229 }
1230
1231
1232 /**
1233 * Select-box - Number of Months in a Row
1234 *
1235 * @return void
1236 */
1237 function wpbc_ajx_cstm__ui__template__months_in_row(){
1238
1239 $booking_action = 'set_calendar_months_in_row';
1240
1241 $el_id = 'ui_btn_cstm__' . $booking_action ;
1242
1243 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
1244
1245
1246 ?><div class="ui_element ui_nowrap0"><?php
1247
1248 wpbc_flex_label( array( 'id' => $el_id
1249 , 'label' => '<span class="" style="font-weight:600;">' . __('Number of months in a row' ,'booking') . ':</span>'
1250 ) );
1251 ?></div><?php
1252 ?><div class="ui_element ui_nowrap"><?php
1253
1254 // Options
1255 $dropdown_options = array( '' => __('Default','booking'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6 );
1256
1257 $params_select = array(
1258 'id' => $el_id // HTML ID of element
1259 , 'name' => $booking_action
1260 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
1261 , 'style' => '' // CSS of select element
1262 , 'class' => '' // CSS Class of select element
1263 //, 'multiple' => true
1264 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
1265 , 'disabled' => false
1266 , 'disabled_options' => array() // If some options disabled, then it has to list here
1267 , 'options' => $dropdown_options
1268 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
1269 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
1270 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__months_in_row', jQuery(this).val() );
1271 wpbc_ajx_customize_plugin__send_request_with_params( {} );"
1272 );
1273 wpbc_flex_select( $params_select );
1274
1275
1276 wpbc_ajx_cstm__ui__selectbox_prior_btn( $el_id );
1277 wpbc_ajx_cstm__ui__selectbox_next_btn( $el_id );
1278 ?></div><?php
1279
1280 // Set checked specific OPTION depends on last action from user
1281 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
1282 jQuery( document ).ready( function (){
1283 // Set selected option in dropdown list based on data. value
1284 jQuery( '#<?php echo $el_id; ?> option[value="' + data.ajx_data.calendar_settings.calendar__view__months_in_row + '"]' ).prop( 'selected', true );
1285 } );
1286
1287 <?php if (0) { ?></script><?php } ?> #><?php
1288 }
1289
1290
1291 /**
1292 * Width of Calendar
1293 *
1294 * @return void
1295 */
1296 function wpbc_ajx_cstm__ui__template__calendar_width(){
1297
1298 $booking_action = 'set_calendar_width';
1299
1300 $el_id = 'ui_btn_cstm__' . $booking_action ;
1301
1302 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
1303
1304 ?><div class="ui_element ui_nowrap0"><?php
1305
1306 wpbc_flex_label( array( 'id' => $el_id
1307 , 'label' => '<span class="" style="font-weight:600;">' . __('Maximum width of calendar' ,'booking') . ':</span>'
1308 ) );
1309 ?></div><?php
1310 ?><div class="ui_element ui_nowrap"><?php
1311
1312 $param_text = array(
1313 'type' => 'text'
1314 , 'id' => $el_id
1315 , 'name' => $el_id
1316 , 'label' => ''
1317 , 'disabled' => false
1318 , 'class' => ''
1319 , 'style' => 'width:5em;'
1320 , 'placeholder' => __( 'Default', 'booking' )
1321 , 'attr' => array()
1322 , 'is_escape_value' => false
1323 , 'value' => "{{ data.ajx_data.calendar_settings.calendar__view__width.replace('px','').replace('%','') }}"
1324 , 'onfocus' => ''
1325 //, 'onkeydown' => "jQuery('.ui__set_booking_cost__section_in_booking_{{data['parsed_fields']['booking_id']}}').show();" // JavaScript code
1326 , 'onchange' => "var t_width = parseInt( jQuery(this).val() );
1327 t_width = isNaN( t_width ) ? '' : t_width;
1328 var t_dim = jQuery( '#" . $el_id . "_dim' ).val();
1329 if ( '%' == t_dim ){
1330 t_width = ( t_width > 100) ? 100 : t_width;
1331 t_width = ( 0 === t_width ) ? '' : t_width;
1332 }
1333 t_dim = ( '' === t_width ) ? '' : t_dim;
1334 wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__width', t_width + t_dim );"
1335 // . " wpbc_ajx_customize_plugin__send_request_with_params( {} );"
1336
1337 );
1338 wpbc_flex_text( $param_text );
1339
1340 $params_select = array(
1341 'id' => $el_id . '_dim' // HTML ID of element
1342 , 'name' => $el_id . '_dim'
1343 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
1344 , 'style' => '' // CSS of select element
1345 , 'class' => '' // CSS Class of select element
1346 //, 'multiple' => true
1347 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
1348 , 'disabled' => false
1349 , 'disabled_options' => array() // If some options disabled, then it has to list here
1350 , 'options' => array( '%' => '% &nbsp; ', 'px' => 'px &nbsp; ' )
1351 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
1352 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
1353 , 'onchange' => "jQuery( '#" . $el_id . "' ).trigger( 'change' );"
1354 );
1355 wpbc_flex_select( $params_select );
1356
1357 //wpbc_ajx_cstm__ui__select_skin_prior_btn( $el_id );
1358 //wpbc_ajx_cstm__ui__select_skin_next_btn( $el_id );
1359 ?></div><?php
1360
1361 // Set checked specific OPTION depends on last action from user
1362 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
1363 jQuery( document ).ready( function (){
1364
1365 if ( -1 !== data.ajx_data.calendar_settings.calendar__view__width.indexOf('%') ) {
1366 jQuery( '#<?php echo $el_id; ?>_dim option[value="%"]' ).prop( 'selected', true );
1367 } else {
1368 jQuery( '#<?php echo $el_id; ?>_dim option[value="px"]' ).prop( 'selected', true );
1369 }
1370
1371 } );
1372
1373 <?php if (0) { ?></script><?php } ?> #><?php
1374 }
1375
1376
1377 /**
1378 * Height of Calendar Cell
1379 *
1380 * @return void
1381 */
1382 function wpbc_ajx_cstm__ui__template__calendar_cell_height(){
1383
1384 $booking_action = 'set_calendar_cell_height';
1385
1386 $el_id = 'ui_btn_cstm__' . $booking_action ;
1387
1388 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
1389
1390 ?><div class="ui_element ui_nowrap0"><?php
1391
1392 wpbc_flex_label( array( 'id' => $el_id
1393 , 'label' => '<span class="" style="font-weight:600;">' . __('Height of calendar cell' ,'booking') . ':</span>'
1394 ) );
1395 ?></div><?php
1396 ?><div class="ui_element ui_nowrap"><?php
1397
1398 $param_text = array(
1399 'type' => 'text'
1400 , 'id' => $el_id
1401 , 'name' => $el_id
1402 , 'label' => ''
1403 , 'disabled' => false
1404 , 'class' => ''
1405 , 'style' => 'width:5em;'
1406 , 'placeholder' => __( 'Default', 'booking' )
1407 , 'attr' => array()
1408 , 'is_escape_value' => false
1409 , 'value' => "{{ data.ajx_data.calendar_settings.calendar__view__cell_height.replace('px','').replace('%','') }}"
1410 , 'onfocus' => ''
1411 //, 'onkeydown' => "jQuery('.ui__set_booking_cost__section_in_booking_{{data['parsed_fields']['booking_id']}}').show();" // JavaScript code
1412 , 'onchange' => "var t_cell_height = parseInt( jQuery(this).val() );
1413 t_cell_height = isNaN( t_cell_height ) ? '' : t_cell_height;
1414 var t_dim = jQuery( '#" . $el_id . "_dim' ).val();
1415 t_dim = ( '' === t_cell_height ) ? '' : t_dim;
1416 wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__cell_height', t_cell_height + t_dim );"
1417 // . " wpbc_ajx_customize_plugin__send_request_with_params( {} );"
1418
1419 );
1420 wpbc_flex_text( $param_text );
1421
1422 $params_select = array(
1423 'id' => $el_id . '_dim' // HTML ID of element
1424 , 'name' => $el_id . '_dim'
1425 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
1426 , 'style' => '' // CSS of select element
1427 , 'class' => '' // CSS Class of select element
1428 //, 'multiple' => true
1429 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
1430 , 'disabled' => false
1431 , 'disabled_options' => array() // If some options disabled, then it has to list here
1432 , 'options' => array( 'px' => 'px &nbsp; ' )
1433 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
1434 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
1435 , 'onchange' => "jQuery( '#" . $el_id . "' ).trigger( 'change' );"
1436 );
1437 wpbc_flex_select( $params_select );
1438
1439 //wpbc_ajx_cstm__ui__select_skin_prior_btn( $el_id );
1440 //wpbc_ajx_cstm__ui__select_skin_next_btn( $el_id );
1441 ?></div><?php
1442 }
1443
1444
1445 /**
1446 * Button - Apply
1447 * @return void
1448 */
1449 function wpbc_ajx_cstm__ui__calendar_size_apply__btn(){
1450
1451 $params = array(
1452 'type' => 'button' ,
1453 'title' => __( 'Apply Size', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1454 'hint' => '', //array( 'title' => __( 'Reset selected options to default values', 'booking' ), 'position' => 'top' ), // Hint
1455 'link' => 'javascript:void(0)', // Direct link or skip it
1456 'action' => "wpbc_ajx_customize_plugin__send_request_with_params( { } );
1457 wpbc_button_enable_loading_icon( this );
1458 wpbc_admin_show_message_processing( '' );", // JavaScript
1459 'icon' => array(
1460 'icon_font' => 'wpbc_icn_check', //'wpbc_icn_rotate_left', wpbc_icn_close
1461 'position' => 'left',
1462 'icon_img' => ''
1463 ),
1464 'class' => 'wpbc_ui_button', // '' | 'wpbc_ui_button_primary'
1465 'style' => '', // Any CSS class here
1466 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1467 'attr' => array()
1468 );
1469
1470 wpbc_flex_button( $params );
1471 }
1472
1473
1474 /**
1475 * Button - Reset Calendar Size
1476 * @return void
1477 */
1478 function wpbc_ajx_cstm__ui__calendar_size_reset__btn(){
1479
1480 $params = array(
1481 'type' => 'button' ,
1482 'title' => __( 'Reset Size', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
1483 'hint' => '',//array( 'title' => __( 'Reset selected options to default values', 'booking' ), 'position' => 'top' ), // Hint
1484 'link' => 'javascript:void(0)', // Direct link or skip it
1485 'action' => "wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__visible_months', 1 );
1486 wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__months_in_row', '' );
1487 wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__width', '' );
1488 wpbc_ajx_customize_plugin.search_set_param( 'calendar__view__cell_height', '' );
1489
1490 wpbc_ajx_customize_plugin__send_request_with_params( {} );
1491 wpbc_button_enable_loading_icon( this );
1492 wpbc_admin_show_message_processing( '' );", // JavaScript
1493 'icon' => array(
1494 'icon_font' => 'wpbc_icn_close', //'wpbc_icn_rotate_left', wpbc_icn_settings_backup_restore
1495 'position' => 'left',
1496 'icon_img' => ''
1497 ),
1498 'class' => 'wpbc_ui_button_danger0', // '' | 'wpbc_ui_button_primary'
1499 'style' => '', // Any CSS class here
1500 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
1501 'attr' => array( 'id' => 'btn__status_bar__reset' )
1502 );
1503
1504 wpbc_flex_button( $params );
1505 }
1506
1507 // </editor-fold>
1508
1509
1510 // <editor-fold defaultstate="collapsed" desc=" == Dates Selection UI == " >
1511
1512 /**
1513 * Radio buttons - Dates selection mode
1514 *
1515 * @return void
1516 */
1517 function wpbc_ajx_cstm__ui__template__calendar_dates_selection(){
1518
1519 $booking_action = 'set_calendar_dates_selection';
1520
1521 $el_id = 'ui_btn_cstm__' . $booking_action ;
1522
1523 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
1524
1525 ?><div class="ui_element ui_nowrap0"><?php
1526
1527 wpbc_flex_label( array( 'id' => $el_id
1528 , 'label' => '<span class="" style="font-weight:600;">' . __('Days selection in calendar' ,'booking') . ':</span>'
1529 ) );
1530 ?></div><?php
1531 ?><div class="ui_element"><?php
1532
1533 $el_value = 'single';
1534 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id. '_' . $el_value . '__outer_button'; ?>" style="padding-right: 8px;"><?php
1535 $params_radio = array(
1536 'id' => $el_id . '_' . $el_value // HTML ID of element
1537 , 'name' => $booking_action
1538 , 'label' => array( 'title' => __('Single day' ,'booking') , 'position' => 'right' )
1539 , 'style' => 'margin:1px 0 0;' // CSS of select element
1540 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
1541 , 'disabled' => false
1542 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1543 , 'legend' => '' // aria-label parameter
1544 , 'value' => $el_value // Some Value from options array that selected by default
1545 //, 'selected' => false
1546 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1547 //, 'onchange' => "return false;"
1548 );
1549 wpbc_flex_radio( $params_radio );
1550
1551 ?></span><?php
1552 ?></div><?php
1553
1554 $el_value = 'multiple';
1555 ?><div class="ui_element"><?php
1556 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id. '_' . $el_value . '__outer_button'; ?>" style="padding-right: 8px;"><?php
1557 $params_radio = array(
1558 'id' => $el_id . '_' . $el_value // HTML ID of element
1559 , 'name' => $booking_action
1560 , 'label' => array( 'title' => __('Multiple days' ,'booking') , 'position' => 'right' )
1561 , 'style' => 'margin:1px 0 0;' // CSS of select element
1562 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
1563 , 'disabled' => false
1564 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1565 , 'legend' => '' // aria-label parameter
1566 , 'value' => $el_value // Some Value from options array that selected by default
1567 //, 'selected' => false
1568 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1569 );
1570 wpbc_flex_radio( $params_radio );
1571
1572 ?></span><?php
1573 ?></div><?php
1574
1575
1576 // Set checked specific Radio button, depends on last action from user
1577 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
1578
1579 jQuery( document ).ready( function (){
1580
1581 <?php foreach ( array( 'single', 'multiple' ) as $item_val) { ?>
1582
1583 // Change and send Ajax
1584 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_<?php echo $item_val; ?>' ).on( 'change', function ( event ){
1585 <?php // It's required for not send request second time ! ?>
1586 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_<?php echo $item_val; ?>' ).off( 'change' );
1587 wpbc_ajx_customize_plugin.search_set_param( 'calendar__days_selection_mode', '<?php echo $item_val; ?>' );
1588 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_dates_selection'} );
1589 wpbc_button_enable_loading_icon( this );
1590 wpbc_admin_show_message_processing( '' );
1591 return false;
1592 } );
1593 <?php // Helper, if we click on button side, and not at radio button or label, then make radio checked. ?>
1594 jQuery( '.ui_btn_cstm__set_calendar_dates_selection_<?php echo $item_val; ?>__outer_button' ).on( 'click', function (){
1595 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_<?php echo $item_val; ?>' ).prop( "checked", true ).trigger('change');
1596 } );
1597
1598 <?php } ?>
1599
1600 // Set checked or not, specific radio buttons
1601 if ( 'single' == data.ajx_data.calendar_settings.calendar__days_selection_mode ){
1602 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_single' ).prop( 'checked', true );
1603 }
1604 if ( 'multiple' == data.ajx_data.calendar_settings.calendar__days_selection_mode ){
1605 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_multiple' ).prop( 'checked', true );
1606 }
1607 } );
1608
1609 <?php if (0) { ?></script><?php } ?> #><?php
1610
1611
1612 // wpbc_ajx_cstm__ui__template__calendar_dates_selection_range();
1613 }
1614
1615
1616 /**
1617 * Radio buttons - Range Dates selection mode - Business Small and higher
1618 *
1619 * @return void
1620 */
1621 function wpbc_ajx_cstm__ui__template__calendar_dates_selection_range(){
1622
1623 $booking_action = 'set_calendar_dates_selection';
1624
1625 $el_id = 'ui_btn_cstm__' . $booking_action ;
1626
1627 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
1628
1629 $el_value = 'dynamic';
1630 ?><div class="ui_element"><?php
1631 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id. '_' . $el_value . '__outer_button'; ?>" style="padding-right: 8px;"><?php
1632 $params_radio = array(
1633 'id' => $el_id . '_' . $el_value // HTML ID of element
1634 , 'name' => $booking_action
1635 , 'label' => array( 'title' => sprintf(__('2 mouse clicks' ,'booking'),'<strong>','</strong>','<strong>','</strong>')
1636 , 'position' => 'right' )
1637 , 'style' => 'margin:1px 0 0;' // CSS of select element
1638 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
1639 , 'disabled' => false
1640 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1641 , 'legend' => '' // aria-label parameter
1642 , 'value' => $el_value // Some Value from options array that selected by default
1643 //, 'selected' => false
1644 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1645 );
1646 wpbc_flex_radio( $params_radio );
1647
1648 ?></span><?php
1649 ?></div><?php
1650
1651
1652 ?><div class="ui_element_sub_section ui_element_sub_section_dynamic" ><?php
1653
1654 wpbc_ajx_cstm__ui__template__calendar_dates_selection_range__min_max();
1655
1656 wpbc_ajx_cstm__ui__template__calendar_dates_selection_range__specific();
1657
1658 wpbc_ajx_cstm__ui__template__calendar_dates_selection_range__start_days();
1659
1660 ?></div><?php
1661
1662
1663
1664 $el_value = 'fixed';
1665 ?><div class="ui_element"><?php
1666 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id. '_' . $el_value . '__outer_button'; ?>" style="padding-right: 8px;"><?php
1667 $params_radio = array(
1668 'id' => $el_id . '_' . $el_value // HTML ID of element
1669 , 'name' => $booking_action
1670 , 'label' => array( 'title' => sprintf(__('1 mouse click' ,'booking'),'<strong>','</strong>','<strong>','</strong>')
1671 , 'position' => 'right' )
1672 , 'style' => 'margin:1px 0 0;' // CSS of select element
1673 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
1674 , 'disabled' => false
1675 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1676 , 'legend' => '' // aria-label parameter
1677 , 'value' => $el_value // Some Value from options array that selected by default
1678 //, 'selected' => false
1679 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1680 );
1681 wpbc_flex_radio( $params_radio );
1682
1683 ?></span><?php
1684 ?></div><?php
1685
1686
1687 ?><div class="ui_element_sub_section ui_element_sub_section_fixed" ><?php
1688
1689 wpbc_ajx_cstm__ui__template__calendar_dates_selection_fixed__number();
1690
1691 wpbc_ajx_cstm__ui__template__calendar_dates_selection_fixed__start_days();
1692
1693 ?></div><?php
1694
1695
1696 // Set checked specific Radio button, depends on last action from user
1697 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
1698
1699 jQuery( document ).ready( function (){
1700
1701 <?php foreach ( array( 'dynamic', 'fixed' ) as $item_val) { ?>
1702
1703 // Change and send Ajax
1704 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_<?php echo $item_val; ?>' ).on( 'change', function ( event ){
1705 <?php // It's required for not send request second time ! ?>
1706 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_<?php echo $item_val; ?>' ).off( 'change' );
1707 wpbc_ajx_customize_plugin.search_set_param( 'calendar__days_selection_mode', '<?php echo $item_val; ?>' );
1708 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_dates_selection'} );
1709 wpbc_button_enable_loading_icon( this );
1710 wpbc_admin_show_message_processing( '' );
1711 jQuery( '.ui_element_sub_section_dynamic,.ui_element_sub_section_fixed').hide();
1712 if ('fixed' == '<?php echo $item_val; ?>') {
1713 jQuery( '.ui_element_sub_section_fixed').show();
1714 } else {
1715 jQuery( '.ui_element_sub_section_dynamic').show();
1716 }
1717 return false;
1718 } );
1719 <?php // Helper, if we click on button side, and not at radio button or label, then make radio checked. ?>
1720 jQuery( '.ui_btn_cstm__set_calendar_dates_selection_<?php echo $item_val; ?>__outer_button' ).on( 'click', function (){
1721 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_<?php echo $item_val; ?>' ).prop( "checked", true ).trigger('change');
1722 } );
1723
1724 <?php } ?>
1725
1726 // Set checked or not, specific radio buttons
1727 if ( 'dynamic' == data.ajx_data.calendar_settings.calendar__days_selection_mode ){
1728 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_dynamic' ).prop( 'checked', true );
1729 }
1730 jQuery( '.ui_element_sub_section_dynamic,.ui_element_sub_section_fixed').hide();
1731 if ( 'fixed' == data.ajx_data.calendar_settings.calendar__days_selection_mode ){
1732 jQuery( '#ui_btn_cstm__set_calendar_dates_selection_fixed' ).prop( 'checked', true );
1733 jQuery( '.ui_element_sub_section_fixed').show();
1734 } else {
1735 jQuery( '.ui_element_sub_section_dynamic').show();
1736 }
1737 } );
1738
1739 <?php if (0) { ?></script><?php } ?> #><?php
1740 }
1741
1742 /**
1743 * Range Days Min - Max
1744 */
1745 function wpbc_ajx_cstm__ui__template__calendar_dates_selection_range__min_max(){
1746
1747 $booking_action = 'set_calendar_dates_selection_dynamic';
1748
1749 $el_id = 'ui_btn_cstm__' . $booking_action . '_min';
1750
1751 /*
1752 ?><div class="ui_element ui_element_micro ui_nowrap0" style="flex:1 1 100%"><?php
1753
1754 wpbc_flex_label( array( 'id' => $el_id
1755 , 'label' => '<span class="" style="font-weight:600;">' . __('Min-max' ,'booking') . ':</span>'
1756 ) );
1757 ?></div><?php
1758 */
1759
1760 $params = array(
1761 'id' => $el_id // HTML ID of element
1762 , 'name' => $el_id
1763 , 'label' => __( 'From', 'booking' )//'<span class="" style="font-weight:600;">' . __( 'Days', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
1764 , 'style' => 'max-width: 50px;' // CSS of select element
1765 , 'class' => '' // CSS Class of select element
1766 , 'disabled' => false
1767 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1768 , 'placeholder' => '1'
1769 , 'value' => "{{ data.ajx_data.calendar_settings.calendar__bk_2clicks_mode_days_min }}"
1770 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1771 , 'onchange' => " wpbc_ajx_customize_plugin.search_set_param( 'calendar__bk_2clicks_mode_days_min', jQuery(this).val() );
1772 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_dates_selection'} );
1773 wpbc_button_enable_loading_icon( this );
1774 wpbc_admin_show_message_processing( '' );"
1775 );
1776 ?><div class="ui_element ui_element_micro" style="margin-right: 5px;"><?php
1777
1778 wpbc_flex_text( $params );
1779
1780 ?></div><?php
1781
1782
1783 $el_id = 'ui_btn_cstm__' . $booking_action . '_max';
1784
1785 $params = array(
1786 'id' => $el_id // HTML ID of element
1787 , 'name' => $el_id
1788 , 'label' => __( 'to', 'booking' )//'<span class="" style="font-weight:600;"> &dash; </span>'
1789 , 'style' => 'max-width: 50px;' // CSS of select element
1790 , 'class' => '' // CSS Class of select element
1791 , 'disabled' => false
1792 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1793 , 'placeholder' => '30'
1794 , 'value' => "{{ data.ajx_data.calendar_settings.calendar__bk_2clicks_mode_days_max }}"
1795 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1796 , 'onchange' => " wpbc_ajx_customize_plugin.search_set_param( 'calendar__bk_2clicks_mode_days_max', jQuery(this).val() );
1797 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_dates_selection'} );
1798 wpbc_button_enable_loading_icon( this );
1799 wpbc_admin_show_message_processing( '' );"
1800
1801 );
1802 ?><div class="ui_element ui_element_micro"><?php
1803
1804 wpbc_flex_text( $params );
1805
1806 ?></div><?php
1807
1808 ?><div class="ui_element ui_element_micro"><?php
1809
1810 wpbc_flex_label( array( 'id' => $el_id
1811 , 'label' => __('days' ,'booking')
1812 ) );
1813 ?></div><?php
1814
1815
1816 }
1817
1818 /**
1819 * Range Days Specific
1820 */
1821 function wpbc_ajx_cstm__ui__template__calendar_dates_selection_range__specific(){
1822
1823 $booking_action = 'set_calendar_dates_selection_dynamic';
1824
1825 $el_id = 'ui_btn_cstm__' . $booking_action . '_specific';
1826
1827
1828 ?><div class="ui_element ui_element_micro ui_nowrap0" style="flex:1 1 100%"><?php
1829
1830 wpbc_flex_label( array( 'id' => $el_id
1831 , 'label' => '<span class="" style="font-weight:400;">' . __('Specific days selections' ,'booking') . ':</span>'
1832 ) );
1833 ?></div><?php
1834
1835
1836 $params = array(
1837 'id' => $el_id // HTML ID of element
1838 , 'name' => $el_id
1839 , 'label' => ''//'<span class="" style="font-weight:600;">' . __( 'Days', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
1840 , 'style' => 'max-width: 100%;' // CSS of select element
1841 , 'class' => '' // CSS Class of select element
1842 , 'disabled' => false
1843 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1844 , 'placeholder' => '7,14,21,28'
1845 , 'value' => "{{ data.ajx_data.calendar_settings.calendar__bk_2clicks_mode_days_specific }}"
1846 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1847 , 'onchange' => " wpbc_ajx_customize_plugin.search_set_param( 'calendar__bk_2clicks_mode_days_specific', jQuery(this).val() );
1848 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_dates_selection'} );
1849 wpbc_button_enable_loading_icon( this );
1850 wpbc_admin_show_message_processing( '' );"
1851
1852 );
1853 ?><div class="ui_element ui_element_micro"><?php
1854
1855 wpbc_flex_text( $params );
1856
1857 ?></div><?php
1858 }
1859
1860 /**
1861 * Range Days Start week days*
1862 */
1863 function wpbc_ajx_cstm__ui__template__calendar_dates_selection_range__start_days(){
1864
1865 $booking_action = 'set_calendar_dates_selection_dynamic';
1866
1867 $el_id = 'ui_btn_cstm__' . $booking_action . '_start_days';
1868
1869
1870 ?><div class="ui_element ui_element_micro ui_nowrap0" style="flex:1 1 100%"><?php
1871
1872 wpbc_flex_label( array( 'id' => $el_id
1873 , 'label' => '<span class="" style="font-weight:400;">' . __('Start day of range' ,'booking') . ':</span>'
1874 ) );
1875 ?></div><?php
1876
1877 //TODO: here 2023-07-02
1878 // Set checked or unchecked checkboxes depends from data.ajx_data.calendar_settings.calendar__bk_2clicks_mode_days_start = "2,5 || "0,1,2,3,4,5,6" || "-1"
1879 // Then onchange send correct 'calendar__bk_2clicks_mode_days_start' value, for example if it's "0,1,2,3,4,5,6", then it have to be '-1'
1880 // And create the same UI for fixed 1 click
1881
1882 // data.ajx_data.calendar_settings.calendar__bk_2clicks_mode_days_start = "2,5 || "0,1,2,3,4,5,6" || "-1"
1883
1884 $week_days_arr = array(
1885 0 => __( 'Su', 'booking' )
1886 , 1 => __( 'Mo', 'booking' )
1887 , 2 => __( 'Tu', 'booking' )
1888 , 3 => __( 'We', 'booking' )
1889 , 4 => __( 'Th', 'booking' )
1890 , 5 => __( 'Fr', 'booking' )
1891 , 6 => __( 'Sa', 'booking' )
1892 );
1893 foreach ( $week_days_arr as $day_key => $day_title ) {
1894
1895 $params_checkbox = array(
1896 'id' => $el_id . '_'.$day_key // HTML ID of element
1897 , 'name' => $el_id . '_'.$day_key
1898 , 'label' => array( 'title' => $day_title , 'position' => 'right' ) //FixIn: 9.6.1.5
1899 , 'style' => '' // CSS of select element
1900 , 'class' => '' // CSS Class of select element
1901 , 'disabled' => false
1902 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1903 , 'legend' => '' // aria-label parameter
1904 , 'value' => $day_key // Some Value from optins array that selected by default
1905 , 'selected' => false // Selected or not
1906 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
1907 //, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code
1908 , 'onchange' => "
1909 var sel_arr_el = wpbc_ajx_customize_plugin.search_get_param( 'calendar__bk_2clicks_mode_days_start' );
1910 if ( -1 == sel_arr_el ){
1911 sel_arr_el = '0,1,2,3,4,5,6';
1912 }
1913 if ( jQuery( this ).is(':checked') ) {
1914 sel_arr_el = _.uniq( ['".$day_key."'].concat( sel_arr_el.split(',') ) ).sort().join( ',');
1915 } else {
1916 sel_arr_el = _.uniq( _.without( sel_arr_el.split(','), '".$day_key."' ) ).sort().join( ',');
1917 }
1918 wpbc_ajx_customize_plugin.search_set_param( 'calendar__bk_2clicks_mode_days_start', sel_arr_el );
1919 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_dates_selection'} );
1920 wpbc_button_enable_loading_icon( this );
1921 wpbc_admin_show_message_processing( '' );"
1922
1923 );
1924 ?><div class="ui_element ui_element_micro"><?php
1925 wpbc_flex_toggle( $params_checkbox );
1926 ?></div><?php
1927
1928
1929 // Set checked specific Radio button, depends on last action from user
1930 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
1931
1932 jQuery( document ).ready( function (){
1933 if ( ( '-1' === data.ajx_data.calendar_settings.calendar__bk_2clicks_mode_days_start )
1934 || ( -1 !== data.ajx_data.calendar_settings.calendar__bk_2clicks_mode_days_start.indexOf( '<?php echo $day_key; ?>' ) )
1935 ){
1936 jQuery( '#<?php echo $el_id . '_'.$day_key; ?>' ).prop( 'checked', true );//.trigger( 'change' );
1937 } else {
1938 jQuery( '#<?php echo $el_id . '_'.$day_key; ?>' ).prop( 'checked', false );//.trigger( 'change' );
1939 }
1940 } );
1941 <?php if (0) { ?></script><?php } ?> #><?php
1942 }
1943
1944 }
1945
1946
1947
1948 /**
1949 * Fixed Days Number
1950 */
1951 function wpbc_ajx_cstm__ui__template__calendar_dates_selection_fixed__number(){
1952
1953 $booking_action = 'set_calendar_dates_selection_fixed';
1954
1955 $el_id = 'ui_btn_cstm__' . $booking_action . '_number';
1956
1957
1958 ?><div class="ui_element ui_element_micro ui_nowrap0" style="flex:1 1 100%"><?php
1959
1960 wpbc_flex_label( array( 'id' => $el_id
1961 , 'label' => '<span class="" style="font-weight:400;">' . __('Days selection number' ,'booking') . ':</span>'
1962 ) );
1963 ?></div><?php
1964
1965
1966 $params = array(
1967 'id' => $el_id // HTML ID of element
1968 , 'name' => $el_id
1969 , 'label' => ''//'<span class="" style="font-weight:600;">' . __( 'Days', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
1970 , 'style' => 'max-width: 100%;' // CSS of select element
1971 , 'class' => '' // CSS Class of select element
1972 , 'disabled' => false
1973 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
1974 , 'placeholder' => '7'
1975 , 'value' => "{{ data.ajx_data.calendar_settings.calendar__bk_1click_mode_days_num }}"
1976 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code
1977 , 'onchange' => " wpbc_ajx_customize_plugin.search_set_param( 'calendar__bk_1click_mode_days_num', jQuery(this).val() );
1978 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_dates_selection'} );
1979 wpbc_button_enable_loading_icon( this );
1980 wpbc_admin_show_message_processing( '' );"
1981
1982 );
1983 ?><div class="ui_element ui_element_micro"><?php
1984
1985 wpbc_flex_text( $params );
1986
1987 ?></div><?php
1988 }
1989
1990 /**
1991 * Fixed Days Start week days*
1992 */
1993 function wpbc_ajx_cstm__ui__template__calendar_dates_selection_fixed__start_days(){
1994
1995 $booking_action = 'set_calendar_dates_selection_fixed';
1996
1997 $el_id = 'ui_btn_cstm__' . $booking_action . '_start_days';
1998
1999
2000 ?><div class="ui_element ui_element_micro ui_nowrap0" style="flex:1 1 100%"><?php
2001
2002 wpbc_flex_label( array( 'id' => $el_id
2003 , 'label' => '<span class="" style="font-weight:400;">' . __('Start day of range' ,'booking') . ':</span>'
2004 ) );
2005 ?></div><?php
2006
2007 $week_days_arr = array(
2008 0 => __( 'Su', 'booking' )
2009 , 1 => __( 'Mo', 'booking' )
2010 , 2 => __( 'Tu', 'booking' )
2011 , 3 => __( 'We', 'booking' )
2012 , 4 => __( 'Th', 'booking' )
2013 , 5 => __( 'Fr', 'booking' )
2014 , 6 => __( 'Sa', 'booking' )
2015 );
2016 foreach ( $week_days_arr as $day_key => $day_title ) {
2017
2018 $params_checkbox = array(
2019 'id' => $el_id . '_'.$day_key // HTML ID of element
2020 , 'name' => $el_id . '_'.$day_key
2021 , 'label' => array( 'title' => $day_title , 'position' => 'right' ) //FixIn: 9.6.1.5
2022 , 'style' => '' // CSS of select element
2023 , 'class' => '' // CSS Class of select element
2024 , 'disabled' => false
2025 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2026 , 'legend' => '' // aria-label parameter
2027 , 'value' => $day_key // Some Value from optins array that selected by default
2028 , 'selected' => false // Selected or not
2029 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2030 //, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code
2031 , 'onchange' => "
2032 var sel_arr_el = wpbc_ajx_customize_plugin.search_get_param( 'calendar__bk_1click_mode_days_start' );
2033 if ( -1 == sel_arr_el ){
2034 sel_arr_el = '0,1,2,3,4,5,6';
2035 }
2036 if ( jQuery( this ).is(':checked') ) {
2037 sel_arr_el = _.uniq( ['".$day_key."'].concat( sel_arr_el.split(',') ) ).sort().join( ',');
2038 } else {
2039 sel_arr_el = _.uniq( _.without( sel_arr_el.split(','), '".$day_key."' ) ).sort().join( ',');
2040 }
2041 wpbc_ajx_customize_plugin.search_set_param( 'calendar__bk_1click_mode_days_start', sel_arr_el );
2042 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_dates_selection'} );
2043 wpbc_button_enable_loading_icon( this );
2044 wpbc_admin_show_message_processing( '' );"
2045
2046 );
2047 ?><div class="ui_element ui_element_micro"><?php
2048 wpbc_flex_toggle( $params_checkbox );
2049 ?></div><?php
2050
2051
2052 // Set checked specific Radio button, depends on last action from user
2053 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2054
2055 jQuery( document ).ready( function (){
2056 if ( ( '-1' === data.ajx_data.calendar_settings.calendar__bk_1click_mode_days_start )
2057 || ( -1 !== data.ajx_data.calendar_settings.calendar__bk_1click_mode_days_start.indexOf( '<?php echo $day_key; ?>' ) )
2058 ){
2059 jQuery( '#<?php echo $el_id . '_'.$day_key; ?>' ).prop( 'checked', true );//.trigger( 'change' );
2060 } else {
2061 jQuery( '#<?php echo $el_id . '_'.$day_key; ?>' ).prop( 'checked', false );//.trigger( 'change' );
2062 }
2063 } );
2064 <?php if (0) { ?></script><?php } ?> #><?php
2065 }
2066
2067 }
2068
2069
2070 // </editor-fold>
2071
2072
2073 // <editor-fold defaultstate="collapsed" desc=" == Unavailable Weekdays UI == " >
2074
2075
2076 /**
2077 * Unavailable - weekdays
2078 */
2079 function wpbc_ajx_cstm__ui__template__calendar_weekdays_availability(){
2080
2081 $booking_action = 'set_calendar_weekdays_availability';
2082
2083 $el_id = 'ui_btn_cstm__' . $booking_action ;
2084
2085
2086 ?><div class="ui_element ui_element_micro ui_nowrap0" style="flex:1 1 100%"><?php
2087
2088 wpbc_flex_label( array( 'id' => $el_id
2089 , 'style' => 'height: auto;line-height: 1.75em;'
2090 , 'label' => '<span class="" style="font-weight:400;">' . __('Check unavailable days in calendars. This option will overwrite all other settings.' ,'booking') . '</span>'
2091 ) );
2092 ?></div><?php
2093
2094 $week_days_arr = array(
2095 0 => __( 'Su', 'booking' )
2096 , 1 => __( 'Mo', 'booking' )
2097 , 2 => __( 'Tu', 'booking' )
2098 , 3 => __( 'We', 'booking' )
2099 , 4 => __( 'Th', 'booking' )
2100 , 5 => __( 'Fr', 'booking' )
2101 , 6 => __( 'Sa', 'booking' )
2102 );
2103
2104
2105
2106 foreach ( $week_days_arr as $day_key => $day_title ) {
2107
2108 $params_checkbox = array(
2109 'id' => $el_id . '_'.$day_key // HTML ID of element
2110 , 'name' => $el_id . '_'.$day_key
2111 , 'label' => array( 'title' => $day_title , 'position' => 'right' ) //FixIn: 9.6.1.5
2112 , 'style' => '' // CSS of select element
2113 , 'class' => '' // CSS Class of select element
2114 , 'disabled' => false
2115 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2116 , 'legend' => '' // aria-label parameter
2117 , 'value' => $day_key // Some Value from optins array that selected by default
2118 , 'selected' => false // Selected or not
2119 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2120 //, 'onchange' => "wpbc_ajx_booking_send_search_request_with_params( {'ui_usr__send_emails': (jQuery( this ).is(':checked') ? 'send' : 'not_send') } );" // JavaScript code
2121 , 'onchange' => "
2122 var sel_arr_el = wpbc_ajx_customize_plugin.search_get_param( 'availability__user_unavilable_days' );
2123 if ( jQuery( this ).is(':checked') ) {
2124 sel_arr_el = _.uniq( ['".$day_key."'].concat( sel_arr_el.split(',') ) ).sort().join( ',');
2125 } else {
2126 sel_arr_el = _.uniq( _.without( sel_arr_el.split(','), '".$day_key."' ) ).sort().join( ',');
2127 }
2128 wpbc_ajx_customize_plugin.search_set_param( 'availability__user_unavilable_days', sel_arr_el );
2129 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2130 wpbc_button_enable_loading_icon( this );
2131 wpbc_admin_show_message_processing( '' );"
2132
2133 );
2134 ?><div class="ui_element ui_element_micro"><?php
2135 wpbc_flex_toggle( $params_checkbox );
2136 ?></div><?php
2137
2138
2139 // Set checked specific Radio button, depends on last action from user
2140 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2141
2142 jQuery( document ).ready( function (){
2143 if ( ( '-1' === data.ajx_data.calendar_settings.calendar_unavailable.user_unavilable_days )
2144 || ( -1 !== data.ajx_data.calendar_settings.calendar_unavailable.user_unavilable_days.indexOf( '<?php echo $day_key; ?>' ) )
2145 ){
2146 jQuery( '#<?php echo $el_id . '_'.$day_key; ?>' ).prop( 'checked', true );
2147 } else {
2148 jQuery( '#<?php echo $el_id . '_'.$day_key; ?>' ).prop( 'checked', false );
2149 }
2150 } );
2151 <?php if (0) { ?></script><?php } ?> #><?php
2152 }
2153
2154 }
2155
2156 /**
2157 * Unavailable - from Today
2158 */
2159 function wpbc_ajx_cstm__ui__template__calendar_unavailable_from_today(){
2160
2161 $booking_action = 'set_calendar_unavailable_from_today';
2162
2163 $el_id = 'ui_btn_cstm__' . $booking_action ;
2164
2165 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
2166
2167 ?><div class="ui_element ui_nowrap0"><?php
2168
2169 wpbc_flex_label( array( 'id' => $el_id
2170 , 'label' => '<div class="" style="font-weight:400;">'
2171 . __( 'Unavailable days from today', 'booking' ) . ': '
2172 . '<div><code id="' . $el_id . '_hint" style="font-weight:600;font-size:10px;padding:0;color: #626262;"></code></div>'
2173 . '</div>'
2174 ) );
2175 ?></div><?php
2176
2177 ?><div class="ui_element ui_nowrap"><?php
2178
2179 // Options
2180 $dropdown_options = range( 0, 31 );
2181
2182 $params_select = array(
2183 'id' => $el_id // HTML ID of element
2184 , 'name' => $booking_action
2185 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
2186 , 'style' => '' // CSS of select element
2187 , 'class' => '' // CSS Class of select element
2188 //, 'multiple' => true
2189 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2190 , 'disabled' => false
2191 , 'disabled_options' => array() // If some options disabled, then it has to list here
2192 , 'options' => $dropdown_options
2193 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
2194 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2195 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'availability__block_some_dates_from_today', jQuery(this).val() );
2196 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2197 wpbc_button_enable_loading_icon( this );
2198 wpbc_admin_show_message_processing( '' );"
2199 );
2200 wpbc_flex_select( $params_select );
2201
2202
2203 wpbc_ajx_cstm__ui__selectbox_prior_btn( $el_id );
2204 wpbc_ajx_cstm__ui__selectbox_next_btn( $el_id );
2205 ?></div><?php
2206
2207 // Set checked specific OPTION depends on last action from user
2208 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2209 jQuery( document ).ready( function (){
2210 // Set selected option in dropdown list based on data. value
2211 jQuery( '#<?php echo $el_id; ?> option[value="' + data.ajx_data.calendar_settings.calendar_unavailable.block_some_dates_from_today + '"]' ).prop( 'selected', true );
2212
2213 jQuery( '#<?php echo $el_id; ?>_hint' ).html( '<span style="color: #cc3a5f;text-transform: uppercase;"><?php _e('Unavailable','booking') ?></span>'
2214 + data.ajx_data.calendar_settings.calendar_unavailable.block_some_dates_from_today__hint );
2215 } );
2216
2217 <?php if (0) { ?></script><?php } ?> #><?php
2218
2219 }
2220
2221 /**
2222 * Limit Available - from Today
2223 */
2224 function wpbc_ajx_cstm__ui__template__calendar_limit_available_from_today(){
2225
2226 $booking_action = 'set_calendar_limit_available_from_today';
2227
2228 $el_id = 'ui_btn_cstm__' . $booking_action ;
2229
2230 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
2231
2232 ?><div class="ui_element ui_nowrap0"><?php
2233
2234 wpbc_flex_label( array( 'id' => $el_id
2235 , 'label' => '<div class="" style="font-weight:400;">'
2236 . __( 'Limit available days from today', 'booking' ) . ': '
2237 . '<div><code id="' . $el_id . '_hint" style="font-weight:600;font-size:10px;padding:0;color: #626262;"></code></div>'
2238 . '</div>'
2239 ) );
2240 ?></div><?php
2241
2242 ?><div class="ui_element ui_nowrap"><?php
2243
2244 // Options
2245 $dropdown_options = array( '' => ' - ' );
2246 //foreach ( range( 365, 1, -1 ) as $value ) {
2247 foreach ( range( 1,365 ) as $value ) {
2248 $dropdown_options[ $value ] = $value;
2249 }
2250
2251 $params_select = array(
2252 'id' => $el_id // HTML ID of element
2253 , 'name' => $booking_action
2254 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
2255 , 'style' => '' // CSS of select element
2256 , 'class' => '' // CSS Class of select element
2257 //, 'multiple' => true
2258 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2259 , 'disabled' => false
2260 , 'disabled_options' => array() // If some options disabled, then it has to list here
2261 , 'options' => $dropdown_options
2262 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
2263 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2264 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'availability__wpbc_available_days_num_from_today', jQuery(this).val() );
2265 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2266 wpbc_button_enable_loading_icon( this );
2267 wpbc_admin_show_message_processing( '' );"
2268 );
2269 wpbc_flex_select( $params_select );
2270
2271
2272 wpbc_ajx_cstm__ui__selectbox_prior_btn( $el_id );
2273 wpbc_ajx_cstm__ui__selectbox_next_btn( $el_id );
2274 ?></div><?php
2275
2276 // Set checked specific OPTION depends on last action from user
2277 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2278 jQuery( document ).ready( function (){
2279 // Set selected option in dropdown list based on data. value
2280 jQuery( '#<?php echo $el_id; ?> option[value="' + data.ajx_data.calendar_settings.calendar_unavailable.wpbc_available_days_num_from_today + '"]' ).prop( 'selected', true );
2281
2282 jQuery( '#<?php echo $el_id; ?>_hint' ).html( '<span style="color: #50be31;text-transform: uppercase;"><?php _e('Available','booking') ?></span>'
2283 + data.ajx_data.calendar_settings.calendar_unavailable.wpbc_available_days_num_from_today__hint );
2284 } );
2285
2286 <?php if (0) { ?></script><?php } ?> #><?php
2287
2288 }
2289
2290
2291
2292 /**
2293 * Radio buttons - Range Dates selection mode - Business Small and higher
2294 *
2295 * @return void
2296 */
2297 function wpbc_ajx_cstm__ui__template__calendar_unavailable_before_after_bookings(){
2298
2299 $booking_action = 'set_calendar_unavailable_before_after_bookings';
2300
2301 $el_id = 'ui_btn_cstm__' . $booking_action ;
2302
2303 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
2304 ?><div class="clear" style="height: 1px;width: 100%;border-top: 1px solid #ccc;margin: 15px 0 10px;"></div><?php
2305 ?><div class="ui_element ui_nowrap0"><?php
2306
2307 wpbc_flex_label( array( 'id' => $el_id
2308 , 'style' => 'height: auto;'
2309 , 'label' => '<span class="" style="font-weight:400;">'
2310 . __('Unavailable time before / after booking' ,'booking')
2311 .':</span>'
2312
2313 ) );
2314 ?></div><?php
2315
2316 $el_value = '';
2317 ?><div class="ui_element"><?php
2318 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id. '_' . $el_value . '__outer_button'; ?>" style="padding-right: 8px;"><?php
2319 $params_radio = array(
2320 'id' => $el_id . '_' . $el_value // HTML ID of element
2321 , 'name' => $booking_action
2322 , 'label' => array( 'title' => ucfirst( __( 'None', 'booking' ) )
2323 , 'position' => 'right' )
2324 , 'style' => 'margin:1px 0 0;' // CSS of select element
2325 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
2326 , 'disabled' => false
2327 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2328 , 'legend' => '' // aria-label parameter
2329 , 'value' => $el_value // Some Value from options array that selected by default
2330 //, 'selected' => true
2331 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2332 );
2333 wpbc_flex_radio( $params_radio );
2334
2335 ?></span><?php
2336 ?></div><?php
2337
2338
2339 $el_value = 'm';
2340 ?><div class="ui_element"><?php
2341 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id. '_' . $el_value . '__outer_button'; ?>" style="padding-right: 8px;"><?php
2342 $params_radio = array(
2343 'id' => $el_id . '_' . $el_value // HTML ID of element
2344 , 'name' => $booking_action
2345 , 'label' => array( 'title' => ucfirst( __( 'minutes', 'booking' ) ) . ' / ' . ucfirst( __( 'hours', 'booking' ) )
2346 , 'position' => 'right' )
2347 , 'style' => 'margin:1px 0 0;' // CSS of select element
2348 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
2349 , 'disabled' => false
2350 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2351 , 'legend' => '' // aria-label parameter
2352 , 'value' => $el_value // Some Value from options array that selected by default
2353 //, 'selected' => false
2354 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2355 );
2356 wpbc_flex_radio( $params_radio );
2357
2358 ?></span><?php
2359 ?></div><?php
2360
2361
2362 ?><div class="ui_element_sub_section ui_element_sub_section_m" ><?php
2363
2364 wpbc_ajx_cstm__ui__template__calendar_unavailable_before_after_bookings_minutes();
2365
2366 ?></div><?php
2367
2368
2369
2370 $el_value = 'd';
2371 ?><div class="ui_element"><?php
2372 ?><span class="wpbc_ui_control wpbc_ui_button <?php echo $el_id. '_' . $el_value . '__outer_button'; ?>" style="padding-right: 8px;"><?php
2373 $params_radio = array(
2374 'id' => $el_id . '_' . $el_value // HTML ID of element
2375 , 'name' => $booking_action
2376 , 'label' => array( 'title' => ucfirst( __( 'day(s)', 'booking' ) )
2377 , 'position' => 'right' )
2378 , 'style' => 'margin:1px 0 0;' // CSS of select element
2379 , 'class' => 'wpbc_radio__set_days_availability' // CSS Class of select element
2380 , 'disabled' => false
2381 , 'attr' => array() // Any additional attributes, if this radio | checkbox element
2382 , 'legend' => '' // aria-label parameter
2383 , 'value' => $el_value // Some Value from options array that selected by default
2384 //, 'selected' => false
2385 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).is(':checked') , 'in element:' , jQuery( this ) );" // JavaScript code
2386 );
2387 wpbc_flex_radio( $params_radio );
2388
2389 ?></span><?php
2390 ?></div><?php
2391
2392
2393 ?><div class="ui_element_sub_section ui_element_sub_section_d" ><?php
2394
2395 wpbc_ajx_cstm__ui__template__calendar_unavailable_before_after_bookings_days();
2396
2397 ?></div><?php
2398
2399 ?><p><?php
2400 echo '<div id="'.$el_id.'_hint" style="font-weight:400;font-size:11px;margin-top:15px;">'
2401 . '<strong>' . __('Important!' ,'booking') . '</strong> '
2402 . __( 'This feature is applying only for bookings for specific timeslots, or if activated check in/out time option.', 'booking' )
2403 .'</div>'
2404 ?></p> <?php
2405
2406 // Set checked specific Radio button, depends on last action from user
2407 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2408
2409 jQuery( document ).ready( function (){
2410
2411 <?php foreach ( array( '', 'm', 'd' ) as $item_val) { ?>
2412
2413 // Change and send Ajax
2414 jQuery( '#ui_btn_cstm__set_calendar_unavailable_before_after_bookings_<?php echo $item_val; ?>' ).on( 'change', function ( event ){
2415 <?php // It's required for not send request second time ! ?>
2416 jQuery( '#ui_btn_cstm__set_calendar_unavailable_before_after_bookings_<?php echo $item_val; ?>' ).off( 'change' );
2417 wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_in_out', '<?php echo $item_val; ?>' );
2418 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2419 wpbc_button_enable_loading_icon( this );
2420 wpbc_admin_show_message_processing( '' );
2421
2422 jQuery( '.ui_element_sub_section_d,.ui_element_sub_section_m').hide();
2423 if ('m' == '<?php echo $item_val; ?>') {
2424 jQuery( '.ui_element_sub_section_m').show();
2425 }
2426 if ('d' == '<?php echo $item_val; ?>') {
2427 jQuery( '.ui_element_sub_section_d').show();
2428 }
2429 return false;
2430 } );
2431 <?php // Helper, if we click on button side, and not at radio button or label, then make radio checked. ?>
2432 jQuery( '.ui_btn_cstm__set_calendar_unavailable_before_after_bookings_<?php echo $item_val; ?>__outer_button' ).on( 'click', function (){
2433 jQuery( '#ui_btn_cstm__set_calendar_unavailable_before_after_bookings_<?php echo $item_val; ?>' ).prop( "checked", true ).trigger('change');
2434 } );
2435
2436 <?php } ?>
2437
2438 // Set checked or not, specific radio buttons
2439 jQuery( '#ui_btn_cstm__set_calendar_unavailable_before_after_bookings_' ).prop( 'checked', true );
2440 jQuery( '.ui_element_sub_section_d,.ui_element_sub_section_m').hide();
2441 if ( 'm' == data.ajx_data.calendar_settings.calendar_unavailable.booking_unavailable_extra_in_out ){
2442 jQuery( '#ui_btn_cstm__set_calendar_unavailable_before_after_bookings_m' ).prop( 'checked', true );
2443 jQuery( '.ui_element_sub_section_m').show();
2444 }
2445 if ( 'd' == data.ajx_data.calendar_settings.calendar_unavailable.booking_unavailable_extra_in_out ){
2446 jQuery( '#ui_btn_cstm__set_calendar_unavailable_before_after_bookings_d' ).prop( 'checked', true );
2447 jQuery( '.ui_element_sub_section_d').show();
2448 }
2449 <?php
2450 // Show possible selection in paid versions, while using lower version.
2451 if ( ! class_exists( 'wpdev_bk_biz_m' ) ) { ?>
2452 jQuery( '.ui_element_sub_section_m').show();
2453 jQuery( '.ui_element_sub_section_d').show();
2454 <?php } ?>
2455 } );
2456
2457 <?php if (0) { ?></script><?php } ?> #><?php
2458 }
2459
2460 function wpbc_ajx_cstm__ui__template__calendar_unavailable_before_after_bookings_minutes(){
2461
2462 $booking_action = 'booking_unavailable_extra_minutes';
2463 $el_id = 'ui_btn_cstm__' . $booking_action;
2464
2465 // Options
2466 $extra_time = array();
2467 $extra_time[''] = ' - ';
2468 foreach ( range( 5, 55 , 5 ) as $extra_num) { // Each 5 minutes
2469 $extra_time[ $extra_num . 'm' ] = $extra_num . ' ' . __( 'minutes', 'booking' );
2470 }
2471 $extra_time[ '60' . 'm' ] = '1 ' . __( 'hour', 'booking' );
2472 foreach ( range( 65, 115 , 5 ) as $extra_num) { // 1 hour + Each 5 minutes
2473 $extra_time[ $extra_num . 'm' ] = '1 ' . __( 'hour', 'booking' ) . ' ' . ($extra_num - 60 ) . ' ' . __( 'minutes', 'booking' );
2474 }
2475
2476 foreach ( range( 120, 1380 , 60 ) as $extra_num) { // Each Hour based on minutes
2477 $extra_time[ $extra_num . 'm' ] = ($extra_num / 60) . ' ' . __( 'hours', 'booking' );
2478 }
2479
2480
2481 $params_select = array(
2482 'id' => $el_id . '_in' // HTML ID of element
2483 , 'name' => $el_id . '_in'
2484 , 'label' => __( 'Before booking', 'booking' )//'<span class="" style="font-weight:600;">' . __( 'Days', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
2485 , 'style' => 'max-width: 100%;' // CSS of select element
2486 , 'class' => '' // CSS Class of select element
2487 //, 'multiple' => true
2488 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2489 , 'disabled' => false
2490 , 'disabled_options' => array() // If some options disabled, then it has to list here
2491 , 'options' => $extra_time
2492 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
2493 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2494 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_minutes_in', jQuery(this).val() );
2495 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2496 wpbc_button_enable_loading_icon( this );
2497 wpbc_admin_show_message_processing( '' );"
2498 );
2499 ?><div class="ui_element ui_element_micro"><?php
2500 wpbc_flex_select( $params_select );
2501 ?></div><?php
2502
2503
2504 $params_select = array(
2505 'id' => $el_id . '_out' // HTML ID of element
2506 , 'name' => $el_id . '_out'
2507 , 'label' => __( 'After booking', 'booking' )//'<span class="" style="font-weight:600;">' . __( 'Days', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
2508 , 'style' => 'max-width: 100%;' // CSS of select element
2509 , 'class' => '' // CSS Class of select element
2510 //, 'multiple' => true
2511 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2512 , 'disabled' => false
2513 , 'disabled_options' => array() // If some options disabled, then it has to list here
2514 , 'options' => $extra_time
2515 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
2516 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2517 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_minutes_out', jQuery(this).val() );
2518 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2519 wpbc_button_enable_loading_icon( this );
2520 wpbc_admin_show_message_processing( '' );"
2521 );
2522 ?><div class="ui_element ui_element_micro"><?php
2523 wpbc_flex_select( $params_select );
2524 ?></div><?php
2525
2526
2527 // Set checked specific OPTION depends on last action from user
2528 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2529 jQuery( document ).ready( function (){
2530 // Set selected option in dropdown list based on data. value
2531 jQuery( '#<?php echo $el_id . '_in'; ?> option[value="' + data.ajx_data.calendar_settings.calendar_unavailable.booking_unavailable_extra_minutes_in + '"]' ).prop( 'selected', true );
2532 jQuery( '#<?php echo $el_id . '_out'; ?> option[value="' + data.ajx_data.calendar_settings.calendar_unavailable.booking_unavailable_extra_minutes_out + '"]' ).prop( 'selected', true );
2533 } );
2534
2535 <?php if (0) { ?></script><?php } ?> #><?php
2536 }
2537
2538 function wpbc_ajx_cstm__ui__template__calendar_unavailable_before_after_bookings_days(){
2539
2540 $booking_action = 'booking_unavailable_extra_days';
2541 $el_id = 'ui_btn_cstm__' . $booking_action;
2542
2543 // Options
2544 $extra_time = array();
2545 $extra_time[''] = ' - ';
2546 foreach ( range( 1, 30 , 1 ) as $extra_num) { // Each Day
2547 $extra_time[ $extra_num . 'd' ] = $extra_num . ' ' . __( 'day(s)', 'booking' );
2548 }
2549
2550
2551 $params_select = array(
2552 'id' => $el_id . '_in' // HTML ID of element
2553 , 'name' => $el_id . '_in'
2554 , 'label' => __( 'Before booking', 'booking' )//'<span class="" style="font-weight:600;">' . __( 'Days', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
2555 , 'style' => 'max-width: 100%;' // CSS of select element
2556 , 'class' => '' // CSS Class of select element
2557 //, 'multiple' => true
2558 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2559 , 'disabled' => false
2560 , 'disabled_options' => array() // If some options disabled, then it has to list here
2561 , 'options' => $extra_time
2562 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
2563 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2564 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_days_in', jQuery(this).val() );
2565 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2566 wpbc_button_enable_loading_icon( this );
2567 wpbc_admin_show_message_processing( '' );"
2568 );
2569 ?><div class="ui_element ui_element_micro"><?php
2570 wpbc_flex_select( $params_select );
2571 ?></div><?php
2572
2573
2574 $params_select = array(
2575 'id' => $el_id . '_out' // HTML ID of element
2576 , 'name' => $el_id . '_out'
2577 , 'label' => __( 'After booking', 'booking' )//'<span class="" style="font-weight:600;">' . __( 'Days', 'booking' ) . ' <em style="color:#888;">(' . __( 'min-max', 'booking' ) . '):</em></span>'
2578 , 'style' => 'max-width: 100%;' // CSS of select element
2579 , 'class' => '' // CSS Class of select element
2580 //, 'multiple' => true
2581 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2582 , 'disabled' => false
2583 , 'disabled_options' => array() // If some options disabled, then it has to list here
2584 , 'options' => $extra_time
2585 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
2586 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2587 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_days_out', jQuery(this).val() );
2588 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2589 wpbc_button_enable_loading_icon( this );
2590 wpbc_admin_show_message_processing( '' );"
2591 );
2592 ?><div class="ui_element ui_element_micro"><?php
2593 wpbc_flex_select( $params_select );
2594 ?></div><?php
2595
2596
2597 // Set checked specific OPTION depends on last action from user
2598 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2599 jQuery( document ).ready( function (){
2600 // Set selected option in dropdown list based on data. value
2601 jQuery( '#<?php echo $el_id . '_in'; ?> option[value="' + data.ajx_data.calendar_settings.calendar_unavailable.booking_unavailable_extra_days_in + '"]' ).prop( 'selected', true );
2602 jQuery( '#<?php echo $el_id . '_out'; ?> option[value="' + data.ajx_data.calendar_settings.calendar_unavailable.booking_unavailable_extra_days_out + '"]' ).prop( 'selected', true );
2603 } );
2604
2605 <?php if (0) { ?></script><?php } ?> #><?php
2606 }
2607
2608
2609
2610 /**
2611 * Button - Reset Calendar Availability
2612 * @return void
2613 */
2614 function wpbc_ajx_cstm__ui__calendar_weekdays_availability_reset__btn(){
2615
2616 $params = array(
2617 'type' => 'button' ,
2618 'title' => __( 'Reset availability', 'booking' ) . '&nbsp;&nbsp;', // Title of the button
2619 'hint' => '',//array( 'title' => __( 'Reset selected options to default values', 'booking' ), 'position' => 'top' ), // Hint
2620 'link' => 'javascript:void(0)', // Direct link or skip it
2621 'action' => "wpbc_ajx_customize_plugin.search_set_param( 'availability__user_unavilable_days', '' );
2622 wpbc_ajx_customize_plugin.search_set_param( 'availability__block_some_dates_from_today', 0 );
2623 wpbc_ajx_customize_plugin.search_set_param( 'availability__wpbc_available_days_num_from_today', '' );
2624 wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_in_out', '' );
2625 wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_minutes_in', '' );
2626 wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_minutes_out', '' );
2627 wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_days_in', '' );
2628 wpbc_ajx_customize_plugin.search_set_param( 'availability__booking_unavailable_extra_days_out', '' );
2629
2630 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_weekdays_availability'} );
2631 wpbc_button_enable_loading_icon( this );
2632 wpbc_admin_show_message_processing( '' );", // JavaScript
2633 'icon' => array(
2634 'icon_font' => 'wpbc_icn_close', //'wpbc_icn_rotate_left', wpbc_icn_settings_backup_restore
2635 'position' => 'left',
2636 'icon_img' => ''
2637 ),
2638 'class' => 'wpbc_ui_button_danger', // '' | 'wpbc_ui_button_primary'
2639 'style' => '', // Any CSS class here
2640 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
2641 'attr' => array( 'id' => 'btn__status_bar__reset' )
2642 );
2643
2644 wpbc_flex_button( $params );
2645 }
2646
2647
2648 // </editor-fold>
2649
2650
2651 // <editor-fold defaultstate="collapsed" desc=" == Calendar Additional Settings UI == " >
2652
2653 /**
2654 * Select-box - Number of Months to Scroll
2655 *
2656 * @return void
2657 */
2658 function wpbc_ajx_cstm__ui__template__months_to_scroll(){
2659
2660 $booking_action = 'set_booking_max_monthes_in_calendar';
2661
2662 $el_id = 'ui_btn_cstm__' . $booking_action ;
2663
2664 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
2665
2666 ?><div class="ui_element ui_nowrap0"><?php
2667
2668 wpbc_flex_label( array( 'id' => $el_id
2669 , 'label' => '<span class="" style="font-weight:600;">' . __('Number of months to scroll' ,'booking') . ':</span>'
2670 ) );
2671 ?></div><?php
2672 ?><div class="ui_element ui_nowrap"><?php
2673
2674 // Options
2675 $months_options = array();
2676 for ($mm = 1; $mm < 12; $mm++) { $months_options[ $mm . 'm' ] = $mm . ' ' . __('month(s)' ,'booking'); }
2677 for ($yy = 1; $yy < 11; $yy++) { $months_options[ $yy . 'y' ] = $yy . ' ' . __('year(s)' ,'booking'); }
2678
2679 $params_select = array(
2680 'id' => $el_id // HTML ID of element
2681 , 'name' => $booking_action
2682 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
2683 , 'style' => '' // CSS of select element
2684 , 'class' => '' // CSS Class of select element
2685 //, 'multiple' => true
2686 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2687 , 'disabled' => false
2688 , 'disabled_options' => array() // If some options disabled, then it has to list here
2689 , 'options' => $months_options
2690 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
2691 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2692 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'calendar__booking_max_monthes_in_calendar', jQuery(this).val() );
2693 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_additional'} );
2694 wpbc_admin_show_message_processing( '' );
2695 "
2696 );
2697 wpbc_flex_select( $params_select );
2698
2699 wpbc_ajx_cstm__ui__selectbox_prior_btn( $el_id );
2700 wpbc_ajx_cstm__ui__selectbox_next_btn( $el_id );
2701 ?></div><?php
2702
2703 // Set checked specific OPTION depends on last action from user
2704 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2705 jQuery( document ).ready( function (){
2706 // Set selected option in dropdown list based on data. value
2707 jQuery( '#<?php echo $el_id; ?> option[value="' + data.ajx_data.calendar_settings.calendar__booking_max_monthes_in_calendar + '"]' ).prop( 'selected', true );
2708 } );
2709
2710 <?php if (0) { ?></script><?php } ?> #><?php
2711 }
2712
2713
2714 /**
2715 * Select-box - Start week day
2716 *
2717 * @return void
2718 */
2719 function wpbc_ajx_cstm__ui__template__start_day_weeek(){
2720
2721 $booking_action = 'set_booking_start_day_weeek';
2722
2723 $el_id = 'ui_btn_cstm__' . $booking_action ;
2724
2725 //if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { return false; }
2726
2727 ?><div class="ui_element ui_nowrap0"><?php
2728
2729 wpbc_flex_label( array( 'id' => $el_id
2730 , 'label' => '<span class="" style="font-weight:600;">' . __('Start Day of the week' ,'booking') . ':</span>'
2731 ) );
2732 ?></div><?php
2733 ?><div class="ui_element ui_nowrap"><?php
2734
2735 // Options
2736 $options = array(
2737 '0' => __('Sunday' ,'booking')
2738 , '1' => __('Monday' ,'booking')
2739 , '2' => __('Tuesday' ,'booking')
2740 , '3' => __('Wednesday' ,'booking')
2741 , '4' => __('Thursday' ,'booking')
2742 , '5' => __('Friday' ,'booking')
2743 , '6' => __('Saturday' ,'booking')
2744 );
2745 $params_select = array(
2746 'id' => $el_id // HTML ID of element
2747 , 'name' => $booking_action
2748 , 'label' => '' //__( 'Select the skin of the booking calendar', 'booking' )//__('Calendar Skin', 'booking')
2749 , 'style' => '' // CSS of select element
2750 , 'class' => '' // CSS Class of select element
2751 //, 'multiple' => true
2752 //, 'attr' => array( 'value_of_selected_option' => '{{selected_locale_value}}' ) // Any additional attributes, if this radio | checkbox element
2753 , 'disabled' => false
2754 , 'disabled_options' => array() // If some options disabled, then it has to list here
2755 , 'options' => $options
2756 //, 'value' => isset( $escaped_search_request_params[ $el_id ] ) ? $escaped_search_request_params[ $el_id ] : $defaults[ $el_id ] // Some Value from options array that selected by default
2757 //, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code
2758 , 'onchange' => "wpbc_ajx_customize_plugin.search_set_param( 'calendar__booking_start_day_weeek', jQuery(this).val() );
2759 wpbc_ajx_customize_plugin__send_request_with_params( {'do_action': 'save_calendar_additional'} );
2760 wpbc_admin_show_message_processing( '' );
2761 "
2762 );
2763 wpbc_flex_select( $params_select );
2764
2765 wpbc_ajx_cstm__ui__selectbox_prior_btn( $el_id );
2766 wpbc_ajx_cstm__ui__selectbox_next_btn( $el_id );
2767 ?></div><?php
2768
2769 // Set checked specific OPTION depends on last action from user
2770 ?><# <?php if (0) { ?><script type="text/javascript"><?php } ?>
2771 jQuery( document ).ready( function (){
2772 // Set selected option in dropdown list based on data. value
2773 jQuery( '#<?php echo $el_id; ?> option[value="' + data.ajx_data.calendar_settings.calendar__booking_start_day_weeek + '"]' ).prop( 'selected', true );
2774 } );
2775
2776 <?php if (0) { ?></script><?php } ?> #><?php
2777 }
2778
2779 // </editor-fold>