wip
This commit is contained in:
1 parent
17ed7b7f8f
commit
c9cac0903a
24 files changed
+122
-4431
No files matched your search
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Actions\Generate\PdfGenerator;
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
||||
|
||||
@@ -12,11 +12,11 @@ class Deckblatt
|
||||
{
|
||||
// GUTACHTER
|
||||
$html = '<div id="deckblatt-gutachter">';
|
||||
if (Pdf::$gutachter->logo && Pdf::$gutachter->logo_anzeigen) {
|
||||
$html .= '<div id="deckblatt-logo-gutachter" style="width:190mm; height: '.Pdf::$gutachter->logo_height.'mm; background-position: center '.Pdf::$gutachter->logo_align.'; background-image: url(\''.public_path().'/storage/'.Pdf::$gutachter->logo.'\');"></div>';
|
||||
if (PdfGenerator::$gutachter->logo && PdfGenerator::$gutachter->logo_anzeigen) {
|
||||
$html .= '<div id="deckblatt-logo-gutachter" style="width:190mm; height: '.PdfGenerator::$gutachter->logo_height.'mm; background-position: center '.PdfGenerator::$gutachter->logo_align.'; background-image: url(\''.public_path().'/storage/'.PdfGenerator::$gutachter->logo.'\');"></div>';
|
||||
}
|
||||
if (Pdf::$gutachter->referenz_formatting && Pdf::$gutachter->text_anzeigen) {
|
||||
$str = RichContentRenderer::make(Pdf::$gutachter->referenz_formatting)->toHtml();
|
||||
if (PdfGenerator::$gutachter->referenz_formatting && PdfGenerator::$gutachter->text_anzeigen) {
|
||||
$str = RichContentRenderer::make(PdfGenerator::$gutachter->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
}
|
||||
$html .= '</div>';
|
||||
@@ -34,12 +34,12 @@ class Deckblatt
|
||||
|
||||
// AUFTRAGGEBER
|
||||
$html .= '<div id="deckblatt-auftraggeber">';
|
||||
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 (PdfGenerator::$auftraggeber->logo && PdfGenerator::$auftraggeber->logo_anzeigen) {
|
||||
$html .= '<div id="deckblatt-logo-auftraggeber" style="background-image: url(\''.public_path().'/storage/'.PdfGenerator::$auftraggeber->logo.'\');"></div>';
|
||||
}
|
||||
|
||||
if (Pdf::$auftraggeber->referenz_formatting && Pdf::$auftraggeber->text_anzeigen) {
|
||||
$str = RichContentRenderer::make(Pdf::$auftraggeber->referenz_formatting)->toHtml();
|
||||
if (PdfGenerator::$auftraggeber->referenz_formatting && PdfGenerator::$auftraggeber->text_anzeigen) {
|
||||
$str = RichContentRenderer::make(PdfGenerator::$auftraggeber->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Actions\Generate\PdfGenerator;
|
||||
|
||||
class DigitaleSignatur
|
||||
{
|
||||
public static function load($projekte_id)
|
||||
{
|
||||
return '<div style="margin-right:2cm; height:4cm; background-repeat: no-repeat; background-position: right; background-size: contain; background-image: url(\''.public_path().'/storage/'.Pdf::$gutachter->digitale_signatur_stempel.'\');"></div>';
|
||||
return '<div style="margin-right:2cm; height:4cm; background-repeat: no-repeat; background-position: right; background-size: contain; background-image: url(\''.public_path().'/storage/'.PdfGenerator::$gutachter->digitale_signatur_stempel.'\');"></div>';
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,9 @@ class Inhalt
|
||||
public static function load($projekte_id)
|
||||
{
|
||||
$html = '<table class="inhalt">';
|
||||
$inhalte = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->orderBy('sort')->get();
|
||||
$inhalte = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)
|
||||
->whereIn('part', ['standard', 'nutzwerte'])
|
||||
->orderBy('sort')->get();
|
||||
foreach ($inhalte as $inhalt) {
|
||||
if ($inhalt->name != 'INHALTSVERZEICHNIS' && $inhalt->ueberschrift_verbergen) {
|
||||
$html .= '<tr>';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Actions\Generate\PdfGenerator;
|
||||
use App\Models\ProjektPlatzhalter;
|
||||
use Carbon\Carbon;
|
||||
|
||||
@@ -16,12 +16,12 @@ 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['###FIRMA###'] = Pdf::$gutachter->company;
|
||||
$platzhalter['###INTERNER_NAME###'] = PdfGenerator::$projekt->interner_name;
|
||||
$platzhalter['###OFFIZIELLER_NAME###'] = PdfGenerator::$projekt->offizieller_name;
|
||||
$platzhalter['###ORT###'] = PdfGenerator::$projekt->ort;
|
||||
$platzhalter['###FIRMA###'] = PdfGenerator::$gutachter->company;
|
||||
|
||||
$dt = Carbon::create(Pdf::$projekt->erstellung);
|
||||
$dt = Carbon::create(PdfGenerator::$projekt->erstellung);
|
||||
$platzhalter['###DATUM###'] = $dt->isoFormat('D. MMMM YYYY');
|
||||
|
||||
return $platzhalter;
|
||||
|
||||
@@ -24,7 +24,7 @@ use Illuminate\Support\Facades\Storage;
|
||||
use Mpdf\HTMLParserMode;
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
class Pdf
|
||||
class PdfGenerator
|
||||
{
|
||||
public static $projekt;
|
||||
|
||||
@@ -34,9 +34,8 @@ class Pdf
|
||||
|
||||
public static $zusammenstellung = [];
|
||||
|
||||
public static function make($projekte_id, $type, $mode)
|
||||
public static function make($projekte_id, $part)
|
||||
{
|
||||
|
||||
self::$projekt = Projekte::where('id', $projekte_id)->first();
|
||||
|
||||
self::$gutachter = Gutachter::where('id', self::$projekt->gutachter_id)->first();
|
||||
@@ -51,19 +50,12 @@ class Pdf
|
||||
];
|
||||
|
||||
$filepath = Storage::disk('public')->path("/download/$projekte_id/");
|
||||
$filename = \ucfirst($type).' '.preg_replace("'[^0-9a-zA-Z]'", '', self::$projekt->interner_name).'.pdf';
|
||||
|
||||
// if ($type == 'nutzwerte') {
|
||||
// if ($mode == 'new') {
|
||||
// Projekte::where('id', $projekte_id)->update(['pdf_nutzwerte_name' => '', 'pdf_nutzwerte_status' => 1]);
|
||||
// } else {
|
||||
// return Response::download($file, $filename, $headers);
|
||||
// }
|
||||
// }
|
||||
$filename = \ucfirst($part).' '.preg_replace("'[^0-9a-zA-Z]'", '', self::$projekt->interner_name).'.pdf';
|
||||
|
||||
if (! File::isDirectory($filepath)) {
|
||||
File::makeDirectory($filepath, 0777, true, true);
|
||||
}
|
||||
|
||||
$file = $filepath.$filename;
|
||||
|
||||
ob_start();
|
||||
@@ -81,20 +73,27 @@ class Pdf
|
||||
'margin_footer' => 0,
|
||||
]
|
||||
);
|
||||
|
||||
$stylesheet = file_get_contents(__DIR__.'/../../../resources/css/pdf-download.css');
|
||||
$mpdf->WriteHTML($stylesheet, HTMLParserMode::HEADER_CSS);
|
||||
$mpdf->SetTitle($filename);
|
||||
$mpdf->SetCreator('nutzwerte.at');
|
||||
$mpdf->SetAuthor(self::$gutachter->title.' '.self::$gutachter->gender.' '.self::$gutachter->name);
|
||||
|
||||
$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->where('part', $type)->orderBy('sort')->get();
|
||||
$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->where('part', $part)->orderBy('sort')->get();
|
||||
|
||||
// dd($inhaltesverzeichnis);
|
||||
|
||||
$platzhalter = Platzhalter::load($projekte_id);
|
||||
|
||||
foreach ($inhaltesverzeichnis as $inhalt) {
|
||||
|
||||
if ($inhalt->neue_seite) {
|
||||
$mpdf->AddPage();
|
||||
if ($part == 'nutzwerte') {
|
||||
$mpdf->AddPage('P', '', self::$projekt->nutzwerte_startseite);
|
||||
} else {
|
||||
$mpdf->AddPage();
|
||||
}
|
||||
}
|
||||
|
||||
$html = '';
|
||||
@@ -150,11 +149,18 @@ class Pdf
|
||||
}
|
||||
|
||||
if ($inhalt->seitenzahl_anzeige == 1) {
|
||||
$mpdf->SetHTMLFooter('<div class="center">Seite {PAGENO}<br><br></div>');
|
||||
$mpdf->SetHTMLFooter('<div class="center">Seite {PAGENO} <br><br></div>');
|
||||
}
|
||||
if ($html) {
|
||||
$mpdf->WriteHTML($html, HTMLParserMode::HTML_BODY);
|
||||
}
|
||||
|
||||
ProjektInhaltsverzeichnis::where('id', $inhalt->id)->update(['seite' => $mpdf->page]);
|
||||
|
||||
}
|
||||
|
||||
if ($part == 'standard') {
|
||||
Projekte::where('id', $projekte_id)->update(['nutzwerte_startseite' => $mpdf->page]);
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Actions\Generate\Tabellen;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Actions\Generate\PdfGenerator;
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
use App\Models\ProjektMethode;
|
||||
use App\Models\ProjektObjekte;
|
||||
@@ -142,7 +142,7 @@ class Nutzwertberechnung
|
||||
$html .= Html::table_footer($summe_nutzwert);
|
||||
$html .= '</table>';
|
||||
|
||||
Pdf::$zusammenstellung[$komponente['id']] = $summe_nutzwert;
|
||||
PdfGenerator::$zusammenstellung[$komponente['id']] = $summe_nutzwert;
|
||||
}
|
||||
|
||||
$objekte = self::laod_project(true);
|
||||
@@ -175,7 +175,7 @@ class Nutzwertberechnung
|
||||
|
||||
$html .= Html::table_footer($nutzwert, 8);
|
||||
$html .= '</table>';
|
||||
Pdf::$zusammenstellung[$komponente['id']] = $nutzwert;
|
||||
PdfGenerator::$zusammenstellung[$komponente['id']] = $nutzwert;
|
||||
}
|
||||
|
||||
return $html;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Actions\Generate\Tabellen;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Actions\Generate\PdfGenerator;
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
use App\Models\ProjektObjekte;
|
||||
@@ -15,7 +15,7 @@ class Zusammenstellung
|
||||
$summe_prozent = [];
|
||||
$summe_nutzwert = [];
|
||||
|
||||
$nutzwert_gesammt = array_sum(Pdf::$zusammenstellung);
|
||||
$nutzwert_gesammt = array_sum(PdfGenerator::$zusammenstellung);
|
||||
|
||||
$html = Html::table_header(['Top', 'Geschoß', 'Orientierung', 'Typ', 'Nutzwert', 'x2 *', '%']);
|
||||
|
||||
@@ -35,7 +35,7 @@ class Zusammenstellung
|
||||
$html .= Html::td($objekt->orientierung?->name, 'center br bb');
|
||||
$html .= Html::td($objekt?->type, 'center br bb');
|
||||
|
||||
$nutzwert = Pdf::$zusammenstellung[$objekt->id];
|
||||
$nutzwert = PdfGenerator::$zusammenstellung[$objekt->id];
|
||||
$summe_nutzwert[] = $nutzwert;
|
||||
$html .= Html::td(round($nutzwert), 'center bb br');
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Actions\Generate\Utilities;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Actions\Generate\PdfGenerator;
|
||||
use App\Models\ProjektPlatzhalter;
|
||||
|
||||
class Platzhalter
|
||||
@@ -10,10 +10,10 @@ 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;
|
||||
$platzhalter['###INTERNER_NAME###'] = PdfGenerator::$projekt->interner_name;
|
||||
$platzhalter['###OFFIZIELLER_NAME###'] = PdfGenerator::$projekt->offizieller_name;
|
||||
$platzhalter['###ORT###'] = PdfGenerator::$projekt->ort;
|
||||
$platzhalter['###DATUM###'] = PdfGenerator::$projekt->erstellung;
|
||||
|
||||
return $platzhalter;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user