mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-19 16:02:15 +00:00
add fileupload to edit address for meldezettel upload
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { replaceRelativeLegacyLink } from "../../../../helpers/LegacyLinkReplaceHelper.js"
|
||||
export default {
|
||||
name: "GeneralComponent",
|
||||
name: "NewsContentType",
|
||||
props:{
|
||||
content:{
|
||||
type:String,
|
||||
|
||||
@@ -88,6 +88,18 @@ export default {
|
||||
if (isMitarbeiter) {
|
||||
content["isMitarbeiter"] = isMitarbeiter;
|
||||
}
|
||||
|
||||
const filesFromDatabase =
|
||||
await this.$api
|
||||
.call(ApiProfilUpdate.getProfilRequestFiles(
|
||||
updateRequest.profil_update_id
|
||||
))
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
});
|
||||
|
||||
files = filesFromDatabase;
|
||||
content["files"] = files;
|
||||
}
|
||||
|
||||
//? adds the status information if the profil update request was rejected or accepted
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import Dms from "../../../../Form/Upload/Dms.js";
|
||||
|
||||
import ApiProfil from '../../../../../api/factory/profil.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
AutoComplete: primevue.autocomplete,
|
||||
Dms: Dms
|
||||
},
|
||||
|
||||
props: {
|
||||
@@ -11,9 +14,13 @@ export default {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
files: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
},
|
||||
|
||||
inject: ["getZustelladressenCount"],
|
||||
inject: ["getZustelladressenCount", "updateFileID"],
|
||||
|
||||
data() {
|
||||
return {
|
||||
@@ -23,6 +30,8 @@ export default {
|
||||
nationenList: [],
|
||||
originalValue: null,
|
||||
zustellAdressenCount: null,
|
||||
dmsData: [],
|
||||
fileschanged: false
|
||||
};
|
||||
},
|
||||
|
||||
@@ -83,6 +92,11 @@ export default {
|
||||
//? sets the value of a property to null when an empty string is entered to keep the isChanged function valid
|
||||
if (bind === "zustelladresse") {
|
||||
this.data[bind] = event.target.checked;
|
||||
} else if(bind === 'files') {
|
||||
if(this.dmsData.length > 0 && this.dmsData[0].type !== 'application/x.fhc-dms+json') {
|
||||
this.fileschanged = true;
|
||||
}
|
||||
this.updateFileID(this.dmsData);
|
||||
} else {
|
||||
this.data[bind] = event.target.value === "" ? null : event.target.value;
|
||||
}
|
||||
@@ -91,6 +105,11 @@ export default {
|
||||
// update the zustellAdressen count
|
||||
this.zustellAdressenCount = this.getZustelladressenCount();
|
||||
},
|
||||
|
||||
deleteDmsData: function() {
|
||||
this.dmsData = [];
|
||||
this.updateValue(null, 'files');
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
@@ -111,12 +130,14 @@ export default {
|
||||
!this.data.strasse ||
|
||||
!this.data.plz ||
|
||||
!this.data.ort ||
|
||||
!this.data.typ
|
||||
!this.data.typ ||
|
||||
this.dmsData.length === 0
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.originalValue !== JSON.stringify(this.data);
|
||||
const datachanged = this.originalValue !== JSON.stringify(this.data);
|
||||
return datachanged || this.fileschanged;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -133,6 +154,12 @@ export default {
|
||||
this.zustellAdressenCount = this.getZustelladressenCount();
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (this.files) {
|
||||
this.dmsData = this.files;
|
||||
}
|
||||
},
|
||||
|
||||
template: /*html*/ `
|
||||
<div class="gy-3 row justify-content-center align-items-center">
|
||||
<!-- warning message for too many zustellungs Adressen -->
|
||||
@@ -212,9 +239,26 @@ export default {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="row g-2">
|
||||
<div class="col">
|
||||
<dms
|
||||
ref="update"
|
||||
id="files"
|
||||
name="files"
|
||||
:multiple="false"
|
||||
v-model="dmsData"
|
||||
@update:model-value="updateValue($event,'files')"
|
||||
></dms>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button
|
||||
@click="deleteDmsData"
|
||||
class="btn btn-danger"
|
||||
:aria-label="$p.t('profilUpdate','deleteAttachment')"
|
||||
:title="$p.t('profilUpdate','deleteAttachment')"
|
||||
><i style="color:white" class="fa fa-trash" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
`,
|
||||
|
||||
@@ -188,14 +188,16 @@ export default {
|
||||
|
||||
<span class="form-underline-content" >{{data.requested_change.value}}</span>
|
||||
</div>
|
||||
<div v-if="files?.length" class="ms-2">
|
||||
|
||||
<a v-for="file in files" target="_blank" :href="getDocumentLink(file.dms_id)" >{{file.name}}</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<component v-else :is="getComponentView" :withZustelladresse="getComponentView==='adresse'?true:false" :data="data.requested_change"></component>
|
||||
|
||||
<div v-if="files?.length" class="ms-2">
|
||||
|
||||
<a v-for="file in files" target="_blank" :href="getDocumentLink(file.dms_id)" >{{file.name}}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user