import BsModal from "../../Bootstrap/Modal.js"; import Alert from "../../Bootstrap/Alert.js"; import Kontakt from "../Profil/ProfilComponents/Kontakt.js"; import Adresse from "../Profil/ProfilComponents/Adresse.js"; import ApiProfilUpdate from '../../../api/factory/profilUpdate.js'; export default { components: { BsModal, Kontakt, Adresse, }, inject: ["profilUpdateStates"], mixins: [BsModal], props: { title: { type: String, }, value: { type: Object, }, setLoading: { type: Function, }, /* * NOTE(chris): * Hack to expose in "emits" declared events to $props which we use * in the v-bind directive to forward all events. * @see: https://github.com/vuejs/core/issues/3432 */ onHideBsModal: Function, onHiddenBsModal: Function, onHidePreventedBsModal: Function, onShowBsModal: Function, onShownBsModal: Function, }, data() { return { data: this.value, loading: false, result: false, info: null, files: null, }; }, methods: { getProfilStatus: async function () { return ( FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + `/Cis/ProfilUpdate/show/${dms_id}` ); }, getDocumentLink: function (dms_id) { return ( FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + `/Cis/ProfilUpdate/show/${dms_id}` ); }, handleRequest: function (type) { this.loading = true; this.setLoading(true); this.$api .call(ApiProfilUpdate[ type.toLowerCase() == "accept" ? "acceptProfilRequest" : "denyProfilRequest" ](this.data)) .then((res) => { this.result = true; }) .catch((e) => this.$fhcAlert.handleSystemError) .finally(() => { this.setLoading(false); this.loading = false; this.hide(); }); }, }, computed: { getComponentView: function () { if (this.data.topic.toLowerCase().includes("kontakt")) { return "kontakt"; } else if (this.data.topic.toLowerCase().includes("adresse")) { return "adresse"; } else { return "text_input"; } }, }, created() { // only fetching the profilUpdate Attachemnts if the profilUpdate actually has attachments if (this.value.attachment_id) { this.$api .call(ApiProfilUpdate.getProfilRequestFiles( this.data.profil_update_id )) .then((res) => { this.files = res.data; }); } }, mounted() { this.modal = this.$refs.modalContainer.modal; }, popup(options) { return BsModal.popup.bind(this)(null, options); }, template: /*html*/ ` `, };