pdf wip
This commit is contained in:
1 parent
c64634b3a1
commit
523e395064
36 files changed
+431
-635
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Actions\Create;
|
||||
|
||||
use App\Models\Projekte;
|
||||
use App\Models\ProjektInhaltsverzeichnis;
|
||||
use App\Models\ProjektPlatzhalter;
|
||||
|
||||
@@ -22,15 +23,16 @@ class CreatePlatzhalter
|
||||
ProjektPlatzhalter::where('projekte_id', $record->id)->update(['controll' => true]);
|
||||
|
||||
foreach ($_platzhalter as $platzhalter) {
|
||||
$result = ProjektPlatzhalter::where('projekte_id', $record->id)->where('platzhalter', $platzhalter)->get();
|
||||
if ($result->count() == 0) {
|
||||
$tmp = new ProjektPlatzhalter;
|
||||
$tmp->projekte_id = $record->id;
|
||||
$tmp->platzhalter = $platzhalter;
|
||||
$tmp->controll = false;
|
||||
$tmp->save();
|
||||
}
|
||||
ProjektPlatzhalter::updateOrCreate(
|
||||
['projekte_id' => $record->id, 'platzhalter' => $platzhalter],
|
||||
['controll' => false]
|
||||
);
|
||||
}
|
||||
ProjektPlatzhalter::where('projekte_id', $record->id)->where('controll', true)->delete();
|
||||
|
||||
Projekte::where('id', $record->id)->update([
|
||||
'evaluation_gutachten' => false,
|
||||
'pdf_nutzwerte_status' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -12,39 +12,34 @@ class CreateProjektInhaltsverzeichnis
|
||||
{
|
||||
ProjektInhaltsverzeichnis::where('projekte_id', $record->id)->delete();
|
||||
|
||||
$inhaltsverzeichnis = Inhaltsverzeichnis::get();
|
||||
$part = 1;
|
||||
foreach ($inhaltsverzeichnis as $inhalt) {
|
||||
$inhaltsverzeichnis = Inhaltsverzeichnis::orderBy('sort')->get();
|
||||
|
||||
foreach ($inhaltsverzeichnis as $key => $value) {
|
||||
|
||||
$key++;
|
||||
|
||||
$textblock = '';
|
||||
if ($inhalt->textblock_id > 0) {
|
||||
$textblock = Textblock::where('id', $inhalt->textblock_id)->pluck('textblock')->first();
|
||||
if ($value->textblock_id > 0) {
|
||||
$textblock = Textblock::where('id', $value->textblock_id)->pluck('textblock')->first();
|
||||
}
|
||||
|
||||
if ($inhalt->tabellen_id == 5) {
|
||||
$part = 2;
|
||||
}
|
||||
$inhalt = new ProjektInhaltsverzeichnis;
|
||||
$inhalt->projekte_id = $record->id;
|
||||
$inhalt->sort = $key;
|
||||
$inhalt->ordnungszahl = $value->ordnungszahl;
|
||||
$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->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->save();
|
||||
|
||||
ProjektInhaltsverzeichnis::updateOrCreate(
|
||||
[
|
||||
'projekte_id' => $record->id,
|
||||
'name' => $inhalt->name,
|
||||
],
|
||||
[
|
||||
'sort' => $inhalt->sort,
|
||||
'ordnungszahl' => $inhalt->ordnungszahl,
|
||||
'name' => $inhalt->name,
|
||||
'name2' => $inhalt->name2,
|
||||
'ueberschrift_anzeigen' => $inhalt->ueberschrift_anzeigen,
|
||||
'tabellen_id' => $inhalt->tabellen_id,
|
||||
'textblock_id' => $inhalt->textblock_id,
|
||||
'part' => $part,
|
||||
'seite' => $inhalt->seite,
|
||||
'neue_seite' => $inhalt->neue_seite,
|
||||
'seitenzahl_anzeige' => $inhalt->seitenzahl_anzeige,
|
||||
'no_edit' => $inhalt->no_edit,
|
||||
'textblock' => $textblock,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Download;
|
||||
|
||||
use App\Actions\Generate\GenerateExcel;
|
||||
use App\Models\Projekt;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class Excel
|
||||
{
|
||||
public function download($projekts_id, $mode)
|
||||
{
|
||||
if ($mode == 'new') {
|
||||
Projekt::where('id', $projekts_id)->update(['excel_nutzwerte' => '', 'excel_nutzwerte_ok' => '0']);
|
||||
}
|
||||
|
||||
$projekt = Projekt::where('id', $projekts_id)->first()->toArray();
|
||||
$filepath = Storage::disk('public')->path("/download/$projekts_id/excel/");
|
||||
|
||||
if ($projekt['excel_nutzwerte_ok'] == 0) {
|
||||
|
||||
$filename = preg_replace("'[^0-9a-zA-Z]'", '', $projekt['intname']).'.xlsx';
|
||||
|
||||
if (! File::isDirectory($filepath)) {
|
||||
File::makeDirectory($filepath, 0777, true, true);
|
||||
}
|
||||
$file = $filepath.$filename;
|
||||
|
||||
GenerateExcel::generate($file, $projekts_id);
|
||||
|
||||
Projekt::where('id', $projekts_id)->update(['excel_nutzwerte' => $filename, 'excel_nutzwerte_ok' => '1']);
|
||||
|
||||
} else {
|
||||
|
||||
$filename = $projekt['excel_nutzwerte'];
|
||||
$file = $filepath.$filename;
|
||||
}
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/vnd.ms-excel',
|
||||
'Content-Disposition: attachment;filename="'.$filename.'"',
|
||||
'Cache-Control: max-age=0',
|
||||
'Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT',
|
||||
'Cache-Control: cache, must-revalidate',
|
||||
'Pragma: public',
|
||||
];
|
||||
|
||||
return Response::download($file, $projekt['name'], $headers);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Download;
|
||||
|
||||
use App\Actions\Generate\MakeGutachten;
|
||||
use App\Models\Projekte;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class Gutachten
|
||||
{
|
||||
public function download($projekte_id, $mode)
|
||||
{
|
||||
if ($mode == 'new') {
|
||||
Projekte::where('id', $projekte_id)->update(['pdf_gutachten_name' => '', 'pdf_gutachten_status' => '0']);
|
||||
}
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/pdf',
|
||||
'Cache-Control: max-age=0',
|
||||
'Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT',
|
||||
'Cache-Control: cache, must-revalidate',
|
||||
];
|
||||
|
||||
$projekt = Projekte::where('id', $projekte_id)->first()->toArray();
|
||||
|
||||
$filepath = Storage::disk('public')->path("/download/$projekte_id/");
|
||||
|
||||
$filename = 'Gutachten '.preg_replace("'[^0-9a-zA-Z]'", '', $projekt['interner_name']).'.pdf';
|
||||
|
||||
if (! File::isDirectory($filepath)) {
|
||||
File::makeDirectory($filepath, 0777, true, true);
|
||||
}
|
||||
$file = $filepath.$filename;
|
||||
|
||||
MakeGutachten::generate($file, $projekte_id);
|
||||
|
||||
return Response::download($file, 'Gutachten '.$projekt['offizieller_name'], $headers);
|
||||
|
||||
// if ($projekt['pdf_standardtexte_ok'] == 0) {
|
||||
|
||||
// $filename = preg_replace("'[^0-9a-zA-Z]'", '', $projekt['interner_name']).'.pdf';
|
||||
|
||||
// if (! File::isDirectory($filepath)) {
|
||||
// File::makeDirectory($filepath, 0777, true, true);
|
||||
// }
|
||||
// $file = $filepath.$filename;
|
||||
|
||||
// MakeGutachten::generate($file, $projekte_id);
|
||||
|
||||
// Projekt::where('id', $projekte_id)->update(['pdf_standardtexte' => $filename, 'pdf_standardtexte_ok' => 1]);
|
||||
|
||||
// return Response::download($file, $projekt['name'], $headers);
|
||||
// } else {
|
||||
|
||||
// $filename = $projekt['pdf_standardtexte'];
|
||||
|
||||
// $file = $filepath.$filename;
|
||||
|
||||
// return Response::download($file, $projekt['name'], $headers);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Download;
|
||||
|
||||
use App\Actions\Generate\MakeNutzwerte;
|
||||
use App\Models\Projekte;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Response;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class Nutzwerte
|
||||
{
|
||||
public function download($projekte_id, $mode)
|
||||
{
|
||||
|
||||
if ($mode == 'new') {
|
||||
Projekte::where('id', $projekte_id)->update(['pdf_nutzwerte_name' => '', 'pdf_nutzwerte_status' => '0']);
|
||||
}
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/pdf',
|
||||
'Cache-Control: max-age=0',
|
||||
'Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT',
|
||||
'Cache-Control: cache, must-revalidate',
|
||||
];
|
||||
|
||||
$projekt = Projekte::where('id', $projekte_id)->first()->toArray();
|
||||
|
||||
$filepath = Storage::disk('public')->path("/download/$projekte_id/");
|
||||
|
||||
$filename = 'Gutachten '.preg_replace("'[^0-9a-zA-Z]'", '', $projekt['interner_name']).'.pdf';
|
||||
|
||||
if (! File::isDirectory($filepath)) {
|
||||
File::makeDirectory($filepath, 0777, true, true);
|
||||
}
|
||||
$file = $filepath.$filename;
|
||||
|
||||
MakeNutzwerte::generate($file, $projekte_id);
|
||||
|
||||
return Response::download($file, 'Nutzwert '.$projekt['offizieller_name'], $headers);
|
||||
|
||||
// if ($projekt['pdf_nutzwerte_status'] == 0) {
|
||||
|
||||
// $filename = preg_replace("'[^0-9a-zA-Z]'", '', $projekt['intname']).'.pdf';
|
||||
|
||||
// if (! File::isDirectory($filepath)) {
|
||||
// File::makeDirectory($filepath, 0777, true, true);
|
||||
// }
|
||||
// $file = $filepath.$filename;
|
||||
|
||||
// GenerateNutzwerte::generate($file, $projekte_id);
|
||||
|
||||
// Projekte::where('id', $projekte_id)->update(['pdf_nutzwerte' => $filename, 'pdf_nutzwerte_ok' => '1']);
|
||||
|
||||
// return Response::download($file, $projekt['name'], $headers);
|
||||
|
||||
// } else {
|
||||
|
||||
// $filename = $projekt['pdf_nutzwerte_name'];
|
||||
|
||||
// $file = $filepath.$filename;
|
||||
|
||||
// return Response::download($file, $projekt['name'], $headers);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate;
|
||||
|
||||
class Excel
|
||||
{
|
||||
public static function make($projekte_id, $type)
|
||||
{
|
||||
echo 'Excel'.PHP_EOL;
|
||||
dd($type);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Gutachten;
|
||||
|
||||
use App\Actions\Generate\MakeGutachten;
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
||||
|
||||
class Deckblatt
|
||||
{
|
||||
public static function create($textblock)
|
||||
{
|
||||
// $table->boolean('logo_anzeigen')->default(0);
|
||||
// $table->boolean('text_anzeigen')->default(0);
|
||||
|
||||
// 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) {
|
||||
$str = RichContentRenderer::make(MakeGutachten::$gutachter->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
// PROJEKT
|
||||
$html .= '<div id="deckblatt-gutachten">';
|
||||
$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</h2>';
|
||||
$html .= '<div class="base">'.trim(MakeGutachten::$projekt->offizieller_name).'</div>';
|
||||
$html .= '<div class="base">'.trim($textblock).'</div>';
|
||||
$html .= '</div>';
|
||||
|
||||
// AUFTRAGGEBER
|
||||
$html .= '<div id="deckblatt-auftraggeber">';
|
||||
if (MakeGutachten::$auftraggeber->logo && MakeGutachten::$auftraggeber->logo_anzeigen) {
|
||||
$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) {
|
||||
$str = RichContentRenderer::make(MakeGutachten::$auftraggeber->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ class MakeNutzwerte
|
||||
$mpdf->SetCreator('nutzwerte.at');
|
||||
$mpdf->SetAuthor(self::$gutachter->title.' '.self::$gutachter->gender.' '.self::$gutachter->name);
|
||||
|
||||
$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->where('part', 2)->orderBy('sort')->get();
|
||||
$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->where('part', 'nutzwerte')->orderBy('sort')->get();
|
||||
|
||||
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
|
||||
|
||||
|
||||
@@ -2,23 +2,21 @@
|
||||
|
||||
namespace App\Actions\Generate;
|
||||
|
||||
use App\Actions\Generate\Gutachten\AllgemeinTabelle;
|
||||
use App\Actions\Generate\Gutachten\Deckblatt;
|
||||
use App\Actions\Generate\Gutachten\Inhalt;
|
||||
use App\Actions\Generate\Gutachten\Paragraph6Tabelle;
|
||||
use App\Actions\Generate\Gutachten\Platzhalter;
|
||||
use App\Actions\Generate\Gutachten\Ueberschrift;
|
||||
use App\Actions\Generate\Nutzwerte\BerechnungNutzwerte;
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use App\Actions\ProcessData\ProcessRaumorientierung;
|
||||
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 Mpdf\HTMLParserMode;
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
class MakeGutachten
|
||||
class MakeParagraph6
|
||||
{
|
||||
public static $projekt;
|
||||
|
||||
@@ -28,6 +26,10 @@ class MakeGutachten
|
||||
|
||||
public static function generate($filepath, $projekte_id)
|
||||
{
|
||||
// ProcessRaumorientierung::berechnen($projekte_id);
|
||||
// BerechnungNutzwerte::berechnen($projekte_id);
|
||||
|
||||
// PDF START
|
||||
self::$projekt = Projekte::where('id', $projekte_id)->first();
|
||||
|
||||
self::$gutachter = Gutachter::where('id', self::$projekt->gutachter_id)->first();
|
||||
@@ -41,22 +43,21 @@ class MakeGutachten
|
||||
'debug' => true,
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4-P',
|
||||
'margin_left' => 15,
|
||||
'margin_left' => 10,
|
||||
'margin_right' => 10,
|
||||
'margin_top' => 10,
|
||||
'margin_bottom' => 10,
|
||||
'margin_top' => 12,
|
||||
'margin_bottom' => 20,
|
||||
'margin_header' => 0,
|
||||
'margin_footer' => 0,
|
||||
]
|
||||
);
|
||||
|
||||
$stylesheet = file_get_contents(__DIR__.'/../../../resources/css/pdf-download.css');
|
||||
$mpdf->WriteHTML($stylesheet, HTMLParserMode::HEADER_CSS);
|
||||
$mpdf->SetTitle('Gutachten '.self::$projekt->offizieller_name);
|
||||
$mpdf->SetTitle('Nutzwerte '.self::$projekt->offizieller_name);
|
||||
$mpdf->SetCreator('nutzwerte.at');
|
||||
$mpdf->SetAuthor(self::$gutachter->title.' '.self::$gutachter->gender.' '.self::$gutachter->name);
|
||||
|
||||
$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->where('part', 1)->orderBy('sort')->get();
|
||||
$inhaltesverzeichnis = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->where('part', 'paragraph')->orderBy('sort')->get();
|
||||
|
||||
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
|
||||
|
||||
@@ -91,7 +92,7 @@ class MakeGutachten
|
||||
$html .= AllgemeinTabelle::load($projekte_id);
|
||||
break;
|
||||
case '8':
|
||||
$str = RichContentRenderer::make(MakeGutachten::$auftraggeber->referenz_formatting)->toHtml();
|
||||
$str = RichContentRenderer::make(MakeStandardTexte::$auftraggeber->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
break;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Nutzwerte;
|
||||
|
||||
use App\Models\ProjektAllgemeinflaechen;
|
||||
use App\Utilities\Format;
|
||||
use App\Utilities\Html;
|
||||
|
||||
class ProjektAllgemeinflaechens
|
||||
{
|
||||
public static function load(int $projekts_id)
|
||||
{
|
||||
|
||||
$html = '<table>';
|
||||
$html .= '<thead><tr class="head">';
|
||||
$html .= Html::td('Top', 'head bl bt bb');
|
||||
$html .= Html::td('Raumart', 'head bl bt bb');
|
||||
$html .= Html::td('Fläche', 'head center bl bt bb');
|
||||
$html .= Html::td('', 'bl');
|
||||
$html .= Html::td('Top', 'head bb bt bl');
|
||||
$html .= Html::td('Type', 'head bt bl bb');
|
||||
$html .= Html::td('Fläche', 'head center bl bt bb br');
|
||||
$html .= '</tr></thead>';
|
||||
|
||||
$res = ProjektAllgemeinflaechen::select('geschoss', 'raumart', 'qm')->where('projekts_id', $projekts_id)->orderBy('geschoss')->orderBy('raumart')->get();
|
||||
|
||||
foreach ($res as $key => $allg) {
|
||||
$bg = ($key % 4 == 2 || $key % 4 == 3) ? 'hellgrau' : '';
|
||||
if ($key % 2 == 0) {
|
||||
$html .= '<tr>';
|
||||
$html .= Html::td($allg->geschoss, "bl bb br $bg");
|
||||
$html .= Html::td($allg->raumart, "bb br $bg");
|
||||
$html .= Html::td(Format::numeric($allg->qm, 2), "center bb br $bg");
|
||||
$html .= Html::td('');
|
||||
} else {
|
||||
$html .= Html::td($allg->geschoss, "bl bb br $bg");
|
||||
$html .= Html::td($allg->raumart, "bb br $bg");
|
||||
$html .= Html::td(Format::numeric($allg->qm, 2), "center bb br $bg");
|
||||
$html .= '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</table>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace App\Actions\Generate\Nutzwerte;
|
||||
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
use App\Models\Merkmale;
|
||||
use App\Models\ProjektMethode;
|
||||
use App\Models\ProjektObjekte;
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
|
||||
class ZuUndAbschlaege
|
||||
{
|
||||
@@ -21,16 +21,13 @@ class ZuUndAbschlaege
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
|
||||
$has_loggien = ProjektMethode::where('projekte_id', $projekte_id)->where('methode_id', 2)->count();
|
||||
|
||||
if($has_loggien){
|
||||
if ($has_loggien) {
|
||||
$header_row = ['Top Nummer', 'Geschoß', 'Typ', 'Nutzfläche', 'Loggia / Zusatzflächen', 'Gesamtnutzfläche'];
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$header_row = ['Top Nummer', 'Geschoß', 'Typ', 'Nutzfläche'];
|
||||
}
|
||||
|
||||
|
||||
$merkmale = Merkmale::where('projekte_id', $projekte_id)->pluck('name', 'code');
|
||||
|
||||
@@ -74,7 +71,7 @@ class ZuUndAbschlaege
|
||||
foreach ($markmale_codes as $code) {
|
||||
$html .= Html::td($objekt[$code], 'center br bb');
|
||||
}
|
||||
$html .= Html::td(Format::dezimal($objekt['nutzwert'],2), 'center br bb');
|
||||
$html .= Html::td(Format::dezimal($objekt['nutzwert'], 2), 'center br bb');
|
||||
$html .= Html::td(Format::dezimal(100 + $objekt['nutzwert'], 2), 'right br bb');
|
||||
$html .= '</tr>';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate;
|
||||
|
||||
use App\Actions\Generate\Pdf\Deckblatt;
|
||||
use App\Actions\Generate\Pdf\DigitaleSignatur;
|
||||
use App\Actions\Generate\Pdf\Inhalt;
|
||||
use App\Actions\Generate\Pdf\Platzhalter;
|
||||
use App\Actions\Generate\Pdf\Ueberschrift;
|
||||
use App\Actions\Generate\Tabellen\Allgemeinflaechen;
|
||||
use App\Actions\Generate\Tabellen\Paragraph6;
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
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;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Mpdf\HTMLParserMode;
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
class Pdf
|
||||
{
|
||||
public static $projekt;
|
||||
|
||||
public static $gutachter;
|
||||
|
||||
public static $auftraggeber;
|
||||
|
||||
public static function make($projekte_id, $type, $mode)
|
||||
{
|
||||
|
||||
self::$projekt = Projekte::where('id', $projekte_id)->first();
|
||||
|
||||
self::$gutachter = Gutachter::where('id', self::$projekt->gutachter_id)->first();
|
||||
|
||||
self::$auftraggeber = Auftraggeber::where('id', self::$projekt->auftraggeber_id)->first();
|
||||
|
||||
$headers = [
|
||||
'Content-Type: application/pdf',
|
||||
'Cache-Control: max-age=0',
|
||||
'Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT',
|
||||
'Cache-Control: cache, must-revalidate',
|
||||
];
|
||||
|
||||
$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_gutachten_name' => '', 'pdf_nutzwerte_status' => 1]);
|
||||
} else {
|
||||
return Response::download($file, $filename, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
if (! File::isDirectory($filepath)) {
|
||||
File::makeDirectory($filepath, 0777, true, true);
|
||||
}
|
||||
$file = $filepath.$filename;
|
||||
|
||||
ob_start();
|
||||
|
||||
$mpdf = new Mpdf(
|
||||
[
|
||||
'debug' => true,
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4-P',
|
||||
'margin_left' => 10,
|
||||
'margin_right' => 10,
|
||||
'margin_top' => 12,
|
||||
'margin_bottom' => 20,
|
||||
'margin_header' => 0,
|
||||
'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();
|
||||
|
||||
$platzhalter = ProjektPlatzhalter::where('projekte_id', $projekte_id)->pluck('platzhaltertext', 'platzhalter')->toArray();
|
||||
|
||||
foreach ($inhaltesverzeichnis as $inhalt) {
|
||||
|
||||
if ($inhalt->neue_seite) {
|
||||
$mpdf->AddPage();
|
||||
}
|
||||
|
||||
if ($inhalt->textblock) {
|
||||
$textblock = Platzhalter::replace($platzhalter, $inhalt->textblock);
|
||||
$textblock = Format::fix_str($textblock);
|
||||
}
|
||||
|
||||
$html = Ueberschrift::create($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 '8':
|
||||
$str = RichContentRenderer::make(self::$auftraggeber->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
break;
|
||||
case '11':
|
||||
$html .= DigitaleSignatur::load($projekte_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($inhalt->seitenzahl_anzeige == 1) {
|
||||
$mpdf->SetHTMLFooter('<div class="center">Seite {PAGENO}<br><br></div>');
|
||||
}
|
||||
if ($html) {
|
||||
$mpdf->WriteHTML($html, HTMLParserMode::HTML_BODY);
|
||||
}
|
||||
}
|
||||
|
||||
ob_clean();
|
||||
|
||||
$mpdf->Output($file, 'F');
|
||||
|
||||
return Response::download($file, $filename, $headers);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use Filament\Forms\Components\RichEditor\RichContentRenderer;
|
||||
|
||||
class Deckblatt
|
||||
{
|
||||
public static function create($textblock)
|
||||
{
|
||||
// GUTACHTER
|
||||
$html = '<div id="deckblatt-gutachter">';
|
||||
if (Pdf::$gutachter->logo && Pdf::$gutachter->logo_anzeigen) {
|
||||
$html .= '<div id="deckblatt-logo-gutachter" style="background-position: center '.Pdf::$gutachter->logo_align.'; background-image: url(\''.public_path().'/storage/'.Pdf::$gutachter->logo.'\');"></div>';
|
||||
}
|
||||
if (Pdf::$gutachter->referenz_formatting && Pdf::$gutachter->text_anzeigen) {
|
||||
$str = RichContentRenderer::make(Pdf::$gutachter->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
}
|
||||
$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>';
|
||||
|
||||
$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 .= '</div>';
|
||||
|
||||
// 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 (Pdf::$auftraggeber->referenz_formatting && Pdf::$auftraggeber->text_anzeigen) {
|
||||
$str = RichContentRenderer::make(Pdf::$auftraggeber->referenz_formatting)->toHtml();
|
||||
$html .= Format::fix_str($str);
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
use App\Actions\Generate\Pdf;
|
||||
|
||||
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>';
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Gutachten;
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
@@ -13,7 +13,7 @@ class Inhalt
|
||||
$html = '<table class="inhalt">';
|
||||
$inhalte = ProjektInhaltsverzeichnis::where('projekte_id', $projekte_id)->orderBy('sort')->get();
|
||||
foreach ($inhalte as $inhalt) {
|
||||
if ($inhalt->ueberschrift_anzeigen) {
|
||||
if ($inhalt->name != 'INHALTSVERZEICHNIS' && $inhalt->ueberschrift_anzeigen) {
|
||||
$html .= '<tr>';
|
||||
$html .= Html::td(Format::index($inhalt->ordnungszahl));
|
||||
$html .= Html::td($inhalt->name);
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Gutachten;
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
class Platzhalter
|
||||
{
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Gutachten;
|
||||
namespace App\Actions\Generate\Pdf;
|
||||
|
||||
use App\Actions\Generate\Utilities\Format;
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Gutachten;
|
||||
namespace App\Actions\Generate\Tabellen;
|
||||
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
use App\Models\ProjektAllgemeinflaechen;
|
||||
|
||||
class AllgemeinTabelle
|
||||
class Allgemeinflaechen
|
||||
{
|
||||
public static function load($projekte_id)
|
||||
{
|
||||
@@ -17,7 +17,7 @@ class AllgemeinTabelle
|
||||
|
||||
$_data = array_chunk($_allgemeine, 2);
|
||||
|
||||
$html = '<table class="table-striped">';
|
||||
$html = '<table class="table-striped bl bt">';
|
||||
$html .= '<tr>';
|
||||
$html .= '<thead>';
|
||||
$html .= Html::td('Geschoß', 'head bl bt wp10');
|
||||
+5
-4
@@ -1,16 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Generate\Gutachten;
|
||||
namespace App\Actions\Generate\Tabellen;
|
||||
|
||||
use App\Actions\Generate\Utilities\Html;
|
||||
use App\Models\ProjektObjekte;
|
||||
|
||||
class Paragraph6Tabelle
|
||||
class Paragraph6
|
||||
{
|
||||
public static function load($projekte_id)
|
||||
{
|
||||
|
||||
$data = ProjektObjekte::with('orientierung')
|
||||
->with('projektobjekteimdetail')
|
||||
->where('projekte_id', $projekte_id)
|
||||
->orderBy('nicht_in_orientierung')
|
||||
->orderBy('top_nummer')
|
||||
@@ -30,8 +31,8 @@ class Paragraph6Tabelle
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= Html::td($value->top_nummer, 'center br bb');
|
||||
$html .= Html::td($value->geschoss, 'center br bb');
|
||||
$html .= Html::td($value->orientierung->name ?? '', 'center br bb');
|
||||
$html .= Html::td($value->projektobjekteimdetail?->geschoss, 'center br bb');
|
||||
$html .= Html::td($value->orientierung?->name, 'center br bb');
|
||||
$html .= Html::td($value->type, 'center br bb');
|
||||
$html .= '</tr>';
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Actions\Validation;
|
||||
|
||||
use App\Models\Gutachter;
|
||||
use App\Models\ProjektAllgemeinflaechen;
|
||||
use App\Models\Projekte;
|
||||
use App\Models\ProjektInhaltsverzeichnis;
|
||||
@@ -15,6 +16,27 @@ class GutachtenValidation
|
||||
{
|
||||
public static function controll($record)
|
||||
{
|
||||
/**
|
||||
* Projekt
|
||||
*/
|
||||
$pro = Projekte::where('id', $record->id)->first();
|
||||
|
||||
/**
|
||||
* Gutachter
|
||||
*/
|
||||
$res = Gutachter::where('konto_id', auth()->user()->konto_id)->where('id', $pro->gutachter_id)->first();
|
||||
if (! $res->digitale_signatur_stempel) {
|
||||
Notification::make()
|
||||
->title('Gutacher')
|
||||
->info()
|
||||
->icon('heroicon-o-exclamation-triangle')
|
||||
->duration(10000)
|
||||
->body('Es fehlt der Stempel für die <b>Digitale Signatur</b>.')
|
||||
->send();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* ProjektAllgemeinflaechen
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user