446 lines
26 KiB
PHP
446 lines
26 KiB
PHP
<?php
|
|
$pagination_baseurl = $this->getUrl($Mod,"Index");
|
|
$pagination_baseurl_params = ["filter" => $filter];
|
|
$pagination_entity_name = "Zustimmungserklärungen";
|
|
?>
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
|
|
|
|
|
<!-- start page title -->
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="page-title-box">
|
|
<div class="page-title-right">
|
|
<ol class="breadcrumb m-0">
|
|
<li class="breadcrumb-item"><a href="<?=self::getUrl("Dashboard")?>"><?=MFAPPNAME_SLUG?></a></li>
|
|
<li class="breadcrumb-item"><a href="<?=self::getUrl("ConstructionConsentProject")?>">Zustimmungserklärungen</a></li>
|
|
<li class="breadcrumb-item active">Übersicht<?=(array_key_exists("project_id", $filter) && $filter["project_id"]) ? " ".$project->name : ""?></li>
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title">Zustimmmungserklärungen</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
|
|
<div class="card">
|
|
<div class="card-body mb-3">
|
|
<h4 class="header-title mb-3"><i class="fad fa-filter fa-fw"></i> Filter</h4>
|
|
|
|
<form method="get" action="<?=self::getUrl("ConstructionConsent")?>">
|
|
<div class="row">
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_project_id">Projekt</label>
|
|
<select name="filter[project_id]" id="filter_project_id" class="form-control">
|
|
<option value="">Alle</option>
|
|
<?php foreach(ConstructionConsentProject::search(['id' => $allowed_projects]) as $p): ?>
|
|
<option value="<?=$p->id?>" <?=(is_array($filter) && array_key_exists("project_id", $filter) && $p->id == $filter["project_id"]) ? "selected='selected'" : ""?>><?=$p->name?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_network">Netzgebiet</label>
|
|
<select name="filter[network]" id="filter_network" class="form-control">
|
|
<option value="">Alle</option>
|
|
<?php
|
|
$networks = array_key_exists("project_id", $filter) && $filter["project_id"] ? ConstructionConsentNetwork::search(["constructionconsentproject_id" => $filter["project_id"]]) : ConstructionConsentNetwork::getAll();
|
|
$networkOptions = [];
|
|
foreach($networks as $network):
|
|
if (array_key_exists($network->adb_netzgebiet_id, $networkOptions)) continue;
|
|
$networkOptions[$network->adb_netzgebiet_id] = $network;?>
|
|
|
|
<option value="<?=$network->adb_netzgebiet_id?>" <?=(is_array($filter) && array_key_exists("network", $filter) && $network->adb_netzgebiet_id == $filter["network"]) ? "selected='selected'" : ""?>><?=$network->adb_netzgebiet->name?></option>
|
|
<?php endforeach;
|
|
?>
|
|
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-1">
|
|
<label class="form-label" for="filter_object_type">Objektart</label>
|
|
<select name="filter[object_type]" id="filter_object_type" class="form-control">
|
|
<option value="">Alle</option>
|
|
<option value="building" <?=(array_key_exists("object_type", $filter) && $filter["object_type"] == "building") ? "selected='selected'" : ""?>>Gebäude</option>
|
|
<option value="street" <?=(array_key_exists("object_type", $filter) && $filter["object_type"] == "street") ? "selected='selected'" : ""?>>Straße</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-1">
|
|
<label class="form-label" for="filter_status_light">Ampelstatus</label>
|
|
<select name="filter[status_light]" id="filter_status_light" class="form-control">
|
|
<option value="">Alle</option>
|
|
<option value="blue" <?=(array_key_exists("status_light", $filter) && $filter["status_light"] == "blue") ? "selected='selected'" : ""?>>Blau</option>
|
|
<option value="green" <?=(array_key_exists("status_light", $filter) && $filter["status_light"] == "green") ? "selected='selected'" : ""?>>Grün</option>
|
|
<option value="yellow" <?=(array_key_exists("status_light", $filter) && $filter["status_light"] == "yellow") ? "selected='selected'" : ""?>>Gelb</option>
|
|
<option value="red" <?=(array_key_exists("status_light", $filter) && $filter["status_light"] == "red") ? "selected='selected'" : ""?>>Rot</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_inspection_planner">Begehung Planer</label>
|
|
<select name="filter[inspection_planner]" id="filter_inspection_planner" class="form-control">
|
|
<option value="">Alle</option>
|
|
<option value="!NULL" <?=(array_key_exists("inspection_planner", $filter) && $filter["inspection_planner"] == "!NULL") ? "selected='selected'" : ""?>>Ja</option>
|
|
<option value="NULL" <?=(array_key_exists("inspection_planner", $filter) && $filter["inspection_planner"] == "NULL") ? "selected='selected'" : ""?>>Nein</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_conduit_installed_building">Leerrohr im Gebäude</label>
|
|
<select name="filter[conduit_installed_building]" id="filter_conduit_installed_building" class="form-control">
|
|
<option value="">Alle</option>
|
|
<option value="!NULL" <?=(array_key_exists("conduit_installed_building", $filter) && $filter["conduit_installed_building"] == "!NULL") ? "selected='selected'" : ""?>>Ja</option>
|
|
<option value="NULL" <?=(array_key_exists("conduit_installed_building", $filter) && $filter["conduit_installed_building"] == "NULL") ? "selected='selected'" : ""?>>Nein</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_electric_approval">Elektriker freigegeben</label>
|
|
<select name="filter[electric_approval]" id="filter_electric_approval" class="form-control">
|
|
<option value="">Alle</option>
|
|
<option value="!NULL" <?=(array_key_exists("electric_approval", $filter) && $filter["electric_approval"] == "!NULL") ? "selected='selected'" : ""?>>Ja</option>
|
|
<option value="NULL" <?=(array_key_exists("electric_approval", $filter) && $filter["electric_approval"] == "NULL") ? "selected='selected'" : ""?>>Nein</option>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="row mt-2">
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_conduit_installed_ftu">Leerrohr bis HAK</label>
|
|
<select name="filter[conduit_installed_ftu]" id="filter_conduit_installed_ftu" class="form-control">
|
|
<option value="">Alle</option>
|
|
<option value="!NULL" <?=(array_key_exists("conduit_installed_ftu", $filter) && $filter["conduit_installed_ftu"] == "!NULL") ? "selected='selected'" : ""?>>Ja</option>
|
|
<option value="NULL" <?=(array_key_exists("conduit_installed_ftu", $filter) && $filter["conduit_installed_ftu"] == "NULL") ? "selected='selected'" : ""?>>Nein</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-1">
|
|
<label class="form-label" for="filter_inhouse_cabling">Inhouse erledigt</label>
|
|
<select name="filter[inhouse_cabling]" id="filter_inhouse_cabling" class="form-control">
|
|
<option value="">Alle</option>
|
|
<option value="!NULL" <?=(array_key_exists("inhouse_cabling", $filter) && $filter["inhouse_cabling"] == "!NULL") ? "selected='selected'" : ""?>>Ja</option>
|
|
<option value="NULL" <?=(array_key_exists("inhouse_cabling", $filter) && $filter["inhouse_cabling"] == "NULL") ? "selected='selected'" : ""?>>Nein</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_address">Objektadresse</label>
|
|
<input type="text" class="form-control" name="filter[address]" id="filter_address" value="<?=(array_key_exists('address', $filter)) ? $filter['address'] : ""?>" />
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_gst">GST</label>
|
|
<input type="text" class="form-control" name="filter[gst]" id=filter_gst value="<?=(array_key_exists('gst', $filter)) ? $filter['gst'] : ""?>" />
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_gst">EZ</label>
|
|
<input type="text" class="form-control" name="filter[ez]" id=filter_ez value="<?=(array_key_exists('ez', $filter)) ? $filter['ez'] : ""?>" />
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_cwo">Eigentümer</label>
|
|
<input type="text" class="form-control" name="filter[cwo]" id=filter_cwo value="<?=(array_key_exists('cwo', $filter)) ? $filter['cwo'] : ""?>" />
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="row mt-2">
|
|
<div class="col">
|
|
<button type="submit" class="btn btn-primary"><i class="far fa-search fa-fw"></i> Filter anwenden</button>
|
|
<a class="btn btn-secondary" href="<?=self::getUrl("ConstructionConsent", "", ["resetFilter" => 1, "filter" => ["project_id" => (is_array($filter) && array_key_exists("project_id", $filter) ? $filter["project_id"] : "")]])?>"><i class="far fa-xmark fa-fw"></i> Filter zurücksetzen</a>
|
|
</div>
|
|
<!-- create a div that is on the right side of the row-->
|
|
<div class="col text-right">
|
|
<a class="btn btn-success" href="<?=self::getUrl("ConstructionConsent", "downloadMultiple", ["filter" => $filter])?>"><i class="fas fa-download"></i> Zustimmungserklärungen herunterladen</a>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
// if results are more than 0
|
|
if (count($items) > 0) : ?>
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<button class="btn btn-primary collapsed"
|
|
type="button"
|
|
data-toggle="collapse"
|
|
data-target="#collapsibleCard"
|
|
aria-expanded="true"
|
|
aria-controls="collapsibleCard">
|
|
<i class="fas fa-chevron-up chevron-icon"></i>
|
|
Statistiken umschalten
|
|
</button>
|
|
</div>
|
|
|
|
<div id="collapsibleCard" class="collapse">
|
|
<div class="card-body mb-3">
|
|
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; grid-gap: 10px;">
|
|
|
|
<?php
|
|
$cardConfig = [
|
|
[
|
|
'key' => null,
|
|
'header' => 'Liste der Zustimmungserklärungen',
|
|
'icon' => 'fas fa-file-signature',
|
|
'text' => 'Objekttyp',
|
|
'sub' => [
|
|
'Straße/Grundstück ['.$stats['street'].']',
|
|
'Gebäude ['.$stats['building'].']'
|
|
],
|
|
'color' => '#6c757d'
|
|
],
|
|
[
|
|
'key' => 'inspection_planner',
|
|
'header' => 'Begehung Planer durchgeführt',
|
|
'icon' => 'fas fa-clipboard-check',
|
|
'denominator' => $stats['building'],
|
|
'color' => '#28a745'
|
|
],
|
|
[
|
|
'key' => 'conduit_installed_building',
|
|
'header' => 'Leerrohr im Gebäude',
|
|
'icon' => 'fas fa-house-user',
|
|
'denominator' => $stats['building'],
|
|
'color' => '#17a2b8'
|
|
],
|
|
[
|
|
'key' => 'conduit_installed_ftu',
|
|
'header' => 'Leerrohr bis HAK',
|
|
'icon' => 'fas fa-road',
|
|
'denominator' => $stats['building'],
|
|
'color' => '#f5b902'
|
|
],
|
|
[
|
|
'key' => 'inhouse_cabling',
|
|
'header' => 'Inhouse erledigt',
|
|
'icon' => 'fas fa-plug',
|
|
'denominator' => $stats['building'],
|
|
'color' => '#007bff'
|
|
]
|
|
];
|
|
|
|
foreach ($cardConfig as $config) {
|
|
$height = 96 + 25 * (isset($config['sub']) ? count($config['sub']) : 0);
|
|
$text = $config['key'] ?
|
|
$stats[$config['key']].' / '.$config['denominator'].' ('.
|
|
round(($config['denominator'] != 0 ? ($stats[$config['key']] / $config['denominator']) : 0) * 100) . '%)' :
|
|
$config['text'];
|
|
?>
|
|
<div class="card">
|
|
<div class="card-body p-0" style="background-color: <?= $config['color'] ?>">
|
|
<div class="p-2" style="height: <?= $height ?>px">
|
|
<div class="float-right">
|
|
<i class="<?= $config['icon'] ?> text-white widget-icon font-24"></i>
|
|
</div>
|
|
<h5 class="text-white font-weight-normal mt-0"><?= $config['header'] ?></h5>
|
|
<h3 class="mt-2 text-white"><?= $text ?></h3>
|
|
<?php if(isset($config['sub'])): ?>
|
|
<div class="text-white font-weight-light tt-dashboard-display-card-sub-header-container">
|
|
<?php foreach($config['sub'] as $sub): ?>
|
|
<p class="mb-0"><?= $sub ?></p>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php } ?>
|
|
<!-- i have added this to stats and need to show a "traffic light kinda thing round etc" with a grid 2 row 2 col
|
|
|
|
"status_light_blue" => $status_light_blue,
|
|
"status_light_red" => $status_light_red,
|
|
"status_light_yellow" => $status_light_yellow,
|
|
"status_light_green" => $status_light_green
|
|
-->
|
|
|
|
<div class="card">
|
|
<div class="card-body p-0">
|
|
<div class="p-2" style="background-color: #f8f9fa">
|
|
<h5 class="font-weight-normal mt-0">Anfrageresultat</h5>
|
|
</div>
|
|
|
|
<!-- Horizontal Traffic Light -->
|
|
<div style="padding: 20px; background: #333; display: flex; gap: 15px; justify-content: center;">
|
|
<div style="display: flex; flex-direction: row; transform: rotate(0deg); gap: 20px;">
|
|
<!-- Blue -->
|
|
<div style="position: relative; width: 60px; height: 60px;">
|
|
<div style="width: 100%; height: 100%; background-color: #337ab7; border-radius: 50%;"></div>
|
|
<span style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-weight: bold;"><?php echo $stats['status_light_blue']; ?></span>
|
|
</div>
|
|
|
|
<!-- Red -->
|
|
<div style="position: relative; width: 60px; height: 60px;">
|
|
<div style="width: 100%; height: 100%; background-color: #d9534f; border-radius: 50%;"></div>
|
|
<span style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-weight: bold;"><?php echo $stats['status_light_red']; ?></span>
|
|
</div>
|
|
|
|
<!-- Yellow -->
|
|
<div style="position: relative; width: 60px; height: 60px;">
|
|
<div style="width: 100%; height: 100%; background-color: #f0ad4e; border-radius: 50%;"></div>
|
|
<span style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-weight: bold;"><?php echo $stats['status_light_yellow']; ?></span>
|
|
</div>
|
|
|
|
<!-- Green -->
|
|
<div style="position: relative; width: 60px; height: 60px;">
|
|
<div style="width: 100%; height: 100%; background-color: #5cb85c; border-radius: 50%;"></div>
|
|
<span style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-weight: bold;"><?php echo $stats['status_light_green']; ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="card">
|
|
<div class="card-body mb-3">
|
|
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<div class="float-left">
|
|
<h4 class="header-title">Liste aller Zustimmmungserklärungen</h4>
|
|
</div>
|
|
<div class="float-right">
|
|
<a class="btn btn-primary" href="<?=self::getUrl("ConstructionConsent", "add", ["project_id" => (is_array($filter) && array_key_exists("project_id", $filter) ? $filter["project_id"] : "")])?>"><i class="fas fa-plus"></i> Neue Zustimmungserklärung anlegen</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
|
|
|
|
<table class="table table-striped table-hover">
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Objekttyp</th>
|
|
<th>Objektadresse</th>
|
|
<th>KG</th>
|
|
<th>GST-Nr.</th>
|
|
<th>Einlagezahl</th>
|
|
<th>Wohneinheiten</th>
|
|
<th>Bestellungen</th>
|
|
<th class="text-center">Anzahl Eigentümer</th>
|
|
<th>Anfrageresultat</th>
|
|
<th></th>
|
|
</tr>
|
|
<?php foreach($items as $item): ?>
|
|
<tr>
|
|
<td><a href="<?=self::getUrl("ConstructionConsent","View", ["id" => $item->id])?>"><?=$item->name?></a></td>
|
|
<td><?=__($item->object_type)?></td>
|
|
<td>
|
|
<?php if($item->object_type == "street"): ?>
|
|
<?=$item->adb_strasse->name?>, <?=$item->adb_strasse->ortschaft->name?><br />
|
|
<?=$item->adb_strasse->gemeinde->name?>
|
|
<?php else: ?>
|
|
<?=$item->adb_hausnummer->strasse->name?>
|
|
<?=$item->adb_hausnummer->hausnummer?><?=($item->adb_hausnummer->stiege) ? "/".$item->adb_hausnummer->stiege : ""?><br />
|
|
<?=$item->adb_hausnummer->plz->plz?>
|
|
<?=$item->adb_hausnummer->ortschaft->name?><br />
|
|
<?=$item->adb_hausnummer->strasse->gemeinde->name?>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td><?=$item->kg?></td>
|
|
<td><?=$item->gst?></td>
|
|
<td><?=$item->ez?></td>
|
|
<td><?=$item->adb_hausnummer->unit_count ?? ''?></td>
|
|
<td><?=$item->preorder_count?></td>
|
|
<td class="text-center">
|
|
|
|
<?php
|
|
if ($item->owners !== null) {
|
|
$owners = $item->owners;
|
|
$owner_count = count($owners);
|
|
?>
|
|
<?=$owner_count?>
|
|
<?php } ?>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
// Determine the status based on the counts
|
|
$status_class = 'blue'; // Default to blue (all open)
|
|
$approve_override = $item->approve_override;
|
|
if (isset($approve_override) && $approve_override) {
|
|
$status_class = 'green'; // Blue if approve override
|
|
} elseif (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): ?>
|
|
<a href="<?=self::getUrl("ConstructionConsent", "edit", ["id" => $item->id])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
|
|
|
|
<a href="<?=self::getUrl("ConstructionConsent", "delete", ["id" => $item->id])?>" onclick="if(!confirm('Zustimmungserklärung wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
|
|
|
|
|
|
</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"); ?>
|