PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.1.3
LatePoint – Calendar Booking Plugin for Appointments and Events v5.1.3
5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / blocks / bricks / bricks_widget_book_button.php
latepoint / blocks / bricks Last commit date
bricks_widget_book_button.php 1 year ago bricks_widget_book_form.php 1 year ago bricks_widget_calendar.php 1 year ago bricks_widget_customer_dashboard.php 1 year ago bricks_widget_customer_login.php 1 year ago bricks_widget_list_of_resources.php 1 year ago
bricks_widget_book_button.php
407 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class Latepoint_Bricks_Widget_Book_Button extends \Bricks\Element {
8
9 public $category = 'latepoint';
10 public $name = 'latepoint_book_button';
11 public $icon = 'ti-control-stop';
12 public $scripts = ['init_booking_button'];
13
14
15 public function get_label(): string {
16 return esc_html__( 'Booking Button', 'latepoint' );
17 }
18
19 public function enqueue_scripts() {
20 if ( bricks_is_builder() ) {
21 wp_enqueue_script(
22 'bricks_widget_book_button_script',
23 LATEPOINT_PLUGIN_URL . 'blocks/assets/javascripts/bricks-widget-book-button.js',
24 [ 'jquery' ],
25 LATEPOINT_VERSION
26 );
27 }
28 }
29
30 public function set_control_groups() {
31 $this->control_groups['general'] = array(
32 'title' => esc_html__( 'Booking Form Settings', 'latepoint' ),
33 'tab' => 'content',
34 );
35 $this->control_groups['step_settings'] = array(
36 'title' => esc_html__( 'Step Settings', 'latepoint' ),
37 'tab' => 'content',
38 );
39 $this->control_groups['other_settings'] = array(
40 'title' => esc_html__( 'Other Settings', 'latepoint' ),
41 'tab' => 'content',
42 );
43 $this->control_groups['button_styling'] = array(
44 'title' => esc_html__( 'Button', 'latepoint' ),
45 'tab' => 'style',
46 );
47 unset( $this->control_groups['_typography'] );
48 unset( $this->control_groups['_transform'] );
49 }
50
51 // Set builder controls
52 public function set_controls() {
53 $this->controls['_width']['default'] = '100%';
54
55 $this->controls['caption'] = array(
56 'label' => esc_html__( 'Button Caption', 'latepoint' ),
57 'tab' => 'content',
58 'group' => 'general',
59 'type' => 'text',
60 'default' => esc_html__( 'Book Appointment', 'latepoint' ),
61 );
62 $this->controls['hide_summary'] = array(
63 'tab' => 'content',
64 'group' => 'general',
65 'label' => esc_html__( 'Hide Summary', 'latepoint' ),
66 'type' => 'checkbox',
67 'inline' => true,
68 );
69
70 $this->controls['hide_side_panel'] = array(
71 'tab' => 'content',
72 'group' => 'general',
73 'label' => esc_html__( 'Hide Side Panel', 'latepoint' ),
74 'type' => 'checkbox',
75 'inline' => true,
76 );
77
78
79 #step settings group
80
81 $this->controls['selected_agent'] = [
82 'tab' => 'content',
83 'group' => 'step_settings',
84 'label' => esc_html__( 'Preselected Agent', 'latepoint' ),
85 'type' => 'select',
86 'options' => OsBricksHelper::get_data('selected_agents'),
87 'placeholder' => esc_html__( 'Preselected Agent', 'latepoint' ),
88 'searchable' => true,
89 'clearable' => true,
90 ];
91 $this->controls['selected_service'] = [
92 'tab' => 'content',
93 'group' => 'step_settings',
94 'label' => esc_html__( 'Preselected Service', 'latepoint' ),
95 'type' => 'select',
96 'options' => OsBricksHelper::get_data('selected_services'),
97 'placeholder' => esc_html__( 'Preselected Service', 'latepoint' ),
98 'searchable' => true,
99 'clearable' => true,
100 ];
101 $this->controls['selected_service_category'] = [
102 'tab' => 'content',
103 'group' => 'step_settings',
104 'label' => esc_html__( 'Preselected Service Category', 'latepoint' ),
105 'type' => 'select',
106 'options' => OsBricksHelper::get_data('selected_service_categories'),
107 'placeholder' => esc_html__( 'Preselected Service Category', 'latepoint' ),
108 'searchable' => true,
109 'clearable' => true,
110 ];
111
112 $this->controls['selected_bundle'] = [
113 'tab' => 'content',
114 'group' => 'step_settings',
115 'label' => esc_html__( 'Preselected Bundle', 'latepoint' ),
116 'type' => 'select',
117 'options' => OsBricksHelper::get_data('selected_bundles'),
118 'placeholder' => esc_html__( 'Preselected Bundle', 'latepoint' ),
119 'searchable' => true,
120 'clearable' => true,
121 ];
122
123 $this->controls['selected_location'] = [
124 'tab' => 'content',
125 'group' => 'step_settings',
126 'label' => esc_html__( 'Preselected Location', 'latepoint' ),
127 'type' => 'select',
128 'options' => OsBricksHelper::get_data('selected_locations'),
129 'placeholder' => esc_html__( 'Preselected Location', 'latepoint' ),
130 'searchable' => true,
131 'clearable' => true,
132 ];
133 $this->controls['selected_start_date'] = [
134 'tab' => 'content',
135 'group' => 'step_settings',
136 'label' => esc_html__( 'Preselected Booking Start Date', 'latepoint' ),
137 'type' => 'datepicker',
138 'inline' => true,
139 'options' => [
140 'enableTime' => false,
141 'time_24hr' => true
142 ]
143 ];
144 $this->controls['selected_start_time'] = [
145 'tab' => 'content',
146 'group' => 'step_settings',
147 'label' => esc_html__( 'Preselected Booking Start Time', 'latepoint' ),
148 'type' => 'datepicker',
149 'inline' => true,
150 'options' => [
151 'enableTime' => true,
152 'time_24hr' => true,
153 'noCalendar' => true
154 ]
155 ];
156
157 $this->controls['selected_duration'] = [
158 'tab' => 'content',
159 'group' => 'step_settings',
160 'label' => esc_html__( 'Preselected Duration', 'latepoint' ),
161 'type' => 'number',
162 'min' => 0,
163 'inline' => true,
164 ];
165 $this->controls['selected_total_attendees'] = [
166 'tab' => 'content',
167 'group' => 'step_settings',
168 'label' => esc_html__( 'Preselected Total Attendees', 'latepoint' ),
169 'type' => 'number',
170 'min' => 0,
171 'inline' => true,
172 ];
173
174
175 #other settings
176 $this->controls['source_id'] = [
177 'tab' => 'content',
178 'group' => 'other_settings',
179 'label' => esc_html__( 'Source ID', 'latepoint' ),
180 'type' => 'number',
181 'min' => 0,
182 'inline' => true,
183 ];
184 $this->controls['calendar_start_date'] = [
185 'tab' => 'content',
186 'group' => 'other_settings',
187 'label' => esc_html__( 'Calendar Start Date', 'latepoint' ),
188 'type' => 'datepicker',
189 'inline' => true,
190 'options' => [
191 'enableTime' => false,
192 'time_24hr' => true
193 ]
194 ];
195 $this->controls['show_services'] = [
196 'tab' => 'content',
197 'group' => 'other_settings',
198 'label' => esc_html__( 'Show Services', 'latepoint' ),
199 'type' => 'select',
200 'options' => OsBricksHelper::get_data('services'),
201 'placeholder' => esc_html__( 'Show Services', 'latepoint' ),
202 'multiple' => true,
203 'searchable' => true,
204 'clearable' => true,
205 ];
206 $this->controls['show_service_categories'] = [
207 'tab' => 'content',
208 'group' => 'other_settings',
209 'label' => esc_html__( 'Show Service Categories', 'latepoint' ),
210 'type' => 'select',
211 'options' => OsBricksHelper::get_data('service_categories'),
212 'placeholder' => esc_html__( 'Show Service Categories', 'latepoint' ),
213 'multiple' => true,
214 'searchable' => true,
215 'clearable' => true,
216 ];
217 $this->controls['show_agents'] = [
218 'tab' => 'content',
219 'group' => 'other_settings',
220 'label' => esc_html__( 'Show Agents', 'latepoint' ),
221 'type' => 'select',
222 'options' => OsBricksHelper::get_data('agents'),
223 'placeholder' => esc_html__( 'Show Agents', 'latepoint' ),
224 'multiple' => true,
225 'searchable' => true,
226 'clearable' => true,
227 ];
228
229
230 $this->controls['align'] = array(
231 'tab' => 'style',
232 'group' => 'button_styling',
233 'label' => esc_html__( 'Position', 'latepoint' ),
234 'type' => 'text-align',
235 'inline' => true,
236 'exclude' => 'justify',
237 'css' => array(
238 array(
239 'property' => 'text-align',
240 'selector' => '.latepoint-book-button-wrapper',
241 )
242 ),
243 'required' => array( 'button_full_width', '!=', true ),
244 );
245 $this->controls['button_full_width'] = array(
246 'tab' => 'style',
247 'group' => 'button_styling',
248 'label' => esc_html__( 'Full Width', 'latepoint' ),
249 'type' => 'checkbox',
250 'inline' => true,
251 'default' => false,
252 'css' => array(
253 array(
254 'property' => 'display',
255 'selector' => '.latepoint-book-button',
256 'value' => 'block',
257 'required' => true
258 ),
259 ),
260 );
261
262 $this->controls['btn_font'] = [
263 'tab' => 'style',
264 'group' => 'button_styling',
265 'label' => esc_html__( 'Typography', 'latepoint' ),
266 'type' => 'typography',
267 'css' => [
268 [
269 'property' => 'typography',
270 'selector' => '.latepoint-book-button',
271 ],
272 ],
273 'exclude' => ['text-align', 'color'],
274 'inline' => true,
275 ];
276
277 $this->controls['bg_color_separator'] = array(
278 'tab' => 'style',
279 'group' => 'button_styling',
280 'type' => 'separator',
281 );
282
283 $this->controls['bg_color'] = array(
284 'tab' => 'style',
285 'group' => 'button_styling',
286 'label' => esc_html__( 'Background Color', 'latepoint' ),
287 'type' => 'color',
288 'css' => array(
289 array(
290 'property' => 'background-color',
291 'selector' => '.latepoint-book-button',
292 ),
293 ),
294 );
295
296 $this->controls['text_color'] = array(
297 'tab' => 'style',
298 'group' => 'button_styling',
299 'label' => esc_html__( 'Text Color', 'latepoint' ),
300 'type' => 'color',
301 'css' => array(
302 array(
303 'property' => 'color',
304 'selector' => '.latepoint-book-button',
305 ),
306 ),
307 );
308
309 $this->controls['border_separator'] = array(
310 'tab' => 'style',
311 'group' => 'button_styling',
312 'type' => 'separator',
313 );
314
315 $this->controls['btn_border'] = [
316 'tab' => 'style',
317 'group' => 'button_styling',
318 'label' => esc_html__( 'Border', 'latepoint' ),
319 'type' => 'border',
320 'css' => [
321 [
322 'property' => 'border',
323 'selector' => '.latepoint-book-button',
324 ],
325 ],
326 'inline' => true,
327 'small' => true,
328 ];
329
330 $this->controls['btn_shadow'] = [
331 'tab' => 'style',
332 'group' => 'button_styling',
333 'label' => esc_html__( 'Box Shadow', 'latepoint' ),
334 'type' => 'box-shadow',
335 'css' => [
336 [
337 'property' => 'box-shadow',
338 'selector' => '.latepoint-book-button',
339 ],
340 ],
341 'inline' => true,
342 'small' => true,
343 ];
344
345 $this->controls['bg_padding_separator'] = array(
346 'tab' => 'style',
347 'group' => 'button_styling',
348 'type' => 'separator',
349 );
350
351 $this->controls['btn_padding'] = [
352 'tab' => 'style',
353 'group' => 'button_styling',
354 'label' => esc_html__( 'Padding', 'latepoint' ),
355 'type' => 'dimensions',
356 'css' => [
357 [
358 'property' => 'padding',
359 'selector' => '.latepoint-book-button',
360 ]
361 ],
362 'default' => [
363 'top' => '15px',
364 'right' => '30px',
365 'bottom' => '15px',
366 'left' => '30px',
367 ]
368 ];
369
370 }
371
372
373 // Render element HTML
374 public function render() {
375
376 $allowed_params = [
377 'caption',
378 'hide_summary',
379 'hide_side_panel',
380 'selected_agent',
381 'selected_service',
382 'selected_bundle',
383 'selected_service_category',
384 'selected_location',
385 'selected_start_date',
386 'selected_start_time',
387 'selected_duration',
388 'selected_total_attendees',
389 'source_id',
390 'calendar_start_date',
391 'show_services',
392 'show_service_categories',
393 'show_agents',
394 'show_locations',
395 'btn_wrapper_classes',
396 'btn_classes'
397 ];
398 $this->settings['btn_wrapper_classes'] = 'bricks-button-wrapper';
399 $this->settings['btn_classes'] = 'bricks-button bricks-background-primary';
400
401 $params = OsBlockHelper::attributes_to_data_params($this->settings, $allowed_params);
402 $output = "<div {$this->render_attributes( '_root' )}>";
403 $output .= do_shortcode('[latepoint_book_button ' . $params . ']');
404 $output .= '</div>';
405 echo $output;
406 }
407 }