mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
changes how the EditProfil Modal passes props to its children
This commit is contained in:
@@ -268,7 +268,7 @@ class ProfilUpdate extends Auth_Controller
|
||||
if(isset($id)) $whereClause['id'] = $id;
|
||||
|
||||
$res= $this->ProfilUpdateModel->getProfilUpdatesWhere($whereClause);
|
||||
|
||||
$res = hasData($res) ? getData($res) : null;
|
||||
echo json_encode($res);
|
||||
|
||||
}
|
||||
@@ -314,6 +314,10 @@ class ProfilUpdate extends Auth_Controller
|
||||
|
||||
//? loops over all updateRequests from a user to validate if the new request is valid
|
||||
$res = $this->ProfilUpdateModel->getProfilUpdatesWhere(["uid"=>$this->uid]);
|
||||
if(isError($res)){
|
||||
show_error("Error occured while querying the profil update requests of UID: ".$uid);
|
||||
}
|
||||
$res = hasData($res)? getData($res):null;
|
||||
|
||||
//? the user cannot delete a zustelladresse/kontakt
|
||||
if( isset($payload->delete) && $payload->{$identifier=="kontakt_id"? "zustellung":"zustelladresse"}){
|
||||
|
||||
@@ -70,6 +70,7 @@ class Profil_update_model extends DB_Model
|
||||
$this->formatProfilRequest($request);
|
||||
}
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
|
||||
|
||||
@media (max-width: 991px) {
|
||||
|
||||
.md-invisible{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
|
||||
.lg-invisible{
|
||||
display:none;
|
||||
}
|
||||
}
|
||||
|
||||
.image-lock{
|
||||
height:22px;
|
||||
|
||||
@@ -16,7 +16,6 @@ export default {
|
||||
title: String,
|
||||
zustelladressenCount: Function,
|
||||
zustellkontakteCount: Function,
|
||||
setLoading:Function,
|
||||
/*
|
||||
* NOTE(chris):
|
||||
* Hack to expose in "emits" declared events to $props which we use
|
||||
@@ -43,12 +42,10 @@ export default {
|
||||
info: null,
|
||||
};
|
||||
},
|
||||
|
||||
inject:["setLoading"],
|
||||
provide(){
|
||||
return {
|
||||
updateFileID: this.updateFileIDFunction,
|
||||
zustellAdresseCount:this.zustelladressenCount,
|
||||
zustellKontaktCount:this.zustellkontakteCount,
|
||||
}
|
||||
},
|
||||
|
||||
@@ -164,13 +161,10 @@ export default {
|
||||
{{title }}
|
||||
</template>
|
||||
<template v-slot:default>
|
||||
|
||||
<div >
|
||||
|
||||
<nav aria-label="breadcrumb" class="ps-2 ">
|
||||
<ol class="breadcrumb ">
|
||||
<li class="breadcrumb-item" v-for="element in breadcrumb">{{element}}</li>
|
||||
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ export default {
|
||||
RoleInformation,
|
||||
ProfilInformation,
|
||||
},
|
||||
inject: ['sortProfilUpdates','collapseFunction','getZustellkontakteCount','getZustelladressenCount','setLoading'],
|
||||
inject: ['sortProfilUpdates','collapseFunction'],
|
||||
data() {
|
||||
return {
|
||||
|
||||
showModal:false,
|
||||
|
||||
funktionen_table_options: {
|
||||
height: 300,
|
||||
@@ -139,7 +139,38 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
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()
|
||||
.then((request) =>{
|
||||
if(!request.error){
|
||||
this.data.profilUpdates = request.data;
|
||||
this.data.profilUpdates.sort(this.sortProfilUpdates);
|
||||
|
||||
}else{
|
||||
console.log("Error when fetching profile updates: " +res.data);
|
||||
}
|
||||
})
|
||||
.catch(err=>{
|
||||
console.log(err);
|
||||
});
|
||||
}else{
|
||||
// when modal was closed without submitting request
|
||||
}
|
||||
this.showModal=false;
|
||||
|
||||
},
|
||||
|
||||
showEditProfilModal() {
|
||||
this.showModal = true;
|
||||
// after a state change, wait for the DOM updates to complete
|
||||
Vue.nextTick(()=>{
|
||||
this.$refs.editModal.show();
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
fetchProfilUpdates: function(){
|
||||
Vue.$fhcapi.ProfilUpdate.selectProfilRequest().then((res)=>{
|
||||
@@ -149,42 +180,7 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
showModal() {
|
||||
|
||||
EditProfil.popup({
|
||||
value:JSON.parse(JSON.stringify(this.editData)),
|
||||
zustelladressenCount:this.getZustelladressenCount,
|
||||
zustellkontakteCount:this.getZustellkontakteCount,
|
||||
title:"Profil bearbeiten",
|
||||
setLoading:this.setLoading,
|
||||
|
||||
}).then((popup_result) => {
|
||||
|
||||
if(popup_result){
|
||||
Vue.$fhcapi.ProfilUpdate.selectProfilRequest()
|
||||
.then((res) =>{
|
||||
if(!res.error){
|
||||
this.data.profilUpdates = res.data;
|
||||
this.data.profilUpdates.sort(this.sortProfilUpdates);
|
||||
|
||||
}else{
|
||||
console.log("Error when fetching profile updates: " +res.data);
|
||||
}
|
||||
})
|
||||
.catch(err=>{
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}).catch((e) => {
|
||||
console.log("catch");
|
||||
// Wenn der User das Modal abbricht ohne Änderungen
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
computed: {
|
||||
@@ -244,7 +240,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">
|
||||
|
||||
<div class="d-md-none col-12 ">
|
||||
@@ -260,7 +256,7 @@ export default {
|
||||
|
||||
<div class="row mb-3 ">
|
||||
<div class="col">
|
||||
<button @click="showModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
|
||||
<button @click="showEditProfilModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<i class="fa fa-edit"></i>
|
||||
@@ -423,7 +419,7 @@ export default {
|
||||
|
||||
<div class="row d-none d-md-block ">
|
||||
<div class="col mb-3">
|
||||
<button @click="showModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
|
||||
<button @click="showEditProfilModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
|
||||
<div class="row">
|
||||
<div class="col-auto">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
inject:["zustellAdresseCount"],
|
||||
inject:["getZustelladressenCount"],
|
||||
data(){
|
||||
return{
|
||||
gemeinden:[],
|
||||
@@ -88,7 +88,7 @@ export default {
|
||||
|
||||
|
||||
this.originalValue = JSON.stringify(this.data);
|
||||
this.zustellAdressenCount = this.zustellAdresseCount();
|
||||
this.zustellAdressenCount = this.getZustelladressenCount();
|
||||
|
||||
},
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export default {
|
||||
|
||||
}
|
||||
},
|
||||
inject:["zustellKontaktCount"],
|
||||
inject:["getZustellkontakteCount"],
|
||||
methods:{
|
||||
updateValue: function(event,bind){
|
||||
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
|
||||
|
||||
this.originalValue = JSON.stringify(this.data);
|
||||
this.zustellKontakteCount = this.zustellKontaktCount();
|
||||
this.zustellKontakteCount = this.getZustellkontakteCount();
|
||||
},
|
||||
template:
|
||||
/*html*/
|
||||
|
||||
@@ -22,12 +22,13 @@ export default {
|
||||
RoleInformation,
|
||||
ProfilInformation,
|
||||
FetchProfilUpdates,
|
||||
EditProfil
|
||||
|
||||
},
|
||||
inject:['sortProfilUpdates','collapseFunction','getZustellkontakteCount','getZustelladressenCount','setLoading'],
|
||||
inject:['sortProfilUpdates','collapseFunction'],
|
||||
data() {
|
||||
return {
|
||||
|
||||
showModal: false,
|
||||
collapseIconBetriebsmittel: true,
|
||||
zutrittsgruppen_table_options: {
|
||||
height: 200,
|
||||
@@ -92,30 +93,37 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
showModal() {
|
||||
|
||||
EditProfil.popup({
|
||||
value:JSON.parse(JSON.stringify(this.editData)),
|
||||
title:"Profil bearbeiten",
|
||||
zustelladressenCount:this.getZustelladressenCount,
|
||||
zustellkontakteCount:this.getZustellkontakteCount,
|
||||
setLoading:this.setLoading,
|
||||
}).then((popup_result) => {
|
||||
if(popup_result){
|
||||
Vue.$fhcapi.ProfilUpdate.selectProfilRequest()
|
||||
.then((res) =>{
|
||||
if(!res.error){
|
||||
this.data.profilUpdates = res.data.sort(this.sortProfilUpdates);
|
||||
}else{
|
||||
alert("Error when fetching profile updates: " +res.data);
|
||||
}
|
||||
})
|
||||
.catch(err=>alert(err));
|
||||
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()
|
||||
.then((request) =>{
|
||||
if(!request.error){
|
||||
this.data.profilUpdates = request.data;
|
||||
this.data.profilUpdates.sort(this.sortProfilUpdates);
|
||||
|
||||
}else{
|
||||
console.log("Error when fetching profile updates: " +res.data);
|
||||
}
|
||||
}).catch((e) => {
|
||||
// Wenn der User das Modal abbricht ohne Änderungen
|
||||
|
||||
})
|
||||
.catch(err=>{
|
||||
console.log(err);
|
||||
});
|
||||
}else{
|
||||
// when modal was closed without submitting request
|
||||
}
|
||||
this.showModal=false;
|
||||
|
||||
},
|
||||
|
||||
showEditProfilModal() {
|
||||
this.showModal = true;
|
||||
// after a state change, wait for the DOM updates to complete
|
||||
Vue.nextTick(()=>{
|
||||
this.$refs.editModal.show();
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
@@ -185,6 +193,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>
|
||||
<!-- ROW -->
|
||||
<div class="row">
|
||||
<!-- HIDDEN QUICK LINKS -->
|
||||
@@ -201,7 +210,7 @@ export default {
|
||||
|
||||
<div class="row ">
|
||||
<div class="col mb-3">
|
||||
<button @click="showModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
|
||||
<button @click="showEditProfilModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<i class="fa fa-edit"></i>
|
||||
@@ -387,7 +396,7 @@ export default {
|
||||
|
||||
<div class="row d-none d-md-block">
|
||||
<div class="col mb-3">
|
||||
<button @click="showModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
|
||||
<button @click="showEditProfilModal" type="button" class="text-start w-100 btn btn-outline-secondary" >
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
<i class="fa fa-edit"></i>
|
||||
|
||||
Reference in New Issue
Block a user