mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 09:52:22 +00:00
adds selectProfilRequest to the new ProfilUpdate FhcAPIController
This commit is contained in:
@@ -43,6 +43,7 @@ class ProfilUpdate extends FHCAPI_Controller
|
||||
'getProfilRequestFiles' => self::PERM_LOGGED,
|
||||
'denyProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'],
|
||||
'acceptProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'],
|
||||
'selectProfilRequest' => self::PERM_LOGGED,
|
||||
|
||||
]);
|
||||
|
||||
@@ -115,6 +116,24 @@ class ProfilUpdate extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess(self::$TOPICS);
|
||||
}
|
||||
|
||||
public function selectProfilRequest()
|
||||
{
|
||||
|
||||
$uid = $this->input->get('uid',true);
|
||||
$id = $this->input->get('id',true);
|
||||
$whereClause = ['uid' => $this->uid];
|
||||
|
||||
if (isset($uid))
|
||||
$whereClause['uid'] = $uid;
|
||||
if (isset($id))
|
||||
$whereClause['id'] = $id;
|
||||
|
||||
$res = $this->ProfilUpdateModel->getProfilUpdatesWhere($whereClause);
|
||||
$res = $this->getDataOrTerminateWithError($res);
|
||||
$this->terminateWithSuccess($res);
|
||||
|
||||
}
|
||||
|
||||
public function getProfilRequestFiles($id)
|
||||
{
|
||||
if(!$id){
|
||||
|
||||
@@ -43,7 +43,7 @@ export default {
|
||||
},
|
||||
|
||||
//TODO post request
|
||||
//? new reuquests
|
||||
//? new requests
|
||||
insertFile: function (dms, replace = null) {
|
||||
const url =
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
@@ -61,19 +61,16 @@ export default {
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/api/frontend/v1/ProfilUpdate/getProfilRequestFiles/${requestID}`,{});
|
||||
},
|
||||
|
||||
search(searchsettings) {
|
||||
const url = '/api/frontend/v1/searchbar/search';
|
||||
return this.$fhcApi.post(url, searchsettings);
|
||||
},
|
||||
|
||||
|
||||
selectProfilRequest: function (uid = null, id = null) {
|
||||
|
||||
return this.$fhcApi.get(
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root +
|
||||
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
|
||||
`/Cis/ProfilUpdate/selectProfilRequest`,{ uid: uid, id: id });
|
||||
`/api/frontend/v1/ProfilUpdate/selectProfilRequest`,
|
||||
{...(uid?{uid}:{}),
|
||||
...(id?{id}:{})
|
||||
});
|
||||
},
|
||||
|
||||
//TODO post request
|
||||
|
||||
@@ -151,17 +151,17 @@ export default {
|
||||
hideEditProfilModal: function () {
|
||||
//? checks the editModal component property result, if the user made a successful request or not
|
||||
if (this.$refs.editModal.result) {
|
||||
Vue.$fhcapi.ProfilUpdate.selectProfilRequest()
|
||||
this.$fhcApi.factory.profilUpdate.selectProfilRequest()
|
||||
.then((request) => {
|
||||
if (!request.error) {
|
||||
if (!request.error && request) {
|
||||
this.data.profilUpdates = request.data;
|
||||
this.data.profilUpdates.sort(this.sortProfilUpdates);
|
||||
} else {
|
||||
console.log("Error when fetching profile updates: " + res.data);
|
||||
console.error("Error when fetching profile updates: " + res.data);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
console.error(err);
|
||||
});
|
||||
} else {
|
||||
// when modal was closed without submitting request
|
||||
@@ -184,8 +184,8 @@ export default {
|
||||
},
|
||||
|
||||
fetchProfilUpdates: function () {
|
||||
Vue.$fhcapi.ProfilUpdate.selectProfilRequest().then((res) => {
|
||||
if (!res.error) {
|
||||
this.$fhcApi.factory.profilUpdate.selectProfilRequest().then((res) => {
|
||||
if (!res.error && res) {
|
||||
this.data.profilUpdates = res.data?.length
|
||||
? res.data.sort(this.sortProfilUpdates)
|
||||
: null;
|
||||
@@ -451,8 +451,6 @@ export default {
|
||||
|
||||
<div v-if="data.profilUpdates" class="row d-none d-md-block mb-3">
|
||||
<div class="col mb-3">
|
||||
|
||||
|
||||
<!-- PROFIL UPDATES -->
|
||||
<fetch-profil-updates v-if="data.profilUpdates && data.profilUpdates.length" @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ export default {
|
||||
);
|
||||
},
|
||||
fetchProfilUpdates: function () {
|
||||
Vue.$fhcapi.ProfilUpdate.selectProfilRequest().then((res) => {
|
||||
if (!res.error) {
|
||||
this.$fhcApi.factory.profilUpdate.selectProfilRequest().then((res) => {
|
||||
if (!res.error && res) {
|
||||
this.data.profilUpdates = res.data?.length
|
||||
? res.data.sort(this.sortProfilUpdates)
|
||||
: null;
|
||||
@@ -107,17 +107,17 @@ export default {
|
||||
hideEditProfilModal: function () {
|
||||
//? checks the editModal component property result, if the user made a successful request or not
|
||||
if (this.$refs.editModal.result) {
|
||||
Vue.$fhcapi.ProfilUpdate.selectProfilRequest()
|
||||
this.$fhcApi.factory.profilUpdate.selectProfilRequest()
|
||||
.then((request) => {
|
||||
if (!request.error) {
|
||||
if (!request.error && res) {
|
||||
this.data.profilUpdates = request.data;
|
||||
this.data.profilUpdates.sort(this.sortProfilUpdates);
|
||||
} else {
|
||||
console.log("Error when fetching profile updates: " + res.data);
|
||||
console.error("Error when fetching profile updates: " + res.data);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
console.error(err);
|
||||
});
|
||||
} else {
|
||||
// when modal was closed without submitting request
|
||||
|
||||
Reference in New Issue
Block a user