From 731a2d8aee9cf8cda1dc7bbcc042992f58e9dae4 Mon Sep 17 00:00:00 2001 From: salam Date: Wed, 20 May 2026 07:58:31 +0200 Subject: [PATCH] =?UTF-8?q?alle=20gescho=C3=9Fe=20bei=20pdf=20zusammenstel?= =?UTF-8?q?lung=20auff=C3=BChren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Generate/Tabellen/Zusammenstellung.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/Actions/Generate/Tabellen/Zusammenstellung.php b/app/Actions/Generate/Tabellen/Zusammenstellung.php index 1838b23..4649f60 100644 --- a/app/Actions/Generate/Tabellen/Zusammenstellung.php +++ b/app/Actions/Generate/Tabellen/Zusammenstellung.php @@ -6,6 +6,7 @@ use App\Actions\Generate\PdfGenerator; use App\Actions\Generate\Utilities\Format; use App\Actions\Generate\Utilities\Html; use App\Models\ProjektObjekte; +use App\Models\ProjektObjekteImDetail; class Zusammenstellung { @@ -19,6 +20,8 @@ class Zusammenstellung $html = Html::table_header(['Top', 'Geschoß', 'Orientierung', 'Typ', 'Nutzwert', 'x2 *', '%']); + $geschosse = self::loadGeschosse($projekte_id); + $objekte = ProjektObjekte::select() ->with('orientierung') ->with('projektobjekteimdetail') @@ -31,7 +34,7 @@ class Zusammenstellung $html .= ''; $html .= Html::td($objekt->top_nummer, 'bl bb br'); - $html .= Html::td($objekt->projektobjekteimdetail->first()->geschoss, 'center br bb'); + $html .= Html::td($geschosse[$objekt->id], 'center br bb'); $html .= Html::td($objekt->orientierung?->name, 'center br bb'); $html .= Html::td($objekt?->type, 'center br bb'); @@ -97,4 +100,25 @@ class Zusammenstellung return $html; } + + public static function loadGeschosse($projekte_id) + { + $objekte = ProjektObjekteImDetail::where('projekte_id', $projekte_id)->get(); + + $arr = []; + foreach ($objekte as $objekt) { + $arr[$objekt->projekt_objekte_id][] = $objekt->geschoss; + } + + foreach ($arr as $key => $value) { + $value = array_unique($value); + if (count($value) > 1) { + $arr[$key] = implode('/', $value); + } else { + $arr[$key] = (string) array_first($value); + } + } + + return $arr; + } }