From 5eba786cbe29d87ac7d59d114dd8c2faa5c626b1 Mon Sep 17 00:00:00 2001 From: Remko Date: Mon, 14 Oct 2024 14:08:04 +0200 Subject: [PATCH] Removed source checks on publicationType and fixed eigenschappen edit --- .../DeleteCatalogiPublicationType.vue | 2 +- .../AddCatalogiPublicationType.vue | 4 ++-- src/modals/publication/AddPublicationModal.vue | 10 +++------- .../publicationData/EditPublicationDataModal.vue | 3 ++- src/views/catalogi/CatalogiDetails.vue | 16 ++++++++-------- src/views/publications/PublicationDetail.vue | 2 +- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/dialogs/catalogiPublicationType/DeleteCatalogiPublicationType.vue b/src/dialogs/catalogiPublicationType/DeleteCatalogiPublicationType.vue index dfb23377..c73a3a05 100644 --- a/src/dialogs/catalogiPublicationType/DeleteCatalogiPublicationType.vue +++ b/src/dialogs/catalogiPublicationType/DeleteCatalogiPublicationType.vue @@ -68,7 +68,7 @@ export default { methods: { deleteCatalogiPublicationType() { const publicationTypeArray = catalogiStore.catalogiItem?.publicationTypes - .filter((source) => source !== (publicationTypeStore.publicationTypeItem?.source || publicationTypeStore.publicationTypeItem?.id)) + .filter((id) => id !== publicationTypeStore.publicationTypeItem?.id) const catalogiItem = new Catalogi({ ...catalogiStore.catalogiItem, diff --git a/src/modals/catalogiPublicationType/AddCatalogiPublicationType.vue b/src/modals/catalogiPublicationType/AddCatalogiPublicationType.vue index 7098492c..7f9996af 100644 --- a/src/modals/catalogiPublicationType/AddCatalogiPublicationType.vue +++ b/src/modals/catalogiPublicationType/AddCatalogiPublicationType.vue @@ -124,7 +124,7 @@ export default { publicationTypeStore.getAllPublicationTypes() .then(({ response, data }) => { const filteredData = data.filter((publicationType) => - !publicationTypeList.includes(publicationType?.source || publicationType?.id), + !publicationTypeList.includes(publicationType?.id), ) this.publicationTypes = { @@ -146,7 +146,7 @@ export default { this.loading = true this.error = false - this.catalogiItem.publicationTypes.push(this.publicationTypes.value.source !== '' ? this.publicationTypes.value.source : this.publicationTypes.value.id) + this.catalogiItem.publicationTypes.push(this.publicationTypes.value.id) const newCatalogiItem = new Catalogi({ ...this.catalogiItem, diff --git a/src/modals/publication/AddPublicationModal.vue b/src/modals/publication/AddPublicationModal.vue index 4faf9bea..5a9e2910 100644 --- a/src/modals/publication/AddPublicationModal.vue +++ b/src/modals/publication/AddPublicationModal.vue @@ -252,7 +252,7 @@ export default { // step 2: get the full publication types from the publicationTypeIds const filteredPublicationType = this.publicationTypeList .filter((publicationType) => { - const publicationTypeId = publicationType.source || publicationType.id + const publicationTypeId = publicationType.id return selectedCatalogus.publicationTypes.includes(publicationTypeId.toString()) }) @@ -268,9 +268,7 @@ export default { const testClass = new Publication({ ...this.publication, catalog: this.catalogi.value?.id, - publicationType: this.publicationType?.value?.source !== '' - ? this.publicationType?.value?.source - : this.publicationType?.value?.id, + publicationType: this.publicationType?.value?.id, published: this.publication.published !== '' ? new Date(this.publication.published).toISOString() : new Date().toISOString(), }) @@ -363,9 +361,7 @@ export default { const publicationItem = new Publication({ ...this.publication, catalog: this.catalogi?.value?.id, - publicationType: this.publicationType?.value?.source !== '' - ? this.publicationType?.value?.source - : this.publicationType?.value?.id, + publicationType: this.publicationType?.value?.id, published: this.publication.published !== '' ? new Date(this.publication.published).toISOString() : new Date().toISOString(), }) diff --git a/src/modals/publicationData/EditPublicationDataModal.vue b/src/modals/publicationData/EditPublicationDataModal.vue index 1166eda0..2de21b97 100644 --- a/src/modals/publicationData/EditPublicationDataModal.vue +++ b/src/modals/publicationData/EditPublicationDataModal.vue @@ -264,7 +264,8 @@ export default { console.log('activePublicationType', this.publicationTypeList) // get the publication type linked to this publication - const activePublicationType = this.publicationTypeList.find((publicationType) => publicationType.source === this.publication.publicationType) + const activePublicationType = this.publicationTypeList.find((publicationType) => publicationType.id.toString() === this.publication.publicationType.toString(), + ) // get all the properties as an array of values (key is not needed as the comparison is done by title) const publicationTypeProperties = Object.values(activePublicationType.properties) // get the publication type properties with the same title as the publicationDataKey diff --git a/src/views/catalogi/CatalogiDetails.vue b/src/views/catalogi/CatalogiDetails.vue index 55b3f1db..7bb86b20 100644 --- a/src/views/catalogi/CatalogiDetails.vue +++ b/src/views/catalogi/CatalogiDetails.vue @@ -90,9 +90,9 @@ import { catalogiStore, publicationTypeStore, navigationStore, organizationStore
-