diff --git a/client/src/App.vue b/client/src/App.vue index 210e0254..3d27aa5b 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -27,6 +27,7 @@ import FullscreenImage from '@/components/FullscreenImage'; import FullscreenInfographic from '@/components/FullscreenInfographic'; import FullscreenVideo from '@/components/FullscreenVideo'; + import DeactivatePerson from '@/components/profile/DeactivatePerson'; import {mapGetters} from 'vuex'; @@ -53,7 +54,8 @@ EditClassNameWizard, FullscreenImage, FullscreenInfographic, - FullscreenVideo + FullscreenVideo, + DeactivatePerson }, computed: { diff --git a/client/src/components/profile/DeactivatePerson.vue b/client/src/components/profile/DeactivatePerson.vue new file mode 100644 index 00000000..756ea2a6 --- /dev/null +++ b/client/src/components/profile/DeactivatePerson.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/client/src/pages/myClass.vue b/client/src/pages/myClass.vue index 7cf4b50e..688d2891 100644 --- a/client/src/pages/myClass.vue +++ b/client/src/pages/myClass.vue @@ -61,7 +61,16 @@ this.changeMember(member, true); }, remove(member) { - this.changeMember(member, false); + this.$store.dispatch('deactivateUser', [ + member.id === this.me.id, // myself + `${member.firstName} ${member.lastName}`, // full name + this.me.selectedClass.name // class name + ]) + .then(() => { + this.changeMember(member, false); + }) + .catch(() => { + }); } }, } diff --git a/client/src/store/index.js b/client/src/store/index.js index 42328442..8cd14dd3 100644 --- a/client/src/store/index.js +++ b/client/src/store/index.js @@ -1,7 +1,7 @@ import Vue from 'vue' import Vuex from 'vuex' -Vue.use(Vuex) +Vue.use(Vuex); // WARNING fixme todo: please do not use this anymore, use the local GraphQL cache export default new Vuex.Store({ @@ -33,7 +33,10 @@ export default new Vuex.Store({ scrollToAssignmentId: '', scrollToAssignmentReady: false, scrollingToAssignment: false, - editModule: false + editModule: false, + modulePayload: [], + modalResolve: () => {}, + modalReject: () => {}, }, getters: { @@ -50,12 +53,21 @@ export default new Vuex.Store({ currentNote: state => state.currentNote, currentNoteParent: state => state.currentNoteParent, noteType: state => state.noteType, + modulePayload: state => state.modulePayload }, actions: { setSpecialContainerClass({commit}, payload) { commit('setSpecialContainerClass', payload); }, + confirmModal({dispatch, state}) { + dispatch('hideModal'); + state.modalResolve(); + }, + cancelModal({dispatch, state}) { + dispatch('hideModal'); + state.modalReject(); + }, hideModal({commit, dispatch}) { document.body.classList.remove('no-scroll'); // won't get at the body any other way commit('setModal', false); @@ -80,6 +92,7 @@ export default new Vuex.Store({ commit('setVimeoId', null); commit('setCurrentNote', null); commit('setNoteType', ''); + commit('setModulePayload', []); }, resetContentBlockPosition({commit}) { commit('setContentBlockPosition', {}); @@ -109,7 +122,12 @@ export default new Vuex.Store({ }, showModal({commit}, payload) { document.body.classList.add('no-scroll'); // won't get at the body any other way + commit('setModal', payload); + return new Promise((resolve, reject) => { + commit('setModalResolve', resolve); + commit('setModalReject', reject); + }) }, addProjectEntry({commit, dispatch}, payload) { commit('setParentProject', payload); @@ -167,8 +185,12 @@ export default new Vuex.Store({ editModule({commit}, payload) { commit('setEditModule', payload) }, - editClassName({commit, dispatch}, payload) { + editClassName({dispatch}, payload) { dispatch('showModal', 'edit-class-name-wizard'); + }, + deactivateUser({commit, dispatch}, payload) { + commit('setModulePayload', payload); + return dispatch('showModal', 'deactivate-person'); } }, @@ -244,6 +266,15 @@ export default new Vuex.Store({ }, setNoteType(state, payload) { state.noteType = payload; + }, + setModulePayload(state, payload) { + state.modulePayload = payload; + }, + setModalResolve(state, payload) { + state.modalResolve = payload; + }, + setModalReject(state, payload) { + state.modalReject = payload; } } })