From 20d6a345060ce4a0e45789a14d8b29af3f3f3ea8 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Wed, 24 Jan 2024 12:18:21 +0100 Subject: [PATCH] little style changes and adds name field to the public.tbl_cis_profil_update table --- application/controllers/Cis/Profil.php | 9 +++++-- .../models/person/Profil_change_model.php | 1 + public/css/components/Profil.css | 6 +++-- public/js/apps/Cis/ProfilUpdateRequests.js | 27 ++++++++++++------- .../ProfilComponents/FetchProfilUpdates.js | 12 ++++----- .../Cis/ProfilUpdate/AcceptDenyUpdate.js | 2 +- system/dbupdate_3.4/25999_C4_ma0594.php | 4 ++- 7 files changed, 39 insertions(+), 22 deletions(-) diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index 381d13a67..cdd3ecde1 100644 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -97,8 +97,13 @@ class Profil extends Auth_Controller $payload = $json->payload; $type = property_exists($json->payload,"kontakt_id")? "kontakt_id" : "adresse_id"; - - $data = ["topic"=>$json->topic,"uid" => $this->uid, "requested_change" => json_encode($payload), "change_timestamp" => "NOW()","status"=>"pending" ]; + $name = $this->PersonModel->getFullName($this->uid); + if(isError($name)){ + // error handling + var_dump($name); + return; + } + $data = ["topic"=>$json->topic,"uid" => $this->uid, "name"=>getData($name), "requested_change" => json_encode($payload), "change_timestamp" => "NOW()","status"=>"pending" ]; //? loops over all updateRequests from a user to validate if the new request is valid $res = $this->ProfilChangeModel->loadWhere(["uid"=>$this->uid]); diff --git a/application/models/person/Profil_change_model.php b/application/models/person/Profil_change_model.php index 0877b4bcc..9a229f308 100644 --- a/application/models/person/Profil_change_model.php +++ b/application/models/person/Profil_change_model.php @@ -51,6 +51,7 @@ class Profil_change_model extends DB_Model $update->requested_change = json_decode($update->requested_change); $update->change_timestamp = !is_null($update->change_timestamp)?date_create($update->change_timestamp)->format('d.m.Y'):null; $update->status_timestamp = !is_null($update->status_timestamp)?date_create($update->status_timestamp)->format('d.m.Y'):null; + } } } diff --git a/public/css/components/Profil.css b/public/css/components/Profil.css index 31adc7fff..d9b725cb6 100644 --- a/public/css/components/Profil.css +++ b/public/css/components/Profil.css @@ -18,12 +18,14 @@ height:22px; width:21px; background-color:white; - position:absolute; - top:0; + position:absolute; + /* top: 1px is important, otherwise it goes over the border of the thumbnail*/ + top:1px; right:12px; display:flex; align-items:center; justify-content:center; + border-radius:3px; } .tabulator-collapsed-row{ diff --git a/public/js/apps/Cis/ProfilUpdateRequests.js b/public/js/apps/Cis/ProfilUpdateRequests.js index 3ce881116..74f3e98c2 100644 --- a/public/js/apps/Cis/ProfilUpdateRequests.js +++ b/public/js/apps/Cis/ProfilUpdateRequests.js @@ -16,18 +16,10 @@ const app = Vue.createApp({ profil_updates_table_options:{ ajaxURL:FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + '/Cis/ProfilUpdate/getAllRequests', - height:300, + height:600, layout:'fitColumns', columns: [ - { - title: "Topic", - field: "topic", - resizable: true, - minWidth: 200, - headerFilter: true, - //responsive:0, - }, { title: "UID", field: "uid", @@ -36,7 +28,22 @@ const app = Vue.createApp({ headerFilter: true, //responsive:0, }, - + { + title: "Name", + field: "name", + minWidth: 200, + resizable:true, + headerFilter: true, + //responsive:0, + }, + { + title: "Topic", + field: "topic", + resizable: true, + minWidth: 200, + headerFilter: true, + //responsive:0, + }, { title: "Date", field: "change_timestamp", diff --git a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js index cd70ab62c..4593fed74 100644 --- a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js +++ b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js @@ -104,14 +104,14 @@ export default { }, template:` -
+
Profil Updates
- + @@ -125,7 +125,7 @@ export default { - + @@ -135,7 +135,7 @@ export default {
Topic Status
{{item.topic}}{{item.topic}} {{item.status}} {{item.change_timestamp}} diff --git a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js index ce446bbdc..6b05a7bf3 100644 --- a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js +++ b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js @@ -202,7 +202,7 @@ export default {
- +
diff --git a/system/dbupdate_3.4/25999_C4_ma0594.php b/system/dbupdate_3.4/25999_C4_ma0594.php index 151a727b2..1017ef94a 100644 --- a/system/dbupdate_3.4/25999_C4_ma0594.php +++ b/system/dbupdate_3.4/25999_C4_ma0594.php @@ -4,8 +4,9 @@ { $qry = "CREATE TABLE public.tbl_cis_profil_update ( profil_update_id INTEGER NOT NULL, - topic VARCHAR(32) NOT NULL, uid VARCHAR(32) NOT NULL, + name TEXT NOT NULL, + topic VARCHAR(32) NOT NULL, requested_change jsonb NOT NULL, change_timestamp TIMESTAMP NOT NULL, status VARCHAR(32) NOT NULL, @@ -22,6 +23,7 @@ CACHE 1; ALTER TABLE public.tbl_cis_profil_update ALTER COLUMN profil_update_id SET DEFAULT nextval('public.tbl_cis_profil_update_id_seq'); + ALTER SEQUENCE public.tbl_cis_profil_update_id_seq OWNED BY public.tbl_cis_profil_update.profil_update_id; ALTER TABLE public.tbl_cis_profil_update ADD CONSTRAINT tbl_cis_profil_update_restricted_status CHECK (status IN ('pending','accepted','rejected')); --ALTER TABLE public.tbl_cis_profil_update ADD CONSTRAINT cis_profil_udpate_topic_uid_unique UNIQUE (uid,topic);