Files
nutzwerte_fi4/app/Filament/Resources/Inhaltsverzeichnis/Tables/InhaltsverzeichnisTable.php
T
2025-10-19 12:26:48 +02:00

47 lines
1.9 KiB
PHP

<?php
namespace App\Filament\Resources\Inhaltsverzeichnis\Tables;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
class InhaltsverzeichnisTable
{
public static function configure(Table $table): Table
{
return $table
->heading('Inhaltsverzeichnis')
->description('Wird als Vorlage bei den Gutachten verwendet.')
->columns([
TextColumn::make('ordnungszahl')
->label('Index')
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
TextColumn::make('name')
->label('Überschrift')
->wrap()
->description(fn ($record): string => $record->textblock_kennungs->name ?? '')
->color(fn ($record): string => match ($record->ueberschrift_nicht_anzeigen) {
1 => 'primary',
default => 'gray',
}),
// ToggleColumn::make('ueberschrift_anzeigen')->label('')->tooltip('Überschrift im PDF anzeigen'),
TextColumn::make('tabellen.name')->wrap(),
TextColumn::make('textblock.name')->wrap(),
TextColumn::make('seite')
->alignCenter()
->badge()
->color('info')
->getStateUsing(fn ($record): string => $record->seite == '0' ? '...' : $record->seite),
])
->defaultSort('sort', direction: 'asc')
->reorderable('sort')
->recordActions([
EditAction::make()->iconButton()->color('gray'),
DeleteAction::make()->iconButton(),
]);
}
}