@@ -176,8 +185,9 @@ export default {
-
-
+
+
+
`,
};
diff --git a/public/js/components/Cis/Profil/MitarbeiterProfil.js b/public/js/components/Cis/Profil/MitarbeiterProfil.js
index 8b58970d5..4b99c8eed 100755
--- a/public/js/components/Cis/Profil/MitarbeiterProfil.js
+++ b/public/js/components/Cis/Profil/MitarbeiterProfil.js
@@ -10,7 +10,7 @@ import QuickLinks from "./ProfilComponents/QuickLinks.js";
import ProfilEmails from "./ProfilComponents/ProfilEmails.js"
import RoleInformation from "./ProfilComponents/RoleInformation.js";
import ProfilInformation from "./ProfilComponents/ProfilInformation.js";
-import Dms from "../../Form/Upload/Dms.js";
+
export default {
components: {
@@ -25,13 +25,10 @@ export default {
ProfilEmails,
RoleInformation,
ProfilInformation,
- Dms,
},
data() {
return {
- //? used for dms component
- dmsData:[],
funktionen_table_options: {
@@ -142,30 +139,8 @@ export default {
methods: {
- testUpdload: function(){
- let formData = new FormData();
- for(let i = 0; i < this.dmsData.length; i++){
-
- formData.append("files[]",this.dmsData[i]);
- }
-
- Vue.$fhcapi.UserData.insertFile(formData).then(res => {
- console.log(res);
- }).catch(err=>{
- console.log(err);
- })
- },
+
- //! delete later
- stringifyFile(file) {
- return JSON.stringify({
- lastModified: file.lastModified,
- lastModifiedDate: file.lastModifiedDate,
- name: file.name,
- size: file.size,
- type: file.type
- });
- },
fetchProfilUpdates: function(){
@@ -277,14 +252,17 @@ export default {
vorname: {
title:"vorname",
- view:"text_input",
+ view:"TextInputDokument",
+ withFiles:true,
data:{
titel:"vorname",
value:this.data.vorname,
+
}},
nachname: {
title:"nachname",
- view:"text_input",
+ view:"TextInputDokument",
+ withFiles:true,
data:{
titel:"nachname",
value:this.data.nachname,
@@ -292,7 +270,8 @@ export default {
},
titel:{
title:"titel",
- view:"text_input",
+ view:"TextInputDokument",
+ withFiles:true,
data:{
titel:"titel",
value:this.data.titel,
@@ -300,7 +279,8 @@ export default {
},
postnomen:{
title:"postnomen",
- view:"text_input",
+ view:"TextInputDokument",
+ withFiles:true,
data:{
titel:"postnomen",
value:this.data.postnomen,
@@ -346,9 +326,7 @@ export default {
template: `
-
{{JSON.stringify(Array.from(dmsData).map(item=>{return stringifyFile(item);}),null,2)}}
-
-
+
diff --git a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js
index 4a145e268..ecc997c48 100755
--- a/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js
+++ b/public/js/components/Cis/Profil/ProfilComponents/FetchProfilUpdates.js
@@ -36,7 +36,7 @@ export default {
case "Add Kontakte" : return status ==='pending'? "EditKontakt": "Status"; break;
case "Delete Adressen" : return status ==='pending'? "Adresse": "Status" ; break;
case "Delete Kontakte" : return status ==='pending'? "Kontakt": "Status"; break;
- default: return status ==='pending'? "text_input": "Status"; break;
+ default: return status ==='pending'? "TextInputDokument": "Status"; break;
}
},
openModal(updateRequest) {
@@ -45,27 +45,40 @@ export default {
let data = null;
let content =null;
- if(view === "text_input"){
-
+
+ if(view === "TextInputDokument"){
+ // this should be the files : updateRequest.requested_change.files
data = {
titel:updateRequest.topic,
- value: updateRequest.requested_change,
+ value: updateRequest.requested_change.value,
+
};
+
+
+
}
else{
data = updateRequest.requested_change;
}
-
+ const exampleFile = updateRequest.requested_change.files.map(file=>{return new File(["files[]"], file.name);})
+ const exampleFileList = new DataTransfer();
+ exampleFile.forEach(file => {
+ exampleFileList.items.add(file);
+ })
+
content={
view:view,
data:data,
+ withFiles:view==="TextInputDokument" ? true:false,
update:true,
topic:updateRequest.topic,
+ files: view==="TextInputDokument" ? exampleFileList.files:null,
}
+
//? adds the status information if the profil update request was rejected or accepted
if(updateRequest.status !== 'pending'){
content['status']= updateRequest.status;
diff --git a/public/js/components/Cis/Profil/ProfilComponents/Status.js b/public/js/components/Cis/Profil/ProfilComponents/Status.js
index 0092f984e..d9277145f 100755
--- a/public/js/components/Cis/Profil/ProfilComponents/Status.js
+++ b/public/js/components/Cis/Profil/ProfilComponents/Status.js
@@ -71,10 +71,16 @@ export default {
{{cardHeader}}
-
diff --git a/public/js/components/Cis/Profil/ProfilComponents/TextInputDokument.js b/public/js/components/Cis/Profil/ProfilComponents/TextInputDokument.js
new file mode 100644
index 000000000..4312d9747
--- /dev/null
+++ b/public/js/components/Cis/Profil/ProfilComponents/TextInputDokument.js
@@ -0,0 +1,93 @@
+import Dms from "../../../Form/Upload/Dms.js";
+
+
+export default {
+ data(){
+ return {
+ dmsData:[],
+ originalValue:null,
+ originalFiles:null,
+ }
+ },
+ components:{
+ Dms,
+ },
+ props:{
+
+ data:{
+ type:Object,
+ },
+ withFiles:{
+ type:Boolean,
+ default:false,
+ },
+ files:{
+ type:FileList,
+ },
+ update:{
+ type:Boolean,
+ }
+ },
+ computed: {
+ isChanged: function(){
+ if(this.update ){
+ if(this.originalFiles !== this.dmsData || this.originalValue !== JSON.stringify(this.data)){
+ return true;
+ }else{
+ return false;
+ }
+ }else{
+ //? controls whether the user is allowed to send the profil update or not
+ if(this.withFiles && !this.dmsData.length) {return false;}
+ return JSON.stringify(this.data) !== Vue.toRaw(this.originalValue);
+ }
+
+ }
+
+ },
+ emits:["profilUpdate"],
+ watch: {
+ //? watcher to trigger the event emit when a file was uploaded or removed
+ dmsData(value) {
+ this.emitChanges();
+ console.log("dmsData",this.dmsData);
+ console.log("original files",Vue.toRaw(this.originalFiles));
+ console.log("compare",this.dmsData == Vue.toRaw(this.originalFiles));
+ }
+ },
+ methods:{
+
+ emitChanges: function(){
+ if(this.isChanged){
+
+ this.$emit('profilUpdate', this.withFiles?{value:this.data.value, files:this.dmsData}:{value:this.data.value});
+ }else{
+
+ this.$emit('profilUpdate',null);
+ }
+ },
+
+ },
+ created(){
+
+ this.originalValue = JSON.stringify(this.data);
+ this.originalFiles = this.files;
+
+ if(this.files){
+ this.dmsData = this.files;
+ }
+
+ },
+ template:`
+
+
+ `,
+}
\ No newline at end of file
diff --git a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js
index f7cd05e31..e3b86d548 100755
--- a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js
+++ b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js
@@ -98,7 +98,7 @@ export default {
},
},
created() {
- console.log("data passed as prop",this.data);
+
},
mounted() {
@@ -181,12 +181,17 @@ export default {