55 lines
2.2 KiB
PHP
55 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Inhaltsverzeichnis\Tables;
|
|
|
|
use Filament\Actions\DeleteAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Support\Enums\FontWeight;
|
|
use Filament\Tables\Columns\IconColumn;
|
|
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.')
|
|
// ->recordClasses(fn ($record) => $record->part == 'gutachten' ? 'border-l-4' : 'border-l-4')
|
|
->columns([
|
|
TextColumn::make('ordnungszahl')
|
|
->label('Index')
|
|
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
|
|
IconColumn::make('neue_seite')
|
|
->label('Seite')
|
|
->icon(fn (string $state): string => match ($state) {
|
|
'1' => 'phosphor-file-plus',
|
|
default => ''
|
|
}),
|
|
TextColumn::make('name')
|
|
->label('Überschrift')
|
|
->wrap()
|
|
->weight(fn ($record): FontWeight => match ($record->ueberschrift_anzeigen) {
|
|
1 => FontWeight::Thin,
|
|
default => FontWeight::SemiBold,
|
|
}),
|
|
// ToggleColumn::make('ueberschrift_anzeigen')->label('')->tooltip('Überschrift im PDF anzeigen'),
|
|
TextColumn::make('tabellen.name')->wrap()->label('Tabelle'),
|
|
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(),
|
|
DeleteAction::make()->iconButton(),
|
|
]);
|
|
}
|
|
}
|