Merge branch 'fronkdev' into 'master'
ConstructionConsent: Owners editable & status/result stats See merge request fronk/thetool!952
This commit is contained in:
@@ -244,7 +244,7 @@ $pagination_entity_name = "Adressen";
|
||||
<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>
|
||||
<small><a href="#" onclick="newOwner(); return false;"><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-down fa-fw"></i> Grundbuch jetzt abfragen</button-->
|
||||
@@ -252,6 +252,30 @@ $pagination_entity_name = "Adressen";
|
||||
<?php if(!is_array($item->owners) || !count($item->owners)): ?>
|
||||
<i>Noch keine Besitzer bekannt</i>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<h5>Zusammenfassung Status (von <?=count($item->owners)?>)</h5>
|
||||
<table class="table table-sm">
|
||||
<?php foreach($item->owner_status_counts as $type => $count): ?>
|
||||
<tr>
|
||||
<th><?=__($type, "consent")?></th>
|
||||
<td><?=$count?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<h5>Zusammenfassung Ergebnis (von <?=count($item->owners)?>)</h5>
|
||||
<table class="table table-sm">
|
||||
<?php foreach($item->owner_result_counts as $type => $count): ?>
|
||||
<tr>
|
||||
<th><?=__($type,"consent")?></th>
|
||||
<td><?=$count?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-sm table-striped table-hover">
|
||||
<tr>
|
||||
<th></th>
|
||||
@@ -259,9 +283,10 @@ $pagination_entity_name = "Adressen";
|
||||
<th>Telefon<br />Fax<br />Email</th>
|
||||
<th>Anfragestatus</th>
|
||||
<th>Ergebnis</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($item->owners as $owner): ?>
|
||||
<tr>
|
||||
<tr id="owner-data-<?=$owner->id?>" data-name="<?=$owner->name?>" data-street="<?=$owner->street?>" data-zip="<?=$owner->zip?>" data-city="<?=$owner->city?>" data-country="<?=$owner->country?>" data-phone="<?=$owner->phone?>" data-fax="<?=$owner->fax?>" data-email="<?=$owner->email?>">
|
||||
<td style="font-size: 1.4em;">
|
||||
<a href="<?=self::getUrl("ConstructionConsent", "Download", ["owner_id" => $owner->id])?>" title="Zustimmungserklärungsformular herunterladen"><i class="far fa-fw fa-file-download"></i></a>
|
||||
</td>
|
||||
@@ -316,6 +341,10 @@ $pagination_entity_name = "Adressen";
|
||||
<hr />
|
||||
<div class="mt-2"><a href="#" onclick="openOwnerUploadModal(<?=$owner->id?>); return false;"><i class="far fa-cloud-upload" style="font-size: 1.4em;"></i> Dokument hochladen</a></div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="#" title="Besitzer bearbeiten" onclick="editOwner(<?=$owner->id?>); return false;"><i class="far fa-fw fa-edit"></i></a>
|
||||
<a href="<?=self::getUrl("ConstructionConsentOwner", "delete", ["id" => $owner->id])?>" onclick="if(!confirm('Besitzer wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash-alt"></i></a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@@ -414,6 +443,7 @@ $pagination_entity_name = "Adressen";
|
||||
<div class="modal-body">
|
||||
|
||||
<input type="hidden" name="constructionconsent_id" value="<?=$item->id?>" />
|
||||
<input type="hidden" name="id" value="" />
|
||||
<h4>Name & Anschrift</h4>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -740,7 +770,40 @@ $pagination_entity_name = "Adressen";
|
||||
$("#owner-upload-name").val("");
|
||||
|
||||
$('#ownerUpload').modal();
|
||||
}
|
||||
|
||||
function newOwner() {
|
||||
$("#newOwnerModal textarea[name=name]").val("");
|
||||
$("#newOwnerModal input[name=street]").val("");
|
||||
$("#newOwnerModal input[name=zip]").val("");
|
||||
$("#newOwnerModal input[name=city]").val("");
|
||||
$("#newOwnerModal input[name=country]").val("");
|
||||
$("#newOwnerModal input[name=phone]").val("");
|
||||
$("#newOwnerModal input[name=fax]").val("");
|
||||
$("#newOwnerModal input[name=email]").val("");
|
||||
$("#newOwnerModal input[name=id]").val("");
|
||||
|
||||
$("#newOwnerModelLabel").text("Neuen Besitzer hinzufügen");
|
||||
|
||||
$("#newOwnerModal").modal("show");
|
||||
}
|
||||
|
||||
function editOwner(owner_id) {
|
||||
if(!owner_id) return;
|
||||
|
||||
$("#newOwnerModal textarea[name=name]").val($("#owner-data-" + owner_id).data("name"));
|
||||
$("#newOwnerModal input[name=street]").val($("#owner-data-" + owner_id).data("street"));
|
||||
$("#newOwnerModal input[name=zip]").val($("#owner-data-" + owner_id).data("zip"));
|
||||
$("#newOwnerModal input[name=city]").val($("#owner-data-" + owner_id).data("city"));
|
||||
$("#newOwnerModal input[name=country]").val($("#owner-data-" + owner_id).data("country"));
|
||||
$("#newOwnerModal input[name=phone]").val($("#owner-data-" + owner_id).data("phone"));
|
||||
$("#newOwnerModal input[name=fax]").val($("#owner-data-" + owner_id).data("fax"));
|
||||
$("#newOwnerModal input[name=email]").val($("#owner-data-" + owner_id).data("email"));
|
||||
$("#newOwnerModal input[name=id]").val(owner_id);
|
||||
|
||||
$("#newOwnerModelLabel").text("Besitzer bearbeiten");
|
||||
|
||||
$("#newOwnerModal").modal("show");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ class ConstructionConsent extends mfBaseModel {
|
||||
private $history;
|
||||
private $inspection_protocol_planner;
|
||||
private $inspection_protocol_electrician;
|
||||
private $owner_result_counts;
|
||||
private $owner_status_counts;
|
||||
|
||||
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";
|
||||
@@ -204,6 +206,34 @@ class ConstructionConsent extends mfBaseModel {
|
||||
return $this->inspection_protocol_electrician;
|
||||
}
|
||||
|
||||
if($name == "owner_result_counts") {
|
||||
$counts = [];
|
||||
|
||||
$owners = $this->getProperty("owners");
|
||||
foreach($owners as $owner) {
|
||||
if(!array_key_exists($owner->result, $counts)) {
|
||||
$counts[$owner->result] = 0;
|
||||
}
|
||||
$counts[$owner->result]++;
|
||||
}
|
||||
$this->owner_result_counts = $counts;
|
||||
return $this->owner_result_counts;
|
||||
}
|
||||
|
||||
if($name == "owner_status_counts") {
|
||||
$counts = [];
|
||||
|
||||
$owners = $this->getProperty("owners");
|
||||
foreach($owners as $owner) {
|
||||
if(!array_key_exists($owner->status, $counts)) {
|
||||
$counts[$owner->status] = 0;
|
||||
}
|
||||
$counts[$owner->status]++;
|
||||
}
|
||||
$this->owner_status_counts = $counts;
|
||||
return $this->owner_status_counts;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
if($this->creator === null) {
|
||||
|
||||
@@ -106,6 +106,29 @@ class ConstructionConsentOwnerController extends mfBaseController
|
||||
|
||||
}
|
||||
|
||||
protected function deleteAction() {
|
||||
$id = $this->request->id;
|
||||
|
||||
$owner = new ConstructionConsentOwner($id);
|
||||
if(!$owner->id) {
|
||||
$this->layout()->setFlash("Besitzer nicht gefunden!", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$consent = $owner->consent;
|
||||
|
||||
foreach($owner->files as $file) {
|
||||
$file->file->delete();
|
||||
$file->delete();
|
||||
}
|
||||
|
||||
$owner->delete();
|
||||
|
||||
$this->layout()->setFlash("Besitzer gelöscht!", "success");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $consent->id]);
|
||||
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
if(!$this->me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
|
||||
Reference in New Issue
Block a user