'', ]; } public function listItems() { return [ [ 'label' => __eva('Book Now Link'), 'slug' => 'book_now_link', 'is_enabled' => !empty($this->default_widget_id), 'description' => __eva('Configure the default widget used for the {book_now} link in WhatsApp and SMS templates.'), ], ]; } public function fields() { return [ 'book_now_link' => [ [ 'attribute' => 'explanation', 'component' => 'group-info-field', 'name' => __eva('Book Now Link Configuration'), 'value' => $this->getExplanationHtml(), ], [ 'attribute' => 'default_widget_id', 'stacked' => true, 'name' => __eva('Default Widget'), 'helpText' => __eva('Select the reservation widget to use when generating the {book_now} link in WhatsApp messages, SMS, and missed call templates.'), 'component' => 'select-field', 'options' => $this->getWidgetOptions(), 'value' => $this->default_widget_id, ], ], ]; } /** * Get explanation HTML for the info field */ protected function getExplanationHtml() { return '
' . '

' . __eva('The {book_now} tag is used in WhatsApp templates, SMS messages, and missed call auto-replies to generate a link to your reservation page.') . '

' . '

' . __eva('Select the default widget that will be used to generate this link. This setting applies to all WhatsApp messages, reminders, reconfirmations, custom messages, auto-replies, and missed call messages.') . '

' . '

' . __eva('In the future, you will be able to configure rules to use different widgets based on the day of the week or time of day.') . '

' . '
'; } /** * Get available widgets as select options */ protected function getWidgetOptions() { $options = [ ['label' => __eva('-- Default widget --'), 'value' => ''], ]; try { $widgets = WidgetForm::where('restaurant_id', $this->restaurant_id)->get(); foreach ($widgets as $widget) { $options[] = [ 'label' => $widget->name ?: __eva('Widget') . ' #' . $widget->id, 'value' => $widget->id, ]; } } catch (\Throwable $e) { // Silently fail } return $options; } }