This commit is contained in:
salam committed 2025-11-10 12:59:50 +01:00
1 parent ae6bb58972
commit 054654fb9c
18 files changed
+1325 -85

No files matched your search

+31 -25
View File
@@ -16,7 +16,6 @@ use App\Models\Auftraggeber;
use App\Models\Gutachter;
use App\Models\Projekte;
use App\Models\ProjektInhaltsverzeichnis;
use App\Models\ProjektPlatzhalter;
use Filament\Forms\Components\RichEditor\RichContentRenderer;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Response;
@@ -87,7 +86,7 @@ class Pdf
$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->where('part', $type)->orderBy('sort')->get();
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
$platzhalter = Platzhalter::load($projekte_id);
foreach ($inhaltesverzeichnis as $inhalt) {
@@ -95,33 +94,41 @@ class Pdf
$mpdf->AddPage();
}
if ($inhalt->textblock) {
$textblock = Platzhalter::replace($platzhalter, $inhalt->textblock);
$textblock = Format::fix_str($textblock);
}
$html = '';
$html = Ueberschrift::load($inhalt);
if ($inhalt->textblock) {
$textblock = Platzhalter::replace($platzhalter, $inhalt->textblock);
$textblock = Format::fix_str($textblock);
if ($inhalt->inhaltselement_id != '9') {
$html .= $textblock;
}
}
if ($inhalt->textblock2) {
$textblock2 = Platzhalter::replace($platzhalter, $inhalt->textblock2);
$textblock2 = Format::fix_str($textblock2);
}
switch ($inhalt->inhaltselement_id) {
case '9':
$html .= Deckblatt::load($inhalt, $textblock);
$html .= Deckblatt::load($inhalt, $textblock, $textblock2);
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 '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':
// AUFTRAGGEBER
$str = RichContentRenderer::make(self::$auftraggeber->referenz_formatting)->toHtml();
@@ -130,11 +137,10 @@ class Pdf
// case '11':
// $html .= DigitaleSignatur::load($projekte_id);
// break;
default:
if ($inhalt->textblock) {
$html .= $textblock;
}
break;
}
if ($inhalt->textblock2 and $inhalt->inhaltselement_id != 9) {
$html .= $textblock2;
}
if ($inhalt->seitenzahl_anzeige == 1) {
+3 -4
View File
@@ -8,7 +8,7 @@ use Filament\Forms\Components\RichEditor\RichContentRenderer;
class Deckblatt
{
public static function load($inhalt, $textblock)
public static function load($inhalt, $textblock, $textblock2)
{
// GUTACHTER
$html = '<div id="deckblatt-gutachter">';
@@ -24,13 +24,12 @@ class Deckblatt
// PROJEKT
$html .= '<div id="deckblatt-projekt">';
$html .= '<h1>'.trim($inhalt->name).'</h1>';
$html .= '<p>'.trim(Pdf::$projekt->interner_name).'</p>';
$html .= '<p>'.trim($textblock).'</p>';
$html .= '</div>';
$html .= '<div id="deckblatt-festsetzung">';
$html .= '<h3>ZUR FESTSETZUNG DER NUTZWERTE</h3>';
$html .= '<p>'.trim(Pdf::$projekt->offizieller_name).'</p>';
$html .= '<p>'.trim($textblock).'</p>';
$html .= '<p>'.trim($textblock2).'</p>';
$html .= '</div>';
// AUFTRAGGEBER
+18
View File
@@ -2,10 +2,28 @@
namespace App\Actions\Generate\Pdf;
use App\Actions\Generate\Pdf;
use App\Models\ProjektPlatzhalter;
use Carbon\Carbon;
class Platzhalter
{
public static function replace($platzhalter, $standardtext)
{
return str_replace(array_keys($platzhalter), array_values($platzhalter), $standardtext);
}
public static function load($projekte_id)
{
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
$platzhalter['###INTERNER_NAME###'] = Pdf::$projekt->interner_name;
$platzhalter['###OFFIZIELLER_NAME###'] = Pdf::$projekt->offizieller_name;
$platzhalter['###ORT###'] = Pdf::$projekt->ort;
$platzhalter['###FIRMA###'] = Pdf::$gutachter->company;
$dt = Carbon::create(Pdf::$projekt->erstellung);
$platzhalter['###DATUM###'] = $dt->isoFormat('D. MMMM YYYY');
return $platzhalter;
}
}
+1 -11
View File
@@ -17,18 +17,8 @@ class Paragraph6
->orderBy('top_nummer')
->get();
$html = '<table class="table-striped bl bt">';
$html .= '<tr>';
$html .= '<thead>';
$html .= Html::td('Top', 'head center br bb');
$html .= Html::td('Geschoß', 'head center br bb');
$html .= Html::td('Orientierung', 'head center br bb');
$html .= Html::td('Typ', 'head center br bb');
$html .= '</thead>';
$html .= '</tr>';
$html = Html::table_header(['Top', 'Geschoß', 'Orientierung', 'Typ']);
foreach ($data as $value) {
$html .= '<tr>';
$html .= Html::td($value->top_nummer, 'center br bb');
$html .= Html::td($value->projektobjekteimdetail?->geschoss, 'center br bb');
+3 -3
View File
@@ -9,7 +9,7 @@ class Html
$html = '<table class="table-striped">';
$html .= '<thead><tr>';
foreach ($header_row as $value) {
$html .= '<th class="bl bt br bb center bg-sky py-2">'.$value.'</th>';
$html .= '<th class="bl bt br bb center bg-sky">'.$value.'</th>';
}
$html .= '</tr></thead>';
@@ -34,11 +34,11 @@ class Html
$html = '<table class="table-striped"><thead><tr>';
foreach ($header_row as $value) {
$html .= '<th class="bl bt br bb bg-sky py-2">'.$value.'</th>';
$html .= '<th class="bl bt br bb bg-sky">'.$value.'</th>';
}
$html .= '<th style="background:white"></th>';
foreach ($header_row as $value) {
$html .= '<th class="bl bt br bb bg-sky py-2">'.$value.'</th>';
$html .= '<th class="bl bt br bb bg-sky">'.$value.'</th>';
}
$html .= '</thead></tr>';
@@ -0,0 +1,20 @@
<?php
namespace App\Actions\Generate\Utilities;
use App\Actions\Generate\Pdf;
use App\Models\ProjektPlatzhalter;
class Platzhalter
{
public static function load($projekte_id)
{
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
$platzhalter['###INTERNER_NAME###'] = Pdf::$projekt->interner_name;
$platzhalter['###OFFIZIELLER_NAME###'] = Pdf::$projekt->offizieller_name;
$platzhalter['###ORT###'] = Pdf::$projekt->ort;
$platzhalter['###DATUM###'] = Pdf::$projekt->erstellung;
return $platzhalter;
}
}