This commit is contained in:
salam committed 2025-10-20 11:51:00 +02:00
1 parent 3a35ccd69d
commit 261fb0916d
38 files changed
+348 -258

No files matched your search

@@ -18,7 +18,7 @@ class AuftraggebersTable
TextColumn::make('email')->copyable()->label('E-Mail')->searchable(),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
]);
}
}
@@ -21,7 +21,7 @@ class GutachtersTable
TextColumn::make('email')->copyable()->label('E-Mail')->searchable(),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
]);
}
}
@@ -8,7 +8,6 @@ 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;
@@ -18,15 +17,15 @@ class InhaltsverzeichnisForm
{
return $schema
->components([
Flex::make([
Section::make([
Section::make('Überschrift')
->schema([
Textarea::make('name')
->required()
->label('Kapitel Überschrift'),
->label('Kapitel / Absatz')
->columnSpan(2),
Checkbox::make('ueberschrift_nicht_anzeigen')
->label('Überschrift nicht angezeigen'),
]),
Section::make([
->label('Überschrift nicht angezeigen')
->columnSpan(2),
TextInput::make('ordnungszahl')
->label('Kapitel Index')
->placeholder('3.21')
@@ -34,36 +33,44 @@ class InhaltsverzeichnisForm
->default(0)
->belowContent([
'Bei "0" wird der Index im PDF nicht angezeigt',
]),
])
->columnSpan(1),
TextInput::make('seite')
->label('Seitenzahl')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird die Seitenzahl automatisch generiert',
])
->columnSpan(1),
])->columnSpanFull(),
Section::make('Tabelle & Textblöcke')
->hiddenLabel()
->schema([
Select::make('tabellen_id')->label('Tabelle')
->prefixIcon('phosphor-table')
->prefixIconColor(
fn ($record): string => $record->tabellen_id == 0 ? 'gray' : 'primary'
)
->default(0)
->options(function () {
return Tabellen::all()->pluck('name', 'id')->toArray();
})->belowContent([
'Kann auch frei bleiben',
]),
]),
])->columnSpanFull(2),
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',
]),
Select::make('textblock_id')->label('Textblock')
->prefixIcon('phosphor-article')
->prefixIconColor(
fn ($record): string => $record->textblock_id == 0 ? 'gray' : 'primary'
)
->default(0)
->options(function () {
return Textblock::all()->pluck('name', 'id')->toArray();
})->belowContent([
'Kann auch frei bleiben',
]),
])->columnSpanFull(),
]);
}
}
@@ -4,6 +4,7 @@ namespace App\Filament\Resources\Inhaltsverzeichnis\Tables;
use Filament\Actions\DeleteAction;
use Filament\Actions\EditAction;
use Filament\Support\Enums\FontWeight;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Columns\ToggleColumn;
use Filament\Tables\Table;
@@ -22,13 +23,12 @@ class InhaltsverzeichnisTable
TextColumn::make('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',
->weight(fn ($record): FontWeight => match ($record->ueberschrift_nicht_anzeigen) {
1 => FontWeight::Thin,
default => FontWeight::SemiBold,
}),
// ToggleColumn::make('ueberschrift_anzeigen')->label('')->tooltip('Überschrift im PDF anzeigen'),
TextColumn::make('tabellen.name')->wrap(),
TextColumn::make('tabellen.name')->wrap()->label('Tabelle'),
TextColumn::make('textblock.name')->wrap(),
TextColumn::make('seite')
->alignCenter()
@@ -39,7 +39,7 @@ class InhaltsverzeichnisTable
->defaultSort('sort', direction: 'asc')
->reorderable('sort')
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
DeleteAction::make()->iconButton(),
]);
}
@@ -17,6 +17,7 @@ class KontoTextblockForm
->required(),
Textarea::make('beschreibung'),
RichEditor::make('textblock')
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
]),
@@ -26,7 +26,7 @@ class KontoTextblocksTable
->html(),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
DeleteAction::make()->iconButton(),
]);
}
@@ -41,6 +41,7 @@ class KontoForm
RichEditor::make('address')->toolbarButtons([
['bold', 'italic', 'underline', 'subscript', 'superscript'],
])
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->label('Adresse')
->required(),
])->columnSpanFull(),
@@ -37,7 +37,7 @@ class KontosTable
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
Action::make('Guthaben laden')
->iconButton()
->color('gray')
@@ -15,6 +15,7 @@ class MethodeForm
TextInput::make('name')->required(),
RichEditor::make('description')
->label('Beschreibung')
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
]),
@@ -23,7 +23,7 @@ class MethodesTable
->html(),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
]);
}
}
@@ -31,7 +31,7 @@ class OrientierungsTable
]),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
]);
}
}
@@ -28,7 +28,7 @@ class PlansTable
TextColumn::make('preis')->money('EUR'),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
]);
}
}
@@ -67,7 +67,7 @@ class EditProjekte extends EditRecord
1 => 'info',
default => 'gray',
})
->label('Herunterladen')
->label('3) Herunterladen')
->icon('phosphor-file-pdf')
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'file']))
->openUrlInNewTab(),
@@ -78,20 +78,24 @@ class EditProjekte extends EditRecord
default => 'gray',
})
->disabled(fn ($record): bool => $record->evaluation ? false : true)
->label('Neu Berechnen')
->icon('phosphor-calculator')
->label('2) Generieren')
->icon('phosphor-math-operations')
->url(fn ($record) => route('standard.download', ['record' => $record, 'mode' => 'new']))
->openUrlInNewTab(),
Action::make('evaluate_gutachten')
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->color(fn ($record): string => match ($record->evaluation) {
1 => 'gray',
default => 'info',
1 => 'success',
default => 'primary',
})
->label('1) Evaluieren')
->icon(fn ($record): string => match ($record->evaluation) {
1 => 'phosphor-check',
default => 'phosphor-eye',
})
->label('Daten Evaluieren')
->icon('phosphor-seal-check')
->action(function ($record): void {
GutachtenValidation::controll($record);
$this->record->refresh();
}),
])->label('Gutachten')
->icon('heroicon-m-ellipsis-vertical')
@@ -92,7 +92,7 @@ class AllgemeinflaechensRelationManager extends RelationManager
]),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
DeleteAction::make()->iconButton(),
])
->toolbarActions([
@@ -2,6 +2,7 @@
namespace App\Filament\Resources\Projektes\RelationManagers;
use App\Actions\Create\CreateProjektInhaltsverzeichnis;
use App\Models\KontoTextblock;
use Filament\Actions\Action;
use Filament\Actions\BulkActionGroup;
@@ -9,18 +10,21 @@ use Filament\Actions\CreateAction;
use Filament\Actions\DeleteAction;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Hidden;
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\Actions;
use Filament\Schemas\Components\Flex;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Components\Utilities\Get;
use Filament\Schemas\Components\Fieldset;
use Filament\Schemas\Components\Grid;
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\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
@@ -41,83 +45,104 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
{
return $schema
->components([
TextInput::make('ordnungszahl')->numeric(),
TextInput::make('name'),
Flex::make([
Section::make([
RichEditor::make('textblock')
->hidden(fn (Get $get): bool => ! $get('textblock_kennung_id'))
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
]),
]),
Section::make([
Action::make('textblock_sichern')
Tabs::make('Tabs')
->tabs([
Tab::make('Überschrift')
->schema([
Hidden::make('konto_id')->default(auth()->user()->konto_id),
Hidden::make('namecheck')->default(function ($record) {
return $record['name'];
}),
Hidden::make('textblock_kennung_id')->default(function ($record) {
return $record['textblock_kennung_id'];
}),
RichEditor::make('textblock')
->hidden()
->default(function ($record) {
return $record['textblock'];
}),
TextInput::make('name')->required()
->label('Geben sie dem Textblock einen eindeutigen Namen')
->validationMessages([
'different' => 'Name ist schon in Verwendung bitte verwenden Sie einen eindeutig Namen.',
Textarea::make('name')
->required()
->label('Kapitel / Absatz')
->columnSpan(2),
Checkbox::make('ueberschrift_nicht_anzeigen')
->label('Überschrift nicht angezeigen')
->columnSpan(2),
TextInput::make('ordnungszahl')
->label('Kapitel Index')
->placeholder('3.21')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird der Index im PDF nicht angezeigt',
])
->different('namecheck')
->default(function ($record) {
return $record['name'];
}),
])
->modalSubmitActionLabel('Sichern')
->iconButton()
->icon('phosphor-floppy-disk')
->tooltip('Ein veränderter Textblock kann als persönliche Vorlage gespeichert werden.')
->action(function (array $mountedActions, $data) {
->columnSpan(1),
TextInput::make('seite')
->label('Seitenzahl')
->numeric()
->default(0)
->belowContent([
'Bei "0" wird die Seitenzahl automatisch generiert',
])
->columnSpan(1),
]),
Tab::make('Textblock')
->schema([
Grid::make()
->columns(6)
->schema([
RichEditor::make('textblock')
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->columnSpan(5)
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
]),
$record = $mountedActions[0]->getRawData();
Fieldset::make('')
->contained(false)
->schema([
Action::make('textblock_sichern')
->schema([
Hidden::make('konto_id')->default(auth()->user()->konto_id),
RichEditor::make('textblock')
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->hidden()
->default(function ($record) {
return $record['textblock'];
}),
TextInput::make('name')->required()
->label('Geben sie der Vorlage einen eindeutigen Namen')
->default(function ($record) {
return $record['name'];
}),
])
->modalSubmitActionLabel('Sichern')
->iconButton()
->icon('phosphor-floppy-disk')
->tooltip('Als persönliche Vorlage speichern')
->action(function (array $mountedActions, $data) {
KontoTextblock::updateOrCreate(
[
'konto_id' => auth()->user()->konto_id,
'name' => $data['name'],
'textblock_kennung_id' => $record['textblock_kennung_id'],
], [
'textblock' => RichContentRenderer::make($record['textblock'])->toHtml(),
]);
}),
Actions::make([
Action::make('textblock_laden')
->schema([
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([
'Bitte eine Vorlage auswählen',
]),
])
->icon('phosphor-article')
->iconButton()
->modalSubmitActionLabel('Einsetzen')
->tooltip('Personaliserten Textblock laden.')
->action(function (Set $set, array $data) {
$set('textblock', KontoTextblock::query()->where('id', $data['konto_textblock_id'])->pluck('textblock')->first());
}),
]),
])->grow(false),
])->columnSpanFull(),
$record = $mountedActions[0]->getRawData();
KontoTextblock::updateOrCreate(
[
'konto_id' => auth()->user()->konto_id,
'name' => $data['name'],
], [
'textblock' => RichContentRenderer::make($record['textblock'])->toHtml(),
]);
}),
Action::make('textblock_laden')
->schema([
Select::make('konto_textblock_id')
->hiddenLabel()
->searchable()
->options(function ($record) {
return KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id')->toArray();
})->belowLabel([
'Bitte eine Vorlage auswählen',
]),
])
->icon('phosphor-article')
->iconButton()
->modalSubmitActionLabel('Einsetzen')
->tooltip('Persönliche Vorlage laden.')
->action(function (Set $set, array $data) {
$set('textblock', KontoTextblock::query()->pluck('textblock')->first());
}),
])
->columns(1),
]),
]),
])->columnSpanFull(),
]);
}
@@ -126,36 +151,61 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
return $table
->recordTitleAttribute('text')
->columns([
// TextColumn::make('sort'),
TextColumn::make('ordnungszahl')
->width('2rem')
->label('Index')
->getStateUsing(fn ($record): string => $record->ordnungszahl == '0' ? '' : number_format($record->ordnungszahl, 2)),
IconColumn::make('textblock_kennung_id')
->label('Text')
TextColumn::make('name')
->wrap()
->weight(fn ($record): FontWeight => match ($record->ueberschrift_nicht_anzeigen) {
1 => FontWeight::Thin,
default => FontWeight::SemiBold,
})
->description(fn ($record): string => $record->textblock_kennung->name ?? ''),
TextColumn::make('tabellen.name')->wrap()->label('Tabelle'),
TextColumn::make('textblock.name')->wrap(),
IconColumn::make('textblock')
->alignCenter()
->icon('phosphor-article')
->color(fn (string $state): string => match ($state) {
'0' => 'gray',
default => 'info',
}),
TextColumn::make('name')
->description(fn ($record): string => $record->textblock_kennung->name ?? ''),
TextColumn::make('seite')
->alignCenter()
->badge()
->color('info')
->getStateUsing(fn ($record): string => $record->seite == '0' ? '...' : $record->seite),
->getStateUsing(function ($record) {
if ($record->ohne_seitenzahl_anzeige) {
return null;
} elseif ($record->seite > 0) {
return (string) $record->seite;
} else {
return (string) 'auto';
}
}),
])
->defaultSort('sort', direction: 'asc')
->reorderable('sort')
->filters([
//
])
->headerActions([
Action::make('generate')
->action(fn (CreateProjektInhaltsverzeichnis $createInhaltsverzeichnis) => $createInhaltsverzeichnis->create($this->ownerRecord))
->requiresConfirmation()
->modalHeading('Inhaltsverzeichnis neu generieren')
->modalDescription('Bestehende Daten werden gelöscht.')
->modalSubmitActionLabel('Ja, neu generieren')
->label('Generieren')
->tooltip('Inhaltsverzeichnis wird neu erstellt.')
->icon('phosphor-gear'),
CreateAction::make()
->icon('phosphor-file-plus')
->createAnother(false),
])
->recordActions([
EditAction::make('edit')->iconButton()->color('gray'),
EditAction::make()->iconButton(),
DeleteAction::make()->iconButton(),
])
->toolbarActions([
@@ -60,7 +60,7 @@ class ProjektPlatzhalterRelationManager extends RelationManager
->icon('heroicon-o-cog-8-tooth'),
])
->recordActions([
// EditAction::make()->iconButton()->color('gray'),
// EditAction::make()->iconButton(),
]);
}
}
@@ -115,7 +115,7 @@ class RaeumeallesRelationManager extends RelationManager
]),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
DeleteAction::make()->iconButton(),
])
->toolbarActions([
@@ -38,12 +38,17 @@ class ProjekteForm
Tab::make('Zuordnung')
->schema([
Select::make('gutachter_id')->relationship(name: 'gutachter', titleAttribute: 'company')->required(),
Select::make('auftraggeber_id')->relationship(name: 'auftraggeber', titleAttribute: 'company')->required(),
Select::make('auftraggeber_id')
->searchable()
->loadingMessage('Lade Auftraggeber...')
->relationship(name: 'auftraggeber', titleAttribute: 'company')
->required(),
Radio::make('status')->options(ProjektStatus::class)->required(),
]),
Tab::make('Beschreibung')
->schema([
RichEditor::make('beschreibung')
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript', 'link'],
['alignStart', 'alignCenter', 'alignEnd', 'horizontalRule'],
@@ -42,7 +42,7 @@ class ProjektesTable
->relationship('auftraggeber', 'company'),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
]);
}
}
@@ -19,6 +19,7 @@ class TextblockForm
->afterLabel('Bei gleichen Textblockarten kann hier der Unterschied kurz angerissen werden.'),
RichEditor::make('textblock')
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
]),
@@ -25,7 +25,7 @@ class TextblocksTable
->html(),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
DeleteAction::make()->iconButton(),
]);
}
@@ -23,7 +23,7 @@ class TextblockResource extends Resource
protected static string|BackedEnum|null $navigationIcon = 'phosphor-article';
protected static ?string $navigationLabel = 'Textblock';
protected static ?string $navigationLabel = 'Textblöcke';
protected static ?string $modelLabel = 'Textblock';
@@ -30,7 +30,7 @@ class UsersTable
TrashedFilter::make()->visible(fn () => auth()->user()->hasRole('super_admin')),
])
->recordActions([
EditAction::make()->iconButton()->color('gray'),
EditAction::make()->iconButton(),
]);
}
}