adds loading modal to ProfilUpdateView

This commit is contained in:
SimonGschnell
2024-02-20 14:32:28 +01:00
parent 47abce4aad
commit 6f7bca6eab
4 changed files with 41 additions and 10 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ const testapp = Vue.createApp({
provide() {
return {
setLoading: (newValue)=>{
console.log(this);
this.loading = newValue;
},
getZustellkontakteCount: this.zustellKontakteCount,
@@ -273,7 +273,7 @@ const testapp = Vue.createApp({
<div v-if="notFoundUID">
<h3>Es wurden keine oder mehrere Profile für {{this.notFoundUID}} gefunden</h3>
<h3>Es wurde keine Person mit der UID {{this.notFoundUID}} gefunden</h3>
</div>
<div v-else>
+8 -3
View File
@@ -1,18 +1,23 @@
import fhcapifactory from "../api/fhcapifactory.js";
import ProfilUpdateView from "../../components/Cis/ProfilUpdate/ProfilUpdateView.js";
Vue.$fhcapi = fhcapifactory;
const app = Vue.createApp({
components: {
['profil-update-view']:ProfilUpdateView
['profil-update-view']:ProfilUpdateView,
},
data() {
return {
}
},
},methods:{
}
});
@@ -19,6 +19,10 @@ export default {
value: {
type: Object,
},
setLoading:{
type: Function,
},
/*
* NOTE(chris):
* Hack to expose in "emits" declared events to $props which we use
@@ -34,6 +38,7 @@ export default {
data() {
return {
data: this.value,
loading: false,
//? result is returned from the Promise when the modal is closed
result: false,
info: null,
@@ -48,7 +53,11 @@ export default {
`/Cis/ProfilUpdate/show/${dms_id}`;
},
acceptRequest: function () {
this.loading = true;
this.setLoading(true);
Vue.$fhcapi.ProfilUpdate.acceptProfilRequest(this.data).then((res) => {
this.setLoading(false);
this.loading = false;
this.result = true;
}).catch((e) => {
Alert.popup(Vue.h('div',{innerHTML:e.response.data}));
@@ -56,9 +65,12 @@ export default {
this.hide();
},
denyRequest: function () {
denyRequest: async function () {
this.loading = true;
this.setLoading(true);
Vue.$fhcapi.ProfilUpdate.denyProfilRequest(this.data).then((res) => {
this.setLoading(false);
this.loading = false;
this.result = true;
}).catch((e) => {
Alert.popup(Vue.h('div',{innerHTML:e.response.data}));
@@ -2,6 +2,7 @@
import { CoreFilterCmpt } from "../../filter/Filter.js";
import AcceptDenyUpdate from "./AcceptDenyUpdate.js";
import Alert from "../../../components/Bootstrap/Alert.js";
import Loading from "../../../components/Loader.js";
const sortProfilUpdates = (ele1, ele2) => {
@@ -25,6 +26,7 @@ const sortProfilUpdates = (ele1, ele2) => {
export default{
components: {
CoreFilterCmpt,
Loading,
},
props:{
id:{
@@ -33,7 +35,7 @@ export default{
},
data() {
return {
loading:false,
showAll: false,
events:[],
profil_update_id:Number(this.id),
@@ -234,9 +236,12 @@ export default{
},
},
methods: {
setLoading: function(newValue){
this.loading = newValue;
},
showModal: function (value) {
AcceptDenyUpdate.popup({ value: value })
AcceptDenyUpdate.popup({ value: value, setLoading:this.setLoading })
.then((res) => {
//? refetches the data, if any request was denied or accepted
@@ -253,6 +258,15 @@ export default{
sessionStorage.setItem("showAll", event.target.value);
},
},
watch:{
loading: function(newValue, oldValue){
if(newValue){
this.$refs.loadingModalRef.show();
}else{
this.$refs.loadingModalRef.hide();
}
}
},
mounted() {
@@ -289,7 +303,7 @@ export default{
</div>
<loading ref="loadingModalRef" :timeout="0"></loading>
<core-filter-cmpt title="Update Requests" ref="UpdatesTable" :tabulatorEvents="events" :tabulator-options="profil_updates_table_options" tableOnly :sideMenu="false" />