WIP 2025-01-09 ConstructionConsent

This commit is contained in:
Frank Schubert
2025-01-10 12:35:25 +01:00
parent aa0b36715b
commit 5f752da41f
8 changed files with 403 additions and 21 deletions

View File

@@ -25,7 +25,7 @@
<?= ($Action == "add") ? "Neue " : "" ?>Zustimmungserklärung <?= ($Action == "edit") ? "bearbeiten " : "" ?>
</h4>
<form class="form-horizontal" method="post" action="<?= self::getUrl("Preordercampaign", "save") ?>">
<form class="form-horizontal" method="post" action="<?= self::getUrl("ConstructionConsent", "save") ?>">
<input type="hidden" name="id" value="<?=isset($item) ? $item->id : ""?>"/>
<div class="card">
@@ -36,7 +36,7 @@
<div class="col-lg-10">
<select class="form-control" name="constructionconsentproject_id" id="constructionconsentproject_id">
<?php foreach(ConstructionConsentProject::getAll() as $project): ?>
<option value="street" <?=($item->constructionconsentproject_id == $project->id ? "selected='selected'" : "")?>><?=$project->name?></option>
<option value="<?=$project->id?>" <?=($item->constructionconsentproject_id == $project->id ? "selected='selected'" : "")?>><?=$project->name?></option>
<?php endforeach; ?>
</select>
</div>
@@ -115,7 +115,7 @@
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label>
<input type="checkbox" name="usage_pipe_on_plot" id="usage_pipe_on_plot" value="1" />
<input type="checkbox" name="usage_pipe_on_plot" id="usage_pipe_on_plot" value="1" <?=($item->usage_pipe_on_plot ? "checked='checked'" : "")?> />
Verlegung von Rohren und Lichtwellenleitern am Grundstück
</label>
</div>
@@ -125,7 +125,7 @@
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label>
<input type="checkbox" name="usage_pipe_in_building" id="usage_pipe_in_building" value="1" />
<input type="checkbox" name="usage_pipe_in_building" id="usage_pipe_in_building" value="1" <?=($item->usage_pipe_in_building ? "checked='checked'" : "")?> />
Verlegung von Rohren und Lichtwellenleitern in den darauf befindlichen Gebäuden
</label>
</div>
@@ -135,7 +135,7 @@
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label>
<input type="checkbox" name="usage_manhole" id="usage_manhole" value="1" />
<input type="checkbox" name="usage_manhole" id="usage_manhole" value="1" <?=($item->usage_manhole ? "checked='checked'" : "")?> />
Errichtung eines Schachtes/einer Kabelmontagegrube und/oder eines LWL-Verteilschrankes/einer LWL-Abschlussbox
</label>
</div>
@@ -145,7 +145,7 @@
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label>
<input type="checkbox" name="usage_owner" id="usage_owner" value="1" />
<input type="checkbox" name="usage_owner" id="usage_owner" value="1" <?=($item->usage_owner ? "checked='checked'" : "")?> />
Die Nutzung der Liegenschaft seitens BB dient der Eigenversorgung der GE und/oder dessen Nutzer(in) und wird dieser entgeltlos zugestimmt
</label>
</div>

View File

@@ -90,6 +90,7 @@ $pagination_entity_name = "Zustimmungserklärungen";
<table class="table table-striped table-hover">
<tr>
<th>Name</th>
<th>Objekttyp</th>
<th>Objektadresse</th>
<th title="Grundstücksnummer">GST-Nr.</th>
@@ -103,6 +104,7 @@ $pagination_entity_name = "Zustimmungserklärungen";
</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"): ?>

View File

