PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.6.6
LatePoint – Calendar Booking Plugin for Appointments and Events v5.6.6
5.6.7 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_list_of_resources.php
latepoint / blocks / bricks Last commit date
bricks_widget_book_button.php 3 weeks ago bricks_widget_book_form.php 3 weeks 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_list_of_resources.php
705 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class Latepoint_Bricks_Widget_List_Of_Resources extends \Bricks\Element {
8
9 public $category = 'latepoint';
10 public $name = 'list_of_resources';
11 public $icon = 'ti-layout-grid2';
12
13
14 public function get_label(): string {
15 return esc_html__( 'List Of Resources', 'latepoint' );
16 }
17
18 public function set_control_groups() {
19 $this->control_groups['general'] = array(
20 'title' => esc_html__( 'Booking Form Settings', 'latepoint' ),
21 'tab' => 'content',
22 );
23
24 $this->control_groups['main_settings'] = array(
25 'title' => esc_html__( 'Settings', 'latepoint' ),
26 'tab' => 'content',
27 );
28
29 $this->control_groups['step_settings'] = array(
30 'title' => esc_html__( 'Step Settings', 'latepoint' ),
31 'tab' => 'content',
32 );
33
34 $this->control_groups['items_settings'] = array(
35 'title' => esc_html__( 'Items Settings', 'latepoint' ),
36 'tab' => 'content',
37 );
38
39 $this->control_groups['other_settings'] = array(
40 'title' => esc_html__( 'Other Settings', 'latepoint' ),
41 'tab' => 'content',
42 );
43
44 $this->control_groups['card_styling'] = array(
45 'title' => esc_html__( 'Card', 'latepoint' ),
46 'tab' => 'style',
47 );
48
49 $this->control_groups['button_styling'] = array(
50 'title' => esc_html__( 'Button', 'latepoint' ),
51 'tab' => 'style',
52 );
53
54 unset( $this->control_groups['_typography'] );
55 unset( $this->control_groups['_transform'] );
56 }
57
58 // Set builder controls
59 public function set_controls() {
60 $this->controls['_width']['default'] = '100%';
61
62 $this->controls['button_caption'] = array(
63 'label' => esc_html__( 'Button Caption', 'latepoint' ),
64 'tab' => 'content',
65 'group' => 'general',
66 'type' => 'text',
67 'default' => esc_html__( 'Book Now', 'latepoint' ),
68 );
69 $this->controls['hide_summary'] = array(
70 'tab' => 'content',
71 'group' => 'general',
72 'label' => esc_html__( 'Hide Summary', 'latepoint' ),
73 'type' => 'checkbox',
74 'inline' => true,
75 );
76
77 $this->controls['hide_side_panel'] = array(
78 'tab' => 'content',
79 'group' => 'general',
80 'label' => esc_html__( 'Hide Side Panel', 'latepoint' ),
81 'type' => 'checkbox',
82 'inline' => true,
83 );
84
85
86 #main settings group
87
88 $this->controls['items'] = [
89 'tab' => 'content',
90 'group' => 'main_settings',
91 'label' => esc_html__( 'Resource Type', 'latepoint' ),
92 'type' => 'select',
93 'options' => [
94 'services' => esc_html__( 'Services', 'latepoint' ),
95 'agents' => esc_html__( 'Agents', 'latepoint' ),
96 'locations' => esc_html__( 'Locations', 'latepoint' ),
97 'bundles' => esc_html__( 'Bundles', 'latepoint' ),
98 ],
99 'default' => 'services'
100 ];
101
102 $this->controls['columns'] = [
103 'tab' => 'content',
104 'group' => 'main_settings',
105 'label' => esc_html__( 'Number of columns', 'latepoint' ),
106 'type' => 'select',
107 'options' => [
108 '1' => esc_html__( 'One', 'latepoint' ),
109 '2' => esc_html__( 'Two', 'latepoint' ),
110 '3' => esc_html__( 'Three', 'latepoint' ),
111 '4' => esc_html__( 'Four', 'latepoint' ),
112 '5' => esc_html__( 'Five', 'latepoint' ),
113 ],
114 'default' => '4'
115 ];
116
117 $this->controls['hide_image'] = array(
118 'tab' => 'content',
119 'group' => 'main_settings',
120 'label' => esc_html__( 'Hide Image', 'latepoint' ),
121 'type' => 'checkbox',
122 'inline' => true,
123 'required' => array( 'items', '=', 'services' ),
124 );
125
126 $this->controls['hide_price'] = array(
127 'tab' => 'content',
128 'group' => 'main_settings',
129 'label' => esc_html__( 'Hide Price', 'latepoint' ),
130 'type' => 'checkbox',
131 'inline' => true,
132 'required' => array( 'items', '=', ['services', 'bundles'] ),
133 );
134
135 $this->controls['hide_description'] = array(
136 'tab' => 'content',
137 'group' => 'main_settings',
138 'label' => esc_html__( 'Hide Description', 'latepoint' ),
139 'type' => 'checkbox',
140 'inline' => true,
141 'required' => array( 'items', '=', ['services', 'bundles'] ),
142 );
143
144
145 #step settings group
146
147 $this->controls['selected_service'] = [
148 'tab' => 'content',
149 'group' => 'step_settings',
150 'label' => esc_html__( 'Preselected Service', 'latepoint' ),
151 'type' => 'select',
152 'options' => OsBricksHelper::get_data('selected_services'),
153 'placeholder' => esc_html__( 'Preselected Service', 'latepoint' ),
154 'searchable' => true,
155 'clearable' => true,
156 'required' => array( 'items', '!=', ['services', 'bundles'] ),
157 ];
158
159 $this->controls['selected_bundle'] = [
160 'tab' => 'content',
161 'group' => 'step_settings',
162 'label' => esc_html__( 'Preselected Bundle', 'latepoint' ),
163 'type' => 'select',
164 'options' => OsBricksHelper::get_data('selected_bundles'),
165 'placeholder' => esc_html__( 'Preselected Bundle', 'latepoint' ),
166 'searchable' => true,
167 'clearable' => true,
168 'required' => array( 'items', '!=', ['services', 'bundles'] ),
169 ];
170
171 $this->controls['selected_agent'] = [
172 'tab' => 'content',
173 'group' => 'step_settings',
174 'label' => esc_html__( 'Preselected Agent', 'latepoint' ),
175 'type' => 'select',
176 'options' => OsBricksHelper::get_data('selected_agents'),
177 'placeholder' => esc_html__( 'Preselected Agent', 'latepoint' ),
178 'searchable' => true,
179 'clearable' => true,
180 'required' => array( 'items', '!=', ['agents'] ),
181 ];
182
183 $this->controls['selected_location'] = [
184 'tab' => 'content',
185 'group' => 'step_settings',
186 'label' => esc_html__( 'Preselected Location', 'latepoint' ),
187 'type' => 'select',
188 'options' => OsBricksHelper::get_data('selected_locations'),
189 'placeholder' => esc_html__( 'Preselected Location', 'latepoint' ),
190 'searchable' => true,
191 'clearable' => true,
192 'required' => array( 'items', '!=', ['locations'] ),
193 ];
194 $this->controls['selected_start_date'] = [
195 'tab' => 'content',
196 'group' => 'step_settings',
197 'label' => esc_html__( 'Preselected Booking Start Date', 'latepoint' ),
198 'type' => 'datepicker',
199 'inline' => true,
200 'options' => [
201 'enableTime' => false,
202 'time_24hr' => true
203 ]
204 ];
205 $this->controls['selected_start_time'] = [
206 'tab' => 'content',
207 'group' => 'step_settings',
208 'label' => esc_html__( 'Preselected Booking Start Time', 'latepoint' ),
209 'type' => 'datepicker',
210 'inline' => true,
211 'options' => [
212 'enableTime' => true,
213 'time_24hr' => true,
214 'noCalendar' => true
215 ]
216 ];
217 $this->controls['selected_duration'] = [
218 'tab' => 'content',
219 'group' => 'step_settings',
220 'label' => esc_html__( 'Preselected Duration', 'latepoint' ),
221 'type' => 'number',
222 'min' => 0,
223 'inline' => true,
224 ];
225 $this->controls['selected_total_attendees'] = [
226 'tab' => 'content',
227 'group' => 'step_settings',
228 'label' => esc_html__( 'Preselected Total Attendees', 'latepoint' ),
229 'type' => 'number',
230 'min' => 0,
231 'inline' => true,
232 ];
233
234
235 # items settings group
236 $this->controls['limit'] = [
237 'tab' => 'content',
238 'group' => 'items_settings',
239 'label' => esc_html__( 'Max Number of Items Shown', 'latepoint' ),
240 'type' => 'number',
241 'min' => 0,
242 'inline' => true,
243 ];
244
245 $this->controls['item_ids_services'] = [
246 'tab' => 'content',
247 'group' => 'items_settings',
248 'label' => esc_html__( 'Show Selected Services', 'latepoint' ),
249 'type' => 'select',
250 'options' => OsBricksHelper::get_data( 'services' ),
251 'placeholder' => esc_html__( 'Show Selected Services', 'latepoint' ),
252 'multiple' => true,
253 'searchable' => true,
254 'clearable' => true,
255 'required' => array( 'items', '=', 'services' ),
256 ];
257 $this->controls['services_categories_ids'] = [
258 'tab' => 'content',
259 'group' => 'items_settings',
260 'label' => esc_html__( 'Show Services Categories', 'latepoint' ),
261 'type' => 'select',
262 'options' => OsBricksHelper::get_data( 'service_categories' ),
263 'placeholder' => esc_html__( 'Show Services Categories', 'latepoint' ),
264 'multiple' => true,
265 'searchable' => true,
266 'clearable' => true,
267 'required' => array( 'items', '=', 'services' ),
268 ];
269
270 $this->controls['item_ids_agents'] = [
271 'tab' => 'content',
272 'group' => 'items_settings',
273 'label' => esc_html__( 'Show Selected Agents', 'latepoint' ),
274 'placeholder' => esc_html__( 'Show Selected Agents', 'latepoint' ),
275 'type' => 'select',
276 'options' => OsBricksHelper::get_data( 'agents' ),
277 'multiple' => true,
278 'searchable' => true,
279 'clearable' => true,
280 'required' => array( 'items', '=', 'agents' ),
281 ];
282 $this->controls['item_ids_locations'] = [
283 'tab' => 'content',
284 'group' => 'items_settings',
285 'label' => esc_html__( 'Show Selected Locations', 'latepoint' ),
286 'placeholder' => esc_html__( 'Show Selected Locations', 'latepoint' ),
287 'type' => 'select',
288 'options' => OsBricksHelper::get_data( 'locations' ),
289 'multiple' => true,
290 'searchable' => true,
291 'clearable' => true,
292 'required' => array( 'items', '=', 'locations' ),
293 ];
294 $this->controls['location_categories_ids'] = [
295 'tab' => 'content',
296 'group' => 'items_settings',
297 'label' => esc_html__( 'Show Location Categories', 'latepoint' ),
298 'placeholder' => esc_html__( 'Show Location Categories', 'latepoint' ),
299 'type' => 'select',
300 'options' => OsBricksHelper::get_data( 'location_categories' ),
301 'multiple' => true,
302 'searchable' => true,
303 'clearable' => true,
304 'required' => array( 'items', '=', 'locations' ),
305 ];
306
307 $this->controls['item_ids_bundles'] = [
308 'tab' => 'content',
309 'group' => 'items_settings',
310 'label' => esc_html__( 'Show Selected Bundles', 'latepoint' ),
311 'type' => 'select',
312 'options' => OsBricksHelper::get_data( 'bundles' ),
313 'placeholder' => esc_html__( 'Show Selected Bundles', 'latepoint' ),
314 'multiple' => true,
315 'searchable' => true,
316 'clearable' => true,
317 'required' => array( 'items', '=', 'bundles' ),
318 ];
319
320 #other settings
321 $this->controls['source_id'] = [
322 'tab' => 'content',
323 'group' => 'other_settings',
324 'label' => esc_html__( 'Source ID', 'latepoint' ),
325 'type' => 'number',
326 'min' => 0,
327 'inline' => true,
328 ];
329 $this->controls['calendar_start_date'] = [
330 'tab' => 'content',
331 'group' => 'other_settings',
332 'label' => esc_html__( 'Calendar Start Date', 'latepoint' ),
333 'type' => 'datepicker',
334 'inline' => true,
335 'options' => [
336 'enableTime' => false,
337 'time_24hr' => true
338 ]
339 ];
340 $this->controls['show_services'] = [
341 'tab' => 'content',
342 'group' => 'other_settings',
343 'label' => esc_html__( 'Show Services', 'latepoint' ),
344 'placeholder' => esc_html__( 'All Services', 'latepoint' ),
345 'type' => 'select',
346 'options' => OsBricksHelper::get_data('services'),
347 'multiple' => true,
348 'searchable' => true,
349 'clearable' => true,
350 'required' => array( 'items', '!=', ['services', 'bundles'] ),
351 ];
352
353 $this->controls['show_service_categories'] = [
354 'tab' => 'content',
355 'group' => 'other_settings',
356 'label' => esc_html__( 'Show Service Categories', 'latepoint' ),
357 'placeholder' => esc_html__( 'All Service Categories', 'latepoint' ),
358 'type' => 'select',
359 'options' => OsBricksHelper::get_data('service_categories'),
360 'multiple' => true,
361 'searchable' => true,
362 'clearable' => true,
363 'required' => array( 'items', '!=', ['services', 'bundles'] ),
364 ];
365 $this->controls['show_agents'] = [
366 'tab' => 'content',
367 'group' => 'other_settings',
368 'label' => esc_html__( 'Show Agents', 'latepoint' ),
369 'placeholder' => esc_html__( 'All Agents', 'latepoint' ),
370 'type' => 'select',
371 'options' => OsBricksHelper::get_data('agents'),
372 'multiple' => true,
373 'searchable' => true,
374 'clearable' => true,
375 'required' => array( 'items', '!=', 'agents' ),
376 ];
377
378 $this->controls['show_locations'] = [
379 'tab' => 'content',
380 'group' => 'other_settings',
381 'label' => esc_html__( 'Show Locations', 'latepoint' ),
382 'type' => 'select',
383 'options' => OsBricksHelper::get_data('locations'),
384 'multiple' => true,
385 'searchable' => true,
386 'clearable' => true,
387 'required' => array( 'items', '!=', 'locations' ),
388 ];
389
390
391 $this->controls['btn_font'] = [
392 'tab' => 'style',
393 'group' => 'button_styling',
394 'label' => esc_html__( 'Typography', 'latepoint' ),
395 'type' => 'typography',
396 'css' => [
397 [
398 'property' => 'typography',
399 'selector' => '.latepoint-book-button',
400 ],
401 ],
402 'exclude' => ['text-align', 'color'],
403 'inline' => true,
404 ];
405
406 $this->controls['button_full_width'] = array(
407 'tab' => 'style',
408 'group' => 'button_styling',
409 'label' => esc_html__( 'Full Width', 'latepoint' ),
410 'type' => 'checkbox',
411 'inline' => true,
412 'default' => false,
413 'css' => array(
414 array(
415 'property' => 'display',
416 'selector' => '.latepoint-book-button',
417 'value' => 'block',
418 ),
419 ),
420 );
421
422 $this->controls['bg_color_separator'] = array(
423 'tab' => 'style',
424 'group' => 'button_styling',
425 'type' => 'separator',
426 );
427
428 $this->controls['bg_color'] = array(
429 'tab' => 'style',
430 'group' => 'button_styling',
431 'label' => esc_html__( 'Background Color', 'latepoint' ),
432 'type' => 'color',
433 'css' => array(
434 array(
435 'property' => 'background-color',
436 'selector' => '.latepoint-book-button',
437 ),
438 ),
439 );
440
441 $this->controls['text_color'] = array(
442 'tab' => 'style',
443 'group' => 'button_styling',
444 'label' => esc_html__( 'Text Color', 'latepoint' ),
445 'type' => 'color',
446 'css' => array(
447 array(
448 'property' => 'color',
449 'selector' => '.latepoint-book-button',
450 ),
451 ),
452 );
453
454 $this->controls['border_separator'] = array(
455 'tab' => 'style',
456 'group' => 'button_styling',
457 'type' => 'separator',
458 );
459
460 $this->controls['btn_border'] = [
461 'tab' => 'style',
462 'group' => 'button_styling',
463 'label' => esc_html__( 'Border', 'latepoint' ),
464 'type' => 'border',
465 'css' => [
466 [
467 'property' => 'border',
468 'selector' => '.latepoint-book-button',
469 ],
470 ],
471 'inline' => true,
472 'small' => true,
473 ];
474
475 $this->controls['btn_shadow'] = [
476 'tab' => 'style',
477 'group' => 'button_styling',
478 'label' => esc_html__( 'Box Shadow', 'latepoint' ),
479 'type' => 'box-shadow',
480 'css' => [
481 [
482 'property' => 'box-shadow',
483 'selector' => '.latepoint-book-button',
484 ],
485 ],
486 'inline' => true,
487 'small' => true,
488 ];
489
490 $this->controls['bg_padding_separator'] = array(
491 'tab' => 'style',
492 'group' => 'button_styling',
493 'type' => 'separator',
494 );
495
496 $this->controls['btn_padding'] = [
497 'tab' => 'style',
498 'group' => 'button_styling',
499 'label' => esc_html__( 'Padding', 'latepoint' ),
500 'type' => 'dimensions',
501 'css' => [
502 [
503 'property' => 'padding',
504 'selector' => '.latepoint-book-button',
505 ]
506 ],
507 ];
508
509
510 #card settings
511
512 $this->controls['align'] = array(
513 'tab' => 'style',
514 'group' => 'card_styling',
515 'label' => esc_html__( 'Align', 'latepoint' ),
516 'type' => 'text-align',
517 'inline' => true,
518 'exclude' => 'justify',
519 'css' => array(
520 array(
521 'property' => 'text-align',
522 'selector' => '.resource-item',
523 )
524 )
525 );
526
527 $this->controls['card_bg_color'] = array(
528 'tab' => 'style',
529 'group' => 'card_styling',
530 'label' => esc_html__( 'Background Color', 'latepoint' ),
531 'type' => 'color',
532 'css' => array(
533 array(
534 'property' => 'background-color',
535 'selector' => '.resource-item',
536 ),
537 ),
538 );
539
540 $this->controls['cbg_color_separator'] = array(
541 'tab' => 'style',
542 'group' => 'card_styling',
543 'type' => 'separator',
544 );
545
546 $this->controls['card_title'] = [
547 'tab' => 'style',
548 'group' => 'card_styling',
549 'label' => esc_html__( 'Title', 'latepoint' ),
550 'type' => 'typography',
551 'exclude' => ['text-align'],
552 'css' => [
553 [
554 'property' => 'typography',
555 'selector' => '.ri-name > h3, .ri-title',
556 ],
557 ],
558 'inline' => true,
559 ];
560
561 $this->controls['card_price'] = [
562 'tab' => 'style',
563 'group' => 'card_styling',
564 'label' => esc_html__( 'Price', 'latepoint' ),
565 'type' => 'typography',
566 'exclude' => ['text-align'],
567 'required' => array(
568 [ 'hide_price', '!=', true],
569 ['items', '=', ['services', 'bundles']]
570 ),
571 'css' => [
572 [
573 'property' => 'typography',
574 'selector' => '.ri-price',
575 ],
576 ],
577 'inline' => true,
578 ];
579
580 $this->controls['card_descr'] = [
581 'tab' => 'style',
582 'group' => 'card_styling',
583 'label' => esc_html__( 'Description', 'latepoint' ),
584 'type' => 'typography',
585 'exclude' => ['text-align'],
586 'required' => array(
587 [ 'hide_description', '!=', true],
588 ['items', '=', ['services', 'bundles']]
589 ),
590 'css' => [
591 [
592 'property' => 'typography',
593 'selector' => '.ri-description',
594 ],
595 ],
596 'inline' => true,
597 ];
598
599 $this->controls['cborder_separator'] = array(
600 'tab' => 'style',
601 'group' => 'card_styling',
602 'type' => 'separator',
603 );
604
605 $this->controls['card_border'] = [
606 'tab' => 'style',
607 'group' => 'card_styling',
608 'label' => esc_html__( 'Border', 'latepoint' ),
609 'type' => 'border',
610 'css' => [
611 [
612 'property' => 'border',
613 'selector' => '.resource-item',
614 ],
615 ],
616 'inline' => true,
617 'small' => true,
618 ];
619
620 $this->controls['card_shadow'] = [
621 'tab' => 'style',
622 'group' => 'card_styling',
623 'label' => esc_html__( 'Box Shadow', 'latepoint' ),
624 'type' => 'box-shadow',
625 'css' => [
626 [
627 'property' => 'box-shadow',
628 'selector' => '.resource-item',
629 ],
630 ],
631 'inline' => true,
632 'small' => true,
633 ];
634
635 $this->controls['card_padding_separator'] = array(
636 'tab' => 'style',
637 'group' => 'button_styling',
638 'type' => 'separator',
639 );
640
641 $this->controls['card_padding'] = [
642 'tab' => 'style',
643 'group' => 'card_styling',
644 'label' => esc_html__( 'Padding', 'latepoint' ),
645 'type' => 'dimensions',
646 'css' => [
647 [
648 'property' => 'padding',
649 'selector' => '.resource-item',
650 ]
651 ],
652 ];
653
654
655 }
656
657
658 // Render element HTML
659 public function render() {
660
661 $this->settings['item_ids'] = OsBlockHelper::get_ids_from_resources($this->settings['items'], $this->settings);
662 $this->settings['group_ids'] = $this->settings['services_categories_ids'] ?? $this->settings['location_categories_ids'] ?? [];
663
664 $allowed_params = [
665 'items',
666 'columns',
667 'hide_summary',
668 'hide_side_panel',
669 'hide_image',
670 'hide_price',
671 'hide_description',
672 'selected_agent',
673 'selected_service',
674 'selected_bundle',
675 'selected_service_category',
676 'selected_location',
677 'selected_start_date',
678 'selected_start_time',
679 'selected_duration',
680 'selected_total_attendees',
681 'limit',
682 'item_ids',
683 'group_ids',
684 'source_id',
685 'calendar_start_date',
686 'show_services',
687 'show_service_categories',
688 'show_agents',
689 'show_locations',
690 'button_caption',
691 'btn_wrapper_classes',
692 'btn_classes'
693 ];
694 $this->settings['btn_wrapper_classes'] = 'bricks-button-wrapper';
695 $this->settings['btn_classes'] = 'bricks-button bricks-background-primary';
696
697 $params = OsBlockHelper::attributes_to_data_params($this->settings, $allowed_params);
698
699 $output = "<div {$this->render_attributes( '_root' )}>";
700 $output .= do_shortcode('[latepoint_resources ' . $params . ']');
701 $output .= '</div>';
702 echo $output;
703
704 }
705 }