From b85c93ad8388e122740eb261c18179cf925116d4 Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Thu, 30 Jan 2025 14:54:34 +0100 Subject: [PATCH] Added Changes in ConstructionConsent --- Layout/default/ConstructionConsent/Index.php | 85 +++++++++++++------ Layout/default/ConstructionConsent/View.php | 77 +++++++++++++++-- .../ConstructionConsent.php | 5 ++ 3 files changed, 137 insertions(+), 30 deletions(-) diff --git a/Layout/default/ConstructionConsent/Index.php b/Layout/default/ConstructionConsent/Index.php index d035b47aa..d49752bfd 100644 --- a/Layout/default/ConstructionConsent/Index.php +++ b/Layout/default/ConstructionConsent/Index.php @@ -93,11 +93,11 @@ $pagination_entity_name = "Zustimmungserklärungen"; Name Objekttyp Objektadresse - GST-Nr. - EZ - Besitzer - Besitzer Adresse - Besitzer Kontakt + + + + + Anfragestatus Anfrageresultat @@ -118,26 +118,41 @@ $pagination_entity_name = "Zustimmungserklärungen"; adb_hausnummer->strasse->gemeinde->name?> - gstnr?> - ez?> - owner_name?> - - owner_street?>
- owner_zip?> owner_city?>
- - - phone): ?> - Tel: phone?>
- - fax): ?> - Fax: fax?>
- - email): ?> - Email: email?> - - +gstnr?> +ez?> +owner_name?> + +owner_street?> +owner_zip?>owner_city?> + + +phone): ?> +phone?> + +fax): ?> +fax?> + +email): ?> +email?> + + status) ? __($item->status,"consent") : ""?> - result) ? __($item->result,"consent") : ""?> + + owner_result_counts['denied']) && $item->owner_result_counts['denied'] > 0) { + $status_class = 'red'; // Red if at least one denied + } elseif ((isset($item->owner_result_counts['unresolvable']) && $item->owner_result_counts['unresolvable'] > 0) || + (isset($item->owner_result_counts['moved']) && $item->owner_result_counts['moved'] > 0)) { + $status_class = 'yellow'; // Yellow if at least one unresolvable or moved + } elseif (isset($item->owner_result_counts['accepted']) && + $item->owner_result_counts['accepted'] === count($item->owners)) { + $status_class = 'green'; // Green if all accepted + } + ?> +
+ $item->id])?>"> result): ?> @@ -163,5 +178,25 @@ $pagination_entity_name = "Zustimmungserklärungen"; - + diff --git a/Layout/default/ConstructionConsent/View.php b/Layout/default/ConstructionConsent/View.php index d35b8fe92..d82f832c4 100644 --- a/Layout/default/ConstructionConsent/View.php +++ b/Layout/default/ConstructionConsent/View.php @@ -180,7 +180,7 @@ $pagination_entity_name = "Adressen"; Plan/Skizze - file): ?> + file && $item->file->file): ?> @@ -257,7 +257,7 @@ $pagination_entity_name = "Adressen";
Zusammenfassung Status (von owners)?>)
owner_status_counts as $type => $count): ?> - + @@ -265,17 +265,33 @@ $pagination_entity_name = "Adressen";
-
Zusammenfassung Ergebnis (von owners)?>)
+ owner_result_counts['denied']) && $item->owner_result_counts['denied'] > 0) { + $status_class = 'red'; // Red if at least one denied + } elseif ((isset($item->owner_result_counts['unresolvable']) && $item->owner_result_counts['unresolvable'] > 0) || + (isset($item->owner_result_counts['moved']) && $item->owner_result_counts['moved'] > 0)) { + $status_class = 'yellow'; // Yellow if at least one unresolvable or moved + } elseif (isset($item->owner_result_counts['accepted']) && + $item->owner_result_counts['accepted'] === count($item->owners)) { + $status_class = 'green'; // Green if all accepted + } + ?> + + +
Zusammenfassung Ergebnis (von owners)?>)
owner_result_counts as $type => $count): ?> - - + +
+ @@ -985,4 +1001,55 @@ $pagination_entity_name = "Adressen"; + + + + \ No newline at end of file diff --git a/application/ConstructionConsent/ConstructionConsent.php b/application/ConstructionConsent/ConstructionConsent.php index 57b44b386..d88c93475 100644 --- a/application/ConstructionConsent/ConstructionConsent.php +++ b/application/ConstructionConsent/ConstructionConsent.php @@ -210,6 +210,11 @@ class ConstructionConsent extends mfBaseModel { $counts = []; $owners = $this->getProperty("owners"); + + if (!isset($owners) || !is_array($owners)) { + return []; + } + foreach($owners as $owner) { if(!array_key_exists($owner->result, $counts)) { $counts[$owner->result] = 0;