This commit is contained in:
salam committed 2025-10-21 18:00:44 +02:00
1 parent 9881d8c37b
commit 6bf10b25bd
21 files changed
+245 -178

No files matched your search

+8 -13
View File
@@ -3,6 +3,7 @@
namespace App\Actions\Generate\Gutachten;
use App\Actions\Generate\MakeGutachten;
use App\Actions\Generate\Utilities\Format;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
class Deckblatt
@@ -13,30 +14,26 @@ class Deckblatt
// $table->boolean('text_anzeigen')->default(0);
// GUTACHTER
$html = '<div class="adler"></div>';
$html .= '<div id="deckblatt-gutachter">';
$html = '<div id="deckblatt-gutachter">';
if (MakeGutachten::$gutachter->logo && MakeGutachten::$gutachter->logo_anzeigen) {
$html .= '<div id="deckblatt-logo-gutachter" style="background-position: center '.MakeGutachten::$gutachter->logo_align.'; background-image: url(\''.public_path().'/storage/'.MakeGutachten::$gutachter->logo.'\');"></div>';
}
if (MakeGutachten::$gutachter->referenz_formatting && MakeGutachten::$gutachter->text_anzeigen) {
$from = ['--', 'text-align: end;'];
$to = ['', 'text-align: right;'];
$str = RichContentRenderer::make(MakeGutachten::$gutachter->referenz_formatting)->toHtml();
$html .= str_replace($from, $to, $str);
$html .= Format::fix_str($str);
}
$html .= '</div>';
// PROJEKT
$html .= '<div id="deckblatt-gutachten">';
$html .= '<h1>Gutachten</h1>';
$html .= '<div class="base bold ml-1">'.trim(MakeGutachten::$projekt->interner_name).'</div>';
$html .= '<h1 style="font-size:28px;">Gutachten</h1>';
$html .= '<div class="base ml-1">'.trim(MakeGutachten::$projekt->interner_name).'</div>';
$html .= '</div>';
$html .= '<div id="deckblatt-festsetzung">';
$html .= '<h2>ZUR FESTSETZUNG DER NUTZWERTE';
$html .= '<div class="base bold">'.trim(MakeGutachten::$projekt->offizieller_name).'</div>';
$html .= '<h2>ZUR FESTSETZUNG DER NUTZWERTE</h2>';
$html .= '<div class="base">'.trim(MakeGutachten::$projekt->offizieller_name).'</div>';
$html .= '<div class="base">'.trim($textblock).'</div>';
$html .= '</h2>';
$html .= '</div>';
// AUFTRAGGEBER
@@ -45,10 +42,8 @@ class Deckblatt
$html .= '<div id="deckblatt-logo-auftraggeber" style="background-image: url(\''.public_path().'/storage/'.MakeGutachten::$auftraggeber->logo.'\');"></div>';
}
if (MakeGutachten::$auftraggeber->referenz_formatting && MakeGutachten::$auftraggeber->text_anzeigen) {
$from = ['--'];
$to = [''];
$str = RichContentRenderer::make(MakeGutachten::$auftraggeber->referenz_formatting)->toHtml();
$html .= str_replace($from, $to, $str);
$html .= Format::fix_str($str);
}
$html .= '</div>';
@@ -15,5 +15,6 @@ class Ueberschrift
return '<div class="header">'.$inhalt->name.'</div>';
}
}
}
}
+21 -3
View File
@@ -10,12 +10,14 @@ use App\Actions\Generate\Gutachten\Platzhalter;
use App\Actions\Generate\Gutachten\Standardtext;
use App\Actions\Generate\Gutachten\Tabelle;
use App\Actions\Generate\Gutachten\Ueberschrift;
use App\Actions\Generate\Utilities\Format;
use App\Models\Auftraggeber;
use App\Models\Gutachter;
use App\Models\Inhaltsverzeichnis;
use App\Models\Projekte;
use App\Models\ProjektInhaltsverzeichnis;
use App\Models\ProjektPlatzhalter;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Mpdf\HTMLParserMode;
use Mpdf\Mpdf;
@@ -72,22 +74,38 @@ class MakeGutachten
$mpdf->AddPage();
}
$textblock = $inhalt->textblock ? Platzhalter::replace($inhalt->textblock) : '';
if ($inhalt->textblock) {
$textblock = Platzhalter::replace($inhalt->textblock);
$textblock = Format::fix_str($textblock);
}
if ($inhalt->name == 'DECKBLATT') {
$html = Deckblatt::create($textblock);
} elseif ($inhalt->name == 'INHALTSVERZEICHNIS') {
$html = Inhalt::create();
} else {
$html = Ueberschrift::create($inhalt);
$html .= $textblock;
switch ($inhalt->tabellen_id) {
case '8':
$str = RichContentRenderer::make(MakeGutachten::$auftraggeber->referenz_formatting)->toHtml();
$html .= Format::fix_str($str);
break;
}
if ($inhalt->textblock) {
$html .= $textblock;
}
}
if ($inhalt->seitenzahl_anzeige == 1) {
$mpdf->SetHTMLFooter('<div class="center">Seite {PAGENO}<br><br></div>');
}
$mpdf->WriteHTML($html, HTMLParserMode::HTML_BODY);
if ($html) {
$mpdf->WriteHTML($html, HTMLParserMode::HTML_BODY);
}
}
// $inhalte = Inhaltsverzeichnis::where('projekte_id', $projekte_id)->where('is_active', 1)->orderBy('pos')->get();
@@ -30,4 +30,12 @@ class Format
return '';
}
}
public static function fix_str($str)
{
$from = ['--', 'text-align: end;'];
$to = ['', 'text-align: right;'];
return str_replace($from, $to, $str);
}
}
@@ -5,6 +5,7 @@ namespace App\Actions\Validation;
use App\Models\Allgemeinflaechen;
use App\Models\OrientierungZuAbschlaege;
use App\Models\Projekte;
use App\Models\ProjektInhaltsverzeichnis;
use App\Models\ProjektMethode;
use App\Models\ProjektPlatzhalter;
use App\Models\Raeumealle;
@@ -209,6 +210,22 @@ class GutachtenValidation
}
}
/**
* ProjektInhaltsverzeichnis
*/
$res = ProjektInhaltsverzeichnis::where('projekte_id', $record->id)->get();
if (! $res->count()) {
Notification::make()
->title('Inhaltsverzeichnis')
->info()
->icon('heroicon-o-exclamation-triangle')
->body('Inhaltsverzeichnis fehlt!')
->duration(10000)
->send();
return false;
}
/**
* ProjektPlatzhalter
*/
@@ -17,6 +17,7 @@ class InhaltsverzeichnisTable
return $table
->heading('Inhaltsverzeichnis')
->description('Wird als Vorlage bei den Gutachten verwendet.')
// ->recordClasses(fn ($record) => $record->part == 'gutachten' ? 'border-l-4' : 'border-l-4')
->columns([
TextColumn::make('ordnungszahl')
->label('Index')
@@ -80,7 +80,7 @@ class EditProjekte extends EditRecord
->disabled(fn ($record): bool => ! $record->pdf_gutachten_status)
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->color(fn ($record): string => match ($record->pdf_gutachten_status) {
1 => 'info',
1 => 'primary',
default => 'gray',
})
->label('Öffnen')
@@ -90,7 +90,7 @@ class EditProjekte extends EditRecord
Action::make('make_gutachten')
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->color(fn ($record): string => match ($record->evaluation_gutachten) {
1 => 'info',
1 => 'primary',
default => 'gray',
})
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
@@ -110,7 +110,7 @@ class EditProjekte extends EditRecord
->disabled(fn ($record): bool => ! $record->pdf_nutzwerte_status)
->hidden(fn ($record): bool => $record->bezahlt_am ? false : true)
->color(fn ($record): string => match ($record->pdf_gutachten_status) {
1 => 'info',
1 => 'primary',
default => 'gray',
})
->label('Öffnen')
@@ -122,12 +122,16 @@ class EditProjekte extends EditRecord
->disabled(fn ($record): bool => $record->evaluation_gutachten ? false : true)
->label('Berechnen')
->icon('phosphor-calculator')
->color(fn ($record): string => match ($record->evaluation_gutachten) {
1 => 'primary',
default => 'gray',
})
->url(fn ($record) => route('nutzwerte.download', ['record' => $record, 'mode' => 'new']))
->openUrlInNewTab(),
])->label('Nutzwerte')
->icon('heroicon-m-ellipsis-vertical')
->button()
->color('primary'),
->color('warning'),
/**
* EXCEL
*/
@@ -149,7 +153,7 @@ class EditProjekte extends EditRecord
])->label('Spreadsheet')
->icon('heroicon-m-ellipsis-vertical')
->button()
->color('primary'),
->color('info'),
DeleteAction::make(),
];
}
@@ -86,10 +86,24 @@ class ProjektInhaltsverzeichnisRelationManager extends RelationManager
->schema([
TextInput::make('konto_textblock_id')->hidden(),
RichEditor::make('textblock')
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->columnSpan(5)
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
['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('')
@@ -21,7 +21,21 @@ class TextblockForm
RichEditor::make('textblock')
->extraInputAttributes(['style' => 'min-height: 20rem; max-height: 50vh; overflow-y: auto;'])
->toolbarButtons([
['bold', 'italic', 'underline', 'strike', 'subscript', 'superscript'],
['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',
],
]),
])->columns(1);
}
+3 -3
View File
@@ -26,11 +26,11 @@ class AppServiceProvider extends ServiceProvider
{
FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::Slate,
'info' => Color::Blue,
'gray' => Color::Zinc,
'info' => Color::Slate,
'primary' => Color::Blue,
'success' => Color::Green,
'warning' => Color::Amber,
'warning' => Color::Yellow,
]);
FilamentView::registerRenderHook(