big change Inhaltstabelle und PDF
This commit is contained in:
1 parent
2f6ae7e4a1
commit
d5d1f743bb
58 files changed
+1244
-922
No files matched your search
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Filament\Resources\Inhaltsverzeichnis\Schemas;
|
||||
|
||||
use App\Models\Tabellen;
|
||||
use App\Models\Inhaltselement;
|
||||
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\Section;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class InhaltsverzeichnisForm
|
||||
@@ -17,72 +18,75 @@ class InhaltsverzeichnisForm
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make('Überschrift')
|
||||
->schema([
|
||||
Checkbox::make('neue_seite')
|
||||
->label('Start neuer Seite'),
|
||||
Checkbox::make('ueberschrift_anzeigen')
|
||||
->label('Überschrift angezeigen'),
|
||||
Textarea::make('name')
|
||||
->required()
|
||||
->label('Überschrift in der Inhaltsangabe')
|
||||
->columnSpan(3),
|
||||
Textarea::make('name2')
|
||||
->label('Überschrift im Dokument')
|
||||
->belowContent([
|
||||
'Bei abweichender Überschrift im Dokument',
|
||||
])
|
||||
->columnSpan(3),
|
||||
TextInput::make('ordnungszahl')
|
||||
->label('Kapitel Index')
|
||||
->placeholder('3.21')
|
||||
->numeric()
|
||||
->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),
|
||||
Checkbox::make('seitenzahl_anzeige')
|
||||
->label('Seitenzahl angezeigen'),
|
||||
])->columnSpanFull(),
|
||||
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');
|
||||
Tabs::make('Überschrift')
|
||||
->tabs([
|
||||
Tab::make('Überschrift')
|
||||
->schema([
|
||||
Checkbox::make('neue_seite')
|
||||
->label('Start neuer Seite'),
|
||||
Checkbox::make('ueberschrift_anzeigen')
|
||||
->label('Überschrift angezeigen'),
|
||||
Textarea::make('name')
|
||||
->required()
|
||||
->label('Überschrift')
|
||||
->columnSpan(3),
|
||||
]),
|
||||
Tab::make('Kapitel Index')
|
||||
->schema([
|
||||
TextInput::make('ordnungszahl')
|
||||
->label('Kapitel Index')
|
||||
->placeholder('3.21')
|
||||
->numeric()
|
||||
->default(0)
|
||||
->belowContent([
|
||||
'Bei "0" wird der Index im Inhaltsverzeichnis und bei der Überschrift im Dokument 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(1),
|
||||
])->columnSpanFull(),
|
||||
Tab::make('Inhaltselement')
|
||||
->hiddenLabel()
|
||||
->schema([
|
||||
Select::make('inhaltselement_id')
|
||||
->label('Inhaltselement')
|
||||
->prefixIcon('phosphor-table')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Inhaltselement::all()->pluck('name', 'id')->toArray();
|
||||
array_push($res, 'Ohne');
|
||||
|
||||
return $res;
|
||||
}),
|
||||
Select::make('tabellen_id')->label('Tabelle')
|
||||
->prefixIcon('phosphor-table')
|
||||
->prefixIconColor(
|
||||
fn ($record): string => $record->tabellen_id == 0 ? 'gray' : 'primary'
|
||||
)
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Tabellen::all()->pluck('name', 'id')->toArray();
|
||||
array_unshift($res, 'Ohne Tabelle');
|
||||
return $res;
|
||||
}),
|
||||
|
||||
return $res;
|
||||
}),
|
||||
]),
|
||||
Tab::make('Textblock')
|
||||
->hiddenLabel()
|
||||
->schema([
|
||||
Select::make('textblock_id')
|
||||
->label('Textblock')
|
||||
// ->description('Ausgabe Textblock vor Tabelle')
|
||||
->prefixIcon('phosphor-article')
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Textblock::all()->pluck('name', 'id')->toArray();
|
||||
array_push($res, 'Ohne');
|
||||
|
||||
])->columnSpanFull(),
|
||||
return $res;
|
||||
}),
|
||||
]),
|
||||
])->vertical()->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ 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
|
||||
{
|
||||
@@ -18,40 +17,27 @@ class InhaltsverzeichnisTable
|
||||
return $table
|
||||
->heading('Inhaltsverzeichnis')
|
||||
->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')
|
||||
->tooltip('Start neue Seite')
|
||||
->color('primary')
|
||||
->alignCenter()
|
||||
->label('Start')
|
||||
->icon(fn (string $state): string => match ($state) {
|
||||
'1' => 'phosphor-file-plus',
|
||||
default => ''
|
||||
}),
|
||||
TextColumn::make('name')
|
||||
->color('primary')
|
||||
->label('Überschrift')
|
||||
->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('inhaltselement.name')
|
||||
->label('Element')
|
||||
->wrap(),
|
||||
TextColumn::make('textblock.name')
|
||||
->wrap(),
|
||||
TextColumn::make('seite')
|
||||
->alignCenter()
|
||||
->badge()
|
||||
|
||||
@@ -21,7 +21,7 @@ class PermissionResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Kunden';
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Benutzer';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'lucide-key-square';
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Plans\Pages;
|
||||
|
||||
use App\Filament\Resources\Plans\PlanResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreatePlan extends CreateRecord
|
||||
{
|
||||
protected static string $resource = PlanResource::class;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Plans\Pages;
|
||||
|
||||
use App\Filament\Resources\Plans\PlanResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditPlan extends EditRecord
|
||||
{
|
||||
protected static string $resource = PlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Plans\Pages;
|
||||
|
||||
use App\Filament\Resources\Plans\PlanResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListPlans extends ListRecords
|
||||
{
|
||||
protected static string $resource = PlanResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// CreateAction::make()
|
||||
// ->icon('phosphor-file-plus')
|
||||
// ->createAnother(false),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Plans;
|
||||
|
||||
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||
use App\Filament\Resources\Plans\Pages\ListPlans;
|
||||
use App\Filament\Resources\Plans\Schemas\PlanForm;
|
||||
use App\Filament\Resources\Plans\Tables\PlansTable;
|
||||
use App\Models\Plan;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class PlanResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Plan::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-banknotes';
|
||||
|
||||
protected static ?string $cluster = AdministrationCluster::class;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Kunden';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
protected static ?string $navigationLabel = 'Zahlungsplan';
|
||||
|
||||
protected static ?string $modelLabel = 'Zahlungsplan';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'Zahlungspläne';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return PlanForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return PlansTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListPlans::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Plans\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class PlanForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required(),
|
||||
TextInput::make('payment')->label('Zahlung')->required(),
|
||||
Textarea::make('description')->label('Beschreibung')->required(),
|
||||
TextInput::make('preis')->required()->numeric(),
|
||||
TextInput::make('limit_user')->required()->label('Anzahl Benutzer')->numeric(),
|
||||
TextInput::make('limit_gutachter')->required()->label('Anzahl Gutachter')->numeric(),
|
||||
TextInput::make('icon'),
|
||||
])->inlineLabel()->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Plans\Tables;
|
||||
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class PlansTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
IconColumn::make('icon')
|
||||
->label('')
|
||||
->size(IconSize::TwoExtraLarge)
|
||||
->color('primary')
|
||||
->icon(fn (string $state): string => $state),
|
||||
TextColumn::make('name')
|
||||
->description(fn ($record): string => $record->description)
|
||||
->wrap(),
|
||||
TextColumn::make('payment')->label('Plan'),
|
||||
TextColumn::make('limit_user')->label('Benutzer')->badge(),
|
||||
TextColumn::make('limit_gutachter')->label('Gutachter')->badge(),
|
||||
TextColumn::make('preis')->money('EUR'),
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,7 @@ class EditProjekte extends EditRecord
|
||||
*/
|
||||
Action::make('freischalten')
|
||||
->hidden(fn ($record): bool => $record->bezahlt_am ? true : false)
|
||||
->color('warning')
|
||||
->visible(fn (): bool => auth()->user()->konto->guthaben)
|
||||
->requiresConfirmation()
|
||||
->modalHeading('Gutachten freischalten?')
|
||||
|
||||
+131
-44
@@ -3,9 +3,9 @@
|
||||
namespace App\Filament\Resources\Projektes\RelationManagers;
|
||||
|
||||
use App\Actions\Create\CreateProjektInhaltsverzeichnis;
|
||||
use App\Models\Inhaltselement;
|
||||
use App\Models\KontoTextblock;
|
||||
use App\Models\ProjektInhaltsverzeichnis;
|
||||
use App\Models\Tabellen;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\CreateAction;
|
||||
@@ -29,7 +29,6 @@ use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
{
|
||||
@@ -50,23 +49,19 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
Tabs::make('Tabs')
|
||||
->tabs([
|
||||
Tab::make('Überschrift')
|
||||
->hidden(fn ($record) => $record?->name == 'DECKBLATT' ? true : false)
|
||||
// ->hidden(fn ($record) => $record?->name == 'DECKBLATT' ? true : false)
|
||||
->schema([
|
||||
Checkbox::make('neue_seite')
|
||||
->label('Start neuer Seite'),
|
||||
Checkbox::make('ueberschrift_anzeigen')
|
||||
->label('Überschrift angezeigen'),
|
||||
// Checkbox::make('ueberschrift_anzeigen')
|
||||
// ->label('Überschrift angezeigen'),
|
||||
Textarea::make('name')
|
||||
->required()
|
||||
->label('Überschrift in der Inhaltsangabe')
|
||||
->label('Überschrift')
|
||||
->columnSpan(2),
|
||||
Textarea::make('name2')
|
||||
->label('Überschrift im Dokument')
|
||||
->belowContent([
|
||||
'Bei abweichender Überschrift im Dokument',
|
||||
])
|
||||
->columnSpan(2),
|
||||
|
||||
]),
|
||||
Tab::make('Kapitel Index')
|
||||
->schema([
|
||||
TextInput::make('ordnungszahl')
|
||||
->label('Kapitel Index')
|
||||
->placeholder('3.21')
|
||||
@@ -76,6 +71,11 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
'Bei "0" wird der Index im PDF nicht angezeigt',
|
||||
])
|
||||
->columnSpan(1),
|
||||
]),
|
||||
Tab::make('Seitenzahl')
|
||||
->schema([
|
||||
Checkbox::make('seitenzahl_anzeige')
|
||||
->label('Seitenzahl angezeigen'),
|
||||
TextInput::make('seite')
|
||||
->label('Seitenzahl')
|
||||
->numeric()
|
||||
@@ -85,16 +85,18 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
])
|
||||
->columnSpan(1),
|
||||
]),
|
||||
Tab::make('Textblock')
|
||||
->hidden(fn ($record) => in_array($record?->name, ['INHALTSVERZEICHNIS']) ? true : false)
|
||||
Tab::make('Textblock Abschnitt A')
|
||||
->schema([
|
||||
Grid::make()
|
||||
->columns(6)
|
||||
->schema([
|
||||
TextInput::make('textblock_name')
|
||||
->columnSpan(5)
|
||||
->label('Textblock Name'),
|
||||
TextInput::make('konto_textblock_id')->hidden(),
|
||||
RichEditor::make('textblock')
|
||||
->hiddenLabel()
|
||||
->aboveLabel(fn ($record): string => $record?->tabellen_id != 0 ? 'Ausgabe Textblock vor Tabelle' : '')
|
||||
->aboveLabel(fn ($record): string => $record?->inhaltselement_id != 0 ? 'Ausgabe Textblock vor Tabelle' : '')
|
||||
->columnSpan(5)
|
||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
|
||||
->toolbarButtons([
|
||||
@@ -186,23 +188,120 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
])->columns(1),
|
||||
]),
|
||||
]),
|
||||
Tab::make('Tabellen')
|
||||
->hidden(fn ($record) => in_array($record?->name, ['DECKBLATT']) ? true : false)
|
||||
Tab::make('Inhalts Elemente')
|
||||
->schema([
|
||||
Select::make('tabellen_id')->label('Tabelle')
|
||||
Select::make('inhaltselement_id')->label('Inhalts Element')
|
||||
->prefixIcon('phosphor-table')
|
||||
->prefixIconColor(
|
||||
fn ($record): string => $record?->tabellen_id == 0 ? 'gray' : 'primary'
|
||||
)
|
||||
->default(0)
|
||||
->options(function () {
|
||||
$res = Tabellen::all()->pluck('name', 'id')->toArray();
|
||||
array_unshift($res, 'Ohne Tabelle');
|
||||
$res = Inhaltselement::all()->pluck('name', 'id')->toArray();
|
||||
array_push($res, 'Ohne');
|
||||
|
||||
return $res;
|
||||
}),
|
||||
]),
|
||||
])->columnSpanFull(),
|
||||
Tab::make('Textblock Abschnitt B')
|
||||
->schema([
|
||||
Grid::make()
|
||||
->columns(6)
|
||||
->schema([
|
||||
TextInput::make('konto_textblock_id')->hidden(),
|
||||
RichEditor::make('textblock2')
|
||||
->hiddenLabel()
|
||||
->aboveLabel(fn ($record): string => $record?->inhaltselement_id != 0 ? 'Ausgabe Textblock vor Tabelle' : '')
|
||||
->columnSpan(5)
|
||||
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
|
||||
->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',
|
||||
],
|
||||
]),
|
||||
|
||||
Fieldset::make('')
|
||||
->contained(false)
|
||||
->schema([
|
||||
Action::make('sichern')
|
||||
->iconButton()
|
||||
->tooltip('Änderungen in der Vorlage speichern')
|
||||
->icon('phosphor-floppy-disk')
|
||||
->schema([
|
||||
TextInput::make('name')->required()
|
||||
->label('Ändern sie gegebeben Falls den Namen')
|
||||
->default(function ($record) {
|
||||
return KontoTextblock::where('id', $record?->konto_textblock_id)->pluck('name')->first();
|
||||
}),
|
||||
])
|
||||
->hidden(function ($record) {
|
||||
return (bool) ! $record?->konto_textblock_id;
|
||||
})
|
||||
->action(function (array $mountedActions, array $data) {
|
||||
$record = $mountedActions[0]->getRawData();
|
||||
|
||||
KontoTextblock::where('id', $record['konto_textblock_id'])
|
||||
->update(['name' => $data['name'], 'textblock' => RichContentRenderer::make($record['textblock'])->toHtml()]);
|
||||
|
||||
}),
|
||||
Action::make('neu')
|
||||
->iconButton()
|
||||
->icon('phosphor-file-plus')
|
||||
->schema([
|
||||
TextInput::make('name')->required()
|
||||
->label('Geben sie der Vorlage einen eindeutigen Namen')
|
||||
->default(function ($record) {
|
||||
return $record?->name;
|
||||
}),
|
||||
])
|
||||
->modalSubmitActionLabel('Sichern')
|
||||
->tooltip('Neue Vorlage erstellen')
|
||||
->action(function (array $mountedActions, array $data) {
|
||||
|
||||
$record = $mountedActions[0]->getRawData();
|
||||
|
||||
$block = new KontoTextblock;
|
||||
$block->konto_id = auth()->user()->konto_id;
|
||||
$block->name = $data['name'];
|
||||
$block->textblock = RichContentRenderer::make($record['textblock'])->toHtml();
|
||||
$block->save();
|
||||
|
||||
ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $block->id]);
|
||||
}),
|
||||
Action::make('laden')
|
||||
->iconButton()
|
||||
->icon('phosphor-article')
|
||||
->schema([
|
||||
Select::make('konto_textblock_id')
|
||||
->hiddenLabel()
|
||||
->searchable()
|
||||
->options(KontoTextblock::where('konto_id', auth()->user()->konto_id)->pluck('name', 'id'))
|
||||
->belowLabel([
|
||||
'Bitte eine Vorlage auswählen',
|
||||
]),
|
||||
])
|
||||
->modalSubmitActionLabel('Einsetzen')
|
||||
->tooltip('Vorlage laden.')
|
||||
->action(function (Set $set, array $mountedActions, array $data) {
|
||||
$record = $mountedActions[0]->getRawData();
|
||||
ProjektInhaltsverzeichnis::where('id', $record['id'])->update(['konto_textblock_id' => $data['konto_textblock_id']]);
|
||||
$set('konto_textblock_id', $data['konto_textblock_id']);
|
||||
$set('textblock', KontoTextblock::where('id', $data['konto_textblock_id'])->pluck('textblock')->first());
|
||||
}),
|
||||
])->columns(1),
|
||||
]),
|
||||
]),
|
||||
])->vertical()->columnSpanFull(),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -230,27 +329,15 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
|
||||
default => ''
|
||||
}),
|
||||
TextColumn::make('name')
|
||||
->color('primary')
|
||||
->wrap()
|
||||
->searchable()
|
||||
->description(fn ($record): string => $record->textblock_kennung->name ?? ''),
|
||||
->searchable(),
|
||||
|
||||
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)),
|
||||
IconColumn::make('tabellen')
|
||||
->label('Tabelle')
|
||||
->color('primary')
|
||||
->alignCenter()
|
||||
->icon('phosphor-table')
|
||||
->tooltip(fn ($record): HtmlString => new HtmlString($record->name)),
|
||||
TextColumn::make('textblock_name')
|
||||
->label('Textblock')
|
||||
->wrap(),
|
||||
TextColumn::make('inhaltselement.name')
|
||||
->label('Inhalts Element'),
|
||||
TextColumn::make('seite')
|
||||
->alignCenter()
|
||||
->badge()
|
||||
|
||||
@@ -579,6 +579,6 @@ class ProjektObjekteRelationManager extends RelationManager
|
||||
}
|
||||
}
|
||||
|
||||
return round($sum);
|
||||
return $sum;
|
||||
}
|
||||
}
|
||||
@@ -30,8 +30,18 @@ class ProjekteForm
|
||||
->tabs([
|
||||
Tab::make('Benennung')
|
||||
->schema([
|
||||
TextInput::make('offizieller_name')->label('Offizieller Name')->required(),
|
||||
TextInput::make('interner_name')->label('Interner Name')->required(),
|
||||
TextInput::make('offizieller_name')
|
||||
->label('Offizieller Name')
|
||||
->required()
|
||||
->belowContent([
|
||||
'Kann mit "###OFFIZIELLER_NAME###" im Text verwendet werden.',
|
||||
]),
|
||||
TextInput::make('interner_name')
|
||||
->label('Interner Name')
|
||||
->required()
|
||||
->belowContent([
|
||||
'Kann mit "###INTERNER_NAME###" im Text verwendet werden.',
|
||||
]),
|
||||
TextInput::make('ort')->required()->suffix('am'),
|
||||
DatePicker::make('erstellung')->helperText('Datum am Gutachten')->required(),
|
||||
])->columns(2),
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Filament\Resources\Textblocks\Schemas;
|
||||
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
@@ -15,11 +14,27 @@ class TextblockForm
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
Textarea::make('beschreibung')
|
||||
->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;'])
|
||||
->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([
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace App\Filament\Resources\Textblocks\Tables;
|
||||
|
||||
use App\Models\Textblock;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class TextblocksTable
|
||||
{
|
||||
@@ -17,13 +18,23 @@ class TextblocksTable
|
||||
->defaultPaginationPageOption(5)
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->weight(FontWeight::Bold)
|
||||
->wrap()
|
||||
->description(function ($record) {
|
||||
return new HtmlString($record->textblock);
|
||||
return view('pages.textblock')->with('record', $record);
|
||||
})
|
||||
->html(),
|
||||
])
|
||||
->deferFilters(false)
|
||||
->filtersFormColumns(3)
|
||||
->filters([
|
||||
SelectFilter::make('id')
|
||||
->label('Textblock')
|
||||
->preload()
|
||||
->default(1)
|
||||
->options(function (): array {
|
||||
return Textblock::pluck('name', 'id')->toArray();
|
||||
}),
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->paginated(false)
|
||||
->recordActions([
|
||||
EditAction::make()->iconButton(),
|
||||
DeleteAction::make()->iconButton(),
|
||||
|
||||
Reference in new issue
Block a user