From 73792d1e780a21baa91a57ea54f3141025dc3cf9 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Mon, 15 Jan 2024 15:40:55 +0100 Subject: [PATCH] the user is now able to delete an existing change request that he made --- application/controllers/Cis/Profil.php | 11 +++++++++++ public/js/apps/api/userdata.js | 7 +++++++ .../js/components/Cis/Profil/ProfilComponents.js | 16 +++++++++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/application/controllers/Cis/Profil.php b/application/controllers/Cis/Profil.php index 8b87f3c5a..89ff47b32 100644 --- a/application/controllers/Cis/Profil.php +++ b/application/controllers/Cis/Profil.php @@ -21,6 +21,7 @@ class Profil extends Auth_Controller 'getView' => ['student/anrechnung_beantragen:r', 'user:r'], 'insertProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'], 'updateProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'], + 'deleteProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'], ]); @@ -147,6 +148,16 @@ class Profil extends Auth_Controller } } + public function deleteProfilRequest(){ + + $json = json_decode($this->input->raw_input_stream); + + $delete_res = $this->ProfilChangeModel->delete([$json]); + echo json_encode($delete_res); + + + } + private function viewMitarbeiterProfil($uid) diff --git a/public/js/apps/api/userdata.js b/public/js/apps/api/userdata.js index df655988c..b8691e8ec 100644 --- a/public/js/apps/api/userdata.js +++ b/public/js/apps/api/userdata.js @@ -17,6 +17,13 @@ export default { return axios.post(url,{topic, payload}); }, + deleteProfilRequest: function(requestID){ + const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+ + `/Cis/Profil/deleteProfilRequest`; + + return axios.post(url,requestID); + }, + getEditProfil: function() { const url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router+ `/Cis/Profil/getEditProfil`; diff --git a/public/js/components/Cis/Profil/ProfilComponents.js b/public/js/components/Cis/Profil/ProfilComponents.js index 55c748ec7..28a68bb64 100644 --- a/public/js/components/Cis/Profil/ProfilComponents.js +++ b/public/js/components/Cis/Profil/ProfilComponents.js @@ -268,6 +268,12 @@ const FetchProfilUpdates = { return {} }, methods:{ + deleteRequest: function(item){ + + Vue.$fhcapi.UserData.deleteProfilRequest(item.profil_update_id).then((res)=>{ + console.log(res); + }); + }, getView: function(topic){ console.log("the topic is here",topic); switch(topic){ @@ -289,6 +295,7 @@ const FetchProfilUpdates = { }, update:true, topic:updateRequest.topic, + } }else{ content = { @@ -297,6 +304,7 @@ const FetchProfilUpdates = { update:true, topic:updateRequest.topic, + } } @@ -328,20 +336,22 @@ const FetchProfilUpdates = { }, template:` - +
{{JSON.stringify(data,null,2)}}
- + + - + +
Topic Date of RequestBearbeitenLöschen
{{item.topic}} {{item.change_timestamp}}