adds a select to the profilUpdateRequests to change display between only pending and all requests

This commit is contained in:
SimonGschnell
2024-02-01 15:27:24 +01:00
parent d813f55a9b
commit e5182a20ac
2 changed files with 57 additions and 6 deletions
@@ -16,6 +16,7 @@ class ProfilUpdate extends Auth_Controller
'acceptProfilRequest'=>['user:r'],
'denyProfilRequest'=>['user:r'],
'show'=>['user:r'],
'getPendingRequests'=>['user:r'],
]);
@@ -49,6 +50,15 @@ class ProfilUpdate extends Auth_Controller
echo json_encode($res);
}
public function getPendingRequests(){
$res = $this->ProfilChangeModel->loadWhere(["status"=>"pending"]);
$res = hasData($res)? getData($res) : [];
echo json_encode($res);
}
public function acceptProfilRequest(){
$_POST = json_decode($this->input->raw_input_stream,true);
+47 -6
View File
@@ -9,11 +9,21 @@ const app = Vue.createApp({
},
data() {
return {
showAll: false,
profil_updates_table_options: {
ajaxURL:
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
"/Cis/ProfilUpdate/getAllRequests",
ajaxURL:FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
`/Cis/ProfilUpdate/`,
ajaxURLGenerator: (url,config,params)=>{
//? this function needs to be an array function in order to access the this properties of the Vue component
if(this.showAll){
return url +"getAllRequests";
}else{
return url +"getPendingRequests";
}
},
height: 600,
layout: "fitColumns",
@@ -106,13 +116,44 @@ const app = Vue.createApp({
},
};
},
computed: {},
methods: {},
computed: {
getFetchUrl: function(){
let url = FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
`/Cis/ProfilUpdate/`;
if(this.showAll){
url+"getAllRequests";
}else{
url+"getPendingRequests";
}
return url;
}
},
methods: {
updateData: function(){
this.$refs.UpdatesTable.tabulator.setData();
/*
console.log(this.profil_updates_table_options.ajaxURL);
*/
}
},
created() {},
mounted() {},
template: `
<div>
<div class="form-underline flex-fill ">
<div class="form-underline-titel">Show Profil Requests</div>
<select class="mb-2 " v-model="showAll" @change="updateData" class="form-select" aria-label="Profil updates display selection">
<option :selected="true" :value="false">Only Pending Requests</option>
<option :value="true">All Requests</option>
</select>
</div>
<core-filter-cmpt title="Update Requests" ref="UpdatesTable" :tabulator-options="profil_updates_table_options" tableOnly :sideMenu="false" />