textblöcke und Tabellen in der Inhaltsangabe

This commit is contained in:
salam committed 2025-10-31 11:17:15 +01:00
1 parent 5907e1129d
commit c64634b3a1
13 files changed
+242 -205

No files matched your search

@@ -4,10 +4,12 @@ namespace App\Filament\Resources\Inhaltsverzeichnis\Tables;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Enums\FiltersLayout;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Support\HtmlString;
class InhaltsverzeichnisTable
{
@@ -15,36 +17,68 @@ class InhaltsverzeichnisTable
{
return $table
->heading('Inhaltsverzeichnis')
->description('Wird als Vorlage bei den Gutachten verwendet.')
->description('Generische Vorlage beim Erstellen neuer Projekte.')
// ->recordClasses(fn ($record) => $record->part == 'gutachten' ? 'border-l-4' : 'border-l-4')
->columns([
TextColumn::make('ordnungszahl')
->label('Index')
->alignRight()
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
IconColumn::make('neue_seite')
->label('Seite')
->tooltip('Start neue Seite')
->color('primary')
->alignCenter()
->label('Start')
->icon(fn (string $state): string => match ($state) {
'1' => 'phosphor-file-plus',
default => ''
}),
IconColumn::make('ueberschrift_anzeigen')
->label('')
->tooltip('Überschrift anzeigen')
->icon(fn (string $state): Heroicon => match ($state) {
'1' => Heroicon::OutlinedEye,
'0' => Heroicon::OutlinedEyeSlash,
}),
TextColumn::make('name')
->label('Überschrift')
->wrap(),
TextColumn::make('tabellen.name')->wrap()->label('Tabelle'),
TextColumn::make('textblock.name')->wrap(),
IconColumn::make('ueberschrift_anzeigen')
->label('Anzeigen')
->alignCenter()
->tooltip('Überschrift anzeigen')
->color(fn ($state): string => $state ? 'primary' : 'gray')
->icon(fn ($state): string => $state ? 'phosphor-article-ny-times' : ''),
IconColumn::make('textblock')
->color('primary')
->alignCenter()
->icon('phosphor-article')
->tooltip(fn ($record): HtmlString => new HtmlString($record->name)),
IconColumn::make('tabellen')
->color('primary')
->alignCenter()
->icon('phosphor-table')
->tooltip(fn ($record): HtmlString => new HtmlString($record->name)),
TextColumn::make('seite')
->alignCenter()
->badge()
->color('info')
->getStateUsing(fn ($record): string => $record->seite == '0' ? '...' : $record->seite),
->color(fn ($record): string => $record->seitenzahl_anzeige ? 'primary' : 'gray')
->getStateUsing(function ($record) {
if ($record->seitenzahl_anzeige) {
return $record->seite == '0' ? 'auto' : $record->seite;
}
}),
])
// ->paginated(false)
->defaultPaginationPageOption(5)
->persistFiltersInSession()
->deferFilters(false)
->filtersFormColumns(3)
->filters([
SelectFilter::make('part')
->selectablePlaceholder(false)
->default('standard')
->label('Gutachten Komponenten')
->options([
'standard' => 'Gutachten Standard Texte',
'nutzwerte' => 'Nutzwerberechnung',
'paragraph' => 'Auszug Gutachten gem. §6',
]),
])
// ], layout: FiltersLayout::AboveContent)
->defaultSort('sort', direction: 'asc')
->reorderable('sort')
->recordActions([