mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
fixes little bug for View Profil and changes layout of the profil update fetch component
This commit is contained in:
@@ -19,6 +19,7 @@ class Profil extends Auth_Controller
|
||||
'index' => ['student/anrechnung_beantragen:r', 'user:r'], // TODO(chris): permissions?
|
||||
'foto_sperre_function' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
'getView' => ['student/anrechnung_beantragen:r', 'user:r'],
|
||||
'View' => ['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'],
|
||||
@@ -99,11 +100,14 @@ class Profil extends Auth_Controller
|
||||
//? loops over all updateRequests from a user to validate if the new request is valid
|
||||
$res = $this->ProfilChangeModel->loadWhere(["uid"=>$this->uid]);
|
||||
$res = hasData($res) ? getData($res) : null;
|
||||
|
||||
if($res){
|
||||
foreach($res as $update_request){
|
||||
$existing_change = json_decode($update_request->requested_change);
|
||||
|
||||
if(isset($existing_change->$type) && $existing_change->$type == $payload->$type){
|
||||
echo json_encode($existing_change);
|
||||
echo property_exists($existing_change,$type);
|
||||
|
||||
if(property_exists($existing_change,$type) && $existing_change->$type == $payload->$type){
|
||||
//? the kontakt_id / adresse_id of a change has to be unique
|
||||
|
||||
echo json_encode(error("cannot change the same resource twice"));
|
||||
@@ -267,6 +271,7 @@ class Profil extends Auth_Controller
|
||||
}
|
||||
|
||||
|
||||
print_r($telefon_res);
|
||||
|
||||
$res = new stdClass();
|
||||
$res->username = $uid;
|
||||
@@ -303,7 +308,7 @@ class Profil extends Auth_Controller
|
||||
//? Mailverteiler Info
|
||||
$res->mailverteiler = $mailverteiler_res;
|
||||
|
||||
$res->standort_telefon = $telefon_res->kontakt;
|
||||
$res->standort_telefon = isset($telefon_res)? $telefon_res->kontakt : null;
|
||||
|
||||
return $res;
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ export default {
|
||||
//? if the topic was passed through the prop add it to the component
|
||||
this.topic = this.editData.topic;
|
||||
}
|
||||
console.log("here",this.editData);
|
||||
|
||||
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ import Kontakt from "./ProfilComponents/Kontakt.js";
|
||||
import EditKontakt from "./ProfilComponents/EditKontakt.js";
|
||||
import Adresse from "./ProfilComponents/Adresse.js";
|
||||
import EditAdresse from "./ProfilComponents/EditAdresse.js";
|
||||
import Status from "./ProfilComponents/Status.js";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -9,6 +10,7 @@ export default {
|
||||
EditKontakt,
|
||||
Adresse,
|
||||
EditAdresse,
|
||||
Status,
|
||||
},
|
||||
props: {
|
||||
|
||||
@@ -173,7 +175,7 @@ export default {
|
||||
<!-- if it not a normal text input field then reder the custom edit input component -->
|
||||
<!-- custom component is required to emit an profilUpdate event to register the new entered value -->
|
||||
<template v-else>
|
||||
<component @profilUpdate="profilUpdateEmit" :is="view" :data="data"></component>
|
||||
<component @profilUpdate="profilUpdateEmit" :is="view" :data="data" v-bind="list"></component>
|
||||
</template>
|
||||
`,
|
||||
};
|
||||
|
||||
@@ -16,6 +16,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
|
||||
deleteRequest: function(item){
|
||||
|
||||
Vue.$fhcapi.UserData.deleteProfilRequest(item.profil_update_id).then((res)=>{
|
||||
@@ -27,42 +28,46 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
getView: function(topic){
|
||||
getView: function(topic,status){
|
||||
switch(topic){
|
||||
case "Private Kontakte" : return "EditKontakt"; break;
|
||||
case "Private Adressen" : return "EditAdresse"; break;
|
||||
case "Add Adressen" : return "EditAdresse"; break;
|
||||
case "Add Kontakte" : return "EditKontakt"; break;
|
||||
case "Delete Adressen" : return "Adresse"; break;
|
||||
case "Delete Kontakte" : return "Kontakt"; break;
|
||||
case "Delete Adressen" : return status ==='pending'? "Adresse": "Status" ; break;
|
||||
case "Delete Kontakte" : return status ==='pending'? "Kontakt": "Status"; break;
|
||||
default: return "text_input"; break;
|
||||
}
|
||||
},
|
||||
openModal(updateRequest) {
|
||||
console.log(JSON.stringify(updateRequest));
|
||||
|
||||
let view = this.getView(updateRequest.topic);
|
||||
let view = this.getView(updateRequest.topic,updateRequest.status);
|
||||
let data = null;
|
||||
let content =null;
|
||||
if(view === 'text_input'){
|
||||
content={
|
||||
view:view,
|
||||
data:{
|
||||
//TODO: change data handling for text_input component to accept the data in the same way as the other components
|
||||
data = {
|
||||
titel:updateRequest.topic,
|
||||
value:updateRequest.requested_change,
|
||||
},
|
||||
update:true,
|
||||
topic:updateRequest.topic,
|
||||
|
||||
}
|
||||
};
|
||||
}else{
|
||||
content = {
|
||||
view: view,
|
||||
data: updateRequest.requested_change,
|
||||
update:true,
|
||||
topic:updateRequest.topic,
|
||||
|
||||
|
||||
}
|
||||
data = updateRequest.requested_change;
|
||||
}
|
||||
|
||||
content={
|
||||
view:view,
|
||||
data:data,
|
||||
update:true,
|
||||
topic:updateRequest.topic,
|
||||
|
||||
}
|
||||
|
||||
//? adds the status information if the profil update request was rejected or accepted
|
||||
if(updateRequest.status !== 'pending'){
|
||||
content['status']= updateRequest.status;
|
||||
content['status_message']= updateRequest.status_message;
|
||||
content['status_timestamp']=updateRequest.status_timestamp;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +141,12 @@ export default {
|
||||
|
||||
</td>
|
||||
</template>
|
||||
<template v-else-if="item.status === 'accepted'">
|
||||
<td class="align-middle text-center"><i style="color:gray" role="button" @click="openModal(item)" class="fa fa-eye"></i></td>
|
||||
</template>
|
||||
<template v-else-if="item.status === 'rejected'">
|
||||
<td class="align-middle text-center"><i style="color:gray" role="button" @click="openModal(item)" class="fa fa-eye"></i></td>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
export default {
|
||||
|
||||
data(){
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
props:{
|
||||
data:{type:Object},
|
||||
view:{type:String},
|
||||
status:{type:String},
|
||||
status_message:{type:String},
|
||||
status_timestamp:{type:String},
|
||||
update:{type:Boolean},
|
||||
},
|
||||
created(){
|
||||
|
||||
|
||||
},template:`
|
||||
<div class="form-underline mb-2">
|
||||
<div class="form-underline-titel">Status</div>
|
||||
<span class="form-underline-content">{{status}} </span>
|
||||
</div>
|
||||
|
||||
<div v-if="status_message" class="form-underline mb-2 ">
|
||||
<div class="form-underline-titel">Status message</div>
|
||||
<span class="form-underline-content">{{status_message}} </span>
|
||||
</div>
|
||||
|
||||
<div class="form-underline mb-2">
|
||||
<div class="form-underline-titel">Date</div>
|
||||
<span class="form-underline-content">{{status_timestamp}} </span>
|
||||
</div>`,
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user