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

@@ -25,10 +25,9 @@ use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
use Filament\Support\Enums\FontWeight;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Support\HtmlString;
@@ -216,62 +215,67 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
// ->recordClasses(fn ($record) => $record->part == 'gutachten' ? 'border-l border-primary-500' : 'border-l border-success-500')
->columns([
TextColumn::make('ordnungszahl')
->alignCenter()
->label('Index')
->alignRight()
->width('2rem')
->label('Index')
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2))
->extraCellAttributes(function ($record) {
if ($record->part == 1) {
return ['class' => 'bg-primary-500/10'];
} else {
return ['class' => 'bg-success-500/10'];
}
}),
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
IconColumn::make('neue_seite')
->label('Seite')
->tooltip('Start einer neue Seite')
->tooltip('Start neue Seite')
->alignCenter()
->label('Start')
->color('primary')
->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')
->wrap()
->searchable()
->weight(fn ($record): FontWeight => match ($record->ueberschrift_anzeigen) {
1 => FontWeight::SemiBold,
default => FontWeight::Thin,
})
->description(fn ($record): string => $record->textblock_kennung->name ?? ''),
TextColumn::make('tabellen.name')->wrap()->label('Tabelle'),
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->textblock))
->color(fn (string $state): string => match ($state) {
'0' => 'gray',
default => 'info',
}),
->tooltip(fn ($record): HtmlString => new HtmlString($record->textblock)),
IconColumn::make('tabellen')
->label('Tabelle')
->color('primary')
->alignCenter()
->icon('phosphor-table')
->tooltip(fn ($record): HtmlString => new HtmlString($record->name)),
TextColumn::make('seite')
->alignCenter()
->badge()
->color('info')
->color(fn ($record): string => $record->seitenzahl_anzeige ? 'primary' : 'gray')
->getStateUsing(function ($record) {
if ($record->seitenzahl_anzeige) {
if ($record->seite > 0) {
return (string) $record->seite;
} else {
return (string) 'auto';
}
return $record->seite == '0' ? 'auto' : $record->seite;
}
}),
])
->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',
]),
])
->defaultSort('sort', direction: 'asc')
->reorderable('sort')
->headerActions([