63 lines
2.6 KiB
PHP
63 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\TenantFeedbackResource\Schemas;
|
|
|
|
use Filament\Infolists\Components\KeyValueEntry;
|
|
use Filament\Infolists\Components\Section;
|
|
use Filament\Infolists\Components\TextEntry;
|
|
use Filament\Schemas\Schema;
|
|
use Illuminate\Support\Str;
|
|
|
|
class TenantFeedbackInfolist
|
|
{
|
|
public static function configure(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make(__('Überblick'))
|
|
->columns(3)
|
|
->schema([
|
|
TextEntry::make('tenant.name')->label(__('Tenant'))->placeholder('—'),
|
|
TextEntry::make('event.name')->label(__('Event'))->placeholder('—'),
|
|
TextEntry::make('category')
|
|
->label(__('Kategorie'))
|
|
->badge()
|
|
->formatStateUsing(fn ($state) => $state ? Str::headline($state) : '—'),
|
|
TextEntry::make('sentiment')
|
|
->label(__('Stimmung'))
|
|
->badge()
|
|
->color(fn (?string $state) => match ($state) {
|
|
'positive' => 'success',
|
|
'neutral' => 'warning',
|
|
'negative' => 'danger',
|
|
default => 'gray',
|
|
})
|
|
->formatStateUsing(fn (?string $state) => $state ? Str::headline($state) : '—'),
|
|
TextEntry::make('rating')
|
|
->label(__('Rating'))
|
|
->formatStateUsing(fn (?int $state) => $state ? sprintf('%d/5', $state) : '—'),
|
|
TextEntry::make('created_at')
|
|
->label(__('Eingegangen'))
|
|
->since(),
|
|
]),
|
|
Section::make(__('Inhalt'))
|
|
->columns(1)
|
|
->schema([
|
|
TextEntry::make('title')
|
|
->label(__('Betreff'))
|
|
->placeholder('—'),
|
|
TextEntry::make('message')
|
|
->label(__('Nachricht'))
|
|
->markdown()
|
|
->placeholder('—'),
|
|
]),
|
|
Section::make(__('Metadaten'))
|
|
->schema([
|
|
KeyValueEntry::make('metadata')
|
|
->label(__('Metadata'))
|
|
->columnSpanFull(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|