Added Changes in ConstructionConsent

This commit is contained in:
Luca Haid
2025-01-30 14:54:34 +01:00
parent e2d0f65a81
commit b85c93ad83
3 changed files with 137 additions and 30 deletions
+60 -25
View File
@@ -93,11 +93,11 @@ $pagination_entity_name = "Zustimmungserklärungen";
<th>Name</th> <th>Name</th>
<th>Objekttyp</th> <th>Objekttyp</th>
<th>Objektadresse</th> <th>Objektadresse</th>
<th title="Grundstücksnummer">GST-Nr.</th> <!-- <th title="Grundstücksnummer">GST-Nr.</th>-->
<th title="Grundbuch Einlagezahl">EZ</th> <!-- <th title="Grundbuch Einlagezahl">EZ</th>-->
<th>Besitzer</th> <!-- <th>Besitzer</th>-->
<th>Besitzer Adresse</th> <!-- <th>Besitzer Adresse</th>-->
<th>Besitzer Kontakt</th> <!-- <th>Besitzer Kontakt</th>-->
<th>Anfragestatus</th> <th>Anfragestatus</th>
<th>Anfrageresultat</th> <th>Anfrageresultat</th>
<th></th> <th></th>
@@ -118,26 +118,41 @@ $pagination_entity_name = "Zustimmungserklärungen";
<?=$item->adb_hausnummer->strasse->gemeinde->name?> <?=$item->adb_hausnummer->strasse->gemeinde->name?>
<?php endif; ?> <?php endif; ?>
</td> </td>
<td><?=$item->gstnr?></td> <!-- <td>--><?php //=$item->gstnr?><!--</td>-->
<td><?=$item->ez?></td> <!-- <td>--><?php //=$item->ez?><!--</td>-->
<td><?=$item->owner_name?></td> <!-- <td>--><?php //=$item->owner_name?><!--</td>-->
<td> <!-- <td>-->
<?=$item->owner_street?><br /> <!-- --><?php //=$item->owner_street?><!--<br />-->
<?=$item->owner_zip?> <?=$item->owner_city?><br /> <!-- --><?php //=$item->owner_zip?><!-- --><?php //=$item->owner_city?><!--<br />-->
</td> <!-- </td>-->
<td> <!-- <td>-->
<?php if($item->phone): ?> <!-- --><?php //if($item->phone): ?>
Tel: <?=$item->phone?><br /> <!-- Tel: --><?php //=$item->phone?><!--<br />-->
<?php endif; ?> <!-- --><?php //endif; ?>
<?php if($item->fax): ?> <!-- --><?php //if($item->fax): ?>
Fax: <?=$item->fax?><br /> <!-- Fax: --><?php //=$item->fax?><!--<br />-->
<?php endif; ?> <!-- --><?php //endif; ?>
<?php if($item->email): ?> <!-- --><?php //if($item->email): ?>
Email: <?=$item->email?> <!-- Email: --><?php //=$item->email?>
<?php endif; ?> <!-- --><?php //endif; ?>
</td> <!-- </td>-->
<td><?=($item->status) ? __($item->status,"consent") : ""?></td> <td><?=($item->status) ? __($item->status,"consent") : ""?></td>
<td><?=($item->result) ? __($item->result,"consent") : ""?></td> <td>
<?php
// Determine the status based on the counts
$status_class = 'blue'; // Default to blue (all open)
if (isset($item->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
}
?>
<div class="status-circle <?=$status_class?>"></div>
</td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;"> <td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("ConstructionConsent", "view", ["id" => $item->id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a> <a href="<?=self::getUrl("ConstructionConsent", "view", ["id" => $item->id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
<?php if(!$item->result): ?> <?php if(!$item->result): ?>
@@ -163,5 +178,25 @@ $pagination_entity_name = "Zustimmungserklärungen";
</div> </div>
</div> </div>
<style>
/* Styles for the status circle */
.status-circle {
width: 25px;
height: 25px;
border-radius: 50%;
display: inline-block;
}
.status-circle.red {
background-color: #d9534f; /* Red */
}
.status-circle.yellow {
background-color: #f0ad4e; /* Yellow */
}
.status-circle.green {
background-color: #5cb85c; /* Green */
}
.status-circle.blue {
background-color: #337ab7; /* Blue */
}
</style>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?> <?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
+72 -5
View File
@@ -180,7 +180,7 @@ $pagination_entity_name = "Adressen";
</tr><tr> </tr><tr>
<th>Plan/Skizze</th> <th>Plan/Skizze</th>
<td> <td>
<?php if($item->file): ?> <?php if($item->file && $item->file->file): ?>
<!--img src="<?=self::getUrl("File", "Download", ["id" => $item->file->file_id])?>" style="max-width: 480px;"/--> <!--img src="<?=self::getUrl("File", "Download", ["id" => $item->file->file_id])?>" style="max-width: 480px;"/-->
<img src="<?=$item->file->file->asDataUrl()?>" style="max-width: 480px;" /> <img src="<?=$item->file->file->asDataUrl()?>" style="max-width: 480px;" />
<?php endif; ?> <?php endif; ?>
@@ -257,7 +257,7 @@ $pagination_entity_name = "Adressen";
<h5>Zusammenfassung Status (von <?=count($item->owners)?>)</h5> <h5>Zusammenfassung Status (von <?=count($item->owners)?>)</h5>
<table class="table table-sm"> <table class="table table-sm">
<?php foreach($item->owner_status_counts as $type => $count): ?> <?php foreach($item->owner_status_counts as $type => $count): ?>
<tr> <tr class="ConstructionConsentOwnerResult-<?=$type?>">
<th><?=__($type, "consent")?></th> <th><?=__($type, "consent")?></th>
<td><?=$count?></td> <td><?=$count?></td>
</tr> </tr>
@@ -265,17 +265,33 @@ $pagination_entity_name = "Adressen";
</table> </table>
</div> </div>
<div class="col-3"> <div class="col-3">
<h5>Zusammenfassung Ergebnis (von <?=count($item->owners)?>)</h5> <?php
// Determine the status based on the counts
$status_class = 'blue'; // Default to blue (all open)
if (isset($item->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
}
?>
<!-- Circle for status -->
<h5><div class="status-circle <?=$status_class?>"></div>Zusammenfassung Ergebnis (von <?=count($item->owners)?>)</h5>
<table class="table table-sm"> <table class="table table-sm">
<?php foreach($item->owner_result_counts as $type => $count): ?> <?php foreach($item->owner_result_counts as $type => $count): ?>
<?php if(!$type) continue; ?> <?php if(!$type) continue; ?>
<tr> <tr class="ConstructionConsentOwnerResult-<?=$type?>">
<th><?=__($type,"consent")?></th> <th><?=__($type,"consent")?></th>
<td><?=$count?></td> <td><?=$count?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</table> </table>
</div> </div>
</div> </div>
<table class="table table-sm table-striped table-hover"> <table class="table table-sm table-striped table-hover">
<tr> <tr>
@@ -985,4 +1001,55 @@ $pagination_entity_name = "Adressen";
</script> </script>
<style>
/* Styles for the status circle */
.status-circle {
width: 14px;
height: 14px;
border-radius: 50%;
display: inline-block;
}
.status-circle.red {
background-color: #d9534f; /* Red */
}
.status-circle.yellow {
background-color: #f0ad4e; /* Yellow */
}
.status-circle.green {
background-color: #5cb85c; /* Green */
}
.status-circle.blue {
background-color: #337ab7; /* Blue */
}
.ConstructionConsentOwnerResult-denied {
/*red background color here for this tr*/
background-color: #d9534f
}
.ConstructionConsentOwnerResult-open {
/*grey background color here for this tr*/
background-color: #bababa
}
.ConstructionConsentOwnerResult-accepted {
/*green background color here for this tr*/
background-color: #5cb85c
}
.ConstructionConsentOwnerResult-unresolvable {
/*orange background color here for this tr*/
background-color: #f0ad4e
}
.ConstructionConsentOwnerResult-moved {
/*orange background color here for this tr*/
background-color: #f0ad4e
}
</style>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?> <?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
@@ -210,6 +210,11 @@ class ConstructionConsent extends mfBaseModel {
$counts = []; $counts = [];
$owners = $this->getProperty("owners"); $owners = $this->getProperty("owners");
if (!isset($owners) || !is_array($owners)) {
return [];
}
foreach($owners as $owner) { foreach($owners as $owner) {
if(!array_key_exists($owner->result, $counts)) { if(!array_key_exists($owner->result, $counts)) {
$counts[$owner->result] = 0; $counts[$owner->result] = 0;