From c79e329439d4f867e8f8fe03dc1071ea839cee7b Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 8 Oct 2025 15:35:28 +0200 Subject: [PATCH] add iso dates to result object of profile updates api endpoint, use iso date in tabulator to sort correctly and format with luxon js --- .../models/person/Profil_update_model.php | 3 +++ application/views/Cis/ProfilUpdate.php | 4 ++++ .../Cis/ProfilUpdate/ProfilUpdateView.js | 17 +++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/application/models/person/Profil_update_model.php b/application/models/person/Profil_update_model.php index 36f53ff75..31005c4b7 100644 --- a/application/models/person/Profil_update_model.php +++ b/application/models/person/Profil_update_model.php @@ -235,8 +235,11 @@ class Profil_update_model extends DB_Model private function formatProfilRequest($request) { $request->requested_change = json_decode($request->requested_change); + $request->insertamum_iso = !is_null($request->insertamum) ? date_create($request->insertamum)->format('Y-m-d') : null; $request->insertamum = !is_null($request->insertamum) ? date_create($request->insertamum)->format('d.m.Y') : null; + $request->updateamum_iso = !is_null($request->updateamum) ? date_create($request->updateamum)->format('Y-m-d') : null; $request->updateamum = !is_null($request->updateamum) ? date_create($request->updateamum)->format('d.m.Y') : null; + $request->status_timestamp_iso = !is_null($request->status_timestamp) ? date_create($request->status_timestamp)->format('Y-m-d') : null; $request->status_timestamp = !is_null($request->status_timestamp) ? date_create($request->status_timestamp)->format('d.m.Y') : null; } diff --git a/application/views/Cis/ProfilUpdate.php b/application/views/Cis/ProfilUpdate.php index e797d436f..2e69208c7 100644 --- a/application/views/Cis/ProfilUpdate.php +++ b/application/views/Cis/ProfilUpdate.php @@ -2,10 +2,14 @@ $includesArray = array( 'title' => 'Profil Änderungen', 'vue3' => true, + 'primevue3' => true, 'bootstrap5' => true, 'fontawesome6'=> true, 'axios027' => true, 'tabulator5' => true, + 'customJSs' => array( + 'vendor/moment/luxonjs/luxon.min.js' + ), 'customJSModules' => array( 'public/js/apps/Cis/ProfilUpdateRequests.js' ), diff --git a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js index 53a6a5041..745f53002 100644 --- a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js +++ b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js @@ -4,6 +4,7 @@ import Alert from "../../../components/Bootstrap/Alert.js"; import Loading from "../../../components/Loader.js"; import ApiProfilUpdate from '../../../api/factory/profilUpdate.js'; +import { dateFilter } from '../../../tabulator/filters/Dates.js'; const sortProfilUpdates = (ele1, ele2, thisPointer) => { let result = 0; @@ -241,10 +242,13 @@ export default { }, { title: this.$p.t("profilUpdate", "insertamum"), - field: "insertamum", + field: "insertamum_iso", resizable: true, - headerFilter: true, + headerFilterFunc: 'dates', + headerFilter: dateFilter, minWidth: 200, + formatter:"datetime", + formatterParams: this.datetimeFormatterParams(), //responsive:0, }, { @@ -377,6 +381,15 @@ export default { this.showAcceptDenyModal(arrayRowData[0]); } } + }, + datetimeFormatterParams: function() { + const params = { + inputFormat:"yyyy-MM-dd", + outputFormat:"dd.MM.yyyy", + invalidPlaceholder:"(invalid date)", + timezone:FHC_JS_DATA_STORAGE_OBJECT.timezone + }; + return params; } }, watch: {