Merge branch 'constr-consent-change' into 'master'

Added Changes in ConstructionConsent

See merge request fronk/thetool!964
This commit is contained in:
Luca Haid
2025-01-30 13:55:52 +00:00
3 changed files with 137 additions and 30 deletions

View File

@@ -93,11 +93,11 @@ $pagination_entity_name = "Zustimmungserklärungen";
<th>Name</th>
<th>Objekttyp</th>
<th>Objektadresse</th>
<th title="Grundstücksnummer">GST-Nr.</th>
<th title="Grundbuch Einlagezahl">EZ</th>
<th>Besitzer</th>
<th>Besitzer Adresse</th>
<th>Besitzer Kontakt</th>
<!-- <th title="Grundstücksnummer">GST-Nr.</th>-->
<!-- <th title="Grundbuch Einlagezahl">EZ</th>-->
<!-- <th>Besitzer</th>-->
<!-- <th>Besitzer Adresse</th>-->
<!-- <th>Besitzer Kontakt</th>-->
<th>Anfragestatus</th>
<th>Anfrageresultat</th>
<th></th>
@@ -118,26 +118,41 @@ $pagination_entity_name = "Zustimmungserklärungen";
<?=$item->adb_hausnummer->strasse->gemeinde->name?>
<?php endif; ?>
</td>
<td><?=$item->gstnr?></td>
<td><?=$item->ez?></td>
<td><?=$item->owner_name?></td>
<td>
<?=$item->owner_street?><br />
<?=$item->owner_zip?> <?=$item->owner_city?><br />
</td>
<td>
<?php if($item->phone): ?>
Tel: <?=$item->phone?><br />
<?php endif; ?>
<?php if($item->fax): ?>
Fax: <?=$item->fax?><br />
<?php endif; ?>
<?php if($item->email): ?>
Email: <?=$item->email?>
<?php endif; ?>
</td>
<!-- <td>--><?php //=$item->gstnr?><!--</td>-->
<!-- <td>--><?php //=$item->ez?><!--</td>-->
<!-- <td>--><?php //=$item->owner_name?><!--</td>-->
<!-- <td>-->
<!-- --><?php //=$item->owner_street?><!--<br />-->
<!-- --><?php //=$item->owner_zip?><!-- --><?php //=$item->owner_city?><!--<br />-->
<!-- </td>-->
<!-- <td>-->
<!-- --><?php //if($item->phone): ?>
<!-- Tel: --><?php //=$item->phone?><!--<br />-->
<!-- --><?php //endif; ?>
<!-- --><?php //if($item->fax): ?>
<!-- Fax: --><?php //=$item->fax?><!--<br />-->
<!-- --><?php //endif; ?>
<!-- --><?php //if($item->email): ?>
<!-- Email: --><?php //=$item->email?>
<!-- --><?php //endif; ?>
<!-- </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;">
<a href="<?=self::getUrl("ConstructionConsent", "view", ["id" => $item->id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
<?php if(!$item->result): ?>
@@ -163,5 +178,25 @@ $pagination_entity_name = "Zustimmungserklärungen";
</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"); ?>

View File

@@ -180,7 +180,7 @@ $pagination_entity_name = "Adressen";
</tr><tr>
<th>Plan/Skizze</th>
<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="<?=$item->file->file->asDataUrl()?>" style="max-width: 480px;" />
<?php endif; ?>
@@ -257,7 +257,7 @@ $pagination_entity_name = "Adressen";
<h5>Zusammenfassung Status (von <?=count($item->owners)?>)</h5>
<table class="table table-sm">
<?php foreach($item->owner_status_counts as $type => $count): ?>
<tr>
<tr class="ConstructionConsentOwnerResult-<?=$type?>">
<th><?=__($type, "consent")?></th>
<td><?=$count?></td>
</tr>
@@ -265,17 +265,33 @@ $pagination_entity_name = "Adressen";
</table>
</div>
<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">
<?php foreach($item->owner_result_counts as $type => $count): ?>
<?php if(!$type) continue; ?>
<tr>
<?php if(!$type) continue; ?>
<tr class="ConstructionConsentOwnerResult-<?=$type?>">
<th><?=__($type,"consent")?></th>
<td><?=$count?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<table class="table table-sm table-striped table-hover">
<tr>
@@ -985,4 +1001,55 @@ $pagination_entity_name = "Adressen";
</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"); ?>

View File

@@ -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;