diff --git a/resources/assets/js/components/AkauntingDropzoneFileUpload.vue b/resources/assets/js/components/AkauntingDropzoneFileUpload.vue index fb83759da..303280227 100644 --- a/resources/assets/js/components/AkauntingDropzoneFileUpload.vue +++ b/resources/assets/js/components/AkauntingDropzoneFileUpload.vue @@ -244,17 +244,17 @@ export default { download: attachment[0].downloadPath, dropzone: 'edit', }; - this.dropzone.emit("addedfile", mockFile); + this.dropzone.emit("addedfile", mockFile); this.dropzone.options.thumbnail.call(this.dropzone, mockFile, attachment[0].path); // Make sure that there is no progress bar, etc... this.dropzone.emit("complete", mockFile); - this.files.forEach(async (attachment) => { - if (attachment.download) { - attachment.previewElement.querySelector("[data-dz-download]").href = attachment.download; - attachment.previewElement.querySelector("[data-dz-download]").classList.remove("d-none"); - } + this.files.forEach(async (attachment) => { + if (attachment.download) { + attachment.previewElement.querySelector("[data-dz-download]").href = attachment.download; + attachment.previewElement.querySelector("[data-dz-download]").classList.remove("d-none"); + } }); if (this.preview == 'single' && attachments.length == 1) { diff --git a/resources/assets/js/mixins/spa-global.js b/resources/assets/js/mixins/spa-global.js index afc5ec153..96f358575 100644 --- a/resources/assets/js/mixins/spa-global.js +++ b/resources/assets/js/mixins/spa-global.js @@ -83,16 +83,32 @@ export default { onEditEvent(form_method, form_url, plus_data, form_list, form_id) { const formData = new FormData(this.$refs["form"]); const data = {}; - + let file = {}; + for (let [key, val] of formData.entries()) { Object.assign(data, { [key]: val, - ['type']: 'normal' + }); + } + + if(this.$refs.dropzoneWizard) { + if(this.$refs.dropzoneWizard.dropzone.files.length) { + file = this.$refs.dropzoneWizard.dropzone.files[0]; + } else { + file = this.$refs.dropzoneWizard.files[0]; + } + } + + if(plus_data == 'logo') { + Object.assign(data, { + ['logo']: file }); } - if (!plus_data || plus_data == undefined) { - delete data.type; + if(plus_data == 'type') { + Object.assign(data, { + ['type']: 'normal', + }); } window.axios({ @@ -126,12 +142,13 @@ export default { for (let [key, val] of formData.entries()) { Object.assign(data, { [key]: val, - ['type']: 'normal' }); } - if (!plus_data || plus_data == undefined) { - delete data.type; + if(plus_data == 'type') { + Object.assign(data, { + ['type']: 'normal', + }); } window.axios({ diff --git a/resources/assets/js/views/wizard/Company.vue b/resources/assets/js/views/wizard/Company.vue index e6724b540..bbc729208 100644 --- a/resources/assets/js/views/wizard/Company.vue +++ b/resources/assets/js/views/wizard/Company.vue @@ -70,13 +70,12 @@
- -
@@ -173,8 +172,7 @@ export default { }, onEditSave() { - this.onEditEvent("PATCH", url + "/wizard/company", "", "", ""); - + this.onEditEvent("PATCH", url + "/wizard/company", "logo", "", ""); this.$router.push("/wizard/currencies"); }, },