20, 'element' => 'fcal_booking', 'attributes' => array( 'name' => 'fcal_booking', 'data-type' => 'fcal_booking' ), 'settings' => array( 'label' => __('Select Appointment Date & Time', 'fluent-booking'), 'admin_field_label' => '', 'event_id' => '', 'booking_calendar' => '', 'conditional_logics' => array(), 'container_class' => '', 'cal_guest_fields' => [ 'email_field' => '', 'name_field' => '', 'host_info' => 'show' ], 'validation_rules' => array( 'required' => [ 'value' => false, 'message' => __('Appointment Date & Time is required', 'fluent-booking'), ], ), ), 'editor_options' => array( 'title' => __('FluentBooking Field', 'fluent-booking'), 'icon_class' => 'el-icon-date', 'template' => 'inputCalendar' ), ]; } public function getGeneralEditorElements() { return [ 'booking_calendar', 'label', 'label_placement', 'admin_field_label', 'event_id', 'cal_guest_fields', 'validation_rules', ]; } public function getAdvancedEditorElements() { return [ 'container_class', 'name', 'conditional_logics' ]; } public function getEditorCustomizationSettings() { return [ 'event_id' => [ 'template' => 'selectGroup', 'label' => __('Select Calendar', 'fluent-booking'), ], 'cal_guest_fields' => [ 'template' => 'CustomSettingsField', 'label' => __('Guest Fields', 'fluent-booking'), 'componentName' => 'FluentCalNameEmailChoiceComponent' ], ]; } /** * Compile and echo the html element * @param array $data [element data] * @param object $form [Form Object] * @return void */ public function render($data, $form) { $elementName = $data['element']; $data['attributes']['class'] = @trim('ff-el-form-control ' . Arr::get($data, 'attributes.class')); $data['attributes']['id'] = $this->makeElementId($data, $form); if ($tabIndex = \FluentForm\App\Helpers\Helper::getNextTabIndex()) { $data['attributes']['tabindex'] = $tabIndex; } $ariaRequired = 'false'; if (Arr::get($data, 'settings.validation_rules.required.value')) { $ariaRequired = 'true'; } $slot_id = (int)Arr::get($data, 'settings.event_id'); $calendarEvent = CalendarSlot::find($slot_id); if (!$calendarEvent || !$calendarEvent->calendar) { esc_html_e('Selected Calendar could not be found', 'fluent-booking'); return; } $isHostEnabled = Arr::get($data, 'settings.cal_guest_fields.host_info', 'hide') == 'show'; $showHostInfo = $isHostEnabled || Arr::isTrue($calendarEvent->settings, 'multi_duration.enabled'); [$localizeData, $element_id] = (new FluentFormInit())->getLocalizedData($calendarEvent, $data, $form); $localizeData['time_format'] = (Helper::getGlobalSettings())['time_format']; $assetUrl = App::getInstance('url.assets'); wp_enqueue_script( 'fluentform-calendar-public', $assetUrl . 'public/js/fluentform.js', [], FLUENT_BOOKING_ASSETS_VERSION, true ); if (BookingFieldService::hasPhoneNumberField($localizeData['form_fields'])) { wp_enqueue_script('fluent-booking-phone-field', $assetUrl . 'public/js/phone-field.js', [], FLUENT_BOOKING_ASSETS_VERSION, true); ?> getGlobalVars() ); $calClass = 'fluentform_calendar_app'; if ($showHostInfo) { $calClass .= ' fcal_showing_host'; } else { $calClass .= ' fcal_not_showing_host'; } $elMarkup = '
| ' . __('Booking ID', 'fluent-booking') . ' | '; $html .= '' . $booking->id . ' View Booking | '; $html .= '
|---|---|
| ' . __('Booking Status', 'fluent-booking') . ' | '; $html .= '' . $booking->status . ' | '; $html .= '
| ' . __('Date & Time', 'fluent-booking') . ' | '; $html .= '' . $booking->getFullBookingDateTimeText($calendar->author_timezone, true) . ' (' . $calendar->author_timezone . ') | '; $html .= '
| ' . __('Meeting Duration', 'fluent-booking') . ' | '; $html .= '' . $booking->slot_minutes . ' Minutes | '; $html .= '
| ' . __('Meeting Host', 'fluent-booking') . ' | '; $html .= '' . $calendar->title . ' | '; $html .= '