inhaltsangabe wip

This commit is contained in:
salam committed 2025-10-19 12:26:48 +02:00
1 parent 8ccc4a3c20
commit 3a35ccd69d
34 files changed
+281 -236

No files matched your search

@@ -10,8 +10,14 @@ class CreateProjektInhaltsverzeichnis
{
public static function create($record)
{
$inhaltsverzeichnis = Inhaltsverzeichnis::with('textblock_kennung')->get();
$inhaltsverzeichnis = Inhaltsverzeichnis::get();
foreach ($inhaltsverzeichnis as $inhalt) {
$textblock = '';
if ($inhalt->textblock_id > 0) {
$textblock = Textblock::where('id', $inhalt->textblock_id)->pluck('textblock')->first();
}
ProjektInhaltsverzeichnis::updateOrCreate(
[
'projekte_id' => $record->id,
@@ -20,9 +26,12 @@ class CreateProjektInhaltsverzeichnis
[
'sort' => $inhalt->sort,
'ordnungszahl' => $inhalt->ordnungszahl,
'name' => $inhalt->name,
'ueberschrift_nicht_anzeigen' => $inhalt->ueberschrift_nicht_anzeigen,
'seite' => $inhalt->seite,
'textblock_kennung_id' => $inhalt->textblock_kennung_id,
'textblock' => Textblock::where('id', $inhalt->textblock_kennung_id)->pluck('textblock')->first(),
'tabellen_id' => $inhalt->tabellen_id,
'textblock_id' => $inhalt->textblock_id,
'textblock' => $textblock,
]);
}
}
@@ -52,6 +52,29 @@ class GutachterForm
->label('Telefon')
->defaultCountry('AT'),
]),
Tab::make('Logo')
->icon('phosphor-image')
->schema([
Checkbox::make('logo_anzeigen')
->label('Das Logo im Gutachten verwenden')
->columnSpanFull(),
FileUpload::make('logo')
->image()
->disk('public')
->directory('gutachter-logo')
->maxSize(3072) // 3MB limit
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
->visibility('public')
->label('Logo'),
Radio::make('logo_align')
->Label('Position')
->default('right')
->options([
'left' => 'Links',
'center' => 'Zentriert',
'right' => 'Rechts',
]),
])->columns(2),
Tab::make('Anzeige am Deckblatt')
->icon('lucide-contact')
->schema([
@@ -98,28 +121,19 @@ class GutachterForm
->label('Adresse')
->required(),
]),
Tab::make('Logo')
->icon('phosphor-image')
Tab::make('digitale_signatur')
->label('Digitale Signatur')
->icon('phosphor-stamp')
->schema([
Checkbox::make('logo_anzeigen')
->label('Das Logo im Gutachten verwenden')
->columnSpanFull(),
FileUpload::make('logo')
FileUpload::make('digitale_signatur_stempel')
->label('Bild vom Stempel')
->image()
->disk('public')
->directory('gutachter-logo')
->directory('gutachter-stempel')
->maxSize(3072) // 3MB limit
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
->visibility('public')
->label('Logo'),
Radio::make('logo_align')
->Label('Position')
->default('right')
->options([
'left' => 'Links',
'center' => 'Zentriert',
'right' => 'Rechts',
]),
->visibility('public'),
])->columns(2),
])->columnSpanFull(),
]);
@@ -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(),
]);
}
}
@@ -23,7 +23,7 @@ class KontoTextblockResource extends Resource
protected static ?string $cluster = VerwaltungCluster::class;
protected static ?string $navigationLabel = 'Textblock';
protected static ?string $navigationLabel = 'Eigene Textblöcke';
protected static ?string $modelLabel = 'Textblock';
@@ -2,9 +2,7 @@
namespace App\Filament\Resources\KontoTextblocks\Schemas;
use App\Models\TextblockKennung;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
@@ -17,11 +15,7 @@ class KontoTextblockForm
->components([
TextInput::make('name')
->required(),
Textarea::make('beschreibung')
->afterLabel('Bei gleichen Textblockarten kann hier der Unterschied kurz angerissen werden.'),
Select::make('textblock_kennung_id')
->label('Textblock Art')
->options(TextblockKennung::pluck('name', 'id')),
Textarea::make('beschreibung'),
RichEditor::make('textblock')
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
@@ -2,13 +2,10 @@
namespace App\Filament\Resources\KontoTextblocks\Tables;
use App\Models\TextblockKennung;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Support\Enums\FontWeight;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\SelectFilter;
use Filament\Tables\Table;
use Illuminate\Support\HtmlString;
@@ -19,14 +16,8 @@ class KontoTextblocksTable
return $table
->defaultPaginationPageOption(5)
->columns([
TextColumn::make('textblock_kennung.name')
->label('Kennung')
->color('info')
->wrap()
->description(function ($record) {
return new HtmlString($record->beschreibung);
}),
TextColumn::make('name')
->searchable()
->weight(FontWeight::Bold)
->wrap()
->description(function ($record) {
@@ -34,22 +25,9 @@ class KontoTextblocksTable
})
->html(),
])
->filters([
SelectFilter::make('textblock_kennung_id')
->label('Textbock Art')
->options(function (): array {
return TextblockKennung::join('konto_textblocks', 'textblock_kennungs.id', '=', 'konto_textblocks.textblock_kennung_id')
->pluck('textblock_kennungs.name', 'textblock_kennungs.id')->toArray();
})
->preload(),
])
->recordActions([
EditAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
EditAction::make()->iconButton()->color('gray'),
DeleteAction::make()->iconButton(),
]);
}
}
@@ -179,7 +179,7 @@ class OrientierungZuAbschlaegesRelationManager extends RelationManager
}
}),
BulkAction::make('a')
->label($spalten['a'].' Faktor' ?? '')
->label($spalten['a'] ?? '')
->color('info')
->hidden(isset($spalten['a']) ? false : true)
->schema([
@@ -3,7 +3,6 @@
namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Models\KontoTextblock;
use App\Models\TextblockKennung;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\CreateAction;
@@ -11,14 +10,14 @@ use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Radio;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Components\Actions;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Flex;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Utilities\Set;
use Filament\Schemas\Schema;
@@ -42,27 +41,19 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
{
return $schema
->components([
TextInput::make('ordnungszahl')->numeric(),
TextInput::make('name'),
Select::make('textblock_kennung_id')
->label('Textblock Art')
->options(function () {
$relatedOptions = TextblockKennung::all()->pluck('name', 'id')->toArray();
return ['0' => 'ohne Textblock'] + $relatedOptions;
})
->live(),
RichEditor::make('textblock')
->hidden(fn (Get $get): bool => ! $get('textblock_kennung_id'))
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
Flex::make([
Section::make([
RichEditor::make('textblock')
->hidden(fn (Get $get): bool => ! $get('textblock_kennung_id'))
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
]),
]),
Fieldset::make('Vorlagen')
->hiddenLabel()
->hidden(fn ($record): bool => ! isset($record) || ! $record['textblock_kennung_id'])
->schema([
Section::make([
Action::make('textblock_sichern')
->schema([
Hidden::make('konto_id')->default(auth()->user()->konto_id),
@@ -88,9 +79,9 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
}),
])
->modalSubmitActionLabel('Sichern')
->iconButton()
->icon('phosphor-floppy-disk')
->tooltip('Ein veränderter Textblock kann als persönliche Vorlage gespeichert werden.')
->color('info')
->action(function (array $mountedActions, $data) {
$record = $mountedActions[0]->getRawData();
@@ -107,8 +98,9 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
Actions::make([
Action::make('textblock_laden')
->schema([
Radio::make('konto_textblock_id')
Select::make('konto_textblock_id')
->hiddenLabel()
->searchable()
->options(function ($record) {
return KontoTextblock::where('textblock_kennung_id', $record['textblock_kennung_id'])->where('konto_id', auth()->user()->konto_id)->pluck('name', 'id')->toArray();
})->belowLabel([
@@ -116,16 +108,17 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
]),
])
->icon('phosphor-article')
->iconButton()
->modalSubmitActionLabel('Einsetzen')
->color('info')
->tooltip('Personaliserten Texblock laden.')
->tooltip('Personaliserten Textblock laden.')
->action(function (Set $set, array $data) {
$set('textblock', KontoTextblock::query()->where('id', $data['konto_textblock_id'])->pluck('textblock')->first());
}),
]),
])->columns(4),
])->grow(false),
])->columnSpanFull(),
])->columns(1);
]);
}
public function table(Table $table): Table
@@ -2,9 +2,7 @@
namespace App\Filament\Resources\Textblocks\Schemas;
use App\Models\TextblockKennung;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
@@ -19,9 +17,7 @@ class TextblockForm
->required(),
Textarea::make('beschreibung')
->afterLabel('Bei gleichen Textblockarten kann hier der Unterschied kurz angerissen werden.'),
Select::make('textblock_kennung_id')
->label('Textblock Art')
->options(TextblockKennung::pluck('name', 'id')),
RichEditor::make('textblock')
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
@@ -2,6 +2,7 @@
namespace App\Filament\Resources\Textblocks\Tables;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Support\Enums\FontWeight;
use Filament\Tables\Columns\TextColumn;
@@ -15,13 +16,6 @@ class TextblocksTable
return $table
->defaultPaginationPageOption(5)
->columns([
TextColumn::make('textblock_kennung.name')
->label('Kennung')
->color('info')
->wrap()
->description(function ($record) {
return new HtmlString($record->beschreibung);
}),
TextColumn::make('name')
->weight(FontWeight::Bold)
->wrap()
@@ -32,6 +26,7 @@ class TextblocksTable
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
DeleteAction::make()->iconButton(),
]);
}
}
+1
View File
@@ -23,6 +23,7 @@ class Gutachter extends Model
'logo',
'logo_align',
'referenz_formatting',
'digitale_signatur_stempel',
'logo_anzeigen',
'text_anzeigen',
];
+10 -3
View File
@@ -8,14 +8,21 @@ class Inhaltsverzeichnis extends Model
{
protected $fillable = [
'name',
'textblock_kennung_id',
'ueberschrift_anzeigen',
'tabellen_id',
'textblock_id',
'sort',
'ordnungszahl',
'seite',
];
public function textblock_kennung()
public function textblock()
{
return $this->hasMany(TextblockKennung::class, 'id', 'textblock_kennung_id');
return $this->hasMany(Textblock::class, 'id', 'textblock_id');
}
public function tabellen()
{
return $this->hasMany(Tabellen::class, 'id', 'tabellen_id');
}
}
-5
View File
@@ -18,9 +18,4 @@ class KontoTextblock extends Model
{
static::addGlobalScope(new KontoScope);
}
public function textblock_kennung()
{
return $this->hasMany(TextblockKennung::class, 'id', 'textblock_kennung_id');
}
}
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Tabellen extends Model
{
//
}
-6
View File
@@ -9,12 +9,6 @@ class Textblock extends Model
protected $fillable = [
'name',
'beschreibung',
'textblock_kennung_id',
'textblock',
];
public function textblock_kennung()
{
return $this->hasMany(TextblockKennung::class, 'id');
}
}
-12
View File
@@ -1,12 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class TextblockKennung extends Model
{
protected $fillable = [
'name',
];
}