This commit is contained in:
salam committed 2025-11-07 10:52:36 +01:00
1 parent faded38980
commit 48b372c164
24 files changed
+357 -244

No files matched your search

@@ -20,12 +20,13 @@ class CreateProjektInhaltsverzeichnis
$text = Textblock::where('id', $value->textblock_id)->first();
$inhalt = new ProjektInhaltsverzeichnis;
$inhalt->projekte_id = $record->id;
$inhalt->inhaltsverzeichnis_id = $value->id;
$inhalt->sort = $key;
$inhalt->ordnungszahl = $value->ordnungszahl;
$inhalt->name = $value->name;
$inhalt->name2 = $value->name2;
$inhalt->ueberschrift_verbergen = $value->ueberschrift_verbergen;
$inhalt->inhaltselement_id = $value->inhaltselement_id;
$inhalt->textblock_id = $value->textblock_id;
$inhalt->part = $value->part;
$inhalt->seite = $value->seite;
$inhalt->neue_seite = $value->neue_seite;
+4 -2
View File
@@ -7,12 +7,14 @@ use Filament\Actions\Action;
class ShowHelp
{
public static $helping;
public static function show($kennung)
{
$helping = Help::where('kennung', $kennung)->first();
if (! $helping) {
return false;
}
return Action::make('help')
->icon('phosphor-question')
->tooltip(view('pages.help')->with('helping', $helping))
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Actions\Helper;
use Filament\Actions\Action;
use Illuminate\View\View;
class ShowHelpInhalt
{
public static function show()
{
return Action::make('help')
->icon('phosphor-question')
->hidden(fn ($record): bool => (! $record->inhaltsverzeichnis->hilfe_titel && ! $record->inhaltsverzeichnis->hilfe_description || ! $record->inhaltsverzeichnis->hilfe_image) ? true : false)
->tooltip(fn ($record): View => view('pages.helpinhalt')->with('record', $record))
->iconButton();
}
}
+5 -12
View File
@@ -19,15 +19,15 @@ class HelpResource extends Resource
protected static ?string $cluster = AdministrationCluster::class;
protected static string|UnitEnum|null $navigationGroup = 'Vorlagen';
protected static string|UnitEnum|null $navigationGroup = 'Hilfen';
protected static string|BackedEnum|null $navigationIcon = 'phosphor-info';
protected static string|BackedEnum|null $navigationIcon = 'phosphor-question';
protected static ?string $navigationLabel = 'Hilfen';
protected static ?string $navigationLabel = 'Allgemein';
protected static ?string $modelLabel = 'Hilfen';
protected static ?string $modelLabel = 'Allgemein';
protected static ?string $pluralModelLabel = 'Hilfen';
protected static ?string $pluralModelLabel = 'Allgemein';
protected static ?int $navigationSort = 5;
@@ -41,13 +41,6 @@ class HelpResource extends Resource
return HelpsTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
@@ -5,9 +5,11 @@ namespace App\Filament\Resources\Inhaltsverzeichnis\Schemas;
use App\Models\Inhaltselement;
use App\Models\Textblock;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Schemas\Schema;
@@ -24,38 +26,63 @@ class InhaltsverzeichnisForm
->schema([
Checkbox::make('neue_seite')
->label('Start neuer Seite'),
Checkbox::make('seitenzahl_anzeige')
->label('Seitenzahl angezeigen'),
Checkbox::make('ueberschrift_verbergen')
->label('Überschrift verbergen'),
Textarea::make('name')
TextInput::make('name')
->prefixIcon('phosphor-article')
->required()
->label('Überschrift')
->columnSpan(3),
]),
Tab::make('Kapitel Index')
->schema([
->columnSpan(2),
TextInput::make('ordnungszahl')
->label('Kapitel Index')
->prefixIcon('phosphor-list-numbers')
->placeholder('3.21')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird der Index im Inhaltsverzeichnis und bei der Überschrift im Dokument nicht angezeigt.',
'Bei "0" wird der Index nicht angezeigt',
])
->columnSpan(1),
])->columnSpanFull(),
Tab::make('Seitenzahl')
->schema([
Checkbox::make('seitenzahl_anzeige')
->label('Seitenzahl angezeigen'),
TextInput::make('seite')
->label('Seitenzahl')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird die Seitenzahl automatisch generiert',
->columnSpan(2),
// TextInput::make('seite')
// ->label('Seitenzahl')
// ->numeric()
// ->default(0)
// ->belowContent([
// 'Bei "0" wird die Seitenzahl automatisch generiert',
// ])
// ->columnSpan(1),
Section::make('Benutzer Hilfe')
->icon('phosphor-chat-text')
->schema([
TextInput::make('hilfe_titel')
->aboveLabel([
'Erklärungen des Inhalts beim Bearbeiten des Gutachtens',
])
->afterLabel(['optional'])
->label('Überschrift')
->columnSpanFull(),
Textarea::make('hilfe_description')
->afterLabel(['optional'])
->label('Beschreibung'),
FileUpload::make('hilfe_image')
->afterLabel(['optional'])
->image()
->label('Bild')
->disk('public')
->maxSize(3072) // 3MB limit
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
->directory('gutachten_hilfe')
->visibility('public')
->columnSpanFull(),
])
->columnSpan(1),
])->columnSpanFull(),
->secondary()
->compact()
->collapsed()
->columnSpanFull(),
])->columns(3),
Tab::make('Inhaltselement')
->hiddenLabel()
->schema([
@@ -69,7 +96,6 @@ class InhaltsverzeichnisForm
return $res;
}),
]),
Tab::make('Textblock')
->hiddenLabel()
@@ -16,7 +16,7 @@ class InhaltsverzeichnisTable
{
return $table
->heading('Inhaltsverzeichnis')
->description('Generische Vorlage beim Erstellen neuer Projekte.')
->description('Vorlage zum Erstellen von neuen Projekte. Das Inhaltsverzeichnis ist unterteilt in drei Abschnitte (Filter).')
->columns([
TextColumn::make('ordnungszahl')
->label('Index')
@@ -3,6 +3,7 @@
namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Actions\Create\CreateProjektInhaltsverzeichnis;
use App\Actions\Helper\ShowHelpInhalt;
use App\Models\Inhaltselement;
use App\Models\KontoTextblock;
use App\Models\ProjektInhaltsverzeichnis;
@@ -16,7 +17,6 @@ use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Schemas\Components\Fieldset;
@@ -49,54 +49,52 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
Tabs::make('Tabs')
->tabs([
Tab::make('Überschrift')
// ->hidden(fn ($record) => $record?->name == 'DECKBLATT' ? true : false)
->schema([
Checkbox::make('neue_seite')
->label('Start neuer Seite'),
->label('Start neuer Seite')
->columnSpan(2),
// Checkbox::make('seitenzahl_anzeige')
// ->label('Seitenzahl angezeigen'),
// Checkbox::make('ueberschrift_verbergen')
// ->label('Überschrift verbergen'),
Textarea::make('name')
TextInput::make('name')
->prefixIcon('phosphor-article')
->afterLabel([ShowHelpInhalt::show()])
->required()
->label('Überschrift')
->columnSpan(2),
]),
Tab::make('Kapitel Index')
->schema([
TextInput::make('ordnungszahl')
->label('Kapitel Index')
->prefixIcon('phosphor-list-numbers')
->placeholder('3.21')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird der Index im PDF nicht angezeigt',
'Bei "0" wird der Index nicht angezeigt',
])
->columnSpan(1),
->columnSpan(2),
// TextInput::make('seite')
// ->label('Seitenzahl')
// ->numeric()
// ->default(0)
// ->belowContent([
// 'Bei "0" wird die Seitenzahl automatisch generiert',
// ])
// ->columnSpan(1),
]),
Tab::make('Seitenzahl')
->schema([
Checkbox::make('seitenzahl_anzeige')
->label('Seitenzahl angezeigen'),
TextInput::make('seite')
->label('Seitenzahl')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird die Seitenzahl automatisch generiert',
])
->columnSpan(1),
]),
Tab::make('Textblock Abschnitt A')
Tab::make('Textblock A')
->schema([
Grid::make()
->columns(6)
->schema([
TextInput::make('textblock_name')
->columnSpan(5)
->label('Textblock Name'),
// TextInput::make('textblock_name')
// ->columnSpan(5)
// ->label('Textblock Name'),
TextInput::make('konto_textblock_id')->hidden(),
RichEditor::make('textblock')
->hiddenLabel()
->aboveLabel(fn ($record): string => $record?->inhaltselement_id != 0 ? 'Ausgabe Textblock vor Tabelle' : '')
->aboveLabel(fn ($record): string => $record?->inhaltselement_id != 0 ? 'Ausgabe vor Inhaltselement' : '')
->columnSpan(5)
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->toolbarButtons([
@@ -200,7 +198,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
return $res;
}),
]),
Tab::make('Textblock Abschnitt B')
Tab::make('Textblock B')
->schema([
Grid::make()
->columns(6)
@@ -208,7 +206,7 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
TextInput::make('konto_textblock_id')->hidden(),
RichEditor::make('textblock2')
->hiddenLabel()
->aboveLabel(fn ($record): string => $record?->inhaltselement_id != 0 ? 'Ausgabe Textblock vor Tabelle' : '')
->aboveLabel(fn ($record): string => $record?->inhaltselement_id != 0 ? 'Ausgabe nach Inhaltselement' : '')
->columnSpan(5)
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->toolbarButtons([
@@ -2,8 +2,12 @@
namespace App\Filament\Resources\Textblocks\Schemas;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Components\Tabs;
use Filament\Schemas\Components\Tabs\Tab;
use Filament\Schemas\Schema;
class TextblockForm
@@ -12,46 +16,84 @@ class TextblockForm
{
return $schema
->components([
TextInput::make('name')
->required(),
RichEditor::make('textblock')
->label('Abschnitt A')
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
])->floatingToolbars([
'paragraph' => [
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
],
'heading' => [
'h1', 'h2', 'h3',
],
'table' => [
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
'tableMergeCells', 'tableSplitCell',
'tableToggleHeaderRow',
'tableDelete',
],
]),
RichEditor::make('textblock2')
->label('Abschnitt B')
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
])->floatingToolbars([
'paragraph' => [
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
],
'heading' => [
'h1', 'h2', 'h3',
],
'table' => [
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
'tableMergeCells', 'tableSplitCell',
'tableToggleHeaderRow',
'tableDelete',
],
Tabs::make('Tabs')
->tabs([
Tab::make('Inhaltselement')
->icon('phosphor-textbox')
->schema([
TextInput::make('name')
->label('Element Name')
->afterLabel([
'Wird im Gutachten nicht verwendet, dient nur zur Erkennen des Inhaltselements.',
])
->required(),
RichEditor::make('textblock')
->label('Abschnitt A')
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
])->floatingToolbars([
'paragraph' => [
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
],
'heading' => [
'h1', 'h2', 'h3',
],
'table' => [
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
'tableMergeCells', 'tableSplitCell',
'tableToggleHeaderRow',
'tableDelete',
],
]),
RichEditor::make('textblock2')
->label('Abschnitt B')
->afterLabel([
'Textblock uner der Überschrift.',
])
->belowContent([
'Dieses Feld kann auch leer bleiben. Sollten im selben Punkt des Inhaltsvereichnisses auch eine Tabelle verwendet werden, dann wird dieser Text nach dieser angezeigt.',
])
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'horizontalRule', 'table'],
])->floatingToolbars([
'paragraph' => [
'bold', 'italic', 'underline', 'strike', 'subscript', 'superscript',
],
'heading' => [
'h1', 'h2', 'h3',
],
'table' => [
'tableAddColumnBefore', 'tableAddColumnAfter', 'tableDeleteColumn',
'tableAddRowBefore', 'tableAddRowAfter', 'tableDeleteRow',
'tableMergeCells', 'tableSplitCell',
'tableToggleHeaderRow',
'tableDelete',
],
]),
]),
Tab::make('Benutzer Hilfe')
->icon('phosphor-chat-text')
->schema([
TextInput::make('hilfe_titel')
->aboveLabel([
'Dieser Inhalt wird dem Benutzer an entsprechender Stelle bei der Bearbeitung des Gutachtens angezeigt.',
])
->label('Überschrift')
->columnSpanFull(),
Textarea::make('hilfe_description'),
FileUpload::make('hilfe_image')
->image()
->label('Bild')
->disk('public')
->maxSize(3072) // 3MB limit
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp'])
->directory('gutachten_hilfe')
->visibility('public')
->columnSpanFull(),
]),
]),
])->columns(1);
}
}
+3
View File
@@ -16,6 +16,9 @@ class Inhaltsverzeichnis extends Model
'seite',
'neue_seite',
'seitenzahl_anzeige',
'hilfe_titel',
'hilfe_description',
'hilfe_image',
];
/**
+5
View File
@@ -26,4 +26,9 @@ class ProjektInhaltsverzeichnis extends Model
{
return $this->hasOne(Inhaltselement::class, 'id', 'inhaltselement_id');
}
public function inhaltsverzeichnis()
{
return $this->hasOne(Inhaltsverzeichnis::class, 'id', 'inhaltsverzeichnis_id');
}
}
+1 -1
View File
@@ -27,10 +27,10 @@ class AppServiceProvider extends ServiceProvider
FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::Zinc,
'info' => Color::Slate,
'primary' => Color::Blue,
'success' => Color::Green,
'warning' => Color::Yellow,
'info' => Color::Sky,
]);
FilamentView::registerRenderHook(