Replaces image thumbnail with mimetype icon right after changing document type.

This commit is contained in:
mateuswetah 2021-05-13 11:22:21 -03:00
parent b5f9637d88
commit b60ee62161
1 changed files with 5 additions and 1 deletions

View File

@ -316,7 +316,7 @@
class="image"> class="image">
<span <span
class="image-placeholder" class="image-placeholder"
v-if="item.document_type == 'empty'"> v-if="item.document_type == 'empty' && item.document_mimetype == 'empty'">
{{ $i18n.get('label_empty_thumbnail') }} {{ $i18n.get('label_empty_thumbnail') }}
</span> </span>
<img <img
@ -1235,6 +1235,7 @@ export default {
this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type }) this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type })
.then(item => { .then(item => {
this.item.document_as_html = item.document_as_html; this.item.document_as_html = item.document_as_html;
this.item.document_mimetype = item.document_mimetype;
this.isLoading = false; this.isLoading = false;
}) })
.catch((errors) => { .catch((errors) => {
@ -1266,6 +1267,7 @@ export default {
this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type }) this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type })
.then(item => { .then(item => {
this.item.document_as_html = item.document_as_html; this.item.document_as_html = item.document_as_html;
this.item.document_mimetype = item.document_mimetype;
this.isLoading = false; this.isLoading = false;
let oldThumbnail = this.item.thumbnail; let oldThumbnail = this.item.thumbnail;
@ -1301,6 +1303,7 @@ export default {
document_type: this.form.document_type document_type: this.form.document_type
}) })
.then(() => { .then(() => {
this.item.document_mimetype = 'empty';
this.isLoadingAttachments = true; this.isLoadingAttachments = true;
this.fetchAttachments({ this.fetchAttachments({
page: 1, page: 1,
@ -1385,6 +1388,7 @@ export default {
.then((item) => { .then((item) => {
this.isLoading = false; this.isLoading = false;
this.item.document_as_html = item.document_as_html; this.item.document_as_html = item.document_as_html;
this.item.document_mimetype = item.document_mimetype;
let oldThumbnail = this.item.thumbnail; let oldThumbnail = this.item.thumbnail;
if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail ) if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail )