+
Name & Anschrift
@@ -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");
}
diff --git a/application/ConstructionConsent/ConstructionConsent.php b/application/ConstructionConsent/ConstructionConsent.php
index 2ec7b4764..57b44b386 100644
--- a/application/ConstructionConsent/ConstructionConsent.php
+++ b/application/ConstructionConsent/ConstructionConsent.php
@@ -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) {
diff --git a/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php b/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php
index 25c390b7e..2cf6a53ac 100644
--- a/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php
+++ b/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php
@@ -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");