From 6f7bca6eabc5b7b609234dabcd90f62b240cf2f9 Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Tue, 20 Feb 2024 14:32:28 +0100 Subject: [PATCH] adds loading modal to ProfilUpdateView --- public/js/apps/Cis/Profil.js | 4 ++-- public/js/apps/Cis/ProfilUpdateRequests.js | 11 +++++++--- .../Cis/ProfilUpdate/AcceptDenyUpdate.js | 16 +++++++++++++-- .../Cis/ProfilUpdate/ProfilUpdateView.js | 20 ++++++++++++++++--- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/public/js/apps/Cis/Profil.js b/public/js/apps/Cis/Profil.js index 5e772a23c..26897039a 100755 --- a/public/js/apps/Cis/Profil.js +++ b/public/js/apps/Cis/Profil.js @@ -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({
-

Es wurden keine oder mehrere Profile für {{this.notFoundUID}} gefunden

+

Es wurde keine Person mit der UID {{this.notFoundUID}} gefunden

diff --git a/public/js/apps/Cis/ProfilUpdateRequests.js b/public/js/apps/Cis/ProfilUpdateRequests.js index 5132b84bb..5bd4d894e 100755 --- a/public/js/apps/Cis/ProfilUpdateRequests.js +++ b/public/js/apps/Cis/ProfilUpdateRequests.js @@ -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:{ + + } }); diff --git a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js index fbc0ee0c7..ed13eae03 100755 --- a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js +++ b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js @@ -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})); diff --git a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js index e04bf321b..2c0bc1c2e 100644 --- a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js +++ b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js @@ -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{
- +