From 4dfa6097516d6421770e85a1472713bf7d46b93e Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Tue, 26 Jul 2022 09:52:45 -0300 Subject: [PATCH] Syncs attachment when document is changed. --- .../components/edition/item-attachments-edition-form.vue | 1 + src/views/admin/components/edition/item-edition-form.vue | 2 ++ src/views/admin/components/lists/attachments-list.vue | 9 +++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/admin/components/edition/item-attachments-edition-form.vue b/src/views/admin/components/edition/item-attachments-edition-form.vue index d505a5858..ee5773fc5 100644 --- a/src/views/admin/components/edition/item-attachments-edition-form.vue +++ b/src/views/admin/components/edition/item-attachments-edition-form.vue @@ -37,6 +37,7 @@ diff --git a/src/views/admin/components/edition/item-edition-form.vue b/src/views/admin/components/edition/item-edition-form.vue index df13bac9e..b0f1ff3f2 100644 --- a/src/views/admin/components/edition/item-edition-form.vue +++ b/src/views/admin/components/edition/item-edition-form.vue @@ -1472,6 +1472,8 @@ export default { if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail ) this.item.thumbnail = item.thumbnail; + this.shouldLoadAttachments = !this.shouldLoadAttachments; + }) .catch((errors) => { for (let error of errors.errors) { diff --git a/src/views/admin/components/lists/attachments-list.vue b/src/views/admin/components/lists/attachments-list.vue index 7fa39615a..1d9cee946 100644 --- a/src/views/admin/components/lists/attachments-list.vue +++ b/src/views/admin/components/lists/attachments-list.vue @@ -14,9 +14,9 @@ v-for="(attachment, index) in attachments" :key="index" class="file-item-container" - :class="{ 'is-file-document': item.document == attachment.id, 'is-file-thumbnail': item.thumbnail_id == attachment.id }"> + :class="{ 'is-file-document': form.document == attachment.id, 'is-file-thumbnail': item.thumbnail_id == attachment.id }"> {{ $i18n.get('label_document') }} @@ -25,7 +25,7 @@ :modal-on-click="true" :file="attachment"/> {