| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentBooking\App\Services\Integrations\Elementor\Widgets; |
| 4 |
|
| 5 |
use FluentBooking\App\Models\Calendar; |
| 6 |
use FluentBooking\App\Hooks\Handlers\BlockEditorHandler; |
| 7 |
use FluentBooking\App\Models\CalendarSlot; |
| 8 |
|
| 9 |
class FcalCalendar extends \Elementor\Widget_Base |
| 10 |
{ |
| 11 |
|
| 12 |
/** |
| 13 |
* Get widget name. |
| 14 |
* |
| 15 |
* @return string Widget name. |
| 16 |
*/ |
| 17 |
public function get_name() |
| 18 |
{ |
| 19 |
return 'fluentbooking-calendar'; |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Get widget title. |
| 24 |
* |
| 25 |
* @return string Widget title. |
| 26 |
*/ |
| 27 |
public function get_title() |
| 28 |
{ |
| 29 |
return esc_html__('Calendar', 'fluent-booking'); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Get widget icon. |
| 34 |
* |
| 35 |
* @return string Widget icon. |
| 36 |
*/ |
| 37 |
public function get_icon() |
| 38 |
{ |
| 39 |
return 'fluent-booking-icon'; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Get widget categories. |
| 44 |
* |
| 45 |
* @return array Widget categories. |
| 46 |
*/ |
| 47 |
public function get_categories() |
| 48 |
{ |
| 49 |
return ['fluentbooking']; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Get widget keywords. |
| 54 |
* |
| 55 |
* @return array Widget keywords. |
| 56 |
*/ |
| 57 |
public function get_keywords() |
| 58 |
{ |
| 59 |
return ['fluent', 'booking', 'calendar', 'team', 'event']; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Register FluentBooking widget controls. |
| 64 |
* |
| 65 |
* @access protected |
| 66 |
*/ |
| 67 |
protected function register_controls() |
| 68 |
{ |
| 69 |
|
| 70 |
$this->start_controls_section( |
| 71 |
'content_section', |
| 72 |
[ |
| 73 |
'label' => esc_html__('Content', 'fluent-booking'), |
| 74 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 75 |
] |
| 76 |
); |
| 77 |
$this->add_control( |
| 78 |
'title', |
| 79 |
[ |
| 80 |
'label' => esc_html__('Title', 'fluent-booking'), |
| 81 |
'type' => \Elementor\Controls_Manager::TEXT, |
| 82 |
'placeholder' => esc_html__('Enter title here', 'fluent-booking'), |
| 83 |
] |
| 84 |
); |
| 85 |
$this->add_control( |
| 86 |
'description', |
| 87 |
[ |
| 88 |
'label' => esc_html__('Description', 'fluent-booking'), |
| 89 |
'type' => \Elementor\Controls_Manager::TEXTAREA, |
| 90 |
'rows' => 4, |
| 91 |
'placeholder' => esc_html__('Enter description here', 'fluent-booking'), |
| 92 |
] |
| 93 |
); |
| 94 |
$this->add_control( |
| 95 |
'header_image', |
| 96 |
[ |
| 97 |
'label' => esc_html__('Choose Header Image', 'fluent-booking'), |
| 98 |
'type' => \Elementor\Controls_Manager::MEDIA |
| 99 |
] |
| 100 |
); |
| 101 |
$this->add_control( |
| 102 |
'show_host_info', |
| 103 |
[ |
| 104 |
'label' => esc_html__('Host Info', 'fluent-booking'), |
| 105 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 106 |
'label_on' => esc_html__('Show', 'fluent-booking'), |
| 107 |
'label_off' => esc_html__('Hide', 'fluent-booking'), |
| 108 |
'return_value' => 'yes', |
| 109 |
'default' => 'yes', |
| 110 |
] |
| 111 |
); |
| 112 |
|
| 113 |
$this->add_control( |
| 114 |
'selected_cal_id', |
| 115 |
[ |
| 116 |
'label' => esc_html__('Select Calendar', 'fluent-booking'), |
| 117 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 118 |
'label_block' => true, |
| 119 |
'options' => $this->getCalendars() |
| 120 |
] |
| 121 |
); |
| 122 |
|
| 123 |
$this->add_control( |
| 124 |
'selected_event_ids', |
| 125 |
[ |
| 126 |
'label' => esc_html__('Select Events', 'fluent-booking'), |
| 127 |
'type' => \Elementor\Controls_Manager::SELECT2, |
| 128 |
'label_block' => true, |
| 129 |
'multiple' => true, |
| 130 |
'options' => [] |
| 131 |
] |
| 132 |
); |
| 133 |
|
| 134 |
$this->end_controls_section(); |
| 135 |
|
| 136 |
$this->styleSettings(); |
| 137 |
} |
| 138 |
|
| 139 |
private function styleSettings() |
| 140 |
{ |
| 141 |
$this->start_controls_section( |
| 142 |
'content_style', |
| 143 |
[ |
| 144 |
'label' => esc_html__('Style', 'fluent-booking'), |
| 145 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 146 |
] |
| 147 |
); |
| 148 |
$this->add_control('fcal_primary_color', |
| 149 |
[ |
| 150 |
'label' => esc_html__('Primary Color', 'fluent-booking'), |
| 151 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 152 |
'selectors' => [ |
| 153 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .calendar .day .is-today, |
| 154 |
{{WRAPPER}} .fcal_slot_picker .fcal_spot_lists .fcal_spot.fcal_spot_selected .fcal_spot_name' => 'color: {{VALUE}}', |
| 155 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .calendar .day .is-today:before' => 'background: {{VALUE}}', |
| 156 |
'{{WRAPPER}} .fcal_slot_picker .fcal_spot_lists .fcal_spot .fcal_spot_confirm' => 'background: {{VALUE}}', |
| 157 |
'{{WRAPPER}} .calendar_nav .fcal_nav_active svg' => 'color: {{VALUE}}', |
| 158 |
'{{WRAPPER}} .fcal_timezone_select .svelte-select.focused' => 'border-color: {{VALUE}} !important', |
| 159 |
'{{WRAPPER}} .fcal_timezone_select .svelte-select .svelte-select-list .item.active' => 'border-color: {{VALUE}} !important', |
| 160 |
'{{WRAPPER}} .fcal_slot_picker .fcal_spot_lists .fcal_spot.fcal_spot_selected' => 'border-color: {{VALUE}}', |
| 161 |
'{{WRAPPER}} .fcal_slot_picker .fcal_spot_lists .fcal_spot:hover' => 'border-color: {{VALUE}}', |
| 162 |
'{{WRAPPER}} .fcal_timezone_select .svelte-select .svelte-select-list .item.hover' => 'background: {{VALUE}} !important', |
| 163 |
'{{WRAPPER}} .fcal_slot_picker .fcal_spot_lists .fcal_spot:before' => 'background: {{VALUE}} !important', |
| 164 |
'{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content input:focus' => 'border-color: {{VALUE}} !important', |
| 165 |
'{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content select:focus' => 'border-color: {{VALUE}} !important', |
| 166 |
'{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content textarea:focus' => 'border-color: {{VALUE}} !important', |
| 167 |
'{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item button' => 'border-color: {{VALUE}}; background: {{VALUE}};', |
| 168 |
'{{WRAPPER}} span.fcal_host_badge' => 'color: {{VALUE}}', |
| 169 |
'{{WRAPPER}} span.fcal_host_badge:before' => 'background: {{VALUE}}', |
| 170 |
'{{WRAPPER}} .fcal_normal_booking_footer a' => 'color: {{VALUE}}', |
| 171 |
'{{WRAPPER}} .fcal_timezone_select .svelte-select.list-open:before' => 'border-bottom-color: {{VALUE}}; border-left-color: {{VALUE}}', |
| 172 |
'{{WRAPPER}} .fcal_loading_dates_inner .wrapper .cube' => 'background-color: {{VALUE}}', |
| 173 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_icon_item .fcal_multi_duration .fcal_duration.is_selected' => 'background-color: {{VALUE}}', |
| 174 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .calendar .day.day-enabled:hover span' => 'background-color: {{VALUE}}', |
| 175 |
'{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content .fcal_radio_group .fcal_radio_icon::before, |
| 176 |
{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .fcal_date_event_details .fcal_date_event_details_header .fcal_back button.fcal_svg:hover' => 'background: {{VALUE}}', |
| 177 |
'{{WRAPPER}} .fcal_no_availability button' => 'background-color: {{VALUE}}', |
| 178 |
'{{WRAPPER}} .fcal_slot button svg path' => 'stroke: {{VALUE}}', |
| 179 |
'{{WRAPPER}} .fcal_slot_wrapper .fcal_back .fcal_back_btn:hover, |
| 180 |
{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content .fcal_radio_group input:checked ~ .fcal_radio_icon, |
| 181 |
{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content .fcal_custom_checkbox input:checked ~ .checkbox_mark, |
| 182 |
{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content .fcal_custom_checkbox input:focus ~ .checkbox_mark' => 'border-color: {{VALUE}}', |
| 183 |
'{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content .fcal_custom_checkbox input:checked ~ .checkbox_mark' => 'background: {{VALUE}}' |
| 184 |
], |
| 185 |
] |
| 186 |
); |
| 187 |
$this->add_control('fcal_border_color', |
| 188 |
[ |
| 189 |
'label' => esc_html__('Border Color', 'fluent-booking'), |
| 190 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 191 |
'selectors' => [ |
| 192 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_side' => 'border-right-color: {{VALUE}}', |
| 193 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .fcal_date_event_details .fcal_date_event_details_header' => 'border-bottom-color: {{VALUE}}', |
| 194 |
'{{WRAPPER}} {{WRAPPER}} .fcal_payment_items table tbody td' => 'border-bottom-color: {{VALUE}} !important', |
| 195 |
'{{WRAPPER}} .fcal_wrap .fcal_calendar_inner, |
| 196 |
{{WRAPPER}} .fcal_slot_picker .fcal_slot_picker_header .fcal_slot_picker_header_action, {{WRAPPER}} .fcal_slot_picker .fcal_spot_lists .fcal_spot, |
| 197 |
{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content select, |
| 198 |
{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content textarea, |
| 199 |
{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content input, |
| 200 |
{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content .fcal_radio_group .fcal_radio_icon, |
| 201 |
{{WRAPPER}} .fcal_booking_form_wrap .fcal_booking_form .fcal_form_item .fcal_input_content .fcal_custom_checkbox .checkbox_mark, |
| 202 |
{{WRAPPER}} .fcal_payment_items table' => 'border-color: {{VALUE}}', |
| 203 |
'{{WRAPPER}} .fcal_timezone_select .svelte-select, |
| 204 |
{{WRAPPER}} .fcal_slot_picker .fcal_slot_picker_header .fcal_back .fcal_svg, |
| 205 |
{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .fcal_date_event_details .fcal_date_event_details_header .fcal_back button.fcal_svg' => 'border-color: {{VALUE}} !important', |
| 206 |
'{{WRAPPER}} .fcal_slot' => 'border-bottom-color: {{VALUE}}', |
| 207 |
'{{WRAPPER}} .fcal_slots, |
| 208 |
{{WRAPPER}} .fcal_slot .book_now' => 'border-color: {{VALUE}}' |
| 209 |
], |
| 210 |
] |
| 211 |
); |
| 212 |
$this->add_control( |
| 213 |
'avatar-radius', |
| 214 |
[ |
| 215 |
'label' => esc_html__('Avatar Radius', 'fluent-booking'), |
| 216 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 217 |
'size_units' => ['px', '%', 'em', 'rem', 'custom'], |
| 218 |
'default' => [ |
| 219 |
'top' => 8, |
| 220 |
'right' => 8, |
| 221 |
'bottom' => 8, |
| 222 |
'left' => 8, |
| 223 |
'unit' => 'px', |
| 224 |
'isLinked' => true, |
| 225 |
], |
| 226 |
'selectors' => [ |
| 227 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_side .fcal_author_avatar img, |
| 228 |
{{WRAPPER}} .fcal_author_header img, |
| 229 |
{{WRAPPER}} .fcal_calendar_wrapper .fcal_calendar_header .fcal_person_avatar img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 230 |
], |
| 231 |
'condition' => [ |
| 232 |
'show_host_info' => 'yes', |
| 233 |
], |
| 234 |
] |
| 235 |
); |
| 236 |
|
| 237 |
$this->add_control( |
| 238 |
'date-radius', |
| 239 |
[ |
| 240 |
'label' => esc_html__('Date Radius', 'fluent-booking'), |
| 241 |
'type' => \Elementor\Controls_Manager::DIMENSIONS, |
| 242 |
'size_units' => ['px', '%', 'em', 'rem', 'custom'], |
| 243 |
'default' => [ |
| 244 |
'top' => 4, |
| 245 |
'right' => 4, |
| 246 |
'bottom' => 4, |
| 247 |
'left' => 4, |
| 248 |
'unit' => 'px', |
| 249 |
'isLinked' => true, |
| 250 |
], |
| 251 |
'selectors' => [ |
| 252 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .calendar .day.day-enabled span' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 253 |
], |
| 254 |
] |
| 255 |
); |
| 256 |
|
| 257 |
$this->add_control('enabled_date_background', |
| 258 |
[ |
| 259 |
'label' => esc_html__('Enabled Date Background', 'fluent-booking'), |
| 260 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 261 |
'selectors' => [ |
| 262 |
'{{WRAPPER}} .fcal_payment_items table thead th' => 'background-color: {{VALUE}}', |
| 263 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .calendar .day.day-enabled span' => 'background-color: {{VALUE}}', |
| 264 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_icon_item .fcal_multi_duration .fcal_duration:not(.is_selected)' => 'background-color: {{VALUE}}', |
| 265 |
], |
| 266 |
] |
| 267 |
); |
| 268 |
$this->add_control('enabled_date_color', |
| 269 |
[ |
| 270 |
'label' => esc_html__('Enabled Date Color', 'fluent-booking'), |
| 271 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 272 |
'selectors' => [ |
| 273 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .calendar .day.day-enabled span' => 'color: {{VALUE}}', |
| 274 |
], |
| 275 |
] |
| 276 |
); |
| 277 |
$this->add_control('disabled_date_color', |
| 278 |
[ |
| 279 |
'label' => esc_html__('Disabled Date Color', 'fluent-booking'), |
| 280 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 281 |
'selectors' => [ |
| 282 |
'{{WRAPPER}} .fcal_calendar_inner .fcal_date_wrapper .calendar .day.day-disabled' => 'color: {{VALUE}}', |
| 283 |
], |
| 284 |
] |
| 285 |
); |
| 286 |
|
| 287 |
$this->end_controls_section(); |
| 288 |
} |
| 289 |
|
| 290 |
private function getCalendars() |
| 291 |
{ |
| 292 |
$calendars = Calendar::with(['events' => function ($query) { |
| 293 |
$query->where('status', 'active'); |
| 294 |
}])->where('status', 'active')->get(); |
| 295 |
|
| 296 |
$formattedValue = []; |
| 297 |
|
| 298 |
if (empty($calendars)) { |
| 299 |
return $formattedValue; |
| 300 |
} |
| 301 |
|
| 302 |
foreach ($calendars as $calendar) { |
| 303 |
$formattedValue[$calendar->id] = $calendar->title; |
| 304 |
} |
| 305 |
|
| 306 |
return $formattedValue; |
| 307 |
} |
| 308 |
|
| 309 |
private function getCalendarEvents($selectedCalId, $eventIds) |
| 310 |
{ |
| 311 |
if (empty($eventIds) || empty($selectedCalId)) { |
| 312 |
return []; |
| 313 |
} |
| 314 |
|
| 315 |
$events = CalendarSlot::where('calendar_id', $selectedCalId) |
| 316 |
->whereIn('id', $eventIds) |
| 317 |
->get(); |
| 318 |
|
| 319 |
$calendar = Calendar::find($selectedCalId); |
| 320 |
|
| 321 |
if (!$calendar || !$events) { |
| 322 |
return []; |
| 323 |
} |
| 324 |
|
| 325 |
$formattedData = [ |
| 326 |
'user_profile' => $calendar->getAuthorProfile(), |
| 327 |
'events' => $this->formatEvents($events), |
| 328 |
]; |
| 329 |
|
| 330 |
$formattedData['user_profile']['description'] = $calendar->description; |
| 331 |
|
| 332 |
return $formattedData; |
| 333 |
} |
| 334 |
|
| 335 |
|
| 336 |
private function formatEvents($events) |
| 337 |
{ |
| 338 |
$formattedEvents = []; |
| 339 |
foreach ($events as $event) { |
| 340 |
$event->description = $event->getDescription(); |
| 341 |
$formattedEvents[] = [ |
| 342 |
'title' => $event->title, |
| 343 |
'color_schema' => $event->color_schema, |
| 344 |
'short_description' => $event->short_description, |
| 345 |
'durations' => $event->getAvailableDurations(), |
| 346 |
]; |
| 347 |
} |
| 348 |
|
| 349 |
return $formattedEvents; |
| 350 |
} |
| 351 |
|
| 352 |
|
| 353 |
/** |
| 354 |
* Render currency widget output on the frontend. |
| 355 |
* |
| 356 |
* @access protected |
| 357 |
*/ |
| 358 |
protected function render() |
| 359 |
{ |
| 360 |
$settings = $this->get_settings_for_display(); |
| 361 |
$events = $this->getCalendarEvents($settings['selected_cal_id'], $settings['selected_event_ids']); |
| 362 |
|
| 363 |
$blockEditor = new BlockEditorHandler(); |
| 364 |
|
| 365 |
$hostInfo = true; |
| 366 |
if ($settings['show_host_info'] == 'yes') { |
| 367 |
$hostInfo = false; |
| 368 |
} |
| 369 |
|
| 370 |
$attributes = [ |
| 371 |
'calendarId' => $settings['selected_cal_id'], |
| 372 |
'eventIds' => $settings['selected_event_ids'], |
| 373 |
'title' => $settings['title'], |
| 374 |
'description' => $settings['description'], |
| 375 |
'headerImage' => $settings['header_image'], |
| 376 |
'hideInfo' => $hostInfo |
| 377 |
]; |
| 378 |
|
| 379 |
if (\Elementor\Plugin::$instance->editor->is_edit_mode()) : |
| 380 |
// Output for editor |
| 381 |
?> |
| 382 |
<style> |
| 383 |
.fcal_calendar_wrapper .fcal_calendar_header { |
| 384 |
text-align: center; |
| 385 |
display: flex; |
| 386 |
flex-direction: column; |
| 387 |
align-items: center; |
| 388 |
justify-content: center; |
| 389 |
margin-bottom: 30px; |
| 390 |
} |
| 391 |
.fcal_calendar_wrapper .fcal_calendar_header .fcal_person_avatar { |
| 392 |
display: inline-block; |
| 393 |
} |
| 394 |
.fcal_calendar_wrapper .fcal_calendar_header .fcal_person_avatar img { |
| 395 |
max-width: 74px; |
| 396 |
max-height: 74px; |
| 397 |
width: 100%; |
| 398 |
object-fit: cover; |
| 399 |
border-radius: 8px; |
| 400 |
} |
| 401 |
.fcal_calendar_wrapper .fcal_calendar_header .fcal_calendar_title { |
| 402 |
font-size: 1.5rem; |
| 403 |
margin: 6px 0 0.2rem 0; |
| 404 |
line-height: 1.2; |
| 405 |
color: #1b2533; |
| 406 |
font-weight: 500; |
| 407 |
} |
| 408 |
.fcal_calendar_wrapper .fcal_calendar_header .fcal_calendar_description { |
| 409 |
font-size: 14px; |
| 410 |
line-height: 20px; |
| 411 |
color: #6b7280; |
| 412 |
font-weight: 400; |
| 413 |
} |
| 414 |
.fcal_slots_wrap { |
| 415 |
margin-top: 1rem; |
| 416 |
} |
| 417 |
.fcal_slots { |
| 418 |
display: grid; |
| 419 |
grid-template-columns: 1fr; |
| 420 |
border: 1px solid #d6dae1; |
| 421 |
border-radius: 8px; |
| 422 |
overflow: hidden; |
| 423 |
} |
| 424 |
.fcal_slots .fcal_slot:last-child { |
| 425 |
border-bottom: none; |
| 426 |
} |
| 427 |
.fcal_slot { |
| 428 |
border-bottom: 1px solid #d6dae1; |
| 429 |
padding: 16px 24px; |
| 430 |
transition: 0.3s; |
| 431 |
background: #ffffff; |
| 432 |
} |
| 433 |
.fcal_slot > .fcal_card { |
| 434 |
text-decoration: none; |
| 435 |
display: flex; |
| 436 |
align-items: center; |
| 437 |
justify-content: space-between; |
| 438 |
} |
| 439 |
.fcal_slot h2 { |
| 440 |
font-size: 16px; |
| 441 |
font-weight: 700; |
| 442 |
line-height: 24px; |
| 443 |
position: relative; |
| 444 |
margin: 0; |
| 445 |
color: #1B2533; |
| 446 |
padding-left: 19px; |
| 447 |
} |
| 448 |
.fcal_slot h2 .fcal_slot_color_schema { |
| 449 |
width: 10px; |
| 450 |
height: 10px; |
| 451 |
border-radius: 50%; |
| 452 |
position: absolute; |
| 453 |
left: 0; |
| 454 |
top: 8px; |
| 455 |
} |
| 456 |
.fcal_slot .fcal_description { |
| 457 |
font-size: 16px; |
| 458 |
font-weight: 400; |
| 459 |
line-height: 24px; |
| 460 |
color: #6b7280; |
| 461 |
margin: 0 0 7px; |
| 462 |
padding-left: 19px; |
| 463 |
} |
| 464 |
.fcal_slot .fcal_slot_duration { |
| 465 |
font-size: 12px; |
| 466 |
font-weight: 500; |
| 467 |
line-height: 18px; |
| 468 |
margin: 0; |
| 469 |
display: inline-flex; |
| 470 |
align-items: center; |
| 471 |
gap: 7px; |
| 472 |
color: #445164; |
| 473 |
padding-left: 19px; |
| 474 |
} |
| 475 |
.fcal_slot .book_now { |
| 476 |
border: 1px solid #d6dae1; |
| 477 |
color: #1b2533; |
| 478 |
min-width: fit-content; |
| 479 |
font-size: 14px; |
| 480 |
font-weight: 500; |
| 481 |
line-height: 20px; |
| 482 |
display: inline-flex; |
| 483 |
align-items: center; |
| 484 |
border-radius: 8px; |
| 485 |
background: transparent; |
| 486 |
padding: 7px 16px 7px 16px; |
| 487 |
transition: 0.3s; |
| 488 |
gap: 8px; |
| 489 |
position: relative; |
| 490 |
} |
| 491 |
.fcal_author_header { |
| 492 |
text-align: center; |
| 493 |
} |
| 494 |
.fcal_author_header img { |
| 495 |
width: 96px; |
| 496 |
height: 96px; |
| 497 |
object-fit: cover; |
| 498 |
border-radius: 8px; |
| 499 |
display: block; |
| 500 |
margin: auto auto 10px auto; |
| 501 |
} |
| 502 |
.fcal_author_header h1 { |
| 503 |
font-size: 20px; |
| 504 |
font-weight: 700; |
| 505 |
line-height: 28px; |
| 506 |
margin: 0; |
| 507 |
color: #1b2533; |
| 508 |
} |
| 509 |
.fcal_author_header p { |
| 510 |
font-size: 16px; |
| 511 |
line-height: 24px; |
| 512 |
margin: 8px 0 0 0; |
| 513 |
color: #6b7280; |
| 514 |
} |
| 515 |
</style> |
| 516 |
<div class="fcal_calendar_wrapper"> |
| 517 |
<div class="fcal_cals_wrap"> |
| 518 |
<div class="fcal_calendar_header"> |
| 519 |
<?php if ($settings['header_image']) : ?> |
| 520 |
<div class="fcal_person_avatar"> |
| 521 |
<img decoding="async" src="<?php echo esc_url($settings['header_image']['url']); ?>" alt="<?php echo esc_html($settings['title']); ?>"> |
| 522 |
</div> |
| 523 |
<?php endif; |
| 524 |
if ($settings['title']) : ?> |
| 525 |
<h2 class="fcal_calendar_title"><?php echo esc_html($settings['title']); ?></h2> |
| 526 |
<?php |
| 527 |
endif; |
| 528 |
if ($settings['description']) : ?> |
| 529 |
<div class="fcal_calendar_description"> |
| 530 |
<?php echo esc_html($settings['description']); ?> |
| 531 |
</div> |
| 532 |
<?php endif; ?> |
| 533 |
</div> |
| 534 |
</div> |
| 535 |
|
| 536 |
<?php |
| 537 |
if (isset($events['events']) && !empty($events['events'])) : ?> |
| 538 |
<div class="fluent_booking_team_view"> |
| 539 |
<?php if (!$hostInfo) : ?> |
| 540 |
<div class="fcal_author_header"> |
| 541 |
<img src="<?php echo esc_url($events['user_profile']['avatar']); ?>" alt="<?php echo esc_attr($events['user_profile']['name']); ?>"> |
| 542 |
<div class="author_info"> |
| 543 |
<h1><?php echo esc_html($events['user_profile']['name']); ?></h1> |
| 544 |
<?php if ($events['user_profile']['description']) : ?> |
| 545 |
<p class="fcal_description"><?php echo esc_html($events['user_profile']['description']); ?></p> |
| 546 |
<?php endif; ?> |
| 547 |
</div> |
| 548 |
</div> |
| 549 |
<?php endif; ?> |
| 550 |
<div class="fcal_slots_wrap"> |
| 551 |
<div class="fcal_slots"> |
| 552 |
<?php foreach ($events['events'] as $event) : ?> |
| 553 |
<div class="fcal_slot"> |
| 554 |
<div class="fcal_card fcal_event_card"> |
| 555 |
<div class="fcal_slot_content"> |
| 556 |
<h2> |
| 557 |
<span class="fcal_slot_color_schema" style="background: <?php echo esc_attr($event['color_schema']); ?>"></span> |
| 558 |
<?php echo esc_html($event['title']); ?> |
| 559 |
</h2> |
| 560 |
<p class="fcal_description"> |
| 561 |
<?php echo esc_html($event['short_description']); ?> |
| 562 |
</p> |
| 563 |
<?php foreach ($event['durations'] as $duration) : ?> |
| 564 |
<span class="fcal_slot_duration"> |
| 565 |
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" |
| 566 |
viewBox="0 0 14 14" |
| 567 |
fill="none"> |
| 568 |
<path d="M12.8334 7C12.8334 10.22 10.22 12.8333 7.00002 12.8333C3.78002 12.8333 1.16669 10.22 1.16669 7C1.16669 3.78 3.78002 1.16666 7.00002 1.16666C10.22 1.16666 12.8334 3.78 12.8334 7Z" |
| 569 |
stroke="#445164" stroke-linecap="round" |
| 570 |
stroke-linejoin="round"></path> |
| 571 |
<path d="M9.16418 8.855L7.35585 7.77584C7.04085 7.58917 6.78418 7.14 6.78418 6.7725V4.38084" |
| 572 |
stroke="#445164" stroke-linecap="round" |
| 573 |
stroke-linejoin="round"></path> |
| 574 |
</svg> |
| 575 |
<?php echo esc_html($duration); ?> |
| 576 |
</span> |
| 577 |
<?php endforeach; ?> |
| 578 |
</div> |
| 579 |
<span class="book_now"> |
| 580 |
Book Now |
| 581 |
</span> |
| 582 |
</div> |
| 583 |
</div> |
| 584 |
<?php endforeach; ?> |
| 585 |
</div> |
| 586 |
</div> |
| 587 |
</div> |
| 588 |
<?php else : ?> |
| 589 |
<div class="fcal_empty"><?php esc_html_e('Please Select the Event(s)', 'fluent-booking'); ?></div> |
| 590 |
<?php endif; ?> |
| 591 |
</div> |
| 592 |
<?php else : |
| 593 |
// Output for frontend |
| 594 |
echo $blockEditor->fcalRenderCalendarManagementBlock($attributes); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 595 |
endif; |
| 596 |
?> |
| 597 |
<?php |
| 598 |
|
| 599 |
} |
| 600 |
|
| 601 |
public function content_template() |
| 602 |
{ |
| 603 |
|
| 604 |
} |
| 605 |
} |
| 606 |
|