diff --git a/Layout/default/ConstructionConsent/Index.php b/Layout/default/ConstructionConsent/Index.php
index 5e0eae8f8..dc704a731 100644
--- a/Layout/default/ConstructionConsent/Index.php
+++ b/Layout/default/ConstructionConsent/Index.php
@@ -164,6 +164,14 @@ $pagination_entity_name = "Zustimmungserklärungen";
+
+
+
+
diff --git a/Layout/default/ConstructionConsent/View.php b/Layout/default/ConstructionConsent/View.php
index 8cb43e73c..82a48fe79 100644
--- a/Layout/default/ConstructionConsent/View.php
+++ b/Layout/default/ConstructionConsent/View.php
@@ -132,6 +132,13 @@ $pagination_entity_name = "Adressen";
prioritize) ? "checked='checked'" : ""?> />
+
+ | Aufschieben |
+
+ deferred) ? "checked='checked'" : ""?> />
+ |
+
+
object_type == "building"): ?>
Metadaten |
@@ -1205,7 +1212,45 @@ $pagination_entity_name = "Adressen";
}
}, 'json');
}
- });
+ });
+
+ $("#deferred").on("change", function() {
+ const reason = prompt("Bitte geben Sie einen Grund für das Zurückstellen der Genehmigung ein:");
+ if (reason != null && reason.length < 3) {
+ notify("error", "Begründung muss mindestens 3 Zeichen lang sein");
+ $(this).prop("checked", false);
+ switcheries.forEach(s => s.setPosition());
+ return;
+ } if (true) {
+ $.post("", {
+ consent_id: =$item->id?>,
+ text: `Genehmigung zurückgestellt wurde ${$(this).prop("checked") ? "aktiviert" : "deaktiviert"} | Begründung: ${reason}`
+ }, function (success) {
+ if (success.status != "OK") {
+ notify("error", "Status konnte nicht gespeichert werden");
+ } else {
+ notify("success", "Status erfolgreich gespeichert");
+ }
+ }, 'json');
+
+ $.get("", {
+ consent_id: =$item->id?>,
+ checked: $(this).prop("checked") ? 1 : 0
+ }, function (success) {
+ if (success.status != "OK") {
+ notify("error", "Status konnte nicht gespeichert werden");
+ setTimeout(() => {
+ location.reload()
+ }, 150);
+ } else {
+ notify("success", "Status erfolgreich gespeichert");
+ setTimeout(() => {
+ location.reload()
+ }, 150);
+ }
+ }, 'json');
+ }
+ })
// do the same for prioritize
$("#prioritize").on("change", function() {
diff --git a/application/ConstructionConsent/ConstructionConsent.php b/application/ConstructionConsent/ConstructionConsent.php
index cddce2f75..609dbf2a7 100644
--- a/application/ConstructionConsent/ConstructionConsent.php
+++ b/application/ConstructionConsent/ConstructionConsent.php
@@ -646,6 +646,15 @@ FROM ConstructionConsent
}
}
+ if(array_key_exists("deferred", $filter)) {
+ $approve_override = $filter["deferred"];
+ if($approve_override == "!NULL") {
+ $where .= " AND (deferred IS NOT NULL AND deferred != 0)";
+ } elseif($approve_override == "NULL") {
+ $where .= " AND (deferred IS NULL OR deferred = 0)";
+ }
+ }
+
if(array_key_exists("conduit_installed_ftu", $filter)) {
$conduit_installed_ftu = $filter["conduit_installed_ftu"];
if($conduit_installed_ftu == "!NULL") {
diff --git a/application/ConstructionConsent/ConstructionConsentController.php b/application/ConstructionConsent/ConstructionConsentController.php
index 54b33b590..f23ac2ec1 100644
--- a/application/ConstructionConsent/ConstructionConsentController.php
+++ b/application/ConstructionConsent/ConstructionConsentController.php
@@ -1078,6 +1078,21 @@ class ConstructionConsentController extends mfBaseController {
}
+ protected function deferAction() {
+ $consent_id = $this->request->consent_id;
+ $checked = $this->request->checked;
+
+ $consent = new ConstructionConsent($consent_id);
+ if(!$consent->id) {
+ $this->returnJson(["status" => "error"]);
+ }
+
+ $consent->update(["deferred" => $checked]);
+ $consent->save();
+
+ $this->returnJson(["status" => "OK"]);
+ }
+
protected function prioritizeAction() {
$consent_id = $this->request->consent_id;
$checked = $this->request->checked;
diff --git a/db/migrations/20250618144401_constr_consent_add_deferred.php b/db/migrations/20250618144401_constr_consent_add_deferred.php
new file mode 100644
index 000000000..40251b194
--- /dev/null
+++ b/db/migrations/20250618144401_constr_consent_add_deferred.php
@@ -0,0 +1,27 @@
+getEnvironment() == "thetool") {
+ $table = $this->table('ConstructionConsent');
+ $table->addColumn('deferred', 'boolean', ['null' => true, 'default' => false])
+ ->save();
+ }
+ }
+
+ public function down(): void
+ {
+ if ($this->getEnvironment() == "thetool") {
+ $table = $this->table('ConstructionConsent');
+ $table->removeColumn('deferred')
+ ->save();
+ }
+ }
+}
+
+// ALTER TABLE `ConstructionConsent` ADD COLUMN `deferred` BOOLEAN NULL DEFAULT FALSE AFTER `text`;
\ No newline at end of file