From 1bc7b47b4f527abf0a76284e928654cf66e5d6d5 Mon Sep 17 00:00:00 2001 From: Frank Schubert Date: Thu, 13 Feb 2025 16:36:25 +0100 Subject: [PATCH] ConstructionConsent: added birthdate --- Layout/default/ConstructionConsent/View.php | 16 +++++++++------- .../ConstructionConsentOwnerController.php | 10 ++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Layout/default/ConstructionConsent/View.php b/Layout/default/ConstructionConsent/View.php index 0a826ce34..8d017467d 100644 --- a/Layout/default/ConstructionConsent/View.php +++ b/Layout/default/ConstructionConsent/View.php @@ -304,7 +304,7 @@ $pagination_entity_name = "Adressen"; owners as $owner): ?> - + "> $owner->id])?>" title="Zustimmungserklärungsformular herunterladen"> @@ -505,6 +505,11 @@ $pagination_entity_name = "Adressen"; Kann leer bleiben für Österreich +
+ + +
+

Kontakt

@@ -785,13 +790,8 @@ $pagination_entity_name = "Adressen"; }); } }); - //var blah = new Switchery(); - /*$(".switchery").each(() => { - console.log($(this).id); - });*/ - - $("#inspection_date_planner,#inspection_date_electrician").datepicker({ + $("#inspection_date_planner,#inspection_date_electrician,#birthdate").datepicker({ language: 'de', format: "dd.mm.yyyy", showWeekDays: true, @@ -819,6 +819,7 @@ $pagination_entity_name = "Adressen"; $("#newOwnerModal input[name=phone2]").val(""); $("#newOwnerModal input[name=fax]").val(""); $("#newOwnerModal input[name=email]").val(""); + $("#newOwnerModal input[name=birthdate]").val(""); $("#newOwnerModal input[name=id]").val(""); $("#newOwnerModelLabel").text("Neuen Besitzer hinzufügen"); @@ -840,6 +841,7 @@ $pagination_entity_name = "Adressen"; $("#newOwnerModal input[name=phone2]").val($("#owner-data-" + owner_id).data("phone2")); $("#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=birthdate]").val($("#owner-data-" + owner_id).data("birthdate")); $("#newOwnerModal input[name=id]").val(owner_id); $("#newOwnerModelLabel").text("Besitzer bearbeiten"); diff --git a/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php b/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php index 7473c2e77..0f924ce93 100644 --- a/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php +++ b/application/ConstructionConsentOwner/ConstructionConsentOwnerController.php @@ -89,6 +89,16 @@ class ConstructionConsentOwnerController extends mfBaseController $data["phone2"] = $r->phone2; $data["fax"] = $r->fax; $data["email"] = $r->email; + $date["birthdate"] = null; + + if($r->birthdate) { + try { + $birthdate = DateTime::createFromFormat("d.m.Y", $r->birthdate, new DateTimeZone("Europe/Vienna")); + $data["birthdate"] = $birthdate->format("Y-m-d"); + } catch(Exception $e) { + $this->layout()->setFlash("Ungültiges Geburtsdateum", "warning"); + } + } if($mode == "add") { $data["status"] = "new";