added missing translations
This commit is contained in:
65
app/Filament/Resources/TenantFeedbackResource.php
Normal file
65
app/Filament/Resources/TenantFeedbackResource.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\TenantFeedbackResource\Pages\ListTenantFeedback;
|
||||
use App\Filament\Resources\TenantFeedbackResource\Pages\ViewTenantFeedback;
|
||||
use App\Filament\Resources\TenantFeedbackResource\Schemas\TenantFeedbackForm;
|
||||
use App\Filament\Resources\TenantFeedbackResource\Schemas\TenantFeedbackInfolist;
|
||||
use App\Filament\Resources\TenantFeedbackResource\Tables\TenantFeedbackTable;
|
||||
use App\Models\TenantFeedback;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class TenantFeedbackResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TenantFeedback::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedChatBubbleBottomCenterText;
|
||||
|
||||
protected static UnitEnum|string|null $navigationGroup = null;
|
||||
|
||||
protected static ?int $navigationSort = 120;
|
||||
|
||||
public static function canCreate(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return TenantFeedbackForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return TenantFeedbackInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return TenantFeedbackTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getNavigationGroup(): UnitEnum|string|null
|
||||
{
|
||||
return __('Feedback & Support');
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListTenantFeedback::route('/'),
|
||||
'view' => ViewTenantFeedback::route('/{record}'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TenantFeedbackResource\Pages;
|
||||
|
||||
use App\Filament\Resources\TenantFeedbackResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListTenantFeedback extends ListRecords
|
||||
{
|
||||
protected static string $resource = TenantFeedbackResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TenantFeedbackResource\Pages;
|
||||
|
||||
use App\Filament\Resources\TenantFeedbackResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewTenantFeedback extends ViewRecord
|
||||
{
|
||||
protected static string $resource = TenantFeedbackResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TenantFeedbackResource\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class TenantFeedbackForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TenantFeedbackResource\Tables;
|
||||
|
||||
use App\Models\TenantFeedback;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class TenantFeedbackTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('created_at', 'desc')
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label(__('Eingegangen'))
|
||||
->since()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('tenant.name')
|
||||
->label(__('Tenant'))
|
||||
->searchable()
|
||||
->limit(30),
|
||||
Tables\Columns\TextColumn::make('event.name')
|
||||
->label(__('Event'))
|
||||
->limit(30)
|
||||
->toggleable(),
|
||||
Tables\Columns\TextColumn::make('category')
|
||||
->label(__('Kategorie'))
|
||||
->badge()
|
||||
->formatStateUsing(fn (string $state) => Str::headline($state))
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::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) : '—')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('rating')
|
||||
->label(__('Rating'))
|
||||
->formatStateUsing(fn (?int $state) => $state ? sprintf('%d/5', $state) : '—')
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('message')
|
||||
->label(__('Nachricht'))
|
||||
->limit(60)
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('sentiment')
|
||||
->label(__('Stimmung'))
|
||||
->options([
|
||||
'positive' => __('Positiv'),
|
||||
'neutral' => __('Neutral'),
|
||||
'negative' => __('Negativ'),
|
||||
]),
|
||||
SelectFilter::make('category')
|
||||
->label(__('Kategorie'))
|
||||
->options(fn () => TenantFeedback::query()
|
||||
->whereNotNull('category')
|
||||
->orderBy('category')
|
||||
->pluck('category', 'category')
|
||||
->toArray()),
|
||||
])
|
||||
->recordActions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
])
|
||||
->bulkActions([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user