PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.5.21
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.5.21
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
fluent-booking / app / Hooks / Handlers / AdminMenuHandler.php

AdminMenuHandler.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.5.21, at app/Hooks/Handlers/AdminMenuHandler.php

812 lines 36.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\App\Hooks\Handlers;
4
5 use FluentBooking\App\App;
6 use FluentBooking\App\Models\Calendar;
7 use FluentBooking\App\Models\CalendarSlot;
8 use FluentBooking\App\Models\User;
9 use FluentBooking\App\Services\DateTimeHelper;
10 use FluentBooking\App\Services\Helper;
11 use FluentBooking\App\Services\PermissionManager;
12 use FluentBooking\App\Services\TransStrings;
13
14 class AdminMenuHandler
15 {
16 public function register()
17 {
18 add_action('admin_menu', [$this, 'add']);
19
20 add_action('admin_enqueue_scripts', function () {
21 if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'fluent-booking') { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
22 return;
23 }
24 $this->enqueueAssets();
25 }, 100);
26 }
27
28 public function add()
29 {
30 $capability = PermissionManager::getMenuPermission();
31 $menuPriority = 26;
32
33 if (defined('FLUENTCRM')) {
34 $menuPriority = 4;
35 }
36
37 add_menu_page(
38 __('Fluent Booking', 'fluent-booking'),
39 __('Fluent Booking', 'fluent-booking'),
40 $capability,
41 'fluent-booking',
42 [$this, 'render'],
43 $this->getMenuIcon(),
44 $menuPriority
45 );
46
47 add_submenu_page(
48 'fluent-booking',
49 __('Dashboard', 'fluent-booking'),
50 __('Dashboard', 'fluent-booking'),
51 $capability,
52 'fluent-booking',
53 [$this, 'render']
54 );
55
56 add_submenu_page(
57 'fluent-booking',
58 __('Calendars', 'fluent-booking'),
59 __('Calendars', 'fluent-booking'),
60 $capability,
61 'fluent-booking#/calendars',
62 [$this, 'render']
63 );
64
65 add_submenu_page(
66 'fluent-booking',
67 __('Bookings', 'fluent-booking'),
68 __('Bookings', 'fluent-booking'),
69 $capability,
70 'fluent-booking#/scheduled-events',
71 [$this, 'render']
72 );
73
74 add_submenu_page(
75 'fluent-booking',
76 __('Availability', 'fluent-booking'),
77 __('Availability', 'fluent-booking'),
78 $capability,
79 'fluent-booking#/availability',
80 [$this, 'render']
81 );
82
83 add_submenu_page(
84 'fluent-booking',
85 __('Settings', 'fluent-booking'),
86 __('Settings', 'fluent-booking'),
87 'manage_options',
88 'fluent-booking#/settings/general-settings',
89 [$this, 'render']
90 );
91 }
92
93 public function render()
94 {
95 if (!as_has_scheduled_action('fluent_booking_five_minutes_tasks')) {
96 as_schedule_recurring_action(time(), (60 * 5), 'fluent_booking_five_minutes_tasks', [], 'fluent-booking', true);
97 }
98
99 $this->changeFooter();
100 $app = App::getInstance();
101
102 $config = $app->config;
103
104 $name = $config->get('app.name');
105
106 $slug = $config->get('app.slug');
107
108 $baseUrl = Helper::getAppBaseUrl();
109
110 if (is_admin()) {
111 $baseUrl = admin_url('admin.php?page=fluent-booking#/');
112 }
113
114 $isNew = $this->isNew();
115
116 $menuItems = [
117 [
118 'key' => 'dashboard',
119 'label' => $isNew ? __('Getting Started', 'fluent-booking') : __('Dashboard', 'fluent-booking'),
120 'permalink' => $baseUrl
121 ],
122 [
123 'key' => 'calendars',
124 'label' => __('Calendars', 'fluent-booking'),
125 'permalink' => $baseUrl . 'calendars'
126 ],
127 [
128 'key' => 'scheduled-events',
129 'label' => __('Bookings', 'fluent-booking'),
130 'permalink' => $baseUrl . 'scheduled-events?period=upcoming&author=me',
131 ],
132 [
133 'key' => 'availability',
134 'label' => __('Availability', 'fluent-booking'),
135 'permalink' => $baseUrl . 'availability'
136 ]
137 ];
138
139 if (current_user_can('manage_options')) {
140 $menuItems[] = [
141 'key' => 'settings',
142 'label' => __('Settings', 'fluent-booking'),
143 'permalink' => $baseUrl . 'settings/general-settings'
144 ];
145 }
146
147 if (!defined('FLUENT_BOOKING_PRO_DIR_FILE')) {
148 $menuItems[] = [
149 'key' => 'buy',
150 'label' => __('Upgrade to Pro', 'fluent-booking'),
151 'permalink' => Helper::getUpgradeUrl()
152 ];
153 }
154
155 $menuItems = apply_filters('fluent_booking/admin_menu_items', $menuItems);
156
157 $assets = $app['url.assets'];
158
159 $portalVars = apply_filters('fluent_booking/admin_portal_vars', [
160 'name' => $name,
161 'slug' => $slug,
162 'menuItems' => $menuItems,
163 'baseUrl' => $baseUrl,
164 'logo' => $assets . 'images/logo.svg',
165 ]);
166
167 $app->view->render('admin.menu', $portalVars);
168 }
169
170 public function changeFooter()
171 {
172 add_filter('admin_footer_text', function ($content) {
173 $url = 'https://fluentbooking.com/';
174 /* translators: %s: URL of the FluentBooking website */
175 return sprintf(wp_kses(__('Thank you for using <a href="%s">FluentBooking</a>.', 'fluent-booking'), array('a' => array('href' => array()))), esc_url($url)) . '<span title="based on your WP timezone settings" style="margin-left: 10px;" data-timestamp="' . current_time('timestamp') . '" id="fcal_server_timestamp"></span>';
176 });
177
178 add_filter('update_footer', function ($text) {
179 return FLUENT_BOOKING_VERSION;
180 });
181 }
182
183 public function enqueueAssets()
184 {
185 $app = App::getInstance();
186
187 $isRtl = Helper::fluentbooking_is_rtl();
188
189 $assets = $app['url.assets'];
190
191 $slug = $app->config->get('app.slug');
192
193 $adminAppCss = 'admin/admin.css';
194 if ($isRtl) {
195 $adminAppCss = 'admin/admin-rtl.css';
196 wp_enqueue_style('fluentbooking_admin_rtl', $assets . 'admin/fluentbooking_admin_rtl.css', [], FLUENT_BOOKING_ASSETS_VERSION);
197 }
198
199 add_action('wp_print_scripts', function () {
200
201 $isSkip = apply_filters('fluent_booking/skip_no_conflict', false, 'scripts');
202
203 if ($isSkip) {
204 return;
205 }
206
207 global $wp_scripts;
208 if (!$wp_scripts) {
209 return;
210 }
211
212 $approvedSlugs = apply_filters('fluent_booking/asset_listed_slugs', [
213 '\/fluent-crm\/'
214 ]);
215
216 $approvedSlugs[] = '\/fluent-booking\/';
217 $approvedSlugs[] = '\/fluent-booking-pro\/';
218
219 $approvedSlugs = array_unique($approvedSlugs);
220
221 $approvedSlugs = implode('|', $approvedSlugs);
222
223 $pluginUrl = plugins_url();
224
225 $pluginUrl = str_replace(['http:', 'https:'], '', $pluginUrl);
226
227 foreach ($wp_scripts->queue as $script) {
228 if (empty($wp_scripts->registered[$script]) || empty($wp_scripts->registered[$script]->src)) {
229 continue;
230 }
231
232 $src = $wp_scripts->registered[$script]->src;
233 $isMatched = (strpos($src, $pluginUrl) !== false) && !preg_match('/' . $approvedSlugs . '/', $src);
234 if (!$isMatched) {
235 continue;
236 }
237 wp_dequeue_script($wp_scripts->registered[$script]->handle);
238 }
239 });
240
241 add_action('wp_print_styles', function () {
242 $isSkip = apply_filters('fluent_booking/skip_no_conflict', false, 'styles');
243
244 if ($isSkip) {
245 return;
246 }
247
248 global $wp_styles;
249 if (!$wp_styles) {
250 return;
251 }
252
253 $approvedSlugs = apply_filters('fluent_booking/asset_listed_slugs', [
254 '\/fluent-crm\/'
255 ]);
256
257 $approvedSlugs[] = '\/fluent-booking\/';
258 $approvedSlugs[] = '\/fluent-booking-pro\/';
259
260 $approvedSlugs = array_unique($approvedSlugs);
261
262 $approvedSlugs = implode('|', $approvedSlugs);
263
264 $pluginUrl = plugins_url();
265
266 $themeUrl = get_theme_root_uri();
267
268 $pluginUrl = str_replace(['http:', 'https:'], '', $pluginUrl);
269 $themeUrl = str_replace(['http:', 'https:'], '', $themeUrl);
270
271 foreach ($wp_styles->queue as $script) {
272
273 if (empty($wp_styles->registered[$script]) || empty($wp_styles->registered[$script]->src)) {
274 continue;
275 }
276
277 $src = $wp_styles->registered[$script]->src;
278 $pluginMatched = (strpos($src, $pluginUrl) !== false) && !preg_match('/' . $approvedSlugs . '/', $src);
279 $themeMatched = (strpos($src, $themeUrl) !== false) && !preg_match('/' . $approvedSlugs . '/', $src);
280
281 if (!$pluginMatched && !$themeMatched) {
282 continue;
283 }
284
285 wp_dequeue_style($wp_styles->registered[$script]->handle);
286 }
287 }, 999999);
288
289 wp_enqueue_style('fluent_booing_admin_app', $assets . $adminAppCss, [], FLUENT_BOOKING_ASSETS_VERSION, 'all');
290
291 do_action($slug . '_loading_app');
292
293 wp_enqueue_script(
294 $slug . '_admin_app',
295 $assets . 'admin/app.js',
296 array('jquery'),
297 FLUENT_BOOKING_ASSETS_VERSION,
298 true
299 );
300
301 wp_enqueue_script(
302 $slug . '_global_admin',
303 $assets . 'admin/global_admin.js',
304 array(),
305 FLUENT_BOOKING_ASSETS_VERSION,
306 true
307 );
308
309 if (function_exists('wp_enqueue_editor')) {
310 add_filter('user_can_richedit', '__return_true');
311 wp_enqueue_editor();
312 wp_enqueue_media();
313 }
314
315 wp_localize_script($slug . '_admin_app', 'fluentFrameworkAdmin', $this->getDashboardVars($app));
316 }
317
318 public function getDashboardVars($app)
319 {
320 $assets = $app['url.assets'];
321 $currentUser = get_user_by('ID', get_current_user_id());
322
323 $isNew = $this->isNew();
324
325 $requireSlug = false;
326
327 if ($isNew) {
328 $result = $this->maybeAutoCreateCalendar($currentUser);
329 if (!$result) {
330 $requireSlug = true;
331 }
332 }
333
334 $calendarId = null;
335
336 $firstCalendar = Calendar::where('user_id', $currentUser->ID)->where('type', 'simple')->first();
337
338 if ($firstCalendar) {
339 $calendarId = $firstCalendar->id;
340 }
341
342 $hasAllAccess = false;
343 if (PermissionManager::hasAllCalendarAccess()) {
344 $hasAllAccess = true;
345 }
346
347 $eventColors = Helper::getEventColors();
348 $meetingDurations = Helper::getMeetingDurations();
349 $multiDurations = Helper::getMeetingMultiDurations();
350 $durationLookup = Helper::getDurationLookup();
351 $multiDurationLookup = Helper::getDurationLookup(true);
352 $scheduleSchema = Helper::getWeeklyScheduleSchema();
353 $bufferTimes = Helper::getBufferTimes();
354 $slotIntervals = Helper::getSlotIntervals();
355 $customFieldTypes = Helper::getCustomFieldTypes();
356 $weekSelectTimes = Helper::getWeekSelectTimes();
357 $overrideSelectTimes = Helper::getOverrideSelectTimes();
358 $statusChangingTimes = Helper::getBookingStatusChangingTimes();
359 $locationFields = (new CalendarSlot())->getLocationFields();
360
361 return apply_filters('fluent_booking/admin_vars', [
362 'slug' => $slug = $app->config->get('app.slug'),
363 'nonce' => wp_create_nonce($slug),
364 'rest' => $this->getRestInfo($app),
365 'brand_logo' => $this->getMenuIcon(),
366 'asset_url' => $assets,
367 'event_colors' => $eventColors,
368 'meeting_durations' => $meetingDurations,
369 'multi_durations' => $multiDurations,
370 'buffer_times' => $bufferTimes,
371 'slot_intervals' => $slotIntervals,
372 'schedule_schema' => $scheduleSchema,
373 'location_fields' => $locationFields,
374 'custom_field_types' => $customFieldTypes,
375 'week_select_times' => $weekSelectTimes,
376 'duration_lookup' => $durationLookup,
377 'multi_duration_lookup' => $multiDurationLookup,
378 'override_select_times' => $overrideSelectTimes,
379 'status_changing_times' => $statusChangingTimes,
380 'me' => [
381 'id' => $currentUser->ID,
382 'calendar_id' => $calendarId,
383 'full_name' => trim($currentUser->first_name . ' ' . $currentUser->last_name),
384 'email' => $currentUser->user_email,
385 'is_admin' => $hasAllAccess,
386 'permissions' => PermissionManager::getUserPermissions($currentUser, false),
387 ],
388 'all_hosts' => Calendar::getAllHosts(),
389 'is_new' => $isNew,
390 'require_slug' => $requireSlug,
391 'site_url' => site_url('/'),
392 'upgrade_url' => Helper::getUpgradeUrl(),
393 'timezones' => DateTimeHelper::getTimeZones(true),
394 'supported_features' => apply_filters('fluent_booking/supported_featured', [
395 'multi_users' => true
396 ]),
397 'has_pro' => defined('FLUENT_BOOKING_PRO_DIR_FILE'),
398 'require_upgrade' => defined('FLUENT_BOOKING_PRO_DIR_FILE') && !defined('FLUENT_BOOKING_LITE'),
399 'dashboard_notices' => apply_filters('fluent_booking/dashboard_notices', []),
400 'trans' => TransStrings::getStrings(),
401 'date_format' => DateTimeHelper::getDateFormatter(true),
402 'time_format' => DateTimeHelper::getTimeFormatter(true),
403 'date_time_formatter' => DateTimeHelper::getDateFormatter(true) . ', ' . DateTimeHelper::getTimeFormatter(true),
404 'available_date_formats' => DateTimeHelper::getAvailableDateFormats(),
405 'admin_url' => admin_url(),
406 ]);
407 }
408
409 protected function getRestInfo($app)
410 {
411 $ns = $app->config->get('app.rest_namespace');
412 $ver = $app->config->get('app.rest_version');
413
414 return [
415 'base_url' => esc_url_raw(rest_url()),
416 'url' => rest_url($ns . '/' . $ver),
417 'nonce' => wp_create_nonce('wp_rest'),
418 'namespace' => $ns,
419 'version' => $ver
420 ];
421 }
422
423 protected function getMenuIcon()
424 {
425 return 'data:image/svg+xml;base64,' . base64_encode('<svg width="96" height="101" viewBox="0 0 96 101" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="25.5746" width="6.39365" height="15.9841" rx="3.19683" fill="white"/><rect x="63.9365" width="6.39365" height="15.9841" rx="3.19683" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M54.878 53.0655C54.544 55.6678 53.4646 58.035 51.8535 59.9427C50.1623 61.9572 47.886 63.4614 45.2863 64.1988L45.1741 64.2309L44.9203 64.2976L44.8989 64.303L24.7671 69.7V65.019C24.7671 64.9148 24.7671 64.8106 24.7778 64.7064C24.8953 62.748 26.127 61.0862 27.8476 60.3514C28.0427 60.2659 28.2431 60.1938 28.4515 60.1377L28.6412 60.0869L54.8753 53.0575V53.0655H54.878Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M71.1411 35.8059C70.4571 41.1467 66.6178 45.5017 61.5494 46.9391L61.4372 46.9712L61.1861 47.038H61.1834L61.162 47.0433L24.7671 56.7953V52.1144C24.7671 50.0197 26.0362 48.2216 27.8476 47.4468L28.4515 47.233L28.6385 47.1823L71.1384 35.7952V35.8059H71.1411Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.9802 11.1889H75.9246C83.4282 11.1889 89.5111 17.2718 89.5111 24.7754V70H95.9048V24.7754C95.9048 13.7406 86.9593 4.79523 75.9246 4.79523H19.9802C8.94542 4.79523 0 13.7406 0 24.7754V80.7198C0 91.7546 8.94542 100.7 19.9802 100.7L64.9524 100.7V94.3063H19.9802C12.4765 94.3063 6.39365 88.2234 6.39365 80.7198V24.7754C6.39365 17.2718 12.4765 11.1889 19.9802 11.1889Z" fill="white"/><path fill-rule="evenodd" clip-rule="evenodd" d="M95.9524 70.7477V69.7H64.9524V100.7H66.0001L95.9524 70.7477Z" fill="white"/></svg>');
426 }
427
428 protected function isNew()
429 {
430 return apply_filters('fluent_booking/is_new', !Calendar::first());
431 }
432
433 /**
434 * @param $user \WP_User
435 * @return bool | Calendar
436 */
437 protected function maybeAutoCreateCalendar($user)
438 {
439 if (!apply_filters('fluent_booking/auto_create_calendar', false, $user)) {
440 return false;
441 }
442
443 $userName = $user->user_login;
444
445 if (is_email($userName)) {
446 $userName = explode('@', $userName);
447 $userName = $userName[0];
448 }
449
450 if (!Helper::isCalendarSlugAvailable($userName, true)) {
451 return false;
452 }
453
454 $personName = trim($user->first_name . ' ' . $user->last_name);
455
456 if (!$personName) {
457 $personName = $user->display_name;
458 }
459
460 $data = [
461 'user_id' => $user->ID,
462 'title' => $personName,
463 'slug' => $userName
464 ];
465
466 return Calendar::create($data);
467 }
468
469 public static function settingsMenuItems()
470 {
471 $app = App::getInstance();
472 $urlAssets = $app['url.assets'];
473
474 return apply_filters('fluent_booking/settings_menu_items', [
475 'general_settings' => [
476 'title' => __('General Settings', 'fluent-booking'),
477 'disable' => false,
478 'el_icon' => 'Operation',
479 'component_type' => 'StandAloneComponent',
480 'class' => 'general_settings',
481 'route' => [
482 'name' => 'general_settings'
483 ]
484 ],
485 'team_members' => [
486 'title' => __('Team', 'fluent-booking'),
487 'disable' => true,
488 'el_icon' => 'TeamIcon',
489 'component_type' => 'StandAloneComponent',
490 'class' => 'team_members',
491 'route' => [
492 'name' => 'team_members'
493 ]
494 ],
495 'google' => [
496 'title' => __('Google Calendar / Meet', 'fluent-booking'),
497 'disable' => true,
498 'icon_url' => $urlAssets . 'images/gg-calendar.svg',
499 'component_type' => 'StandAloneComponent',
500 'class' => 'configure_google_calendar',
501 'route' => [
502 'name' => 'configure-google'
503 ]
504 ],
505 'outlook' => [
506 'title' => __('Outlook Calendar / MS Teams', 'fluent-booking'),
507 'disable' => true,
508 'icon_url' => $urlAssets . 'images/ol-icon-color.svg',
509 'component_type' => 'GlobalSettingsComponent',
510 'class' => 'configure_outlook_calendar',
511 'route' => [
512 'name' => 'configure-integrations',
513 'params' => [
514 'settings_key' => 'outlook'
515 ]
516 ]
517 ],
518 'apple_calendar' => [
519 'title' => __('Apple Calendar', 'fluent-booking'),
520 'disable' => true,
521 'icon_url' => $urlAssets . 'images/a-cal.svg',
522 'component_type' => 'GlobalSettingsComponent',
523 'class' => 'configure_apple_calendar',
524 'route' => [
525 'name' => 'configure-integrations',
526 'params' => [
527 'settings_key' => 'apple_calendar'
528 ]
529 ]
530 ],
531 'next_cloud_calendar' => [
532 'title' => __('Nextcloud Calendar', 'fluent-booking'),
533 'disable' => true,
534 'icon_url' => $urlAssets . 'images/Ncloud.svg',
535 'component_type' => 'GlobalSettingsComponent',
536 'class' => 'configure_nextcloud_calendar',
537 'route' => [
538 'name' => 'configure-integrations',
539 'params' => [
540 'settings_key' => 'next_cloud_calendar'
541 ]
542 ]
543 ],
544 'zoom_meeting' => [
545 'title' => __('Zoom', 'fluent-booking'),
546 'disable' => true,
547 'icon_url' => $urlAssets . 'images/zoom.svg',
548 'component_type' => 'StandAloneComponent',
549 'class' => 'zoom_integrations',
550 'route' => [
551 'name' => 'zoom_integrations'
552 ]
553 ],
554 'twilio' => [
555 'title' => __('SMS by Twilio', 'fluent-booking'),
556 'disable' => true,
557 'icon_url' => $urlAssets . 'images/tw.svg',
558 'component_type' => 'GlobalSettingsComponent',
559 'class' => 'configure_twilio',
560 'route' => [
561 'name' => 'configure-integrations',
562 'params' => [
563 'settings_key' => 'twilio'
564 ]
565 ]
566 ],
567 'stripe' => [
568 'title' => __('Stripe', 'fluent-booking'),
569 'disable' => true,
570 'icon_url' => $urlAssets . 'images/payment-methods/stripe.svg',
571 'component_type' => 'GlobalSettingsComponent',
572 'class' => 'stripe_payment',
573 'route' => [
574 'name' => 'PaymentSettingsIndex',
575 'params' => [
576 'settings_key' => 'stripe'
577 ]
578 ]
579 ],
580 'paypal' => [
581 'title' => __('PayPal', 'fluent-booking'),
582 'disable' => true,
583 'icon_url' => $urlAssets . 'images/payment-methods/paypal.svg',
584 'component_type' => 'GlobalSettingsComponent',
585 'class' => 'paypal_payment',
586 'route' => [
587 'name' => 'PaymentSettingsIndex',
588 'params' => [
589 'settings_key' => 'paypal'
590 ]
591 ]
592 ],
593 'license' => [
594 'title' => __('License', 'fluent-booking'),
595 'disable' => true,
596 'el_icon' => 'Lock',
597 'component_type' => 'StandAloneComponent',
598 'class' => 'configure_license',
599 'route' => [
600 'name' => 'license'
601 ]
602 ],
603 ]);
604 }
605
606 public static function getEventSettingsMenuItems($event)
607 {
608 return apply_filters('fluent_booking/calendar_event_setting_menu_items', [
609 'event_details' => [
610 'type' => 'route',
611 'visible' => true,
612 'disable' => false,
613 'route' => [
614 'name' => 'event_details',
615 'params' => [
616 'calendar_id' => $event->calendar_id,
617 'event_id' => $event->id
618 ]
619 ],
620 'label' => __('Event Details', 'fluent-booking'),
621 'svgIcon' => '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M8 2V5" stroke="#1B2533" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 2V5" stroke="#1B2533" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M7 13H15" stroke="#1B2533" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M7 17H12" stroke="#1B2533" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 3.5C19.33 3.68 21 4.95 21 9.65V15.83C21 19.95 20 22.01 15 22.01H9C4 22.01 3 19.95 3 15.83V9.65C3 4.95 4.67 3.69 8 3.5H16Z" stroke="#1B2533" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg>'
622 ],
623 'assignment' => [
624 'type' => 'route',
625 'visible' => false,
626 'disable' => true,
627 'route' => [
628 'name' => 'assignment',
629 'params' => [
630 'calendar_id' => $event->calendar_id,
631 'event_id' => $event->id
632 ]
633 ],
634 'label' => __('Assignment', 'fluent-booking'),
635 'svgIcon' => '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-[16px] w-[16px] stroke-[2px] ltr:mr-2 rtl:ml-2 md:mt-px" data-testid="icon-component"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"></path><circle cx="9" cy="7" r="4"></circle><path d="M22 21v-2a4 4 0 0 0-3-3.87"></path><path d="M16 3.13a4 4 0 0 1 0 7.75"></path></svg>'
636 ],
637 'availability_settings' => [
638 'type' => 'route',
639 'visible' => true,
640 'disable' => false,
641 'route' => [
642 'name' => 'availability_settings',
643 'params' => [
644 'calendar_id' => $event->calendar_id,
645 'event_id' => $event->id
646 ]
647 ],
648 'label' => __('Availability', 'fluent-booking'),
649 'svgIcon' => '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none"><path d="M6.66666 1.66699V4.16699" stroke="#445164" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M13.3333 1.66699V4.16699" stroke="#445164" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M2.91666 7.5752H17.0833" stroke="#445164" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M17.5 7.08366V14.167C17.5 16.667 16.25 18.3337 13.3333 18.3337H6.66667C3.75 18.3337 2.5 16.667 2.5 14.167V7.08366C2.5 4.58366 3.75 2.91699 6.66667 2.91699H13.3333C16.25 2.91699 17.5 4.58366 17.5 7.08366Z" stroke="#445164" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M13.0789 11.4167H13.0864" stroke="#445164" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M13.0789 13.9167H13.0864" stroke="#445164" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.99623 11.4167H10.0037" stroke="#445164" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.99623 13.9167H10.0037" stroke="#445164" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6.91194 11.4167H6.91942" stroke="#445164" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6.91194 13.9167H6.91942" stroke="#445164" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'
650 ],
651 'limit_settings' => [
652 'type' => 'route',
653 'visible' => true,
654 'disable' => false,
655 'route' => [
656 'name' => 'limit_settings',
657 'params' => [
658 'calendar_id' => $event->calendar_id,
659 'event_id' => $event->id
660 ]
661 ],
662 'label' => __('Limits', 'fluent-booking'),
663 'elIcon' => 'Clock'
664 ],
665 'question_settings' => [
666 'type' => 'route',
667 'visible' => true,
668 'disable' => false,
669 'route' => [
670 'name' => 'question_settings',
671 'params' => [
672 'calendar_id' => $event->calendar_id,
673 'event_id' => $event->id
674 ]
675 ],
676 'label' => __('Question Settings', 'fluent-booking'),
677 'svgIcon' => '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8 2V5" stroke="#292D32" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 2V5" stroke="#292D32" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 13.8714V13.6441C12 12.908 12.5061 12.5182 13.0121 12.2043C13.5061 11.9012 14 11.5115 14 10.797C14 9.8011 13.1085 9 12 9C10.8915 9 10 9.8011 10 10.797" stroke="#292D32" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M11.9945 16.4587H12.0053" stroke="#292D32" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 3.5C19.33 3.67504 21 4.91005 21 9.48055V15.4903C21 19.4968 20 21.5 15 21.5H9C4 21.5 3 19.4968 3 15.4903V9.48055C3 4.91005 4.67 3.68476 8 3.5H16Z" stroke="#292D32" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg>'
678 ],
679 'email_notification' => [
680 'type' => 'route',
681 'visible' => true,
682 'disable' => false,
683 'route' => [
684 'name' => 'email_notification',
685 'params' => [
686 'calendar_id' => $event->calendar_id,
687 'event_id' => $event->id
688 ]
689 ],
690 'label' => __('Email Notification', 'fluent-booking'),
691 'elIcon' => 'Message'
692 ],
693 'sms_notification' => [
694 'type' => 'route',
695 'visible' => true,
696 'disable' => true,
697 'route' => [
698 'name' => 'sms_notification',
699 'params' => [
700 'calendar_id' => $event->calendar_id,
701 'event_id' => $event->id
702 ]
703 ],
704 'label' => __('SMS Notification', 'fluent-booking'),
705 'elIcon' => 'Notification'
706 ],
707 'advanced_settings' => [
708 'type' => 'route',
709 'visible' => true,
710 'disable' => true,
711 'route' => [
712 'name' => 'advanced_settings',
713 'params' => [
714 'calendar_id' => $event->calendar_id,
715 'event_id' => $event->id
716 ]
717 ],
718 'label' => __('Advanced Settings', 'fluent-booking'),
719 'elIcon' => 'Operation'
720 ],
721 'payment_settings' => [
722 'type' => 'route',
723 'visible' => true,
724 'disable' => true,
725 'route' => [
726 'name' => 'payment_settings',
727 'params' => [
728 'calendar_id' => $event->calendar_id,
729 'event_id' => $event->id
730 ]
731 ],
732 'label' => __('Payment Settings', 'fluent-booking'),
733 'elIcon' => 'Money'
734 ],
735 'webhook_settings' => [
736 'type' => 'route',
737 'visible' => true,
738 'disable' => true,
739 'route' => [
740 'name' => 'webhook_settings',
741 'params' => [
742 'calendar_id' => $event->calendar_id,
743 'event_id' => $event->id
744 ]
745 ],
746 'label' => __('Webhooks Feeds', 'fluent-booking'),
747 'elIcon' => 'Link'
748 ],
749 'integrations' => [
750 'type' => 'route',
751 'visible' => true,
752 'disable' => false,
753 'route' => [
754 'name' => 'integrations',
755 'params' => [
756 'calendar_id' => $event->calendar_id,
757 'event_id' => $event->id
758 ]
759 ],
760 'label' => __('Integrations', 'fluent-booking'),
761 'elIcon' => 'Connection'
762 ]
763 ], $event);
764 }
765
766 public static function getCalendarSettingsMenuItems($calendar)
767 {
768 return apply_filters('fluent_booking/calendar_setting_menu_items', [
769 'calendar_settings' => [
770 'type' => 'route',
771 'visible' => true,
772 'disable' => false,
773 'route' => [
774 'name' => 'calendar_settings',
775 'params' => [
776 'calendar_id' => $calendar->id
777 ]
778 ],
779 'label' => __('Calendar Settings', 'fluent-booking'),
780 'svgIcon' => '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z" stroke="#292D32" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/><path d="M2 12.8799V11.1199C2 10.0799 2.85 9.21994 3.9 9.21994C5.71 9.21994 6.45 7.93994 5.54 6.36994C5.02 5.46994 5.33 4.29994 6.24 3.77994L7.97 2.78994C8.76 2.31994 9.78 2.59994 10.25 3.38994L10.36 3.57994C11.26 5.14994 12.74 5.14994 13.65 3.57994L13.76 3.38994C14.23 2.59994 15.25 2.31994 16.04 2.78994L17.77 3.77994C18.68 4.29994 18.99 5.46994 18.47 6.36994C17.56 7.93994 18.3 9.21994 20.11 9.21994C21.15 9.21994 22.01 10.0699 22.01 11.1199V12.8799C22.01 13.9199 21.16 14.7799 20.11 14.7799C18.3 14.7799 17.56 16.0599 18.47 17.6299C18.99 18.5399 18.68 19.6999 17.77 20.2199L16.04 21.2099C15.25 21.6799 14.23 21.3999 13.76 20.6099L13.65 20.4199C12.75 18.8499 11.27 18.8499 10.36 20.4199L10.25 20.6099C9.78 21.3999 8.76 21.6799 7.97 21.2099L6.24 20.2199C5.33 19.6999 5.02 18.5299 5.54 17.6299C6.45 16.0599 5.71 14.7799 3.9 14.7799C2.85 14.7799 2 13.9199 2 12.8799Z" stroke="#292D32" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg>'
781 ],
782 'remote_calendars' => [
783 'type' => 'route',
784 'visible' => true,
785 'disable' => true,
786 'route' => [
787 'name' => 'remote_calendars',
788 'params' => [
789 'calendar_id' => $calendar->id
790 ]
791 ],
792 'label' => __('Remote Calendars', 'fluent-booking'),
793 'svgIcon' => '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="mr-2 h-[16px] w-[16px] stroke-[2px] ltr:mr-2 rtl:ml-2 md:mt-0" data-testid="icon-component"><rect width="18" height="18" x="3" y="4" rx="2" ry="2"></rect><line x1="16" x2="16" y1="2" y2="6"></line><line x1="8" x2="8" y1="2" y2="6"></line><line x1="3" x2="21" y1="10" y2="10"></line></svg>'
794 ],
795 'zoom_meeting' => [
796 'type' => 'route',
797 'visible' => true,
798 'disable' => true,
799 'route' => [
800 'name' => 'user_zoom_integration',
801 'params' => [
802 'calendar_id' => $calendar->id
803 ]
804 ],
805 'label' => __('Zoom Integration', 'fluent-booking'),
806 'svgIcon' => '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48px" height="48px"><circle cx="24" cy="24" r="20" fill="#2196f3"/><path fill="#fff" d="M29,31H14c-1.657,0-3-1.343-3-3V17h15c1.657,0,3,1.343,3,3V31z"/><polygon fill="#fff" points="37,31 31,27 31,21 37,17"/></svg>'
807 ]
808 ], $calendar);
809 }
810 }
811
812