diff --git a/application/controllers/Cis/ProfilUpdate.php b/application/controllers/Cis/ProfilUpdate.php index 5e6d1df18..c075221b0 100755 --- a/application/controllers/Cis/ProfilUpdate.php +++ b/application/controllers/Cis/ProfilUpdate.php @@ -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); diff --git a/public/js/apps/Cis/ProfilUpdateRequests.js b/public/js/apps/Cis/ProfilUpdateRequests.js index 58287d27f..7ce7e130e 100755 --- a/public/js/apps/Cis/ProfilUpdateRequests.js +++ b/public/js/apps/Cis/ProfilUpdateRequests.js @@ -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: `
+
+
Show Profil Requests
+ + + +
+ +