diff --git a/Layout/default/ConstructionConsent/Form.php b/Layout/default/ConstructionConsent/Form.php index 5a9d3d560..e3546467c 100644 --- a/Layout/default/ConstructionConsent/Form.php +++ b/Layout/default/ConstructionConsent/Form.php @@ -36,7 +36,7 @@
@@ -46,8 +46,8 @@
@@ -55,7 +55,7 @@
- + " placeholder="z.B. Straße oder Adresse" />
@@ -64,7 +64,7 @@
@@ -76,28 +76,28 @@
- + " />
- + " />
- + " />
- + " />
@@ -107,7 +107,7 @@
- + " />
@@ -115,7 +115,7 @@
@@ -125,7 +125,7 @@
@@ -135,7 +135,7 @@
@@ -145,7 +145,7 @@
@@ -166,7 +166,7 @@
- +
@@ -207,7 +207,14 @@ */ $('#adb_strasse_id').select2({ ajax: { - url: ' "findStreet", "project_id" => $project->id])?>', + url: '', + data: (params) => { + return { + q: params.term, + do: "findStreet", + project_id: $("#constructionconsentproject_id :selected").val() + } + }, delay: 250, dataType: 'json' }, @@ -220,6 +227,11 @@ $('#new-address-toggle').show(); } }); + + $("#constructionconsentproject_id").change(() => { + $("#adb_strasse_id").val("").change(); + }); + \ No newline at end of file diff --git a/Layout/default/ConstructionConsent/Index.php b/Layout/default/ConstructionConsent/Index.php index 4bb41f954..129de256c 100644 --- a/Layout/default/ConstructionConsent/Index.php +++ b/Layout/default/ConstructionConsent/Index.php @@ -36,8 +36,8 @@ $pagination_entity_name = "Zustimmungserklärungen";
@@ -62,7 +62,7 @@ $pagination_entity_name = "Zustimmungserklärungen";
- 1])?>"> Filter zurücksetzen + 1, "filter" => ["project_id" => $filter["project_id"]]])?>"> Filter zurücksetzen
@@ -80,7 +80,7 @@ $pagination_entity_name = "Zustimmungserklärungen";

Liste aller Zustimmmungserklärungen

- "> Neue Zustimmungserklärung anlegen + $filter["project_id"]])?>"> Neue Zustimmungserklärung anlegen
diff --git a/application/ConstructionConsent/ConstructionConsent.php b/application/ConstructionConsent/ConstructionConsent.php index e85a8dd77..849b5df0e 100644 --- a/application/ConstructionConsent/ConstructionConsent.php +++ b/application/ConstructionConsent/ConstructionConsent.php @@ -262,6 +262,20 @@ class ConstructionConsent extends mfBaseModel { private static function getSqlFilter($filter) { $where = "1=1 "; + if(array_key_exists("project_id", $filter)) { + $project_id = $filter['project_id']; + if(is_numeric($project_id)) { + $where .= " AND ConstructionConsent.constructionconsentproject_id=$project_id"; + } + } + + if(array_key_exists("constructionconsentproject_id", $filter)) { + $constructionconsentproject_id = $filter['constructionconsentproject_id']; + if(is_numeric($constructionconsentproject_id)) { + $where .= " AND ConstructionConsent.constructionconsentproject_id=$constructionconsentproject_id"; + } + } + if(array_key_exists("adb_wohneinheit_id", $filter)) { $adb_wohneinheit_id = $filter['adb_wohneinheit_id']; if(is_numeric($adb_wohneinheit_id)) { diff --git a/application/ConstructionConsent/ConstructionConsentController.php b/application/ConstructionConsent/ConstructionConsentController.php index 65e3965c0..9e110303d 100644 --- a/application/ConstructionConsent/ConstructionConsentController.php +++ b/application/ConstructionConsent/ConstructionConsentController.php @@ -75,6 +75,13 @@ class ConstructionConsentController extends mfBaseController { $items = ConstructionConsent::search($filter); $this->layout->set("items", $items); + if(array_key_exists("project_id", $filter) && $filter["project_id"]) { + $project = new ConstructionConsentProject($filter["project_id"]); + if($project->id) { + $this->layout()->set("project", $project); + } + } + } private function getPreparedFilter($filter) : array @@ -87,6 +94,8 @@ class ConstructionConsentController extends mfBaseController { } } + + return $new_filter; } @@ -110,6 +119,9 @@ class ConstructionConsentController extends mfBaseController { protected function addAction() : void { $this->layout()->setTemplate("ConstructionConsent/Form"); + if($this->request->project_id) { + $this->layout()->set("project_id", $this->request->project_id); + } } protected function editAction() : void {