@@ -0,0 +1,249 @@
<?php
$pagination_entity_name = "Adressen";
?>
<?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("ConstructionConsent")?>">Zustimmungserklärungen</a></li>
<li class="breadcrumb-item active"><?=$item->name?></li>
</ol>
</div>
<h4 class="page-title">Zustimmungserkärungen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("ConstructionConsent")?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Übersicht</a>
<a href="<?=self::getUrl("ConstructionConsent","edit", ['id' => $item->id])?>" class="btn btn-outline-success"><i class="fas fa-edit"></i> Zustimmungserklärung bearbeiten</a>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="card border-top-primary">
<div class="card-body">
<h3 class="text-center mb-3">Zustimmungserklärung <?=$item->name?></h3>
<table class="table table-sm table-striped view-table">
<tr>
<th>Projekt</th>
<td><?=$item->project->name?></td>
</tr><tr>
<th>Objekttyp</th>
<td><?=__($item->object_type, "consent")?></td>
</tr><tr>
<th>Straße</th>
<td><?=$item->adb_strasse->gemeinde->name?>, <?=$item->adb_strasse->name?></td>
</tr><tr>
<th>Geplante Länge</th>
<td><?=$item->usage_length?></td>
</tr><tr>
<th>Geplante Nutzung</th>
<td>
<?php if($item->usage_pipe_on_plot): ?>
<i class="fas fa-fw fa-check text-success"></i>
<?php else: ?>
<i class="fas fa-fw fa-xmark"></i>
<?php endif; ?>
Verlegung von Rohren und Lichtwellenleitern am Grundstück<br />
<?php if($item->usage_pipe_in_building): ?>
<i class="fas fa-fw fa-check text-success"></i>
<?php else: ?>
<i class="fas fa-fw fa-xmark"></i>
<?php endif; ?>
Verlegung von Rohren und Lichtwellenleitern in den darauf befindlichen Gebäuden<br />
<?php if($item->usage_manhole): ?>
<i class="fas fa-fw fa-check text-success"></i>
<?php else: ?>
<i class="fas fa-fw fa-xmark"></i>
<?php endif; ?>
Errichtung eines Schachtes/einer Kabelmontagegrube und/oder eines LWL-Verteilschrankes/einer LWL-Abschlussbox<br />
<?php if($item->usage_owner): ?>
<i class="fas fa-fw fa-check text-success"></i>
<?php else: ?>
<i class="fas fa-fw fa-xmark"></i>
<?php endif; ?>
Die Nutzung der Liegenschaft seitens BB dient der Eigenversorgung der GE und/oder dessen Nutzer(in) und wird dieser entgeltlos zugestimmt
</td>
</tr><tr>
<td colspan="2"><h4>Grundbuchdaten</h4></td>
</tr><tr>
<th>EZ</th>
<td><?=$item->ez?></td>
</tr><tr>
<th>KG</th>
<td><?=$item->kg?></td>
</tr><tr>
<th>GST</th>
<td><?=$item->gst?></td>
</tr><tr>
<th>GSTNR</th>
<td><?=$item->gstnr?></td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Erstellt</th>
<td class="text-monospace"><?=date("d.m.Y H:i:s", $item->create)?> (<?=$item->creator->name?>)</td>
</tr><tr>
<th>Letzte Bearbeitung</th>
<td class="text-monospace"><?=date("d.m.Y H:i:s", $item->edit)?> (<?=$item->editor->name?>)</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-6">
<div class="card border-top-success">
<div class="card-body">
<h3 class="text-center mb-3">Objektbesitzer
<small><a data-toggle="modal" data-target="#newOwnerModal" href="#"><i class="fas fa-plus"></i> Neuen Besitzer hinzufügen</a></small>
</h3>
<button class="btn btn-sm btn-outline-primary mb-2"><i class="fas fa-download fa-fw"></i> Grundbuch jetzt abfragen</button>
<?php if(!is_array($item->owners) || !count($item->owners)): ?>
<i>Noch keine Besitzer bekannt</i>
<?php else: ?>
<?php foreach($item->owners as $owner): ?>
<div class="card">
<div class="card-body">
<table class="table table-sm table-hover table-striped">
<tr>
<th>Name:</th>
<td><?=$owner->name?></td>
</tr><tr>
<th>Anschrift:</th>
<td>
<?=$owner->street?><br />
<?=$owner->zip?> <?=$owner->city?><br />
<?=$owner->country?>
</td>
</tr><tr>
<th>Telefon:</th>
<td><?=$owner->phone?></td>
</tr><tr>
<th>Fax:</th>
<td><?=$owner->fax?></td>
</tr><tr>
<th>Email:</th>
<td><?=$owner->email?></td>
</tr><tr>
<th>Anfragestatus</th>
<td class="text-monospace"><?=__($item->status, "consent")?></td>
</tr><tr>
<th>Anfrage Resultat</th>
<td class="text-monospace"><?=__($item->result, "consent")?></td>
</tr>
</table>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="newOwnerModal" aria-hidden="true" aria-labelledby="#newOwnerModelLabel" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="newOwnerModelLabel">Neuen Besitzer hinzufügen</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form method="post" action="<?=self::getUrl("ConstructionConsentOwner", "save")?>">
<input type="hidden" name="constructionconsent_id" value="<?=$item->id?>" />
<h4>Name & Anschrift</h4>
<div class="form-group">
<label for="name" class="col-form-label">Name:</label>
<textarea class="form-control" name="name" id="name"></textarea>
</div>
<div class="form-group">
<label for="street" class="col-form-label">Straße:</label>
<input type="text" class="form-control" name="street" id="street" />
</div>
<div class="form-group">
<label for="zip" class="col-form-label">PLZ / Ort:</label>
<div class="row">
<div class="col-4">
<input type="text" class="form-control" name="zip" id="zip" />
</div>
<div class="col-8">
<input type="text" class="form-control" name="city" id="city" />
</div>
</div>
</div>
<div class="form-group">
<label for="country" class="col-form-label">Land:</label>
<input type="text" class="form-control" name="country" id="country" />
<small>Kann leer bleiben für Österreich</small>
</div>
<h4>Kontakt</h4>
<div class="form-group">
<label for="phone" class="col-form-label">Telefon:</label>
<input type="text" class="form-control" name="phone" id="phone" />
</div>
<div class="form-group">
<label for="fax" class="col-form-label">Fax:</label>
<input type="text" class="form-control" name="fax" id="fax" />
</div>
<div class="form-group">
<label for="email" class="col-form-label">Email:</label>
<input type="text" class="form-control" name="email" id="email" />
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
<button type="button" class="btn btn-primary">Speichern</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function addOwner() {
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -1,14 +1,25 @@
<?php
class ConstructionConsent extends mfBaseModel {
private $project;
private $termnination;
private $adb_hausnummer;
private $adb_strasse;
private $owners;
private $creator;
private $editor;
public function getProperty($name) {
if($this->$name == null) {
if($name == "project") {
$project = new ConstructionConsentProject($this->id);
if($project->id) {
$this->project = $project;
}
return $this->project;
}
if($name == "adb_hausnummer") {
if(!$this->adb_hausnummer_id) return null;
$hausnummer = new ADBHausnummer($this->adb_hausnummer_id);
@@ -27,6 +38,38 @@ class ConstructionConsent extends mfBaseModel {
return $this->adb_strasse;
}
if($name == "owners") {
if(!$this->id) return null;
$owners = ConstructionConsentOwner::search(["constructionconsent_id" => $this->id]);
if(count($owners)) {
$this->owners = $owners;
}
return $this->owners;
}
if($name == "creator") {
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
if($this->creator === null) {
$this->creator = new User($this->create_by);
if($this->creator->id) {
mfValuecache::singleton()->set("Worker-id-".$this->create_by, $this->creator);
}
}
return $this->creator;
}
if($name == "editor") {
$this->editor = mfValuecache::singleton()->get("Worker-id-".$this->edit_by);
if($this->editor === null) {
$this->editor = new User($this->edit_by);
if($this->editor->id) {
mfValuecache::singleton()->set("Worker-id-".$this->edit_by, $this->editor);
}
}
return $this->editor;
}
$classname = ucfirst($name);
$idfield = $name."_id";
@@ -55,8 +98,9 @@ class ConstructionConsent extends mfBaseModel {
$model = new ConstructionConsent();
$table_fields = [
"termination_id","adb_wohneinheit_id","object_type","ez","owner_name","owner_street","owner_zip","owner_city",
"owner_country","status","result","create_by","edit_by","create","edit"
"constructionconsentproject_id", "termination_id","adb_hausnummer_id", "adb_strasse_id", "object_type", "name", "ez", "kg", "gst", "gstnr",
"usage_length", "usage_pipe_on_plot", "usage_pipe_in_building", "usage_manhole", "usage_owner",
"status", "result", "result_text", "note", "create_by","edit_by","create","edit"
];
foreach($data as $field => $value) {

View File

@@ -90,6 +90,25 @@ class ConstructionConsentController extends mfBaseController {
return $new_filter;
}
protected function viewAction() : void {
$this->layout()->setTemplate("ConstructionConsent/View");
$id = $this->request->id;
if(!is_numeric($id) || $id < 1) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
$item = new ConstructionConsent($id);
if(!$item || !$item->id) {
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
$this->redirect("ConstructionConsent");
}
$this->layout()->set("item", $item);
}
protected function addAction() : void {
$this->layout()->setTemplate("ConstructionConsent/Form");
}
@@ -131,16 +150,16 @@ class ConstructionConsentController extends mfBaseController {
$data["constructionconsentproject_id"] = $r->constructionconsentproject_id;
$data["object_type"] = $r->object_type;
$data["name"] = $r->name;
$data["adb_street_id"] = $r->adb_street_id;
$data["adb_strasse_id"] = $r->adb_strasse_id;
$data["ez"] = $r->ez;
$data["kg"] = $r->kg;
$data["gst"] = $r->gst;
$data["gstnr"] = $r->gstnr;
$data["usage_length"] = $r->usage_length;
$data["usage_pipe_on_plot"] = $r->usage_pipe_on_plot;
$data["usage_pipe_in_building"] = $r->usage_pipe_in_building;
$data["usage_manhole"] = $r->usage_manhole;
$data["usage_owner"] = $r->usage_owner;
$data["usage_length"] = $r->usage_length ?: null;
$data["usage_pipe_on_plot"] = $r->usage_pipe_on_plot ? 1 : 0;
$data["usage_pipe_in_building"] = $r->usage_pipe_in_building ? 1 : 0;
$data["usage_manhole"] = $r->usage_manhole ? 1 : 0;
$data["usage_owner"] = $r->usage_owner ? 1 : 0;
if($mode == "add") {
$item = ConstructionConsent::create($data);
@@ -258,7 +277,6 @@ class ConstructionConsentController extends mfBaseController {
$adb = FronkDB::singleton(ADDRESSDB_DBHOST, ADDRESSDB_DBUSER, ADDRESSDB_DBPASS, ADDRESSDB_DBNAME);
$res = $adb->query($sql);
$this->log->debug("done");
if(!$adb->num_rows($res)) {
header("Content-Type: application/json");

View File

@@ -33,8 +33,8 @@ class ConstructionConsentOwner extends mfBaseModel {
$model = new ConstructionConsentOwner();
$table_fields = [
"constructionconsent_id", "owner_name", "owner_street", "owner_zip", "owner_city", "owner_country", "owner_phone",
"owner_fax", "owner_email", "status", "result", "create_by","edit_by","create","edit"
"constructionconsent_id", "name", "street", "zip", "city", "country", "phone",
"fax", "email", "status", "result", "create_by","edit_by","create","edit"
];
foreach($data as $field => $value) {
@@ -61,7 +61,7 @@ class ConstructionConsentOwner extends mfBaseModel {
$db = FronkDB::singleton();
$res = $db->select("ConstructionConsentOwner", "*", "1 = 1 ORDER BY owner_name");
$res = $db->select("ConstructionConsentOwner", "*", "1 = 1 ORDER BY name");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new ConstructionConsentOwner($data);
@@ -77,7 +77,7 @@ class ConstructionConsentOwner extends mfBaseModel {
$where = self::getSqlFilter($filter);
$sql = "SELECT * FROM ConstructionConsentOwner
WHERE $where
ORDER BY adb_hausnummer_id LIMIT 1";
ORDER BY name LIMIT 1";
//var_dump($sql);exit;
$res = $db->query($sql);
if($db->num_rows($res)) {
@@ -114,7 +114,7 @@ class ConstructionConsentOwner extends mfBaseModel {
$items = [];
if(!$order) {
$order = "owner_name ASC";
$order = "name ASC";
}
$db = FronkDB::singleton();

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class ConstructionConsentTerminationIdNull extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$cc = $this->table("ConstructionConsent");
$cc->changeColumn("termination_id", "integer", ["null" => true, "default" => null]);
$cc->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
}
if($this->getEnvironment() == "addressdb") {
}
}
}

View File

@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class ConstructionConsentOwnerRenameCols extends AbstractMigration
{
public function up(): void
{
if($this->getEnvironment() == "thetool") {
$cco = $this->table("ConstructionConsentOwner");
$cco->renameColumn("owner_name", "name");
$cco->renameColumn("owner_street", "street");
$cco->renameColumn("owner_zip", "zip");
$cco->renameColumn("owner_city", "city");
$cco->renameColumn("owner_country", "country");
$cco->renameColumn("owner_phone", "phone");
$cco->renameColumn("owner_fax", "fax");
$cco->renameColumn("owner_email", "email");
$cco->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
}
if($this->getEnvironment() == "addressdb") {
}
}
}