textblöcke und Tabellen in der Inhaltsangabe
This commit is contained in:
1 parent
5907e1129d
commit
c64634b3a1
13 files changed
+242
-205
No files matched your search
@@ -23,7 +23,7 @@ class GutachterResource extends Resource
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-stamp';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
protected static ?string $recordTitleAttribute = 'company';
|
||||
|
||||
protected static ?string $navigationLabel = 'Gutachter';
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ class InhaltsverzeichnisForm
|
||||
Textarea::make('name')
|
||||
->required()
|
||||
->label('Überschrift in der Inhaltsangabe')
|
||||
->columnSpan(2),
|
||||
->columnSpan(3),
|
||||
Textarea::make('name2')
|
||||
->label('Überschrift im Dokument')
|
||||
->belowContent([
|
||||
'Bei abweichender Überschrift im Dokument',
|
||||
])
|
||||
->columnSpan(2),
|
||||
->columnSpan(3),
|
||||
TextInput::make('ordnungszahl')
|
||||
->label('Kapitel Index')
|
||||
->placeholder('3.21')
|
||||
@@ -50,10 +50,25 @@ class InhaltsverzeichnisForm
|
||||
'Bei "0" wird die Seitenzahl automatisch generiert',
|
||||
])
|
||||
->columnSpan(1),
|
||||
Checkbox::make('seitenzahl_anzeige')
|
||||
->label('Seitenzahl angezeigen'),
|
||||
])->columnSpanFull(),
|
||||
Section::make('Tabellen & Textblöcke')
|
||||
Section::make('Textblock und Tabelle')
|
||||
->hiddenLabel()
|
||||
->description('Ausgabe Textblock vor Tabelle')
|
||||
->schema([
|
||||
Select::make('textblock_id')->label('Textblock')
|
||||
->prefixIcon('phosphor-article')
|
||||
->prefixIconColor(
|
||||
fn ($record): string => $record->textblock_id == 0 ? 'gray' : 'primary'
|
||||
)
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Textblock::all()->pluck('name', 'id')->toArray();
|
||||
array_unshift($res, 'Ohne Textblock');
|
||||
|
||||
return $res;
|
||||
}),
|
||||
Select::make('tabellen_id')->label('Tabelle')
|
||||
->prefixIcon('phosphor-table')
|
||||
->prefixIconColor(
|
||||
@@ -67,18 +82,6 @@ class InhaltsverzeichnisForm
|
||||
return $res;
|
||||
}),
|
||||
|
||||
Select::make('textblock_id')->label('Textblock')
|
||||
->prefixIcon('phosphor-article')
|
||||
->prefixIconColor(
|
||||
fn ($record): string => $record->textblock_id == 0 ? 'gray' : 'primary'
|
||||
)
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Textblock::all()->pluck('name', 'id')->toArray();
|
||||
array_unshift($res, 'Ohne Textblock');
|
||||
|
||||
return $res;
|
||||
}),
|
||||
])->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -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([
|
||||
|
||||
@@ -15,6 +15,7 @@ class MethodesTable
|
||||
return $table
|
||||
->paginated(false)
|
||||
->columns([
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')
|
||||
->weight(FontWeight::Bold)
|
||||
->wrap()
|
||||
|
||||
+40
-36
@@ -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([
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Filament\Resources\Projektes\RelationManagers;
|
||||
|
||||
use App\Actions\Create\CreateProjektObjekte;
|
||||
use App\Models\Merkmale;
|
||||
use App\Models\Orientierung;
|
||||
use App\Models\ProjektObjekte;
|
||||
@@ -17,7 +16,6 @@ use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Support\Enums\Width;
|
||||
use Filament\Tables\Columns\CheckboxColumn;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
@@ -264,18 +262,6 @@ class ProjektObjekteRelationManager extends RelationManager
|
||||
->after(function (Component $livewire) {
|
||||
$livewire->dispatch('refreshOrientierung');
|
||||
}),
|
||||
// Action::make('erstellen')
|
||||
// ->action(fn (CreateProjektObjekte $createProjektObjekte) => $createProjektObjekte->create($this->ownerRecord))
|
||||
// ->requiresConfirmation()
|
||||
// ->modalHeading('Objekte erstellen')
|
||||
// ->modalDescription('Alle bestehenden Daten in dieser Tabelle werden vorher gelöscht.')
|
||||
// ->modalSubmitActionLabel('Generieren')
|
||||
// ->label('Generieren')
|
||||
// ->tooltip('Daten werden aus "Objekte im Detail" gefiltert.')
|
||||
// ->icon('heroicon-o-cog-8-tooth')
|
||||
// ->after(function (Component $livewire) {
|
||||
// $livewire->dispatch('refreshOrientierung');
|
||||
// }),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
|
||||
Reference in new issue
Block a user