PluginProbe
Booking Calendar / 10.11.3
Booking Calendar v10.11.3
11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 10.11 All 204 releases
booking / includes / page-form-simple / form_simple__toolbar_free.php

form_simple__toolbar_free.php in Booking Calendar 10.11.3, at includes/page-form-simple/form_simple__toolbar_free.php

274 lines 9.4 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 * @package Booking Calendar
4 * @category Simple Booking Form -- Toolbar
5 * @author wpdevelop
6 *
7 * @web-site https://wpbookingcalendar.com/
8 * @email [email protected]
9 *
10 * @modified 2024-08-16
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15
16 function wpbc_simple_form__toolbar_free() {
17
18
19 if ( function_exists( 'wpbc_flex_toolbar__booking_form__top_tabs__ps' ) ) {
20 wpbc_flex_toolbar__booking_form__top_tabs__ps();
21 } else {
22
23 wpbc_bs_toolbar_tabs_html_container_start();
24 wpbc_bs_display_tab( array(
25 'title' => __('Form Fields Setup', 'booking')
26 , 'hint' => array( 'title' => __('Customize booking form in a simple setup' ,'booking') , 'position' => 'bottom' )
27 , 'onclick' => ""
28 // , 'onclick' => "jQuery( '#wpbc_form_field_free' ).show();"
29 // . "jQuery( '.wpbc_center_preview' ).hide();"
30 // . "jQuery('.wpbc_container_hide__on_left_nav_click .nav-tab').removeClass('nav-tab-active');"
31 // . "jQuery(this).addClass('nav-tab-active');"
32 // . "jQuery('.nav-tab i.icon-white').removeClass('icon-white');"
33 // . "jQuery('.nav-tab-active i').addClass('icon-white');"
34 , 'attr' => array( 'style' => 'order:0;' ) // In paid version set it as second tab
35 , 'font_icon' => 'wpbc_icn_format_align_left'
36 , 'default' => true
37 ) );
38 wpbc_bs_toolbar_tabs_html_container_end();
39 }
40
41 // css class: wpbc_flex_toolbar_container
42
43 ?><div class="wpbc_ajx_toolbar wpbc_no_borders0"><?php
44 ?><div class="ui_container ui_container_toolbar ui_container_small ui_container_custom_forms_selection ui_container_actions_row_1"><?php
45
46 // Reset - Form Template -
47 ?><div class="ui_group ui_group___add_new_field"><?php
48
49 ?><div class="ui_element"><?php
50 wpbc_flex_ui__simple_form__select_field();
51 ?></div><?php
52
53 ?><div class="ui_element"><?php
54 wpbc_flex_ui__simple_form__add_field_button();
55 ?></div><?php
56
57 ?></div><?php
58
59 // Select - Custom Forms -
60 if ( function_exists( 'wpbc_flex_toolbar__custom_forms' ) ) {
61 ?><div class="ui_group"><div class="ui_element"><div class="wpbc_ui_separtor" style="margin-left: 8px;"></div></div></div><?php
62 wpbc_flex_toolbar__custom_forms();
63 }
64
65 // Reset - Form Template -
66 ?><div class="ui_group ui_group___reset_form_templates" style="margin-left:auto;"><?php
67
68 ?><div class="ui_element"><?php
69 wpbc_flex_ui__simple_form__reset_form_template__button();
70 ?></div><?php
71
72 ?></div><?php
73
74
75 ?></div><?php
76 ?></div><?php
77
78 }
79
80 // ---------------------------------------------------------------------------------------------------------------------
81 // UI Elements.
82 // ---------------------------------------------------------------------------------------------------------------------
83 function wpbc_flex_ui__simple_form__select_field(){
84
85 $id = 'select_form_help_shortcode';
86
87 $templates = array();
88
89 $templates['selector_hint'] = array(
90 'title' => __( 'Select', 'booking' ) . ' ' . __( 'Form Field', 'booking' ),
91 'id' => '',
92 'name' => '',
93 'style' => 'font-weight: 400;border-bottom:1px dashed #ccc;color:#ccc;',
94 'class' => '',
95 'disabled' => false,
96 'selected' => false,
97 'attr' => array(),
98 );
99 $templates['text'] = array(
100 'title' => __( 'Text', 'booking' ),
101 'id' => '',
102 'name' => '',
103 'style' => '',
104 'class' => '',
105 'disabled' => false,
106 'selected' => false,
107 'attr' => array(),
108 );
109 $templates['select'] = array(
110 'title' => __( 'Dropdown', 'booking' ),
111 'id' => '',
112 'name' => '',
113 'style' => '',
114 'class' => '',
115 'disabled' => false,
116 'selected' => false,
117 'attr' => array(),
118 );
119 $templates['textarea'] = array(
120 'title' => __( 'Textarea', 'booking' ),
121 'id' => '',
122 'name' => '',
123 'style' => '',
124 'class' => '',
125 'disabled' => false,
126 'selected' => false,
127 'attr' => array(),
128 );
129 $templates['checkbox'] = array(
130 'title' => __( 'Checkbox', 'booking' ),
131 'id' => '',
132 'name' => '',
133 'style' => '',
134 'class' => '',
135 'disabled' => false,
136 'selected' => false,
137 'attr' => array(),
138 );
139
140 $templates['optgroup_af_s'] = array(
141 'optgroup' => true,
142 'close' => false,
143 'title' => '&nbsp;' . __( 'Times Fields', 'booking' ),
144 );
145
146 $templates['rangetime'] = array(
147 'title' => __( 'Time Slots', 'booking' ),
148 'id' => '',
149 'name' => '',
150 'style' => '',
151 'class' => '',
152 'disabled' => false,
153 'selected' => false,
154 'attr' => array(),
155 );
156 $templates['durationtime'] = array(
157 'title' => __( 'Duration Time', 'booking' ),
158 'id' => '',
159 'name' => '',
160 'style' => '',
161 'class' => '',
162 'disabled' => false,
163 'selected' => false,
164 'attr' => array(),
165 );
166 $templates['starttime'] = array(
167 'title' => __( 'Start Time', 'booking' ),
168 'id' => '',
169 'name' => '',
170 'style' => '',
171 'class' => '',
172 'disabled' => false,
173 'selected' => false,
174 'attr' => array(),
175 );
176
177 // If time slot field already exist, then re-update it to Edit Field.
178 $templates = apply_filters( 'wpbc_form_gen_free_fields_selection', $templates, wpbc_simple_form__db__get_visual_form_structure() );
179
180 $templates['optgroup_af_e'] = array( 'optgroup' => true, 'close' => true );
181
182
183 $params_select = array(
184 'id' => $id, // HTML ID of element.
185 'name' => $id,
186 'options' => $templates,
187 'onchange' => "wpbc_show_fields_generator( this.options[this.selectedIndex].value );",
188 // 'label' => __('Booking Form', 'booking') . ':' // Label (optional).
189 // , 'style' => '' // CSS of select element.
190 // , 'class' => '' // CSS Class of select element.
191 // , 'multiple' => false //.
192 // , 'attr' => array() // Any additional attributes, if this radio | checkbox element.
193 // , 'disabled' => false //.
194 // , 'disabled_options' => array( 2, 30 ) // If some options disabled, then it has to list here.
195 // , 'value' => ( isset( $escaped_search_request_params[ 'next_days' ] ) ) ? $escaped_search_request_params[ 'next_days' ] : '183' // Some Value from options array that selected by default.
196 // , 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val(), 'in element:' , jQuery( this ) );" // JavaScript code.
197 );
198
199 wpbc_flex_select( $params_select );
200 }
201
202
203 function wpbc_flex_ui__simple_form__add_field_button() {
204
205 $id = 'simple_form__add_field_button';
206
207 $el_id = 'ui_btn_' . $id;
208
209 $params = array(
210 'type' => 'button',
211 'title' => __( 'Add New Field', 'booking' ),
212 'hint' => array(
213 'title' => __( 'Select a field type from the drop-down list on the left.', 'booking' ),
214 'position' => 'bottom',
215 ),
216 'link' => 'javascript:void(0)', // Direct link or skip it.
217 'action' => "if ( 'selector_hint'===jQuery( '#select_form_help_shortcode').val() ) { " .
218 "wpbc_field_highlight( '#select_form_help_shortcode' ); " .
219 "alert( '" . esc_js( esc_attr( __( 'Select a field type from the drop-down list on the left.', 'booking' ) ) ) . "' ); " .
220 "} else { " .
221 "wpbc_show_fields_generator( jQuery( '#select_form_help_shortcode').val() );" .
222 "}",
223 'icon' => array(
224 'icon_font' => 'wpbc_icn_add',
225 'position' => 'right',
226 'icon_img' => '',
227 ),
228 'class' => 'wpbc_ui_button wpbc_bs_button_green', // 'wpbc_ui_button_primary'.
229 'style' => '', // Any CSS class here.
230 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
231 'attr' => array( 'id' => $el_id ),
232 );
233
234 wpbc_flex_button( $params );
235 }
236
237
238 /**
239 * Button for Reset to default booking form
240 * (import form fields from OLD free version
241 */
242 function wpbc_flex_ui__simple_form__reset_form_template__button() {
243
244 $id = 'reset_form_template__button';
245
246 $el_id = 'ui_btn_' . $id;
247
248 $params = array(
249 'type' => 'button',
250 'title' => __( 'Reset', 'booking' ) . '&nbsp;&nbsp;', // Title of the button.
251 'hint' => array(
252 'title' => __( 'Reset booking form fields', 'booking' ),
253 'position' => 'bottom',
254 ),
255 'link' => 'javascript:void(0)', // Direct link or skip it.
256 'action' => "if ( wpbc_are_you_sure('" .
257 esc_js( __( 'Do you really want to do this ?', 'booking' ) ) .
258 "') ) {" .
259 "var selected_val = 'standard';" .
260 "jQuery('#reset_to_default_form').val( selected_val );jQuery('#wpbc_form_field_free').trigger( 'submit' );" .
261 "}",
262 'icon' => array(
263 'icon_font' => 'wpbc_icn_rotate_left wpbc_icn_settings_backup_restore0 wpbc_icn_system_update_alt0',
264 'position' => 'right',
265 'icon_img' => '',
266 ),
267 'class' => 'wpbc_ui_button wpbc_ui_button_danger', // 'wpbc_ui_button_primary'.
268 'style' => '', // Any CSS class here.
269 'mobile_show_text' => true, // Show or hide text, when viewing on Mobile devices (small window size).
270 'attr' => array( 'id' => $el_id ),
271 );
272
273 wpbc_flex_button( $params );
274 }