mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
hotfix, editProfil modal in fetchProfilUpdates component
This commit is contained in:
@@ -246,7 +246,7 @@ class Profil extends Auth_Controller
|
||||
if ($nation == "A") {
|
||||
if (isset($zip) && $zip > 999 && $zip < 32000) {
|
||||
|
||||
$gemeinde_res = $this->GemeindeModel->loadWhere(['ortschaftskennziffer' => $zip]);
|
||||
$gemeinde_res = $this->GemeindeModel->loadWhere(['plz' => $zip]);
|
||||
if (isError($gemeinde_res)) {
|
||||
show_error("error while trying to query bis.tbl_gemeinde");
|
||||
}
|
||||
|
||||
@@ -148,11 +148,36 @@ const profilApp = Vue.createApp({
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return this.data.kontakte.filter(kontakt => {
|
||||
return kontakt.zustellung;
|
||||
}).map(kon =>{
|
||||
return kon.kontakt_id;
|
||||
});
|
||||
|
||||
//TODO counting the zustellKontakte/Adresse does not work correctly
|
||||
/* let kontakteArray = [];
|
||||
|
||||
if(this.data.profilUpdates.length){
|
||||
kontakteArray = kontakteArray.concat(this.data.profilUpdates.filter((update)=>
|
||||
{
|
||||
|
||||
return update.requested_change.zustellung;
|
||||
}).map((kontant)=>{
|
||||
return kontant.requested_change.kontakt_id
|
||||
}))
|
||||
|
||||
}
|
||||
|
||||
if(!this.data.profilUpdates.length || !this.data.kontakte.every(kontakt=> this.data.profilUpdates.some(update=>update.requested_change.kontakt_id == kontakt.kontakt_id))){
|
||||
kontakteArray = kontakteArray.concat(this.data.kontakte.filter(kontakt => {
|
||||
return kontakt.zustellung;
|
||||
}).map(kon =>{
|
||||
return kon.kontakt_id;
|
||||
}));
|
||||
}
|
||||
|
||||
return [...(new Set(kontakteArray))]; */
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
@@ -234,13 +259,13 @@ const profilApp = Vue.createApp({
|
||||
data:kontakt
|
||||
}})
|
||||
},
|
||||
Password_Change : {
|
||||
title:"Passwort Ändern",
|
||||
view:"ChangePassword",
|
||||
data:{
|
||||
test:"testvalue",
|
||||
}
|
||||
},
|
||||
// Password_Change : {
|
||||
// title:"Passwort Ändern",
|
||||
// view:"ChangePassword",
|
||||
// data:{
|
||||
// test:"testvalue",
|
||||
// }
|
||||
// },
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
@@ -174,7 +174,6 @@ export default {
|
||||
|
||||
fetchProfilUpdates: function(){
|
||||
Vue.$fhcapi.ProfilUpdate.selectProfilRequest().then((res)=>{
|
||||
|
||||
if(!res.error){
|
||||
this.data.profilUpdates = res.data?.length ? res.data.sort(this.sortProfilUpdates) : null ;
|
||||
}
|
||||
@@ -240,6 +239,7 @@ export default {
|
||||
|
||||
template: /*html*/`
|
||||
<div class="container-fluid text-break fhc-form" >
|
||||
|
||||
<edit-profil v-if="showModal" ref="editModal" @hideBsModal="hideEditProfilModal" :value="JSON.parse(JSON.stringify(editData))" title="Profil bearbeiten"></edit-profil>
|
||||
<div class="row">
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import EditProfil from "../ProfilModal/EditProfil.js";
|
||||
//? EditProfil is the modal used to edit the profil updates
|
||||
export default {
|
||||
components:{EditProfil},
|
||||
props: {
|
||||
data: {
|
||||
type: Object,
|
||||
@@ -10,9 +11,93 @@ export default {
|
||||
|
||||
emits: ["fetchUpdates"],
|
||||
data() {
|
||||
return {};
|
||||
return {
|
||||
showUpdateModal:false,
|
||||
content:null,
|
||||
editProfilTitle:"Profil bearbeiten",
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
hideEditProfilModal: function(){
|
||||
|
||||
//? checks the editModal component property result, if the user made a successful request or not
|
||||
if(this.$refs.updateEditModal.result){
|
||||
this.$emit("fetchUpdates");
|
||||
}else{
|
||||
// when modal was closed without submitting request
|
||||
}
|
||||
this.showUpdateModal=false;
|
||||
|
||||
},
|
||||
|
||||
async showEditProfilModal(updateRequest) {
|
||||
let view = this.getView(updateRequest.topic, updateRequest.status);
|
||||
|
||||
let data = null;
|
||||
let content = null;
|
||||
let files = null;
|
||||
let withFiles = false;
|
||||
|
||||
if (view === "TextInputDokument") {
|
||||
data = {
|
||||
titel: updateRequest.topic,
|
||||
value: updateRequest.requested_change.value,
|
||||
};
|
||||
|
||||
const filesFromDatabase = await Vue.$fhcapi.ProfilUpdate.getProfilRequestFiles(updateRequest.profil_update_id).then(res=>{
|
||||
return res.data;
|
||||
});
|
||||
|
||||
files= filesFromDatabase;
|
||||
if(files){
|
||||
withFiles = true;
|
||||
}
|
||||
} else {
|
||||
data = updateRequest.requested_change;
|
||||
}
|
||||
|
||||
content = {
|
||||
updateID: updateRequest.profil_update_id,
|
||||
view: view,
|
||||
data: data,
|
||||
withFiles: withFiles,
|
||||
topic: updateRequest.topic,
|
||||
files: files,
|
||||
|
||||
};
|
||||
|
||||
//?TODO: check if updateRequest.uid is a mitarbeiter, if so add the flag isMitarbeiter:true
|
||||
if(view === "EditAdresse"){
|
||||
const isMitarbeiter = await Vue.$fhcapi.UserData.isMitarbeiter(updateRequest.uid).then(res => res.data);
|
||||
|
||||
if(isMitarbeiter){
|
||||
content['isMitarbeiter']=isMitarbeiter;
|
||||
}
|
||||
}
|
||||
|
||||
//? 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;
|
||||
}
|
||||
|
||||
//? update data of the reactive content
|
||||
this.content = content;
|
||||
this.editProfilTitle = updateRequest.topic;
|
||||
|
||||
//? only show the popup if also the right content is available
|
||||
if (content) {
|
||||
this.showUpdateModal = true;
|
||||
// after a state change, wait for the DOM updates to complete
|
||||
Vue.nextTick(()=>{
|
||||
this.$refs.updateEditModal.show();
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
deleteRequest: function (item) {
|
||||
Vue.$fhcapi.ProfilUpdate.deleteProfilRequest(item.profil_update_id).then(
|
||||
(res) => {
|
||||
@@ -55,6 +140,9 @@ export default {
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
// OLD way to open the editProfil modal, which was dynamically added to the html and then removed
|
||||
async openModal(updateRequest) {
|
||||
let view = this.getView(updateRequest.topic, updateRequest.status);
|
||||
|
||||
@@ -126,15 +214,20 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
created() {
|
||||
|
||||
|
||||
},
|
||||
computed: {},
|
||||
template: `
|
||||
<div class="card text-nowrap" >
|
||||
<div class="card " >
|
||||
|
||||
<edit-profil v-if="showUpdateModal" ref="updateEditModal" @hideBsModal="hideEditProfilModal" :value="content" :title="editProfilTitle"></edit-profil>
|
||||
<div class="card-header">
|
||||
Profil Updates
|
||||
</div>
|
||||
<div class="card-body" >
|
||||
<div class="table-responsive">
|
||||
<div class="table-responsive text-nowrap">
|
||||
<table class="m-0 table table-hover">
|
||||
<thead >
|
||||
<tr >
|
||||
@@ -155,11 +248,11 @@ export default {
|
||||
|
||||
<div class="d-flex flex-row justify-content-evenly">
|
||||
<template v-if="item.topic.toLowerCase().includes('delete')">
|
||||
<div class="align-middle text-center"><i role="button" @click="openModal(item)" class="fa fa-eye"></i></div>
|
||||
<div class="align-middle text-center"><i role="button" @click="showEditProfilModal(item)" class="fa fa-eye"></i></div>
|
||||
</template>
|
||||
|
||||
<template v-else >
|
||||
<div class="align-middle text-center" ><i style="color:#00639c" @click="openModal(item)" role="button" class="fa fa-edit"></i></div>
|
||||
<div class="align-middle text-center" ><i style="color:#00639c" @click="showEditProfilModal(item)" role="button" class="fa fa-edit"></i></div>
|
||||
</template>
|
||||
|
||||
<div class="align-middle text-center"><i style="color:red" role="button" @click="deleteRequest(item)" class="fa fa-trash"></i></div>
|
||||
@@ -172,7 +265,7 @@ export default {
|
||||
|
||||
<td class="align-middle text-center">
|
||||
<div class="d-flex flex-row justify-content-evenly">
|
||||
<i role="button" @click="openModal(item)" class="fa fa-eye"></i>
|
||||
<i role="button" @click="showEditProfilModal(item)" class="fa fa-eye"></i>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
@@ -54,6 +54,8 @@ export default {
|
||||
}
|
||||
|
||||
this.$emit('profilUpdate',this.isChanged?this.data:null);
|
||||
// update the zustellAdressen count
|
||||
this.zustellAdressenCount = this.getZustelladressenCount();
|
||||
},
|
||||
},
|
||||
|
||||
@@ -95,7 +97,6 @@ export default {
|
||||
template:/*html*/`
|
||||
<div class="gy-3 row justify-content-center align-items-center">
|
||||
|
||||
|
||||
<!-- warning message for too many zustellungs Adressen -->
|
||||
<div v-if="showZustellAdressenWarning" class="col-12 ">
|
||||
<div class="card bg-danger mx-2">
|
||||
|
||||
@@ -14,6 +14,10 @@ export default {
|
||||
},
|
||||
inject:["getZustellkontakteCount"],
|
||||
methods:{
|
||||
|
||||
getNewKontanteCount:function(){
|
||||
console.log(this.getZustellkontakteCount());
|
||||
},
|
||||
updateValue: function(event,bind){
|
||||
|
||||
if(bind === 'zustellung'){
|
||||
@@ -25,12 +29,13 @@ export default {
|
||||
|
||||
|
||||
this.$emit('profilUpdate',this.isChanged?this.data:null);
|
||||
|
||||
this.zustellKontakteCount = this.getZustellkontakteCount();
|
||||
|
||||
},
|
||||
},
|
||||
computed:{
|
||||
showZustellKontakteWarning: function(){
|
||||
|
||||
if(this.zustellKontakteCount){
|
||||
|
||||
if(this.zustellKontakteCount.includes(this.data.kontakt_id)){
|
||||
@@ -61,8 +66,7 @@ export default {
|
||||
`
|
||||
|
||||
<div class="gy-3 row align-items-center justify-content-center">
|
||||
|
||||
|
||||
|
||||
<!-- warning message for too many zustellungs Kontakte -->
|
||||
<div v-if="showZustellKontakteWarning" class="col-12 ">
|
||||
<div class="card bg-danger mx-2">
|
||||
|
||||
Reference in New Issue
Block a user