PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.10.01
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.10.01
2.5.0 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 All 34 releases
fluent-booking / app / Hooks / Handlers / AdminMenuHandler.php

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

842 lines 37.9 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\Services\DateTimeHelper;
9 use FluentBooking\App\Services\Helper;
10 use FluentBooking\App\Services\PermissionManager;
11 use FluentBooking\App\Services\TransStrings;
12
13 class AdminMenuHandler
14 {
15 public function register()
16 {
17 add_action('admin_menu', [$this, 'add']);
18
19 add_action('admin_enqueue_scripts', function () {
20 if (!isset($_REQUEST['page']) || $_REQUEST['page'] != 'fluent-booking') { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
21 return;
22 }
23 $this->enqueueAssets();
24 }, 100);
25 }
26
27 public function add()
28 {
29 $capability = PermissionManager::getMenuPermission();
30 $menuPriority = 26;
31
32 if (defined('FLUENTCRM')) {
33 $menuPriority = 4;
34 }
35
36 add_menu_page(
37 __('Fluent Booking', 'fluent-booking'),
38 __('Fluent Booking', 'fluent-booking'),
39 $capability,
40 'fluent-booking',
41 [$this, 'render'],
42 $this->getMenuIcon(),
43 $menuPriority
44 );
45
46 add_submenu_page(
47 'fluent-booking',
48 __('Dashboard', 'fluent-booking'),
49 __('Dashboard', 'fluent-booking'),
50 $capability,
51 'fluent-booking',
52 [$this, 'render']
53 );
54
55 add_submenu_page(
56 'fluent-booking',
57 __('Calendars', 'fluent-booking'),
58 __('Calendars', 'fluent-booking'),
59 $capability,
60 'fluent-booking#/calendars',
61 [$this, 'render']
62 );
63
64 add_submenu_page(
65 'fluent-booking',
66 __('Bookings', 'fluent-booking'),
67 __('Bookings', 'fluent-booking'),
68 $capability,
69 'fluent-booking#/scheduled-events',
70 [$this, 'render']
71 );
72
73 add_submenu_page(
74 'fluent-booking',
75 __('Availability', 'fluent-booking'),
76 __('Availability', 'fluent-booking'),
77 $capability,
78 'fluent-booking#/availability',
79 [$this, 'render']
80 );
81
82 add_submenu_page(
83 'fluent-booking',
84 __('Settings', 'fluent-booking'),
85 __('Settings', 'fluent-booking'),
86 'manage_options',
87 'fluent-booking#/settings/general-settings',
88 [$this, 'render']
89 );
90 }
91
92 public function render()
93 {
94 if (!as_has_scheduled_action('fluent_booking_five_minutes_tasks')) {
95 as_schedule_recurring_action(time(), (60 * 5), 'fluent_booking_five_minutes_tasks', [], 'fluent-booking', true);
96 }
97
98 $this->changeFooter();
99
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',
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 do_action('fluent_booking/admin_app_rendering');
168
169 $app->view->render('admin.menu', $portalVars);
170 }
171
172 public function changeFooter()
173 {
174 add_filter('admin_footer_text', function ($content) {
175 $url = 'https://fluentbooking.com/';
176 /* translators: %s: URL of the FluentBooking website */
177 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>';
178 });
179
180 add_filter('update_footer', function ($text) {
181 return FLUENT_BOOKING_VERSION;
182 });
183 }
184
185 public function enqueueAssets()
186 {
187 $app = App::getInstance();
188
189 $isRtl = Helper::fluentbooking_is_rtl();
190
191 $assets = $app['url.assets'];
192
193 $slug = $app->config->get('app.slug');
194
195 $adminAppCss = 'admin/admin.css';
196 if ($isRtl) {
197 $adminAppCss = 'admin/admin-rtl.css';
198 wp_enqueue_style('fluentbooking_admin_rtl', $assets . 'admin/fluentbooking_admin_rtl.css', [], FLUENT_BOOKING_ASSETS_VERSION);
199 }
200
201 add_action('wp_print_scripts', function () {
202
203 $isSkip = apply_filters('fluent_booking/skip_no_conflict', false, 'scripts');
204
205 if ($isSkip) {
206 return;
207 }
208
209 global $wp_scripts;
210 if (!$wp_scripts) {
211 return;
212 }
213
214 $approvedSlugs = apply_filters('fluent_booking/asset_listed_slugs', [
215 '\/fluent-crm\/'
216 ]);
217
218 $approvedSlugs[] = '\/fluent-booking\/';
219 $approvedSlugs[] = '\/fluent-booking-pro\/';
220
221 $approvedSlugs = array_unique($approvedSlugs);
222
223 $approvedSlugs = implode('|', $approvedSlugs);
224
225 $pluginUrl = plugins_url();
226
227 $pluginUrl = str_replace(['http:', 'https:'], '', $pluginUrl);
228
229 foreach ($wp_scripts->queue as $script) {
230 if (empty($wp_scripts->registered[$script]) || empty($wp_scripts->registered[$script]->src)) {
231 continue;
232 }
233
234 $src = $wp_scripts->registered[$script]->src;
235 $isMatched = (strpos($src, $pluginUrl) !== false) && !preg_match('/' . $approvedSlugs . '/', $src);
236 if (!$isMatched) {
237 continue;
238 }
239 wp_dequeue_script($wp_scripts->registered[$script]->handle);
240 }
241 });
242
243 add_action('wp_print_styles', function () {
244 $isSkip = apply_filters('fluent_booking/skip_no_conflict', false, 'styles');
245
246 if ($isSkip) {
247 return;
248 }
249
250 global $wp_styles;
251 if (!$wp_styles) {
252 return;
253 }
254
255 $approvedSlugs = apply_filters('fluent_booking/asset_listed_slugs', [
256 '\/fluent-crm\/'
257 ]);
258
259 $approvedSlugs[] = '\/fluent-booking\/';
260 $approvedSlugs[] = '\/fluent-booking-pro\/';
261
262 $approvedSlugs = array_unique($approvedSlugs);
263
264 $approvedSlugs = implode('|', $approvedSlugs);
265
266 $pluginUrl = plugins_url();
267
268 $themeUrl = get_theme_root_uri();
269
270 $pluginUrl = str_replace(['http:', 'https:'], '', $pluginUrl);
271 $themeUrl = str_replace(['http:', 'https:'], '', $themeUrl);
272
273 foreach ($wp_styles->queue as $script) {
274
275 if (empty($wp_styles->registered[$script]) || empty($wp_styles->registered[$script]->src)) {
276 continue;
277 }
278
279 $src = $wp_styles->registered[$script]->src;
280 $pluginMatched = (strpos($src, $pluginUrl) !== false) && !preg_match('/' . $approvedSlugs . '/', $src);
281 $themeMatched = (strpos($src, $themeUrl) !== false) && !preg_match('/' . $approvedSlugs . '/', $src);
282
283 if (!$pluginMatched && !$themeMatched) {
284 continue;
285 }
286
287 wp_dequeue_style($wp_styles->registered[$script]->handle);
288 }
289 }, 999999);
290
291 wp_enqueue_style('fluent_booing_admin_app', $assets . $adminAppCss, [], FLUENT_BOOKING_ASSETS_VERSION, 'all');
292
293 do_action($slug . '_loading_app'); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound
294
295 wp_enqueue_script(
296 $slug . '_admin_app',
297 $assets . 'admin/app.js',
298 array('jquery'),
299 FLUENT_BOOKING_ASSETS_VERSION,
300 true
301 );
302
303 wp_enqueue_script(
304 $slug . '_global_admin',
305 $assets . 'admin/global_admin.js',
306 array(),
307 FLUENT_BOOKING_ASSETS_VERSION,
308 true
309 );
310
311 if (function_exists('wp_enqueue_editor')) {
312 add_filter('user_can_richedit', '__return_true');
313 wp_enqueue_editor();
314 wp_enqueue_media();
315 }
316
317 wp_localize_script($slug . '_admin_app', 'fluentFrameworkAdmin', $this->getDashboardVars($app));
318 }
319
320 public function getDashboardVars($app)
321 {
322 $assets = $app['url.assets'];
323 $currentUser = get_user_by('ID', get_current_user_id());
324
325 $currentUsername = trim($currentUser->first_name . ' ' . $currentUser->last_name);
326 if (!$currentUsername) {
327 $currentUsername = $currentUser->display_name;
328 }
329
330 $isNew = $this->isNew();
331
332 $requireSlug = false;
333
334 if ($isNew) {
335 $result = $this->maybeAutoCreateCalendar($currentUser);
336 if (!$result) {
337 $requireSlug = true;
338 }
339 }
340
341 $calendarId = null;
342
343 $firstCalendar = Calendar::where('user_id', $currentUser->ID)->where('type', 'simple')->first();
344
345 if ($firstCalendar) {
346 $calendarId = $firstCalendar->id;
347 }
348
349 $hasAllAccess = false;
350 if (PermissionManager::hasAllCalendarAccess()) {
351 $hasAllAccess = true;
352 }
353
354 $eventColors = Helper::getEventColors();
355 $meetingDurations = Helper::getMeetingDurations();
356 $multiDurations = Helper::getMeetingMultiDurations();
357 $durationLookup = Helper::getDurationLookup();
358 $multiDurationLookup = Helper::getDurationLookup(true);
359 $scheduleSchema = Helper::getWeeklyScheduleSchema();
360 $bufferTimes = Helper::getBufferTimes();
361 $slotIntervals = Helper::getSlotIntervals();
362 $customFieldTypes = Helper::getCustomFieldTypes();
363 $weekSelectTimes = Helper::getWeekSelectTimes();
364 $overrideSelectTimes = Helper::getOverrideSelectTimes();
365 $statusChangingTimes = Helper::getBookingStatusChangingTimes();
366 $defaultTermsAndConditions = Helper::getDefaultTermsAndConditions();
367 $locationFields = (new CalendarSlot())->getLocationFields();
368
369 return apply_filters('fluent_booking/admin_vars', [
370 'slug' => $slug = $app->config->get('app.slug'),
371 'nonce' => wp_create_nonce($slug),
372 'rest' => $this->getRestInfo($app),
373 'brand_logo' => $this->getMenuIcon(),
374 'asset_url' => $assets,
375 'event_colors' => $eventColors,
376 'meeting_durations' => $meetingDurations,
377 'multi_durations' => $multiDurations,
378 'buffer_times' => $bufferTimes,
379 'slot_intervals' => $slotIntervals,
380 'schedule_schema' => $scheduleSchema,
381 'location_fields' => $locationFields,
382 'custom_field_types' => $customFieldTypes,
383 'week_select_times' => $weekSelectTimes,
384 'duration_lookup' => $durationLookup,
385 'multi_duration_lookup' => $multiDurationLookup,
386 'override_select_times' => $overrideSelectTimes,
387 'status_changing_times' => $statusChangingTimes,
388 'default_terms' => $defaultTermsAndConditions,
389 'me' => [
390 'id' => $currentUser->ID,
391 'calendar_id' => $calendarId,
392 'full_name' => $currentUsername,
393 'email' => $currentUser->user_email,
394 'is_admin' => $hasAllAccess,
395 'permissions' => PermissionManager::getUserPermissions($currentUser, false),
396 ],
397 'all_hosts' => Calendar::getAllHosts(),
398 'is_new' => $isNew,
399 'require_slug' => $requireSlug,
400 'site_url' => site_url('/'),
401 'upgrade_url' => Helper::getUpgradeUrl(),
402 'timezones' => DateTimeHelper::getTimeZones(true),
403 'features' => Helper::getFeatures(),
404 'supported_features' => apply_filters('fluent_booking/supported_featured', [
405 'multi_users' => true
406 ]),
407 'i18' => [
408 'date_time_config' => DateTimeHelper::getI18nDateTimeConfig(),
409 ],
410 'has_pro' => defined('FLUENT_BOOKING_PRO_DIR_FILE'),
411 'require_upgrade' => defined('FLUENT_BOOKING_PRO_DIR_FILE') && !defined('FLUENT_BOOKING_LITE'),
412 'dashboard_notices' => apply_filters('fluent_booking/dashboard_notices', []),
413 'payment_methods' => apply_filters('fluent_booking/payment/get_all_methods', []),
414 'trans' => TransStrings::getStrings(),
415 'date_format' => DateTimeHelper::getDateFormatter(true),
416 'time_format' => DateTimeHelper::getTimeFormatter(true),
417 'date_time_formatter' => DateTimeHelper::getDateFormatter(true) . ', ' . DateTimeHelper::getTimeFormatter(true),
418 'available_date_formats' => DateTimeHelper::getAvailableDateFormats(),
419 'default_booking_filters' => Helper::getDefaultBookingFilters(),
420 'default_paginations' => Helper::getDefaultPaginations(),
421 'pref_settings' => Helper::getPrefSettings(),
422 'settings_menu_items' => static::settingsMenuItems(),
423 'admin_url' => admin_url(),
424 'is_rtl' => Helper::fluentbooking_is_rtl(),
425 'iframe_html' => Helper::getIframeHtml()
426 ]);
427 }
428
429 protected function getRestInfo($app)
430 {
431 $ns = $app->config->get('app.rest_namespace');
432 $ver = $app->config->get('app.rest_version');
433
434 return [
435 'base_url' => esc_url_raw(rest_url()),
436 'url' => rest_url($ns . '/' . $ver),
437 'nonce' => wp_create_nonce('wp_rest'),
438 'namespace' => $ns,
439 'version' => $ver
440 ];
441 }
442
443 protected function getMenuIcon()
444 {
445 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>');
446 }
447
448 protected function isNew()
449 {
450 return apply_filters('fluent_booking/is_new', !Calendar::first());
451 }
452
453 /**
454 * @param $user \WP_User
455 * @return bool | Calendar
456 */
457 protected function maybeAutoCreateCalendar($user)
458 {
459 if (!apply_filters('fluent_booking/auto_create_calendar', false, $user)) {
460 return false;
461 }
462
463 $userName = $user->user_login;
464
465 if (is_email($userName)) {
466 $userName = explode('@', $userName);
467 $userName = $userName[0];
468 }
469
470 if (!Helper::isCalendarSlugAvailable($userName, true)) {
471 return false;
472 }
473
474 $personName = trim($user->first_name . ' ' . $user->last_name);
475
476 if (!$personName) {
477 $personName = $user->display_name;
478 }
479
480 $data = [
481 'user_id' => $user->ID,
482 'title' => $personName,
483 'slug' => $userName
484 ];
485
486 return Calendar::create($data);
487 }
488
489 public static function settingsMenuItems()
490 {
491 $app = App::getInstance();
492 $urlAssets = $app['url.assets'];
493
494 return apply_filters('fluent_booking/settings_menu_items', [
495 'general_settings' => [
496 'title' => __('General', 'fluent-booking'),
497 'disable' => false,
498 'el_icon' => 'Operation',
499 'component_type' => 'StandAloneComponent',
500 'class' => 'general_settings',
501 'route' => [
502 'name' => 'general_settings'
503 ]
504 ],
505 'team_members' => [
506 'title' => __('Team', 'fluent-booking'),
507 'disable' => true,
508 'el_icon' => 'TeamIcon',
509 'component_type' => 'StandAloneComponent',
510 'class' => 'team_members',
511 'route' => [
512 'name' => 'team_members'
513 ]
514 ],
515 'payment_settings' => [
516 'title' => __('Payment', 'fluent-booking'),
517 'disable' => true,
518 'el_icon' => 'Money',
519 'component_type' => 'PaymentSettingsComponent',
520 'class' => 'payment_settings',
521 'route' => [
522 'name' => 'global_payment_settings',
523 ],
524 'children' => [
525 'payment_settings' => [
526 'title' => __('Settings', 'fluent-booking'),
527 'disable' => true,
528 'route' => [
529 'name' => 'global_payment_settings'
530 ]
531 ],
532 'payment_methods' => [
533 'title' => __('Payment Methods', 'fluent-booking'),
534 'disable' => true,
535 'route' => [
536 'name' => 'payment_methods',
537 'params' => [
538 'settings_key' => 'stripe'
539 ]
540 ]
541 ],
542 'payment_coupons' => [
543 'title' => __('Coupons', 'fluent-booking'),
544 'disable' => true,
545 'route' => [
546 'name' => 'payment_coupons'
547 ]
548 ]
549 ],
550 ],
551 'google' => [
552 'title' => __('Google Calendar / Meet', 'fluent-booking'),
553 'disable' => true,
554 'icon_url' => $urlAssets . 'images/gg-calendar.svg',
555 'component_type' => 'StandAloneComponent',
556 'class' => 'configure_google_calendar',
557 'route' => [
558 'name' => 'configure-google'
559 ]
560 ],
561 'outlook' => [
562 'title' => __('Outlook Calendar / MS Teams', 'fluent-booking'),
563 'disable' => true,
564 'icon_url' => $urlAssets . 'images/ol-icon-color.svg',
565 'component_type' => 'GlobalSettingsComponent',
566 'class' => 'configure_outlook_calendar',
567 'route' => [
568 'name' => 'configure-integrations',
569 'params' => [
570 'settings_key' => 'outlook'
571 ]
572 ]
573 ],
574 'apple_calendar' => [
575 'title' => __('Apple Calendar', 'fluent-booking'),
576 'disable' => true,
577 'icon_url' => $urlAssets . 'images/a-cal.svg',
578 'component_type' => 'GlobalSettingsComponent',
579 'class' => 'configure_apple_calendar',
580 'route' => [
581 'name' => 'configure-integrations',
582 'params' => [
583 'settings_key' => 'apple_calendar'
584 ]
585 ]
586 ],
587 'next_cloud_calendar' => [
588 'title' => __('Nextcloud Calendar', 'fluent-booking'),
589 'disable' => true,
590 'icon_url' => $urlAssets . 'images/Ncloud.svg',
591 'component_type' => 'GlobalSettingsComponent',
592 'class' => 'configure_nextcloud_calendar',
593 'route' => [
594 'name' => 'configure-integrations',
595 'params' => [
596 'settings_key' => 'next_cloud_calendar'
597 ]
598 ]
599 ],
600 'zoom_meeting' => [
601 'title' => __('Zoom', 'fluent-booking'),
602 'disable' => true,
603 'icon_url' => $urlAssets . 'images/zoom.svg',
604 'component_type' => 'StandAloneComponent',
605 'class' => 'zoom_integrations',
606 'route' => [
607 'name' => 'zoom_integrations'
608 ]
609 ],
610 'twilio' => [
611 'title' => __('SMS by Twilio', 'fluent-booking'),
612 'disable' => true,
613 'icon_url' => $urlAssets . 'images/tw.svg',
614 'component_type' => 'GlobalSettingsComponent',
615 'class' => 'configure_twilio',
616 'route' => [
617 'name' => 'configure-integrations',
618 'params' => [
619 'settings_key' => 'twilio'
620 ]
621 ]
622 ],
623 'license' => [
624 'title' => __('License', 'fluent-booking'),
625 'disable' => true,
626 'el_icon' => 'Lock',
627 'component_type' => 'StandAloneComponent',
628 'class' => 'configure_license',
629 'route' => [
630 'name' => 'license'
631 ]
632 ]
633 ]);
634 }
635
636 public static function getEventSettingsMenuItems($event)
637 {
638 return apply_filters('fluent_booking/calendar_event_setting_menu_items', [
639 'event_details' => [
640 'type' => 'route',
641 'visible' => true,
642 'disable' => false,
643 'route' => [
644 'name' => 'event_details',
645 'params' => [
646 'calendar_id' => $event->calendar_id,
647 'event_id' => $event->id
648 ]
649 ],
650 'label' => __('Event Details', 'fluent-booking'),
651 '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>'
652 ],
653 'assignment' => [
654 'type' => 'route',
655 'visible' => false,
656 'disable' => true,
657 'route' => [
658 'name' => 'assignment',
659 'params' => [
660 'calendar_id' => $event->calendar_id,
661 'event_id' => $event->id
662 ]
663 ],
664 'label' => __('Assignment', 'fluent-booking'),
665 '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>'
666 ],
667 'availability_settings' => [
668 'type' => 'route',
669 'visible' => true,
670 'disable' => false,
671 'route' => [
672 'name' => 'availability_settings',
673 'params' => [
674 'calendar_id' => $event->calendar_id,
675 'event_id' => $event->id
676 ]
677 ],
678 'label' => __('Availability', 'fluent-booking'),
679 '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>'
680 ],
681 'limit_settings' => [
682 'type' => 'route',
683 'visible' => true,
684 'disable' => false,
685 'route' => [
686 'name' => 'limit_settings',
687 'params' => [
688 'calendar_id' => $event->calendar_id,
689 'event_id' => $event->id
690 ]
691 ],
692 'label' => __('Limits', 'fluent-booking'),
693 'elIcon' => 'Clock'
694 ],
695 'question_settings' => [
696 'type' => 'route',
697 'visible' => true,
698 'disable' => false,
699 'route' => [
700 'name' => 'question_settings',
701 'params' => [
702 'calendar_id' => $event->calendar_id,
703 'event_id' => $event->id
704 ]
705 ],
706 'label' => __('Question Settings', 'fluent-booking'),
707 '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>'
708 ],
709 'email_notification' => [
710 'type' => 'route',
711 'visible' => true,
712 'disable' => false,
713 'route' => [
714 'name' => 'email_notification',
715 'params' => [
716 'calendar_id' => $event->calendar_id,
717 'event_id' => $event->id
718 ]
719 ],
720 'label' => __('Email Notification', 'fluent-booking'),
721 'elIcon' => 'Message'
722 ],
723 'sms_notification' => [
724 'type' => 'route',
725 'visible' => true,
726 'disable' => true,
727 'route' => [
728 'name' => 'sms_notification',
729 'params' => [
730 'calendar_id' => $event->calendar_id,
731 'event_id' => $event->id
732 ]
733 ],
734 'label' => __('SMS Notification', 'fluent-booking'),
735 'elIcon' => 'Notification'
736 ],
737 'advanced_settings' => [
738 'type' => 'route',
739 'visible' => true,
740 'disable' => true,
741 'route' => [
742 'name' => 'advanced_settings',
743 'params' => [
744 'calendar_id' => $event->calendar_id,
745 'event_id' => $event->id
746 ]
747 ],
748 'label' => __('Advanced Settings', 'fluent-booking'),
749 'elIcon' => 'Operation'
750 ],
751 'payment_settings' => [
752 'type' => 'route',
753 'visible' => true,
754 'disable' => true,
755 'route' => [
756 'name' => 'payment_settings',
757 'params' => [
758 'calendar_id' => $event->calendar_id,
759 'event_id' => $event->id
760 ]
761 ],
762 'label' => __('Payment Settings', 'fluent-booking'),
763 'elIcon' => 'Money'
764 ],
765 'webhook_settings' => [
766 'type' => 'route',
767 'visible' => true,
768 'disable' => true,
769 'route' => [
770 'name' => 'webhook_settings',
771 'params' => [
772 'calendar_id' => $event->calendar_id,
773 'event_id' => $event->id
774 ]
775 ],
776 'label' => __('Webhooks Feeds', 'fluent-booking'),
777 'elIcon' => 'Link'
778 ],
779 'integrations' => [
780 'type' => 'route',
781 'visible' => true,
782 'disable' => false,
783 'route' => [
784 'name' => 'integrations',
785 'params' => [
786 'calendar_id' => $event->calendar_id,
787 'event_id' => $event->id
788 ]
789 ],
790 'label' => __('Integrations', 'fluent-booking'),
791 'elIcon' => 'Connection'
792 ]
793 ], $event);
794 }
795
796 public static function getCalendarSettingsMenuItems($calendar)
797 {
798 return apply_filters('fluent_booking/calendar_setting_menu_items', [
799 'calendar_settings' => [
800 'type' => 'route',
801 'visible' => true,
802 'disable' => false,
803 'route' => [
804 'name' => 'calendar_settings',
805 'params' => [
806 'calendar_id' => $calendar->id
807 ]
808 ],
809 'label' => __('Calendar Settings', 'fluent-booking'),
810 '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>'
811 ],
812 'remote_calendars' => [
813 'type' => 'route',
814 'visible' => true,
815 'disable' => true,
816 'route' => [
817 'name' => 'remote_calendars',
818 'params' => [
819 'calendar_id' => $calendar->id
820 ]
821 ],
822 'label' => __('Remote Calendars', 'fluent-booking'),
823 '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>'
824 ],
825 'zoom_meeting' => [
826 'type' => 'route',
827 'visible' => true,
828 'disable' => true,
829 'route' => [
830 'name' => 'user_zoom_integration',
831 'params' => [
832 'calendar_id' => $calendar->id
833 ]
834 ],
835 'label' => __('Zoom Integration', 'fluent-booking'),
836 '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>'
837 ]
838 ], $calendar);
839 }
840 }
841
842