ConstructionConsent Basic Building data
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
<div class="col-lg-10">
|
||||
<select class="form-control" name="object_type" id="object_type">
|
||||
<option value="building" <?=(isset($item) && $item->object_type == "building" ? "selected='selected'" : "")?>>Gebäude</option>
|
||||
<option value="street" <?=(isset($item) && $item->object_type == "street" ? "selected='selected'" : "")?>>Straße/Grunstück</option>
|
||||
<option value="street" <?=(isset($item) && $item->object_type == "street" ? "selected='selected'" : "")?>>Straße/Grundstück</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -59,7 +59,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="street-search">
|
||||
<div id="address-search" class="<?=(!isset($item) || (isset($item) && $item->object_type == "building")) ? "" : "hidden"?>">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="adb_hausnummer_id">Gebäude *</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="form-control" name="adb_hausnummer_id" id="adb_hausnummer_id">
|
||||
<?php if(isset($item) && $item->adb_hausnummer_id): ?>
|
||||
<option value="<?=$item->adb_hausnummer_id?>" selected="selected"><?=$item->adb_hausnummer->gemeinde->name?>, <?=$item->adb_hausnummer->strasse->name?> <?=$item->adb_hausnummer->hausnummer?></option>
|
||||
<?php endif; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="street-search" class="<?=(!isset($item) || $item->object_type != "street") ? "hidden" : ""?>">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="adb_strasse_id">Straße *</label>
|
||||
<div class="col-lg-10">
|
||||
@@ -73,6 +86,8 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="ez">Grundbuch Einlagezahl EZ</label>
|
||||
<div class="col-lg-10">
|
||||
@@ -243,6 +258,22 @@
|
||||
|
||||
});
|
||||
*/
|
||||
|
||||
$("#object_type").change(() => {
|
||||
var type = $("#object_type").val();
|
||||
if(type == "street") {
|
||||
$("#address-search").hide();
|
||||
$("#adb_hausnummer_id").val("").change();
|
||||
|
||||
$("#street-search").show();
|
||||
} else {
|
||||
$("#street-search").hide();
|
||||
$("#adb_strasse_id").val("").change();
|
||||
|
||||
$("#address-search").show();
|
||||
}
|
||||
});
|
||||
|
||||
$('#adb_strasse_id').select2({
|
||||
ajax: {
|
||||
url: '<?=self::getUrl("ConstructionConsent", "api")?>',
|
||||
@@ -261,6 +292,24 @@
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
$('#adb_hausnummer_id').select2({
|
||||
ajax: {
|
||||
url: '<?=self::getUrl("ConstructionConsent", "api")?>',
|
||||
data: (params) => {
|
||||
return {
|
||||
q: params.term,
|
||||
do: "findAddress",
|
||||
project_id: $("#constructionconsentproject_id :selected").val()
|
||||
}
|
||||
},
|
||||
delay: 250,
|
||||
dataType: 'json'
|
||||
},
|
||||
minimumInputLength: 2,
|
||||
placeholder: "Suche nach Adresse",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
$('#plan_adb_hausnummer_id').select2({
|
||||
ajax: {
|
||||
url: '<?=self::getUrl("ConstructionConsent", "api")?>',
|
||||
@@ -314,7 +363,7 @@
|
||||
$("#plan_preview").attr("src", URL.createObjectURL(file));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$("#constructionconsentproject_id").change(() => {
|
||||
$("#adb_strasse_id").val("").change();
|
||||
|
||||
@@ -62,7 +62,7 @@ $pagination_entity_name = "Zustimmungserklärungen";
|
||||
<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" => $filter["project_id"]]])?>"><i class="far fa-xmark fa-fw"></i> Filter zurücksetzen</a>
|
||||
<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>
|
||||
</div>
|
||||
</form>
|
||||
@@ -80,7 +80,7 @@ $pagination_entity_name = "Zustimmungserklärungen";
|
||||
<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" => $filter["project_id"]])?>"><i class="fas fa-plus"></i> Neue Zustimmungserklärung anlegen</a>
|
||||
<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>
|
||||
@@ -108,7 +108,7 @@ $pagination_entity_name = "Zustimmungserklärungen";
|
||||
<td><?=__($item->object_type)?></td>
|
||||
<td>
|
||||
<?php if($item->object_type == "street"): ?>
|
||||
<?=$item->adb_strasse->name?>
|
||||
<?=$item->adb_strasse->name?>, <?=$item->adb_strasse->ortschaft->name?><br />
|
||||
<?=$item->adb_strasse->gemeinde->name?>
|
||||
<?php else: ?>
|
||||
<?=$item->adb_hausnummer->strasse->name?>
|
||||
|
||||
@@ -51,10 +51,28 @@ $pagination_entity_name = "Adressen";
|
||||
</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>
|
||||
</tr>
|
||||
<?php if($item->object_type == "building"): ?>
|
||||
<tr>
|
||||
<th>Gebäude</th>
|
||||
<td>
|
||||
<?=$item->adb_hausnummer->ortschaft->name?>, <?=$item->adb_hausnummer->strasse->name?> <?=$item->adb_hausnummer->hausnummer?><br />
|
||||
<?=$item->adb_hausnummer->strasse->gemeinde->name?>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th>Anzahl Bestellungen</th>
|
||||
<td><?=$item->preorder_count?></td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<tr>
|
||||
<th>Straße</th>
|
||||
<td>
|
||||
<?=$item->adb_strasse->ortschaft->name?>, <?=$item->adb_strasse->name?><br />
|
||||
<?=$item->adb_strasse->gemeinde->name?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr>
|
||||
<th>Geplante Länge</th>
|
||||
<td><?=$item->usage_length?> lfm</td>
|
||||
</tr><tr>
|
||||
@@ -88,7 +106,17 @@ $pagination_entity_name = "Adressen";
|
||||
<?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>
|
||||
</tr>
|
||||
<?php if($item->object_type == "building"): ?>
|
||||
<tr>
|
||||
<td colspan="2"><h4>Metadaten</h4></td>
|
||||
</tr><tr>
|
||||
<th>Anzahl Bestellungen</th>
|
||||
<td><?=$item->preorder_count?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><h4>Grundbuchdaten</h4></td>
|
||||
</tr><tr>
|
||||
<th>EZ</th>
|
||||
@@ -193,9 +221,9 @@ $pagination_entity_name = "Adressen";
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<?php foreach($owner->files as $file): ?>
|
||||
<?php if(is_array($owner->files) && count($owner->files)): foreach($owner->files as $file): ?>
|
||||
<a href="<?=self::getUrl("File", "download", ["id" => $file->file_id])?>"><i class="far fa-fw fa-file"></i> <?=$file->filename?></a><br />
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; endif; ?>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
@@ -10,6 +10,7 @@ class ConstructionConsent extends mfBaseModel {
|
||||
private $file;
|
||||
private $creator;
|
||||
private $editor;
|
||||
private $preorder_count;
|
||||
|
||||
private $footer_text = "Energie Steiermark Breitband GmbH, A-8010 Graz, Leonhardgürtel 10, Telefon +43 (0)316 9000-0\nSitz Graz, FN 576705x, Landesgericht für ZRS Graz, ATU 77949678, breitband@e-steiermark.com, www.e-steiermark.com";
|
||||
private $footer_font = "ITC Officina Sans Std";
|
||||
@@ -53,7 +54,7 @@ class ConstructionConsent extends mfBaseModel {
|
||||
if($this->$name == null) {
|
||||
|
||||
if($name == "project") {
|
||||
$project = new ConstructionConsentProject($this->id);
|
||||
$project = new ConstructionConsentProject($this->constructionconsentproject_id);
|
||||
if($project->id) {
|
||||
$this->project = $project;
|
||||
}
|
||||
@@ -78,6 +79,24 @@ class ConstructionConsent extends mfBaseModel {
|
||||
return $this->adb_strasse;
|
||||
}
|
||||
|
||||
if($name == "preorder_count") {
|
||||
if(!$this->adb_hausnummer_id) {
|
||||
return 0;
|
||||
}
|
||||
$preorder_count = 0;
|
||||
foreach(PreorderModel::search(["adb_hausnummer_id" => $this->adb_hausnummer_id]) as $preorder) {
|
||||
if($preorder->connection_count) {
|
||||
$preorder_count += $preorder->connection_count;
|
||||
} else {
|
||||
$preorder_count++;
|
||||
}
|
||||
}
|
||||
if($preorder_count) {
|
||||
$this->preorder_count = $preorder_count;
|
||||
}
|
||||
return $this->preorder_count;
|
||||
}
|
||||
|
||||
if($name == "owners") {
|
||||
if(!$this->id) return null;
|
||||
|
||||
|
||||
@@ -186,9 +186,10 @@ class ConstructionConsentController extends mfBaseController {
|
||||
|
||||
protected function saveAction() {
|
||||
$r = $this->request;
|
||||
//var_dump($r->get());exit;
|
||||
|
||||
$id = $r->id;
|
||||
if(is_numeric($id) && $id > 0) {
|
||||
//var_dump($id);exit;
|
||||
$mode = "edit";
|
||||
$item = new ConstructionConsent($id);
|
||||
if(!$item->id) {
|
||||
@@ -200,10 +201,13 @@ class ConstructionConsentController extends mfBaseController {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
//var_dump($r->get());exit;
|
||||
|
||||
$data = [];
|
||||
$data["constructionconsentproject_id"] = $r->constructionconsentproject_id;
|
||||
$data["object_type"] = $r->object_type;
|
||||
$data["name"] = $r->name;
|
||||
$data["adb_hausnummer_id"] = $r->adb_hausnummer_id;
|
||||
$data["adb_strasse_id"] = $r->adb_strasse_id;
|
||||
$data["ez"] = $r->ez;
|
||||
$data["kg"] = $r->kg;
|
||||
@@ -228,11 +232,28 @@ class ConstructionConsentController extends mfBaseController {
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
if(!$data["object_type"] || !$data["adb_strasse_id"]) {
|
||||
if(!$data["object_type"]) {
|
||||
$this->layout()->setFlash("Bitte alle benötigten Felder ausfüllen", "error");
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
if($data["object_type"] == "address") {
|
||||
if(!$data["adb_hausnummer_id"]) {
|
||||
$this->layout()->setFlash("Kein Gebäude ausgewählt", "error");
|
||||
return $this->addAction();
|
||||
}
|
||||
unset($data["adb_strasse_id"]);
|
||||
}
|
||||
|
||||
if($data["object_type"] == "street") {
|
||||
if(!$data["adb_strasse_id"]) {
|
||||
$this->layout()->setFlash("Keine Straße ausgewählt", "error");
|
||||
return $this->addAction();
|
||||
}
|
||||
unset($data["adb_hausnummer_id"]);
|
||||
}
|
||||
|
||||
//var_dump($data, $item);exit;
|
||||
if(!$item->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern", "error");
|
||||
return $this->addAction();
|
||||
@@ -255,13 +276,13 @@ class ConstructionConsentController extends mfBaseController {
|
||||
|
||||
if($file && $file->id) {
|
||||
$ccf = ConstructionConsentFile::create([
|
||||
'constructionconsent_id' => $id,
|
||||
'constructionconsent_id' => $item->id,
|
||||
'file_id' => $file->id,
|
||||
'filename' => "zustimmungserklärung-" . $item->id . "-plan.png",
|
||||
]);
|
||||
|
||||
// delete previous image
|
||||
$img = ConstructionConsentFile::getFirst(["constructionconsent_id" => $id]);
|
||||
$img = ConstructionConsentFile::getFirst(["constructionconsent_id" => $item->id]);
|
||||
if ($img) {
|
||||
$img->file->delete();
|
||||
$img->delete();
|
||||
@@ -274,7 +295,7 @@ class ConstructionConsentController extends mfBaseController {
|
||||
|
||||
|
||||
$this->layout()->setFlash("Zustimmungserklärung erfolgreich gespeichert", "success");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $id]);
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $item->id]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user