inhaltsangabe wip
This commit is contained in:
1 parent
8ccc4a3c20
commit
3a35ccd69d
34 files changed
+281
-236
No files matched your search
@@ -14,6 +14,7 @@ class ListInhaltsverzeichnis extends ListRecords
|
||||
{
|
||||
return [
|
||||
CreateAction::make()
|
||||
->modalHeading('Kapitel hinzufügen')
|
||||
->icon('phosphor-file-plus')
|
||||
->createAnother(false),
|
||||
];
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
|
||||
namespace App\Filament\Resources\Inhaltsverzeichnis\Schemas;
|
||||
|
||||
use App\Models\TextblockKennung;
|
||||
use App\Models\Tabellen;
|
||||
use App\Models\Textblock;
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Components\Flex;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class InhaltsverzeichnisForm
|
||||
@@ -13,15 +18,52 @@ class InhaltsverzeichnisForm
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('ordnungszahl')->numeric(),
|
||||
Select::make('textblock_kennung_id')
|
||||
->label('Textblock Art')
|
||||
->options(function () {
|
||||
$relatedOptions = TextblockKennung::all()->pluck('name', 'id')->toArray();
|
||||
Flex::make([
|
||||
Section::make([
|
||||
Textarea::make('name')
|
||||
->required()
|
||||
->label('Kapitel Überschrift'),
|
||||
Checkbox::make('ueberschrift_nicht_anzeigen')
|
||||
->label('Überschrift nicht angezeigen'),
|
||||
]),
|
||||
Section::make([
|
||||
TextInput::make('ordnungszahl')
|
||||
->label('Kapitel Index')
|
||||
->placeholder('3.21')
|
||||
->numeric()
|
||||
->default(0)
|
||||
->belowContent([
|
||||
'Bei "0" wird der Index im PDF nicht angezeigt',
|
||||
]),
|
||||
TextInput::make('seite')
|
||||
->label('Seitenzahl')
|
||||
->numeric()
|
||||
->default(0)
|
||||
->belowContent([
|
||||
'Bei "0" wird die Seitenzahl automatisch generiert',
|
||||
]),
|
||||
]),
|
||||
])->columnSpanFull(2),
|
||||
|
||||
return ['0' => 'ohne Textblock'] + $relatedOptions;
|
||||
}),
|
||||
TextInput::make('name'),
|
||||
])->columns(1);
|
||||
Select::make('tabellen_id')->label('Tabelle')
|
||||
->prefixIcon('phosphor-table')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
return Tabellen::all()->pluck('name', 'id')->toArray();
|
||||
})->belowContent([
|
||||
'Kann auch frei bleiben',
|
||||
]),
|
||||
|
||||
Select::make('textblock_id')->label('Textblock')
|
||||
->prefixIcon('phosphor-article')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
return Textblock::all()->pluck('name', 'id')->toArray();
|
||||
|
||||
// return ['100' => 'Eigener Textblock'] + $relatedOptions;
|
||||
})->belowContent([
|
||||
'Kann auch frei bleiben',
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
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
|
||||
@@ -11,21 +13,34 @@ class InhaltsverzeichnisTable
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->heading('Inhaltsverzeichnis')
|
||||
->description('Wird als Vorlage bei den Gutachten verwendet.')
|
||||
->columns([
|
||||
// TextColumn::make('sort'),
|
||||
TextColumn::make('ordnungszahl')
|
||||
->label('Index')
|
||||
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
|
||||
TextColumn::make('name')
|
||||
->description(fn ($record): string => $record->textblock_kennungs->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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user