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
@@ -17,12 +17,7 @@ class CreateProjektInhaltsverzeichnis
|
||||
foreach ($inhaltsverzeichnis as $key => $value) {
|
||||
|
||||
$key++;
|
||||
|
||||
$textblock = '';
|
||||
if ($value->textblock_id > 0) {
|
||||
$textblock = Textblock::where('id', $value->textblock_id)->pluck('textblock')->first();
|
||||
}
|
||||
|
||||
$text = Textblock::where('id', $value->textblock_id)->first();
|
||||
$inhalt = new ProjektInhaltsverzeichnis;
|
||||
$inhalt->projekte_id = $record->id;
|
||||
$inhalt->sort = $key;
|
||||
@@ -30,14 +25,15 @@ class CreateProjektInhaltsverzeichnis
|
||||
$inhalt->name = $value->name;
|
||||
$inhalt->name2 = $value->name2;
|
||||
$inhalt->ueberschrift_anzeigen = $value->ueberschrift_anzeigen;
|
||||
$inhalt->tabellen_id = $value->tabellen_id;
|
||||
$inhalt->textblock_id = $value->textblock_id;
|
||||
$inhalt->inhaltselement_id = $value->inhaltselement_id;
|
||||
$inhalt->part = $value->part;
|
||||
$inhalt->seite = $value->seite;
|
||||
$inhalt->neue_seite = $value->neue_seite;
|
||||
$inhalt->seitenzahl_anzeige = $value->seitenzahl_anzeige;
|
||||
$inhalt->no_edit = $value->no_edit;
|
||||
$inhalt->textblock = $textblock;
|
||||
$inhalt->textblock_name = $text->name ?? '';
|
||||
$inhalt->textblock = $text->textblock ?? '';
|
||||
$inhalt->textblock2 = $text->textblock2 ?? '';
|
||||
$inhalt->save();
|
||||
|
||||
}
|
||||
|
||||
@@ -100,39 +100,41 @@ class Pdf
|
||||
$textblock = Format::fix_str($textblock);
|
||||
}
|
||||
|
||||
$html = Ueberschrift::create($inhalt);
|
||||
$html = '';
|
||||
// $html = Ueberschrift::load($inhalt);
|
||||
|
||||
if ($inhalt->name == 'DECKBLATT') {
|
||||
$html .= Deckblatt::create($textblock);
|
||||
} elseif ($inhalt->name == 'INHALTSVERZEICHNIS') {
|
||||
$html .= Inhalt::create($projekte_id);
|
||||
} else {
|
||||
|
||||
if ($inhalt->textblock) {
|
||||
$html .= $textblock;
|
||||
}
|
||||
|
||||
switch ($inhalt->tabellen_id) {
|
||||
case '3':
|
||||
$html .= Paragraph6::load($projekte_id);
|
||||
break;
|
||||
case '4':
|
||||
$html .= Allgemeinflaechen::load($projekte_id);
|
||||
break;
|
||||
case '5':
|
||||
$html .= ZuUndAbschlaege::load($projekte_id);
|
||||
break;
|
||||
case '7':
|
||||
$html .= Zusammenstellung::load($projekte_id);
|
||||
break;
|
||||
case '8':
|
||||
$str = RichContentRenderer::make(self::$auftraggeber->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
break;
|
||||
case '11':
|
||||
$html .= DigitaleSignatur::load($projekte_id);
|
||||
break;
|
||||
}
|
||||
switch ($inhalt->inhaltselement_id) {
|
||||
case '9':
|
||||
$html .= Deckblatt::load($inhalt, $textblock);
|
||||
break;
|
||||
// case '1':
|
||||
// $html .= Inhalt::load($projekte_id);
|
||||
// break;
|
||||
// case '3':
|
||||
// $html .= Paragraph6::load($projekte_id);
|
||||
// break;
|
||||
// case '4':
|
||||
// $html .= Allgemeinflaechen::load($projekte_id);
|
||||
// break;
|
||||
// case '5':
|
||||
// $html .= ZuUndAbschlaege::load($projekte_id);
|
||||
// break;
|
||||
// case '7':
|
||||
// $html .= Zusammenstellung::load($projekte_id);
|
||||
// break;
|
||||
// case '8':
|
||||
// $str = RichContentRenderer::make(self::$auftraggeber->referenz_formatting)->toHtml();
|
||||
// $html .= Format::fix_str($str);
|
||||
// break;
|
||||
// case '11':
|
||||
// $html .= DigitaleSignatur::load($projekte_id);
|
||||
// break;
|
||||
// default:
|
||||
// $html = Ueberschrift::load($inhalt);
|
||||
// if ($inhalt->textblock) {
|
||||
// $html .= $textblock;
|
||||
// }
|
||||
// break;
|
||||
}
|
||||
|
||||
if ($inhalt->seitenzahl_anzeige == 1) {
|
||||
|
||||
@@ -8,7 +8,7 @@ use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
||||
|
||||
class Deckblatt
|
||||
{
|
||||
public static function create($textblock)
|
||||
public static function load($inhalt, $textblock)
|
||||
{
|
||||
// GUTACHTER
|
||||
$html = '<div id="deckblatt-gutachter">';
|
||||
@@ -22,15 +22,15 @@ class Deckblatt
|
||||
$html .= '</div>';
|
||||
|
||||
// PROJEKT
|
||||
$html .= '<div id="deckblatt-gutachten">';
|
||||
$html .= '<h1 style="font-size:28px;">Gutachten</h1>';
|
||||
$html .= '<div class="base ml-1">'.trim(Pdf::$projekt->interner_name).'</div>';
|
||||
$html .= '<div id="deckblatt-projekt">';
|
||||
$html .= '<h1>'.trim($inhalt->name).'</h1>';
|
||||
$html .= '<p>'.trim(Pdf::$projekt->interner_name).'</p>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div id="deckblatt-festsetzung">';
|
||||
$html .= '<h2>ZUR FESTSETZUNG DER NUTZWERTE</h2>';
|
||||
$html .= '<div class="base">'.trim(Pdf::$projekt->offizieller_name).'</div>';
|
||||
$html .= '<div class="base">'.trim($textblock).'</div>';
|
||||
$html .= '<h3>ZUR FESTSETZUNG DER NUTZWERTE</h3>';
|
||||
$html .= '<p>'.trim(Pdf::$projekt->offizieller_name).'</p>';
|
||||
$html .= '<p>'.trim($textblock).'</p>';
|
||||
$html .= '</div>';
|
||||
|
||||
// AUFTRAGGEBER
|
||||
@@ -38,6 +38,7 @@ class Deckblatt
|
||||
if (Pdf::$auftraggeber->logo && Pdf::$auftraggeber->logo_anzeigen) {
|
||||
$html .= '<div id="deckblatt-logo-auftraggeber" style="background-image: url(\''.public_path().'/storage/'.Pdf::$auftraggeber->logo.'\');"></div>';
|
||||
}
|
||||
|
||||
if (Pdf::$auftraggeber->referenz_formatting && Pdf::$auftraggeber->text_anzeigen) {
|
||||
$str = RichContentRenderer::make(Pdf::$auftraggeber->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
|
||||
@@ -8,7 +8,7 @@ use App\Models\ProjektInhaltsverzeichnis;
|
||||
|
||||
class Inhalt
|
||||
{
|
||||
public static function create($projekte_id)
|
||||
public static function load($projekte_id)
|
||||
{
|
||||
$html = '<table class="inhalt">';
|
||||
$inhalte = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->orderBy('sort')->get();
|
||||
|
||||
@@ -6,7 +6,7 @@ use App\Actions\Generate\Utilities\Format;
|
||||
|
||||
class Ueberschrift
|
||||
{
|
||||
public static function create($inhalt)
|
||||
public static function load($inhalt)
|
||||
{
|
||||
if ($inhalt->ueberschrift_anzeigen) {
|
||||
if ($inhalt->ordnungszahl * 1 > 0) {
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Inhaltselement extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'name',
|
||||
];
|
||||
}
|
||||
@@ -9,7 +9,7 @@ class Inhaltsverzeichnis extends Model
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'ueberschrift_anzeigen',
|
||||
'tabellen_id',
|
||||
'inhaltselement_id',
|
||||
'textblock_id',
|
||||
'sort',
|
||||
'ordnungszahl',
|
||||
@@ -35,8 +35,8 @@ class Inhaltsverzeichnis extends Model
|
||||
return $this->hasMany(Textblock::class, 'id', 'textblock_id');
|
||||
}
|
||||
|
||||
public function tabellen()
|
||||
public function inhaltselement()
|
||||
{
|
||||
return $this->hasMany(Tabellen::class, 'id', 'tabellen_id');
|
||||
return $this->hasMany(Inhaltselement::class, 'id', 'inhaltselement_id');
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class Plan extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'payment',
|
||||
'description',
|
||||
'preis',
|
||||
'limit_user',
|
||||
'limit_auftraggeber',
|
||||
'limit_gutachter',
|
||||
'limit_gutachten',
|
||||
'icon',
|
||||
];
|
||||
|
||||
public static function options()
|
||||
{
|
||||
$arr = Plan::all()->toArray();
|
||||
foreach ($arr as $key => $value) {
|
||||
$str = '<div class="text-primary-500 text-lg">'.$value['payment'].'</div>';
|
||||
$str .= '<div class="text-xl font-black">'.number_format($value['preis'], 2).'€</div>';
|
||||
$str .= '<ol class="font-light text-xs leading-3 m-0 p-3">';
|
||||
$str .= '<li>'.$value['limit_user'].' Benutzer</li>';
|
||||
$str .= '<li>'.$value['limit_gutachter'].' Gutachter</li>';
|
||||
$str .= '</ol>';
|
||||
$arr[$key + 1] = new HtmlString($str);
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
}
|
||||
@@ -10,24 +10,20 @@ class ProjektInhaltsverzeichnis extends Model
|
||||
'projekte_id',
|
||||
'name',
|
||||
'ueberschrift_anzeigen',
|
||||
'tabellen_id',
|
||||
'textblock_id',
|
||||
'inhaltselement_id',
|
||||
'sort',
|
||||
'ordnungszahl',
|
||||
'part',
|
||||
'seite',
|
||||
'neue_seite',
|
||||
'seitenzahl_anzeige',
|
||||
'textblock_name',
|
||||
'textblock',
|
||||
'textblock2',
|
||||
];
|
||||
|
||||
public function textblock()
|
||||
public function inhaltselement()
|
||||
{
|
||||
return $this->hasMany(Textblock::class, 'id', 'textblock_id');
|
||||
}
|
||||
|
||||
public function tabellen()
|
||||
{
|
||||
return $this->hasMany(Tabellen::class, 'id', 'tabellen_id');
|
||||
return $this->hasOne(Inhaltselement::class, 'id', 'inhaltselement_id');
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tabellen extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -10,5 +10,6 @@ class Textblock extends Model
|
||||
'name',
|
||||
'beschreibung',
|
||||
'textblock',
|
||||
'textblock2',
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user