the user is now able to delete an existing change request that he made

This commit is contained in:
SimonGschnell
2024-01-15 15:40:55 +01:00
parent e881abe904
commit 73792d1e78
3 changed files with 31 additions and 3 deletions
+11
View File
@@ -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)
+7
View File
@@ -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`;
@@ -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:`
<pre>{{JSON.stringify(data,null,2)}}</pre>
<table class="table table-sm table-hover">
<thead>
<tr >
<th scope="col">Topic</th>
<th scope="col">Date of Request</th>
<th scope="col"></th>
<th scope="col">Bearbeiten</th>
<th scope="col">Löschen</th>
</tr>
</thead>
<tbody>
<tr v-for="item in data">
<td >{{item.topic}}</td>
<td >{{item.change_timestamp}}</td>
<td ><i @click="openModal(item)" role="button" class="fa fa-edit"></i></td>
<td class="text-center" ><i style="color:#00639c" @click="openModal(item)" role="button" class="fa fa-edit"></i></td>
<td class="text-center"><i style="color:red" role="button" @click="deleteRequest(item)" class="fa fa-trash"></i></td>
</tr>
</tbody>
</table>