diff --git a/public/js/apps/Cis/Profil.js b/public/js/apps/Cis/Profil.js index 56ad16746..9df5d42ae 100755 --- a/public/js/apps/Cis/Profil.js +++ b/public/js/apps/Cis/Profil.js @@ -60,10 +60,10 @@ const profilApp = Vue.createApp({ provide() { return { profilUpdateStates: Vue.computed(() => - this.profilUpdateStates ? this.profilUpdateStates : null + this.profilUpdateStates ? this.profilUpdateStates : false ), profilUpdateTopic: Vue.computed(() => - this.profilUpdateTopic ? this.profilUpdateTopic : null + this.profilUpdateTopic ? this.profilUpdateTopic : false ), setLoading: (newValue) => { this.loading = newValue; @@ -364,7 +364,6 @@ const profilApp = Vue.createApp({ Vue.$fhcapi.ProfilUpdate.getTopic() .then((response) => { - console.log("t", response.data); this.profilUpdateTopic = response.data; }) .catch((error) => { diff --git a/public/js/components/Cis/Profil/MitarbeiterProfil.js b/public/js/components/Cis/Profil/MitarbeiterProfil.js index bb3c4e567..41b2c8038 100755 --- a/public/js/components/Cis/Profil/MitarbeiterProfil.js +++ b/public/js/components/Cis/Profil/MitarbeiterProfil.js @@ -220,10 +220,8 @@ export default { //? sorts the profil Updates: pending -> accepted -> rejected this.data.profilUpdates?.sort(this.sortProfilUpdates); }, - + mounted() { - console.log("this mitarbeter",this) - console.log("this p",this.$p) this.$refs.betriebsmittelTable.tabulator.on("tableBuilt", () => { this.$refs.betriebsmittelTable.tabulator.setData(this.data.mittel); }); diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js index 6da5113a9..189dd8f5d 100755 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfil.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfil.js @@ -1,14 +1,14 @@ import BsModal from "../../../Bootstrap/Modal.js"; import Alert from "../../../Bootstrap/Alert.js"; import EditProfilSelect from "./EditProfilSelect.js"; -import Loader from "../../../Loader.js" +import Loader from "../../../Loader.js"; export default { components: { BsModal, Alert, EditProfilSelect, - Loader + Loader, }, mixins: [BsModal], props: { @@ -28,42 +28,40 @@ export default { onShowBsModal: Function, onShownBsModal: Function, }, - + data() { return { topic: null, profilUpdate: null, editData: this.value, - fileID:null, + fileID: null, breadcrumb: null, - loading:false, + loading: false, result: false, info: null, }; }, - inject:["setLoading"], - provide(){ + inject: ["setLoading"], + provide() { return { updateFileID: this.updateFileIDFunction, - } - }, + }; + }, methods: { - - updateFileIDFunction: function(newFileID){ + updateFileIDFunction: function (newFileID) { this.fileID = newFileID; }, async submitProfilChange() { //? check if data is valid before making a request if (this.topic && this.profilUpdate) { - //? if profil update contains any attachment if (this.fileID) { const fileData = await this.uploadFiles(this.fileID); - - this.fileID = fileData? fileData : null; + + this.fileID = fileData ? fileData : null; } //? inserts new row in public.tbl_cis_profil_update @@ -90,66 +88,66 @@ export default { //* v-show on EditProfil modal binded to this.loading //? hides the EditProfil modal and shows the loading modal by calling a callback that was passed as prop from the parent component - this.loading=true; + this.loading = true; this.setLoading(true); - + this.editData.updateID - ? Vue.$fhcapi.ProfilUpdate.updateProfilRequest( + ? Vue.$fhcapi.ProfilUpdate.updateProfilRequest( this.topic, this.profilUpdate, this.editData.updateID, - this.fileID? this.fileID[0]: null - ).then((res) => { - handleApiResponse(res); - }).catch((err) => { - console.error(err); - }) - : Vue.$fhcapi.ProfilUpdate.insertProfilRequest( + this.fileID ? this.fileID[0] : null + ) + .then((res) => { + handleApiResponse(res); + }) + .catch((err) => { + console.error(err); + }) + : Vue.$fhcapi.ProfilUpdate.insertProfilRequest( this.topic, this.profilUpdate, - this.fileID? this.fileID[0]: null - - ).then((res) => { - handleApiResponse(res); - }).catch((err) => { - console.error(err); - }) + this.fileID ? this.fileID[0] : null + ) + .then((res) => { + handleApiResponse(res); + }) + .catch((err) => { + console.error(err); + }); } }, - uploadFiles: async function (files) { - - if (files[0].type !== "application/x.fhc-dms+json"){ + uploadFiles: async function (files) { + if (files[0].type !== "application/x.fhc-dms+json") { let formData = new FormData(); formData.append("files[]", files[0]); - const result = this.editData.updateID ? - //? updating old attachment by replacing - //* second parameter of api request insertFile checks if the file has to be replaced or not - await Vue.$fhcapi.ProfilUpdate.insertFile(formData,this.editData.updateID).then(res => { - return res.data?.map((file) => file.dms_id); - }) - - : - //? fresh insert of new attachment - await Vue.$fhcapi.ProfilUpdate.insertFile(formData).then(res => { - return res.data?.map((file) => file.dms_id); - }) + const result = this.editData.updateID + ? //? updating old attachment by replacing + //* second parameter of api request insertFile checks if the file has to be replaced or not + await Vue.$fhcapi.ProfilUpdate.insertFile( + formData, + this.editData.updateID + ).then((res) => { + return res.data?.map((file) => file.dms_id); + }) + : //? fresh insert of new attachment + await Vue.$fhcapi.ProfilUpdate.insertFile(formData).then((res) => { + return res.data?.map((file) => file.dms_id); + }); return result; - }else{ + } else { //? attachment hasn't been replaced return false; } - }, }, computed: {}, created() { - if (this.editData.topic) { //? if the topic was passed through the prop add it to the component this.topic = this.editData.topic; } - }, mounted() { this.modal = this.$refs.modalContainer.modal; @@ -157,7 +155,7 @@ export default { popup(options) { return BsModal.popup.bind(this)(null, options); }, - template: /*html*/` + template: /*html*/ ` -